mirror of
https://github.com/planetmint/planetmint-go.git
synced 2025-03-30 15:08:28 +00:00
184 implement staged claim (#190)
* adjust issuePoPRewards to mint stagedCRDDL * add GetChallengeRange * add resolveStagedClaims on ReissueRDDLResult msg * move claim resolve to distribution result * add StagedDenom and ClaimDenom to config * added the prepare4linting.sh script * renamed PoPEpochs to PopEpochs * renamed DistributionAddressPoP to DistributionAddressPop * added config value ReIssuanceEpochs * detached the re-issuance from the distribution process and schedule them independently * changed logging messages * added an explicit util/kv_serialize.go file to have all KV serialization done * switched to Bigendian serialization of int64 to have the ordered list on the kvstore * added ComputeReIssuanceValue to enable re-issuances once a day or defined by ReIssuanceEpoch * integrated a ReIssuanceValue computation test case * adjusted the challenges test cases to be epoch-dependent * added ReIssuances per ReIssuanceEpoch * extended the Reissue message * checking ReIssuanceProposal in the ante handler * added precision setter for the UINT to RDDL token converter (and test cases) * add e2e test case for pop rewards Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com> Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com> Co-authored-by: Jürgen Eckel <juergen@riddleandcode.com>
This commit is contained in:
parent
8a8a3aaaf2
commit
94830df5fc
@ -54,7 +54,7 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) {
|
||||
ante.NewValidateMemoDecorator(options.AccountKeeper),
|
||||
NewCheckMachineDecorator(options.MachineKeeper),
|
||||
NewCheckMintAddressDecorator(options.DaoKeeper),
|
||||
NewCheckReissuanceDecorator(),
|
||||
NewCheckReissuanceDecorator(options.DaoKeeper),
|
||||
ante.NewConsumeGasForTxSizeDecorator(options.AccountKeeper),
|
||||
NewDeductFeeDecorator(options.AccountKeeper, options.BankKeeper, options.FeegrantKeeper, options.TxFeeChecker),
|
||||
ante.NewSetPubKeyDecorator(options.AccountKeeper), // SetPubKeyDecorator must be called before all signature verification decorators
|
||||
|
@ -3,16 +3,18 @@ package ante
|
||||
import (
|
||||
errorsmod "cosmossdk.io/errors"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/planetmint/planetmint-go/config"
|
||||
"github.com/planetmint/planetmint-go/util"
|
||||
"github.com/planetmint/planetmint-go/x/dao/keeper"
|
||||
daotypes "github.com/planetmint/planetmint-go/x/dao/types"
|
||||
)
|
||||
|
||||
type CheckReissuanceDecorator struct{}
|
||||
type CheckReissuanceDecorator struct {
|
||||
dk DaoKeeper
|
||||
}
|
||||
|
||||
func NewCheckReissuanceDecorator() CheckReissuanceDecorator {
|
||||
return CheckReissuanceDecorator{}
|
||||
func NewCheckReissuanceDecorator(dk DaoKeeper) CheckReissuanceDecorator {
|
||||
return CheckReissuanceDecorator{
|
||||
dk: dk,
|
||||
}
|
||||
}
|
||||
|
||||
func (cmad CheckReissuanceDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (sdk.Context, error) {
|
||||
@ -20,13 +22,13 @@ func (cmad CheckReissuanceDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simu
|
||||
if sdk.MsgTypeURL(msg) == "/planetmintgo.dao.MsgReissueRDDLProposal" {
|
||||
MsgProposal, ok := msg.(*daotypes.MsgReissueRDDLProposal)
|
||||
if ok {
|
||||
util.GetAppLogger().Debug(ctx, "REISSUE: receive Proposal")
|
||||
conf := config.GetConfig()
|
||||
isValid := keeper.IsValidReissuanceCommand(MsgProposal.GetTx(), conf.ReissuanceAsset, MsgProposal.GetBlockHeight())
|
||||
util.GetAppLogger().Debug(ctx, "ante handler - received re-issuance roposal")
|
||||
isValid := cmad.dk.IsValidReIssuanceProposal(ctx, MsgProposal)
|
||||
if !isValid {
|
||||
util.GetAppLogger().Info(ctx, "REISSUE: error during CheckTx or ReCheckTx")
|
||||
util.GetAppLogger().Info(ctx, "ante handler: rejected re-issuance proposal")
|
||||
return ctx, errorsmod.Wrapf(daotypes.ErrReissuanceProposal, "error during CheckTx or ReCheckTx")
|
||||
}
|
||||
util.GetAppLogger().Debug(ctx, "ante handler - accepted re-issuance proposal")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -37,4 +37,5 @@ type BankKeeper interface {
|
||||
type DaoKeeper interface {
|
||||
GetMintRequestByHash(ctx sdk.Context, hash string) (val daotypes.MintRequest, found bool)
|
||||
GetMintAddress(ctx sdk.Context) (mintAddress string)
|
||||
IsValidReIssuanceProposal(ctx sdk.Context, msg *daotypes.MsgReissueRDDLProposal) (isValid bool)
|
||||
}
|
||||
|
@ -16,7 +16,9 @@ asset-registry-endpoint = "{{ .PlmntConfig.AssetRegistryEndpoint }}"
|
||||
token-denom = "{{ .PlmntConfig.TokenDenom }}"
|
||||
stake-denom = "{{ .PlmntConfig.StakeDenom }}"
|
||||
fee-denom = "{{ .PlmntConfig.FeeDenom }}"
|
||||
pop-epochs = {{ .PlmntConfig.PoPEpochs }}
|
||||
staged-denom = "{{ .PlmntConfig.StagedDenom }}"
|
||||
claim-denom = "{{ .PlmntConfig.ClaimDenom }}"
|
||||
pop-epochs = {{ .PlmntConfig.PopEpochs }}
|
||||
rpc-host = "{{ .PlmntConfig.RPCHost }}"
|
||||
rpc-port = {{ .PlmntConfig.RPCPort }}
|
||||
rpc-user = "{{ .PlmntConfig.RPCUser }}"
|
||||
@ -26,9 +28,9 @@ reissuance-asset = "{{ .PlmntConfig.ReissuanceAsset }}"
|
||||
validator-address = "{{ .PlmntConfig.ValidatorAddress }}"
|
||||
distribution-address-inv = "{{ .PlmntConfig.DistributionAddrInv }}"
|
||||
distribution-address-dao = "{{ .PlmntConfig.DistributionAddrDAO }}"
|
||||
distribution-address-pop = "{{ .PlmntConfig.DistributionAddrPoP }}"
|
||||
distribution-address-pop = "{{ .PlmntConfig.DistributionAddrPop }}"
|
||||
distribution-epochs = {{ .PlmntConfig.DistributionEpochs }}
|
||||
|
||||
re-issuance-epochs = {{ .PlmntConfig.ReIssuanceEpochs }}
|
||||
`
|
||||
|
||||
// Config defines Planetmint's top level configuration
|
||||
@ -37,8 +39,10 @@ type Config struct {
|
||||
TokenDenom string `json:"token-denom" mapstructure:"token-denom"`
|
||||
StakeDenom string `json:"stake-denom" mapstructure:"stake-denom"`
|
||||
FeeDenom string `json:"fee-denom" mapstructure:"fee-denom"`
|
||||
StagedDenom string `json:"staged-denom" mapstructure:"staged-denom"`
|
||||
ClaimDenom string `json:"claim-denom" mapstructure:"claim-denom"`
|
||||
ConfigRootDir string `json:"config-root-dir" mapstructure:"config-root-dir"`
|
||||
PoPEpochs int `json:"pop-epochs" mapstructure:"pop-epochs"` //nolint: tagliatelle // json(kebab): got 'pop-epochs' want 'po-p-epochs'
|
||||
PopEpochs int `json:"pop-epochs" mapstructure:"pop-epochs"`
|
||||
RPCHost string `json:"rpc-host" mapstructure:"rpc-host"`
|
||||
RPCPort int `json:"rpc-port" mapstructure:"rpc-port"`
|
||||
RPCUser string `json:"rpc-user" mapstructure:"rpc-user"`
|
||||
@ -48,8 +52,9 @@ type Config struct {
|
||||
ValidatorAddress string `json:"validator-address" mapstructure:"validator-address"`
|
||||
DistributionAddrInv string `json:"distribution-addr-inv" mapstructure:"distribution-addr-inv"`
|
||||
DistributionAddrDAO string `json:"distribution-addr-dao" mapstructure:"distribution-addr-dao"`
|
||||
DistributionAddrPoP string `json:"distribution-addr-pop" mapstructure:"distribution-addr-pop"` //nolint: tagliatelle // json(kebab): got 'distribution-addr-pop' want 'distribution-addr-po-p'
|
||||
DistributionAddrPop string `json:"distribution-addr-pop" mapstructure:"distribution-addr-pop"`
|
||||
DistributionEpochs int `json:"distribution-epochs" mapstructure:"distribution-epochs"`
|
||||
ReIssuanceEpochs int `json:"re-issuance-epochs" mapstructure:"re-issuance-epochs"`
|
||||
}
|
||||
|
||||
// cosmos-sdk wide global singleton
|
||||
@ -65,8 +70,10 @@ func DefaultConfig() *Config {
|
||||
TokenDenom: "plmnt",
|
||||
StakeDenom: "plmntstake",
|
||||
FeeDenom: "plmnt",
|
||||
StagedDenom: "stagedcrddl",
|
||||
ClaimDenom: "crddl",
|
||||
ConfigRootDir: "",
|
||||
PoPEpochs: 24, // 24 CometBFT epochs of 5s equate 120s
|
||||
PopEpochs: 24, // 24 CometBFT epochs of 5s equate 120s
|
||||
RPCHost: "localhost",
|
||||
RPCPort: 18884,
|
||||
RPCUser: "user",
|
||||
@ -76,8 +83,9 @@ func DefaultConfig() *Config {
|
||||
ValidatorAddress: "plmnt1w5dww335zhh98pzv783hqre355ck3u4w4hjxcx",
|
||||
DistributionAddrInv: "vjTyRN2G42Yq3T5TJBecHj1dF1xdhKF89hKV4HJN3uXxUbaVGVR76hAfVRQqQCovWaEpar7G5qBBprFG",
|
||||
DistributionAddrDAO: "vjU8eMzU3JbUWZEpVANt2ePJuPWSPixgjiSj2jDMvkVVQQi2DDnZuBRVX4Ygt5YGBf5zvTWCr1ntdqYH",
|
||||
DistributionAddrPoP: "vjTvXCFSReRsZ7grdsAreRR12KuKpDw8idueQJK9Yh1BYS7ggAqgvCxCgwh13KGK6M52y37HUmvr4GdD",
|
||||
DistributionEpochs: 17280, // CometBFT epochs of 5s equate 1 day (12*60*24)
|
||||
DistributionAddrPop: "vjTvXCFSReRsZ7grdsAreRR12KuKpDw8idueQJK9Yh1BYS7ggAqgvCxCgwh13KGK6M52y37HUmvr4GdD",
|
||||
DistributionEpochs: 17640, // CometBFT epochs of 5s equate 1 day (12*60*24) + 15 min (15*24) to wait for confirmations on the re-issuance
|
||||
ReIssuanceEpochs: 17280, // CometBFT epochs of 5s equate 1 day (12*60*24)
|
||||
}
|
||||
}
|
||||
|
||||
|
40
docs/static/openapi.yml
vendored
40
docs/static/openapi.yml
vendored
@ -46700,13 +46700,19 @@ paths:
|
||||
properties:
|
||||
proposer:
|
||||
type: string
|
||||
rawtx:
|
||||
rawTx:
|
||||
type: string
|
||||
txID:
|
||||
type: string
|
||||
blockHeight:
|
||||
type: string
|
||||
format: int64
|
||||
firstIncludedPop:
|
||||
type: string
|
||||
format: int64
|
||||
lastIncludedPop:
|
||||
type: string
|
||||
format: int64
|
||||
default:
|
||||
description: An unexpected error response.
|
||||
schema:
|
||||
@ -46748,13 +46754,19 @@ paths:
|
||||
properties:
|
||||
proposer:
|
||||
type: string
|
||||
rawtx:
|
||||
rawTx:
|
||||
type: string
|
||||
txID:
|
||||
type: string
|
||||
blockHeight:
|
||||
type: string
|
||||
format: int64
|
||||
firstIncludedPop:
|
||||
type: string
|
||||
format: int64
|
||||
lastIncludedPop:
|
||||
type: string
|
||||
format: int64
|
||||
pagination:
|
||||
type: object
|
||||
properties:
|
||||
@ -76197,13 +76209,19 @@ definitions:
|
||||
properties:
|
||||
proposer:
|
||||
type: string
|
||||
rawtx:
|
||||
rawTx:
|
||||
type: string
|
||||
txID:
|
||||
type: string
|
||||
blockHeight:
|
||||
type: string
|
||||
format: int64
|
||||
firstIncludedPop:
|
||||
type: string
|
||||
format: int64
|
||||
lastIncludedPop:
|
||||
type: string
|
||||
format: int64
|
||||
planetmintgo.dao.QueryGetReissuancesResponse:
|
||||
type: object
|
||||
properties:
|
||||
@ -76212,13 +76230,19 @@ definitions:
|
||||
properties:
|
||||
proposer:
|
||||
type: string
|
||||
rawtx:
|
||||
rawTx:
|
||||
type: string
|
||||
txID:
|
||||
type: string
|
||||
blockHeight:
|
||||
type: string
|
||||
format: int64
|
||||
firstIncludedPop:
|
||||
type: string
|
||||
format: int64
|
||||
lastIncludedPop:
|
||||
type: string
|
||||
format: int64
|
||||
pagination:
|
||||
type: object
|
||||
properties:
|
||||
@ -76278,13 +76302,19 @@ definitions:
|
||||
properties:
|
||||
proposer:
|
||||
type: string
|
||||
rawtx:
|
||||
rawTx:
|
||||
type: string
|
||||
txID:
|
||||
type: string
|
||||
blockHeight:
|
||||
type: string
|
||||
format: int64
|
||||
firstIncludedPop:
|
||||
type: string
|
||||
format: int64
|
||||
lastIncludedPop:
|
||||
type: string
|
||||
format: int64
|
||||
planetmintgo.machine.LiquidAsset:
|
||||
type: object
|
||||
properties:
|
||||
|
7
prepare4linting.sh
Executable file
7
prepare4linting.sh
Executable file
@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
export LINT="//lint:file-ignore SA1019 Ignore all deprecation errors, it's generated"
|
||||
|
||||
# Add lint-ignore comment to beginning of files
|
||||
sed -i "1i${LINT}" ./x/asset/types/query.pb.gw.go
|
||||
sed -i "1i${LINT}" ./x/machine/types/query.pb.gw.go
|
||||
sed -i "1i${LINT}" ./x/dao/types/query.pb.gw.go
|
@ -6,7 +6,9 @@ option go_package = "github.com/planetmint/planetmint-go/x/dao/types";
|
||||
message Reissuance {
|
||||
|
||||
string proposer = 1;
|
||||
string rawtx = 2;
|
||||
string rawTx = 2;
|
||||
string txID = 3;
|
||||
int64 blockHeight = 4;
|
||||
int64 firstIncludedPop = 5;
|
||||
int64 lastIncludedPop = 6;
|
||||
}
|
||||
|
@ -32,10 +32,12 @@ message MsgReportPopResult {
|
||||
message MsgReportPopResultResponse {}
|
||||
|
||||
message MsgReissueRDDLProposal {
|
||||
string creator = 1;
|
||||
string proposer = 2;
|
||||
string tx = 3;
|
||||
int64 blockHeight = 4;
|
||||
string creator = 1;
|
||||
string proposer = 2;
|
||||
string tx = 3;
|
||||
int64 blockHeight = 4;
|
||||
int64 firstIncludedPop = 5;
|
||||
int64 lastIncludedPop = 6;
|
||||
}
|
||||
|
||||
message MsgReissueRDDLProposalResponse {}
|
||||
|
@ -262,7 +262,7 @@ func (s *E2ETestSuite) TestReissuance() {
|
||||
val := s.network.Validators[0]
|
||||
|
||||
var err error
|
||||
for i := 0; i < conf.PoPEpochs+10; i++ {
|
||||
for i := 0; i < conf.PopEpochs+10; i++ {
|
||||
err = s.network.WaitForNextBlock()
|
||||
s.Require().NoError(err)
|
||||
}
|
||||
@ -271,3 +271,124 @@ func (s *E2ETestSuite) TestReissuance() {
|
||||
intValue := strconv.FormatInt(height, 10)
|
||||
_, _ = clitestutil.ExecTestCLICmd(val.ClientCtx, daocli.CmdGetReissuance(), []string{intValue})
|
||||
}
|
||||
|
||||
func (s *E2ETestSuite) TestPoPResult() {
|
||||
conf := config.GetConfig()
|
||||
val := s.network.Validators[0]
|
||||
|
||||
// send PoP results
|
||||
challenges := make([]daotypes.Challenge, 5)
|
||||
for i := range challenges {
|
||||
blockHeight := (i + 1)
|
||||
challenges[i].Height = int64(blockHeight)
|
||||
challenges[i].Initiator = val.Address.String()
|
||||
challenges[i].Challenger = aliceAddr.String()
|
||||
challenges[i].Challengee = bobAddr.String()
|
||||
challenges[i].Success = true
|
||||
challenges[i].Finished = true
|
||||
|
||||
chJSON, err := json.Marshal(&challenges[i])
|
||||
s.Require().NoError(err)
|
||||
|
||||
args := []string{
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Moniker),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("10%s", conf.FeeDenom)),
|
||||
"--yes",
|
||||
string(chJSON),
|
||||
}
|
||||
|
||||
_, err = clitestutil.ExecTestCLICmd(val.ClientCtx, daocli.CmdReportPopResult(), args)
|
||||
s.Require().NoError(err)
|
||||
s.Require().NoError(s.network.WaitForNextBlock())
|
||||
}
|
||||
|
||||
// check balance for stagedcrddl
|
||||
out, err := clitestutil.ExecTestCLICmd(val.ClientCtx, bank.GetCmdQueryTotalSupply(), []string{
|
||||
fmt.Sprintf("--%s=%s", bank.FlagDenom, conf.StagedDenom),
|
||||
})
|
||||
s.Require().NoError(err)
|
||||
assert.Contains(s.T(), out.String(), conf.StagedDenom)
|
||||
assert.Contains(s.T(), out.String(), "395") // Total supply 5 * 79
|
||||
|
||||
out, err = clitestutil.ExecTestCLICmd(val.ClientCtx, bank.GetBalancesCmd(), []string{
|
||||
aliceAddr.String(),
|
||||
fmt.Sprintf("--%s=%s", bank.FlagDenom, conf.StagedDenom),
|
||||
})
|
||||
s.Require().NoError(err)
|
||||
assert.Contains(s.T(), out.String(), conf.StagedDenom)
|
||||
assert.Contains(s.T(), out.String(), "95") // 5 * 19
|
||||
|
||||
out, err = clitestutil.ExecTestCLICmd(val.ClientCtx, bank.GetBalancesCmd(), []string{
|
||||
bobAddr.String(),
|
||||
fmt.Sprintf("--%s=%s", bank.FlagDenom, conf.StagedDenom),
|
||||
})
|
||||
s.Require().NoError(err)
|
||||
assert.Contains(s.T(), out.String(), conf.StagedDenom)
|
||||
assert.Contains(s.T(), out.String(), "295") // 5 * 59
|
||||
|
||||
out, err = clitestutil.ExecTestCLICmd(val.ClientCtx, bank.GetBalancesCmd(), []string{
|
||||
authtypes.NewModuleAddress(daotypes.ModuleName).String(),
|
||||
fmt.Sprintf("--%s=%s", bank.FlagDenom, conf.StagedDenom),
|
||||
})
|
||||
s.Require().NoError(err)
|
||||
assert.Contains(s.T(), out.String(), conf.StagedDenom)
|
||||
assert.Contains(s.T(), out.String(), "5") // 5 * 1 remainder
|
||||
|
||||
// send DistributionRequest
|
||||
distributionOrder := daotypes.DistributionOrder{
|
||||
Proposer: aliceAddr.String(),
|
||||
FirstPop: challenges[0].Height,
|
||||
LastPop: challenges[4].Height,
|
||||
DaoTxID: "DaoTxID",
|
||||
PopTxID: "PoPTxID",
|
||||
InvestorTxID: "InvestorTxID",
|
||||
}
|
||||
doJSON, err := json.Marshal(&distributionOrder)
|
||||
s.Require().NoError(err)
|
||||
|
||||
_, err = clitestutil.ExecTestCLICmd(val.ClientCtx, daocli.CmdDistributionRequest(), []string{
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Moniker),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("10%s", conf.FeeDenom)),
|
||||
"--yes",
|
||||
string(doJSON),
|
||||
})
|
||||
s.Require().NoError(err)
|
||||
s.Require().NoError(s.network.WaitForNextBlock())
|
||||
|
||||
// send DistributionResult
|
||||
_, err = clitestutil.ExecTestCLICmd(val.ClientCtx, daocli.CmdDistributionResult(), []string{
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Moniker),
|
||||
fmt.Sprintf("--%s=%s", flags.FlagFees, fmt.Sprintf("10%s", conf.FeeDenom)),
|
||||
"--yes",
|
||||
strconv.FormatInt(challenges[4].Height, 10),
|
||||
"DaoTxID",
|
||||
"InvestorTxID",
|
||||
"PoPTxID",
|
||||
})
|
||||
s.Require().NoError(err)
|
||||
s.Require().NoError(s.network.WaitForNextBlock())
|
||||
|
||||
// check balance for crddl
|
||||
out, err = clitestutil.ExecTestCLICmd(val.ClientCtx, bank.GetCmdQueryTotalSupply(), []string{
|
||||
fmt.Sprintf("--%s=%s", bank.FlagDenom, conf.ClaimDenom),
|
||||
})
|
||||
s.Require().NoError(err)
|
||||
assert.Contains(s.T(), out.String(), conf.ClaimDenom)
|
||||
assert.Contains(s.T(), out.String(), "390") // Total supply 5 * 59 + 5 * 19
|
||||
|
||||
out, err = clitestutil.ExecTestCLICmd(val.ClientCtx, bank.GetBalancesCmd(), []string{
|
||||
aliceAddr.String(),
|
||||
fmt.Sprintf("--%s=%s", bank.FlagDenom, conf.ClaimDenom),
|
||||
})
|
||||
s.Require().NoError(err)
|
||||
assert.Contains(s.T(), out.String(), conf.ClaimDenom)
|
||||
assert.Contains(s.T(), out.String(), "95") // 5 * 19
|
||||
|
||||
out, err = clitestutil.ExecTestCLICmd(val.ClientCtx, bank.GetBalancesCmd(), []string{
|
||||
bobAddr.String(),
|
||||
fmt.Sprintf("--%s=%s", bank.FlagDenom, conf.ClaimDenom),
|
||||
})
|
||||
s.Require().NoError(err)
|
||||
assert.Contains(s.T(), out.String(), conf.ClaimDenom)
|
||||
assert.Contains(s.T(), out.String(), "295") // 5 * 59
|
||||
}
|
||||
|
@ -15,8 +15,6 @@ import (
|
||||
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
|
||||
typesparams "github.com/cosmos/cosmos-sdk/x/params/types"
|
||||
"github.com/golang/mock/gomock"
|
||||
"github.com/planetmint/planetmint-go/config"
|
||||
"github.com/planetmint/planetmint-go/testutil/sample"
|
||||
"github.com/planetmint/planetmint-go/x/dao/keeper"
|
||||
"github.com/planetmint/planetmint-go/x/dao/types"
|
||||
"github.com/stretchr/testify/require"
|
||||
@ -25,8 +23,6 @@ import (
|
||||
)
|
||||
|
||||
func DaoKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) {
|
||||
cfg := config.GetConfig()
|
||||
|
||||
storeKey := sdk.NewKVStoreKey(types.StoreKey)
|
||||
memStoreKey := storetypes.NewMemoryStoreKey(types.MemStoreKey)
|
||||
challengeStoreKey := storetypes.NewMemoryStoreKey(types.ChallengeKey)
|
||||
@ -58,11 +54,8 @@ func DaoKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) {
|
||||
ctrl := gomock.NewController(t)
|
||||
bk := daotestutil.NewMockBankKeeper(ctrl)
|
||||
|
||||
amt := sdk.NewCoins(sdk.NewCoin(cfg.TokenDenom, sdk.NewIntFromUint64(1000)))
|
||||
beneficiaryAddr, _ := sdk.AccAddressFromBech32(sample.ConstBech32Addr)
|
||||
|
||||
bk.EXPECT().MintCoins(ctx, types.ModuleName, amt).Return(nil).AnyTimes()
|
||||
bk.EXPECT().SendCoinsFromModuleToAccount(ctx, types.ModuleName, beneficiaryAddr, amt).Return(nil).AnyTimes()
|
||||
bk.EXPECT().MintCoins(gomock.Any(), gomock.Any(), gomock.Any()).Return(nil).AnyTimes()
|
||||
bk.EXPECT().SendCoinsFromModuleToAccount(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(nil).AnyTimes()
|
||||
|
||||
k := keeper.NewKeeper(
|
||||
cdc,
|
||||
|
@ -36,12 +36,14 @@ func buildSignBroadcastTx(goCtx context.Context, loggingContext string, sendingV
|
||||
}()
|
||||
}
|
||||
|
||||
func SendInitReissuance(goCtx context.Context, proposerAddress string, txUnsigned string, blockHeight int64) {
|
||||
func SendInitReissuance(goCtx context.Context, proposerAddress string, txUnsigned string, blockHeight int64,
|
||||
firstIncludedPop int64, lastIncludedPop int64) {
|
||||
ctx := sdk.UnwrapSDKContext(goCtx)
|
||||
// get_last_PoPBlockHeight() // TODO: to be read form the upcoming PoP-store
|
||||
sendingValidatorAddress := config.GetConfig().ValidatorAddress
|
||||
GetAppLogger().Info(ctx, "create re-issuance proposal")
|
||||
msg := daotypes.NewMsgReissueRDDLProposal(sendingValidatorAddress, proposerAddress, txUnsigned, blockHeight)
|
||||
msg := daotypes.NewMsgReissueRDDLProposal(sendingValidatorAddress, proposerAddress, txUnsigned, blockHeight,
|
||||
firstIncludedPop, lastIncludedPop)
|
||||
buildSignBroadcastTx(goCtx, "initializing RDDL re-issuance", sendingValidatorAddress, msg)
|
||||
}
|
||||
|
||||
|
23
util/kv_serialize.go
Normal file
23
util/kv_serialize.go
Normal file
@ -0,0 +1,23 @@
|
||||
package util
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
"encoding/hex"
|
||||
)
|
||||
|
||||
func SerializeInt64(value int64) []byte {
|
||||
// Adding 1 because 0 will be interpreted as nil, which is an invalid key
|
||||
buf := make([]byte, 8)
|
||||
// Use binary.BigEndian to write the int64 into the byte slice
|
||||
binary.BigEndian.PutUint64(buf, uint64(value+1))
|
||||
return buf
|
||||
}
|
||||
|
||||
func SerializeString(value string) []byte {
|
||||
byteArray := []byte(value)
|
||||
return byteArray
|
||||
}
|
||||
|
||||
func SerializeHexString(value string) ([]byte, error) {
|
||||
return hex.DecodeString(value)
|
||||
}
|
@ -24,3 +24,22 @@ func RDDLTokenStringToUint(amount string) (amountUint uint64, err error) {
|
||||
}
|
||||
return amountUint, err
|
||||
}
|
||||
|
||||
func addPrecision(valueString string) string {
|
||||
length := len(valueString)
|
||||
if length > 8 {
|
||||
return valueString[:length-8] + "." + valueString[length-8:]
|
||||
}
|
||||
|
||||
resultString := "0."
|
||||
for i := 0; i < 8-length; i++ {
|
||||
resultString += "0"
|
||||
}
|
||||
return resultString + valueString
|
||||
}
|
||||
|
||||
func UintValueToRDDLTokenString(value uint64) (rddlString string) {
|
||||
uint64String := strconv.FormatUint(value, 10)
|
||||
rddlString = addPrecision(uint64String)
|
||||
return
|
||||
}
|
||||
|
@ -35,3 +35,30 @@ func TestStringToUint(t *testing.T) {
|
||||
assert.Equal(t, expectedValue, value)
|
||||
assert.Equal(t, nil, err)
|
||||
}
|
||||
|
||||
func TestAddPrecisionLongerThan8(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
var input uint64 = 99869000000
|
||||
expectedValue := "998.69000000"
|
||||
rddlTokenString := UintValueToRDDLTokenString(input)
|
||||
assert.Equal(t, expectedValue, rddlTokenString)
|
||||
}
|
||||
|
||||
func TestAddPrecisionEqual8(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
var input uint64 = 69000000
|
||||
expectedValue := "0.69000000"
|
||||
rddlTokenString := UintValueToRDDLTokenString(input)
|
||||
assert.Equal(t, expectedValue, rddlTokenString)
|
||||
}
|
||||
|
||||
func TestAddPrecisionShorterThan8(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
var input uint64 = 9000000
|
||||
expectedValue := "0.09000000"
|
||||
rddlTokenString := UintValueToRDDLTokenString(input)
|
||||
assert.Equal(t, expectedValue, rddlTokenString)
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package keeper
|
||||
|
||||
import (
|
||||
"github.com/planetmint/planetmint-go/util"
|
||||
"github.com/planetmint/planetmint-go/x/asset/types"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/store/prefix"
|
||||
@ -9,12 +10,12 @@ import (
|
||||
|
||||
func (k Keeper) StoreAsset(ctx sdk.Context, msg types.MsgNotarizeAsset) {
|
||||
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.AssetKey))
|
||||
store.Set(GetAssetCIDBytes(msg.GetCid()), []byte(msg.GetCreator()))
|
||||
store.Set(util.SerializeString(msg.GetCid()), []byte(msg.GetCreator()))
|
||||
}
|
||||
|
||||
func (k Keeper) GetAsset(ctx sdk.Context, cid string) (msg types.MsgNotarizeAsset, found bool) {
|
||||
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.AssetKey))
|
||||
creatorBytes := store.Get(GetAssetCIDBytes(cid))
|
||||
creatorBytes := store.Get(util.SerializeString(cid))
|
||||
if creatorBytes == nil {
|
||||
return msg, false
|
||||
}
|
||||
@ -38,8 +39,3 @@ func (k Keeper) GetCidsByAddress(ctx sdk.Context, address string) (cids []string
|
||||
}
|
||||
return cids, len(cids) > 0
|
||||
}
|
||||
|
||||
func GetAssetCIDBytes(cid string) []byte {
|
||||
bz := []byte(cid)
|
||||
return bz
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ import (
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
)
|
||||
|
||||
func BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock, _ keeper.Keeper) {
|
||||
func BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock, k keeper.Keeper) {
|
||||
proposerAddress := req.Header.GetProposerAddress()
|
||||
|
||||
// Check if node is block proposer
|
||||
@ -19,45 +19,52 @@ func BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock, _ keeper.Keeper)
|
||||
if !util.IsValidatorBlockProposer(ctx, proposerAddress) {
|
||||
return
|
||||
}
|
||||
blockHeight := req.Header.GetHeight()
|
||||
if isPoPHeight(req.Header.GetHeight()) && util.IsValidatorBlockProposer(ctx, proposerAddress) {
|
||||
hexProposerAddress := hex.EncodeToString(proposerAddress)
|
||||
currentBlockHeight := req.Header.GetHeight()
|
||||
|
||||
hexProposerAddress := hex.EncodeToString(proposerAddress)
|
||||
if isPopHeight(req.Header.GetHeight()) {
|
||||
// select PoP participants
|
||||
challenger := ""
|
||||
challengee := ""
|
||||
|
||||
// Issue PoP
|
||||
util.SendInitPoP(ctx, hexProposerAddress, challenger, challengee, blockHeight)
|
||||
util.SendInitPoP(ctx, hexProposerAddress, challenger, challengee, currentBlockHeight)
|
||||
// TODO send MQTT message to challenger && challengee
|
||||
}
|
||||
// TODO will be reintegrated with by merging branch 184-implement-staged-claim
|
||||
// if isDistributionHeight(blockHeight) {
|
||||
// // reissue 1st
|
||||
|
||||
// conf := config.GetConfig()
|
||||
// txUnsigned := keeper.GetReissuanceCommand(conf.ReissuanceAsset, blockHeight)
|
||||
// util.SendInitReissuance(ctx, hexProposerAddress, txUnsigned, blockHeight)
|
||||
if isReIssuanceHeight(currentBlockHeight) {
|
||||
reIssuance, err := k.CreateNextReIssuanceObject(ctx, currentBlockHeight)
|
||||
if err == nil {
|
||||
util.SendInitReissuance(ctx, hexProposerAddress, reIssuance.GetRawTx(), currentBlockHeight,
|
||||
reIssuance.GetFirstIncludedPop(), reIssuance.GetLastIncludedPop())
|
||||
} else {
|
||||
util.GetAppLogger().Error(ctx, "error while computing the RDDL re-issuance ", err)
|
||||
}
|
||||
}
|
||||
|
||||
// // distribute thereafter
|
||||
//// initialize the distribution message
|
||||
// distribution, err := k.GetDistributionForReissuedTokens(ctx, blockHeight)
|
||||
// if err != nil {
|
||||
// util.GetAppLogger().Error(ctx, "error while computing the RDDL distribution ", err)
|
||||
// }
|
||||
// util.SendDistributionRequest(ctx, distribution)
|
||||
// }
|
||||
if isDistributionHeight(currentBlockHeight) {
|
||||
distribution, err := k.GetDistributionForReissuedTokens(ctx, currentBlockHeight)
|
||||
if err != nil {
|
||||
util.GetAppLogger().Error(ctx, "error while computing the RDDL distribution ", err)
|
||||
}
|
||||
util.SendDistributionRequest(ctx, distribution)
|
||||
}
|
||||
}
|
||||
|
||||
func isPoPHeight(height int64) bool {
|
||||
func isPopHeight(height int64) bool {
|
||||
cfg := config.GetConfig()
|
||||
return height%int64(cfg.PoPEpochs) == 0
|
||||
return height%int64(cfg.PopEpochs) == 0
|
||||
}
|
||||
|
||||
// TODO will be reintegrated with by merging branch 184-implement-staged-claim
|
||||
// func isDistributionHeight(height int64) bool {
|
||||
// cfg := config.GetConfig()
|
||||
// return height%int64(cfg.DistributionEpochs) == 0
|
||||
// }
|
||||
func isReIssuanceHeight(height int64) bool {
|
||||
cfg := config.GetConfig()
|
||||
return height%int64(cfg.ReIssuanceEpochs) == 0
|
||||
}
|
||||
|
||||
func isDistributionHeight(height int64) bool {
|
||||
cfg := config.GetConfig()
|
||||
return height%int64(cfg.DistributionEpochs) == 0
|
||||
}
|
||||
|
||||
func EndBlocker(ctx sdk.Context, _ abci.RequestEndBlock, k keeper.Keeper) {
|
||||
k.DistributeCollectedFees(ctx)
|
||||
|
@ -15,9 +15,9 @@ var _ = strconv.Itoa(0)
|
||||
|
||||
func CmdReissueRDDLProposal() *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "reissue-rddl-proposal [proposer] [tx] [blockheight]",
|
||||
Use: "reissue-rddl-proposal [proposer] [tx] [blockheight] [firstincludedpop] [lastincludedpop]",
|
||||
Short: "Broadcast message reissueRDDLProposal",
|
||||
Args: cobra.ExactArgs(3),
|
||||
Args: cobra.ExactArgs(5),
|
||||
RunE: func(cmd *cobra.Command, args []string) (err error) {
|
||||
argProposer := args[0]
|
||||
argTx := args[1]
|
||||
@ -25,6 +25,14 @@ func CmdReissueRDDLProposal() *cobra.Command {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
firstIncludedPop, err := cast.ToInt64E(args[3])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
lastIncludedPop, err := cast.ToInt64E(args[4])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
clientCtx, err := client.GetClientTxContext(cmd)
|
||||
if err != nil {
|
||||
@ -36,6 +44,8 @@ func CmdReissueRDDLProposal() *cobra.Command {
|
||||
argProposer,
|
||||
argTx,
|
||||
argBlockHeight,
|
||||
firstIncludedPop,
|
||||
lastIncludedPop,
|
||||
)
|
||||
if err := msg.ValidateBasic(); err != nil {
|
||||
return err
|
||||
|
@ -1,22 +1,22 @@
|
||||
package keeper
|
||||
|
||||
import (
|
||||
"math/big"
|
||||
|
||||
db "github.com/cometbft/cometbft-db"
|
||||
"github.com/cosmos/cosmos-sdk/store/prefix"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/planetmint/planetmint-go/util"
|
||||
"github.com/planetmint/planetmint-go/x/dao/types"
|
||||
)
|
||||
|
||||
func (k Keeper) StoreChallenge(ctx sdk.Context, challenge types.Challenge) {
|
||||
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.ChallengeKey))
|
||||
appendValue := k.cdc.MustMarshal(&challenge)
|
||||
store.Set(getChallengeBytes(challenge.Height), appendValue)
|
||||
store.Set(util.SerializeInt64(challenge.Height), appendValue)
|
||||
}
|
||||
|
||||
func (k Keeper) LookupChallenge(ctx sdk.Context, height int64) (val types.Challenge, found bool) {
|
||||
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.ChallengeKey))
|
||||
challenge := store.Get(getChallengeBytes(height))
|
||||
challenge := store.Get(util.SerializeInt64(height))
|
||||
if challenge == nil {
|
||||
return val, false
|
||||
}
|
||||
@ -24,7 +24,48 @@ func (k Keeper) LookupChallenge(ctx sdk.Context, height int64) (val types.Challe
|
||||
return val, true
|
||||
}
|
||||
|
||||
func getChallengeBytes(height int64) []byte {
|
||||
// Adding 1 because 0 will be interpreted as nil, which is an invalid key
|
||||
return big.NewInt(height + 1).Bytes()
|
||||
func (k Keeper) GetChallengeRangeToEnd(ctx sdk.Context, start int64) (val []types.Challenge, err error) {
|
||||
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.ChallengeKey))
|
||||
// adding 1 to end because end is exclusive on store.Iterator
|
||||
iterator := store.Iterator(util.SerializeInt64(start), nil)
|
||||
defer iterator.Close()
|
||||
|
||||
return k.getChallengeRangeFromStore(ctx, iterator)
|
||||
}
|
||||
|
||||
func (k Keeper) GetChallengeRange(ctx sdk.Context, start int64, end int64) (val []types.Challenge, err error) {
|
||||
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.ChallengeKey))
|
||||
// adding 1 to end because end is exclusive on store.Iterator
|
||||
iterator := store.Iterator(util.SerializeInt64(start), util.SerializeInt64(end+1))
|
||||
defer iterator.Close()
|
||||
|
||||
return k.getChallengeRangeFromStore(ctx, iterator)
|
||||
}
|
||||
|
||||
func (k Keeper) getChallengeRangeFromStore(ctx sdk.Context, iterator db.Iterator) (val []types.Challenge, err error) {
|
||||
for ; iterator.Valid(); iterator.Next() {
|
||||
var challenge types.Challenge
|
||||
if err := challenge.Unmarshal(iterator.Value()); err != nil {
|
||||
util.GetAppLogger().Error(ctx, "unable to unmarshal challenge "+err.Error())
|
||||
return nil, err // or continue TODO make decision
|
||||
}
|
||||
val = append(val, challenge)
|
||||
}
|
||||
return val, nil
|
||||
}
|
||||
|
||||
func (k Keeper) GetChallenges(ctx sdk.Context) (challenges []types.Challenge, err error) {
|
||||
store := ctx.KVStore(k.storeKey)
|
||||
iterator := sdk.KVStorePrefixIterator(store, nil)
|
||||
defer iterator.Close()
|
||||
|
||||
for ; iterator.Valid(); iterator.Next() {
|
||||
var event types.Challenge
|
||||
if err = event.Unmarshal(iterator.Value()); err != nil {
|
||||
util.GetAppLogger().Error(ctx, "unable to unmarshal challenge "+err.Error())
|
||||
return nil, err // or continue TODO make decision
|
||||
}
|
||||
challenges = append(challenges, event)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/planetmint/planetmint-go/config"
|
||||
keepertest "github.com/planetmint/planetmint-go/testutil/keeper"
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
@ -12,15 +13,18 @@ import (
|
||||
"github.com/planetmint/planetmint-go/x/dao/types"
|
||||
)
|
||||
|
||||
// this method returns a range of challenges, each with a blockheight * PopEpochs.
|
||||
// be aware: the first element start with 1 instead of 0
|
||||
func createNChallenge(keeper *keeper.Keeper, ctx sdk.Context, n int) []types.Challenge {
|
||||
items := make([]types.Challenge, n)
|
||||
for i := range items {
|
||||
items[i].Height = int64(i)
|
||||
items[i].Initiator = fmt.Sprintf("initiator%v", i)
|
||||
items[i].Challenger = fmt.Sprintf("challenger%v", i)
|
||||
items[i].Challengee = fmt.Sprintf("challengee%v", i)
|
||||
items[i].Success = true
|
||||
items[i].Finished = true
|
||||
blockHeight := (i + 1) * config.GetConfig().PopEpochs
|
||||
items[i].Height = int64(blockHeight)
|
||||
items[i].Initiator = fmt.Sprintf("initiator%v", blockHeight)
|
||||
items[i].Challenger = fmt.Sprintf("challenger%v", blockHeight)
|
||||
items[i].Challengee = fmt.Sprintf("challengee%v", blockHeight)
|
||||
items[i].Success = false
|
||||
items[i].Finished = false
|
||||
keeper.StoreChallenge(ctx, items[i])
|
||||
}
|
||||
return items
|
||||
@ -36,3 +40,12 @@ func TestGetChallenge(t *testing.T) {
|
||||
assert.Equal(t, item, challenge)
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetChallengeRange(t *testing.T) {
|
||||
t.Parallel()
|
||||
keeper, ctx := keepertest.DaoKeeper(t)
|
||||
createNChallenge(keeper, ctx, 10)
|
||||
challenges, err := keeper.GetChallengeRange(ctx, int64((0+1)*config.GetConfig().PopEpochs), int64((9+1)*config.GetConfig().PopEpochs))
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, 10, len(challenges))
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
package keeper
|
||||
|
||||
import (
|
||||
"math/big"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
@ -15,12 +14,12 @@ import (
|
||||
func (k Keeper) StoreDistributionOrder(ctx sdk.Context, distributionOrder types.DistributionOrder) {
|
||||
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.DistributionKey))
|
||||
appendValue := k.cdc.MustMarshal(&distributionOrder)
|
||||
store.Set(getLastPopBytes(distributionOrder.LastPop), appendValue)
|
||||
store.Set(util.SerializeInt64(distributionOrder.LastPop), appendValue)
|
||||
}
|
||||
|
||||
func (k Keeper) LookupDistributionOrder(ctx sdk.Context, lastPopHeight int64) (val types.DistributionOrder, found bool) {
|
||||
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.DistributionKey))
|
||||
distributionOrder := store.Get(getLastPopBytes(lastPopHeight))
|
||||
distributionOrder := store.Get(util.SerializeInt64(lastPopHeight))
|
||||
if distributionOrder == nil {
|
||||
return val, false
|
||||
}
|
||||
@ -60,11 +59,6 @@ func (k Keeper) GetLastDistributionOrder(ctx sdk.Context) (val types.Distributio
|
||||
// return distribution_orders
|
||||
// }
|
||||
|
||||
func getLastPopBytes(height int64) []byte {
|
||||
// Adding 1 because 0 will be interpreted as nil, which is an invalid key
|
||||
return big.NewInt(height + 1).Bytes()
|
||||
}
|
||||
|
||||
func ComputeDistribution(lastReissuance int64, blockHeight int64, amount uint64) (distribution types.DistributionOrder) {
|
||||
conf := config.GetConfig()
|
||||
distribution.FirstPop = lastReissuance
|
||||
@ -72,7 +66,7 @@ func ComputeDistribution(lastReissuance int64, blockHeight int64, amount uint64)
|
||||
|
||||
distribution.DaoAddr = conf.DistributionAddrDAO
|
||||
distribution.InvestorAddr = conf.DistributionAddrInv
|
||||
distribution.PopAddr = conf.DistributionAddrPoP
|
||||
distribution.PopAddr = conf.DistributionAddrPop
|
||||
|
||||
distribution.DaoAmount = strconv.FormatUint(uint64(float64(amount)*types.PercentageDao), 10)
|
||||
distribution.InvestorAmount = strconv.FormatUint(uint64(float64(amount)*types.PercentageInvestor), 10)
|
||||
@ -107,7 +101,7 @@ func (k Keeper) GetDistributionForReissuedTokens(ctx sdk.Context, blockHeight in
|
||||
for index, obj := range reissuances {
|
||||
if (index == 0 && lastPoP == 0 && obj.BlockHeight == 0) || // corner case (beginning of he chain)
|
||||
(lastPoP < obj.BlockHeight && obj.BlockHeight <= blockHeight) {
|
||||
amount, err := getUint64FromTxString(ctx, obj.Rawtx)
|
||||
amount, err := getUint64FromTxString(ctx, obj.GetRawTx())
|
||||
if err == nil {
|
||||
overallAmount += amount
|
||||
}
|
||||
|
@ -5,7 +5,9 @@ import (
|
||||
"strconv"
|
||||
|
||||
errorsmod "cosmossdk.io/errors"
|
||||
"cosmossdk.io/math"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/planetmint/planetmint-go/config"
|
||||
"github.com/planetmint/planetmint-go/x/dao/types"
|
||||
)
|
||||
|
||||
@ -17,6 +19,10 @@ func (k msgServer) DistributionResult(goCtx context.Context, msg *types.MsgDistr
|
||||
distribution.DaoTxID = msg.DaoTxID
|
||||
distribution.PopTxID = msg.PopTxID
|
||||
distribution.InvestorTxID = msg.InvestorTxID
|
||||
err := k.resolveStagedClaims(ctx, distribution.FirstPop, distribution.LastPop)
|
||||
if err != nil {
|
||||
return nil, errorsmod.Wrapf(types.ErrResolvingStagedClaims, " for provieded PoP heights: %d %d", distribution.FirstPop, distribution.LastPop)
|
||||
}
|
||||
k.StoreDistributionOrder(ctx, distribution)
|
||||
} else {
|
||||
return nil, errorsmod.Wrapf(types.ErrDistributionNotFound, " for provided block height %s", strconv.FormatInt(msg.GetLastPop(), 10))
|
||||
@ -24,3 +30,56 @@ func (k msgServer) DistributionResult(goCtx context.Context, msg *types.MsgDistr
|
||||
|
||||
return &types.MsgDistributionResultResponse{}, nil
|
||||
}
|
||||
|
||||
func (k msgServer) resolveStagedClaims(ctx sdk.Context, start int64, end int64) (err error) {
|
||||
// lookup all challenges since the last distribution
|
||||
challenges, err := k.GetChallengeRange(ctx, start, end)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for _, challenge := range challenges {
|
||||
err = k.convertClaim(ctx, challenge.Challengee)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = k.convertClaim(ctx, challenge.Challenger)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func (k msgServer) convertClaim(ctx sdk.Context, addr string) (err error) {
|
||||
cfg := config.GetConfig()
|
||||
accAddress, err := sdk.AccAddressFromBech32(addr)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
stagedClaim := k.bankKeeper.GetBalance(ctx, accAddress, cfg.StagedDenom)
|
||||
|
||||
if stagedClaim.Amount.GT(math.ZeroInt()) {
|
||||
claim := sdk.NewCoins(sdk.NewCoin(cfg.ClaimDenom, stagedClaim.Amount))
|
||||
err = k.bankKeeper.SendCoinsFromAccountToModule(ctx, accAddress, types.ModuleName, sdk.NewCoins(stagedClaim))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = k.bankKeeper.BurnCoins(ctx, types.ModuleName, sdk.NewCoins(stagedClaim))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = k.bankKeeper.MintCoins(ctx, types.ModuleName, claim)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, accAddress, claim)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
@ -12,10 +12,10 @@ func (k msgServer) ReissueRDDLProposal(goCtx context.Context, msg *types.MsgReis
|
||||
ctx := sdk.UnwrapSDKContext(goCtx)
|
||||
validatorIdentity, validResult := util.GetValidatorCometBFTIdentity(ctx)
|
||||
if validResult && msg.Proposer == validatorIdentity {
|
||||
util.GetAppLogger().Info(ctx, "REISSUE: Asset")
|
||||
util.GetAppLogger().Info(ctx, "reissue: Asset: "+msg.GetTx())
|
||||
txID, err := util.ReissueAsset(msg.Tx)
|
||||
if err != nil {
|
||||
util.GetAppLogger().Error(ctx, "REISSUE: Asset reissuance failed: "+err.Error())
|
||||
util.GetAppLogger().Error(ctx, "reissue: Asset reissuance failed: "+err.Error())
|
||||
}
|
||||
// 3. notarize result by notarizing the liquid tx-id
|
||||
util.SendReissuanceResult(goCtx, msg.GetProposer(), txID, msg.GetBlockHeight())
|
||||
@ -24,7 +24,9 @@ func (k msgServer) ReissueRDDLProposal(goCtx context.Context, msg *types.MsgReis
|
||||
var reissuance types.Reissuance
|
||||
reissuance.BlockHeight = msg.GetBlockHeight()
|
||||
reissuance.Proposer = msg.GetProposer()
|
||||
reissuance.Rawtx = msg.GetTx()
|
||||
reissuance.RawTx = msg.GetTx()
|
||||
reissuance.FirstIncludedPop = msg.GetFirstIncludedPop()
|
||||
reissuance.LastIncludedPop = msg.GetLastIncludedPop()
|
||||
k.StoreReissuance(ctx, reissuance)
|
||||
return &types.MsgReissueRDDLProposalResponse{}, nil
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ func (k msgServer) ReissueRDDLResult(goCtx context.Context, msg *types.MsgReissu
|
||||
return nil, errorsmod.Wrapf(types.ErrTXAlreadySet, " for provided block height %s", strconv.FormatInt(msg.GetBlockHeight(), 10))
|
||||
}
|
||||
reissuance.TxID = msg.GetTxID()
|
||||
|
||||
k.StoreReissuance(ctx, reissuance)
|
||||
|
||||
return &types.MsgReissueRDDLResultResponse{}, nil
|
||||
|
@ -6,6 +6,7 @@ import (
|
||||
errorsmod "cosmossdk.io/errors"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/planetmint/planetmint-go/config"
|
||||
"github.com/planetmint/planetmint-go/util"
|
||||
"github.com/planetmint/planetmint-go/x/dao/types"
|
||||
)
|
||||
@ -18,11 +19,11 @@ func (k msgServer) ReportPopResult(goCtx context.Context, msg *types.MsgReportPo
|
||||
return nil, errorsmod.Wrapf(types.ErrInvalidChallenge, err.Error())
|
||||
}
|
||||
|
||||
if isInitiator(*msg.Challenge) {
|
||||
err = k.issuePoPRewards(*msg.Challenge)
|
||||
if err != nil {
|
||||
return nil, errorsmod.Wrapf(types.ErrFailedPoPRewardsIssuance, err.Error())
|
||||
}
|
||||
// TODO: develop a more resilient pattern: if the distribution does not work,
|
||||
// the challenge shouldn't be discarded. it's most likely not the fault of the PoP participants.
|
||||
err = k.issuePoPRewards(ctx, *msg.Challenge)
|
||||
if err != nil {
|
||||
return nil, errorsmod.Wrapf(types.ErrFailedPoPRewardsIssuance, err.Error())
|
||||
}
|
||||
|
||||
k.StoreChallenge(ctx, *msg.Challenge)
|
||||
@ -30,22 +31,59 @@ func (k msgServer) ReportPopResult(goCtx context.Context, msg *types.MsgReportPo
|
||||
return &types.MsgReportPopResultResponse{}, nil
|
||||
}
|
||||
|
||||
// TODO: ensuer issuePoPrewards is only called once per PoP on all validators
|
||||
func (k msgServer) issuePoPRewards(_ types.Challenge) (err error) {
|
||||
// cfg := config.GetConfig()
|
||||
// client := osc.NewClient(cfg.WatchmenEndpoint, 1234)
|
||||
func (k msgServer) issuePoPRewards(ctx sdk.Context, challenge types.Challenge) (err error) {
|
||||
cfg := config.GetConfig()
|
||||
amt := GetReissuanceAsStringValue(challenge.GetHeight())
|
||||
amtFloat, err := util.RDDLTokenStringToFloat(amt)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// TODO will be reintegrated with by merging branch 184-implement-staged-claim
|
||||
// TODO: finalize message and endpoint
|
||||
// msg := osc.NewMessage("/rddl/token")
|
||||
// msg.Append(challenge.Challenger)
|
||||
// msg.Append(challenge.Challengee)
|
||||
// err := client.Send(msg)
|
||||
popAmt := uint64(amtFloat * types.PercentagePop)
|
||||
stagedCRDDL := sdk.NewCoin(cfg.StagedDenom, sdk.NewIntFromUint64(popAmt))
|
||||
|
||||
err = k.bankKeeper.MintCoins(ctx, types.ModuleName, sdk.NewCoins(stagedCRDDL))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if challenge.Success {
|
||||
err = k.handlePoPSuccess(ctx, challenge, amtFloat)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
err = k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, sdk.AccAddress(challenge.Challenger), sdk.NewCoins(stagedCRDDL))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// TODO: implement check if node is responsible for triggering issuance
|
||||
func isInitiator(_ types.Challenge) bool {
|
||||
return false
|
||||
func (k msgServer) handlePoPSuccess(ctx sdk.Context, challenge types.Challenge, amount float64) (err error) {
|
||||
cfg := config.GetConfig()
|
||||
challengerAmt := uint64(amount * types.PercentageChallenger)
|
||||
challengeeAmt := uint64(amount * types.PercentageChallengee)
|
||||
|
||||
challengerCoin := sdk.NewCoin(cfg.StagedDenom, sdk.NewIntFromUint64(challengerAmt))
|
||||
challengeeCoin := sdk.NewCoin(cfg.StagedDenom, sdk.NewIntFromUint64(challengeeAmt))
|
||||
challengee, err := sdk.AccAddressFromBech32(challenge.Challengee)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, challengee, sdk.NewCoins(challengeeCoin))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
challenger, err := sdk.AccAddressFromBech32(challenge.Challenger)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, challenger, sdk.NewCoins(challengerCoin))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return
|
||||
}
|
||||
|
@ -2,22 +2,24 @@ package keeper
|
||||
|
||||
import (
|
||||
"math"
|
||||
"math/big"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/store/prefix"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/planetmint/planetmint-go/config"
|
||||
"github.com/planetmint/planetmint-go/util"
|
||||
"github.com/planetmint/planetmint-go/x/dao/types"
|
||||
)
|
||||
|
||||
func GetPopNumber(blockHeight int64) float64 {
|
||||
return float64(blockHeight) / float64(config.GetConfig().PoPEpochs)
|
||||
return float64(blockHeight) / float64(config.GetConfig().PopEpochs)
|
||||
}
|
||||
|
||||
var PopsPerCycle float64
|
||||
var ReIssueCommand string
|
||||
|
||||
func init() {
|
||||
PopsPerCycle = 1051200.0
|
||||
ReIssueCommand = "reissueasset"
|
||||
}
|
||||
|
||||
func GetReissuanceAsStringValue(blockHeight int64) string {
|
||||
@ -41,23 +43,60 @@ func GetReissuanceAsStringValue(blockHeight int64) string {
|
||||
}
|
||||
|
||||
func GetReissuanceCommand(assetID string, blockHeight int64) string {
|
||||
return "reissueasset " + assetID + " " + GetReissuanceAsStringValue(blockHeight)
|
||||
return ReIssueCommand + " " + assetID + " " + GetReissuanceAsStringValue(blockHeight)
|
||||
}
|
||||
|
||||
func IsValidReissuanceCommand(reissuanceStr string, assetID string, blockHeight int64) bool {
|
||||
expected := "reissueasset " + assetID + " " + GetReissuanceAsStringValue(blockHeight)
|
||||
expected := ReIssueCommand + " " + assetID + " " + GetReissuanceAsStringValue(blockHeight)
|
||||
return reissuanceStr == expected
|
||||
}
|
||||
|
||||
func GetReissuanceCommandForValue(assetID string, value uint64) string {
|
||||
return ReIssueCommand + " " + assetID + " " + util.UintValueToRDDLTokenString(value)
|
||||
}
|
||||
|
||||
func (k Keeper) CreateNextReIssuanceObject(ctx sdk.Context, currentBlockHeight int64) (reIssuance types.Reissuance, err error) {
|
||||
var lastReissuedPop int64
|
||||
lastReIssuance, found := k.GetLastReIssuance(ctx)
|
||||
if found {
|
||||
lastReissuedPop = lastReIssuance.LastIncludedPop
|
||||
}
|
||||
reIssuanceValue, firstIncludedPop, lastIncludedPop, err := k.ComputeReIssuanceValue(ctx, lastReissuedPop, currentBlockHeight)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
reIssuance.RawTx = GetReissuanceCommandForValue(config.GetConfig().ReissuanceAsset, reIssuanceValue)
|
||||
reIssuance.BlockHeight = currentBlockHeight
|
||||
reIssuance.FirstIncludedPop = firstIncludedPop
|
||||
reIssuance.LastIncludedPop = lastIncludedPop
|
||||
return
|
||||
}
|
||||
|
||||
func (k Keeper) IsValidReIssuanceProposal(ctx sdk.Context, msg *types.MsgReissueRDDLProposal) (isValid bool) {
|
||||
reIssuance, err := k.CreateNextReIssuanceObject(ctx, msg.GetBlockHeight())
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
if reIssuance.GetBlockHeight() == msg.GetBlockHeight() &&
|
||||
reIssuance.GetFirstIncludedPop() == msg.GetFirstIncludedPop() &&
|
||||
reIssuance.GetLastIncludedPop() == msg.GetLastIncludedPop() &&
|
||||
reIssuance.GetRawTx() == msg.GetTx() &&
|
||||
msg.GetProposer() != "" {
|
||||
isValid = true
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (k Keeper) StoreReissuance(ctx sdk.Context, reissuance types.Reissuance) {
|
||||
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.ReissuanceBlockHeightKey))
|
||||
appendValue := k.cdc.MustMarshal(&reissuance)
|
||||
store.Set(getReissuanceBytes(reissuance.BlockHeight), appendValue)
|
||||
store.Set(util.SerializeInt64(reissuance.BlockHeight), appendValue)
|
||||
}
|
||||
|
||||
func (k Keeper) LookupReissuance(ctx sdk.Context, height int64) (val types.Reissuance, found bool) {
|
||||
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.ReissuanceBlockHeightKey))
|
||||
reissuance := store.Get(getReissuanceBytes(height))
|
||||
reissuance := store.Get(util.SerializeInt64(height))
|
||||
if reissuance == nil {
|
||||
return val, false
|
||||
}
|
||||
@ -68,7 +107,7 @@ func (k Keeper) LookupReissuance(ctx sdk.Context, height int64) (val types.Reiss
|
||||
func (k Keeper) getReissuancesRange(ctx sdk.Context, from int64) (reissuances []types.Reissuance) {
|
||||
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.ReissuanceBlockHeightKey))
|
||||
|
||||
iterator := store.Iterator(getReissuanceBytes(from), nil)
|
||||
iterator := store.Iterator(util.SerializeInt64(from), nil)
|
||||
defer iterator.Close()
|
||||
|
||||
for ; iterator.Valid(); iterator.Next() {
|
||||
@ -77,7 +116,55 @@ func (k Keeper) getReissuancesRange(ctx sdk.Context, from int64) (reissuances []
|
||||
k.cdc.MustUnmarshal(reissuance, &reissuanceOrg)
|
||||
reissuances = append(reissuances, reissuanceOrg)
|
||||
}
|
||||
return reissuances
|
||||
return
|
||||
}
|
||||
|
||||
func (k Keeper) GetLastReIssuance(ctx sdk.Context) (val types.Reissuance, found bool) {
|
||||
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.ReissuanceBlockHeightKey))
|
||||
|
||||
iterator := store.ReverseIterator(nil, nil)
|
||||
defer iterator.Close()
|
||||
found = iterator.Valid()
|
||||
if found {
|
||||
reIssuance := iterator.Value()
|
||||
k.cdc.MustUnmarshal(reIssuance, &val)
|
||||
}
|
||||
return val, found
|
||||
}
|
||||
|
||||
func (k Keeper) ComputeReIssuanceValue(ctx sdk.Context, startHeight int64, endHeight int64) (reIssuanceValue uint64, firstIncludedPop int64, lastIncludedPop int64, err error) {
|
||||
challenges, err := k.GetChallengeRange(ctx, startHeight, endHeight)
|
||||
if err != nil {
|
||||
util.GetAppLogger().Error(ctx, "unable to compute get challenges")
|
||||
return
|
||||
}
|
||||
var overallAmount uint64
|
||||
popEpochs := int64(config.GetConfig().PopEpochs)
|
||||
for _, obj := range challenges {
|
||||
// if (index == 0 && startHeight == 0 && obj.BlockHeight == 0) || // corner case (beginning of the chain)
|
||||
if startHeight < obj.GetHeight() && obj.GetHeight()+2*popEpochs <= endHeight {
|
||||
popReIssuanceString := GetReissuanceAsStringValue(obj.GetHeight())
|
||||
amount, err := util.RDDLTokenStringToUint(popReIssuanceString)
|
||||
if err != nil {
|
||||
util.GetAppLogger().Error(ctx, "unable to compute PoP re-issuance value (firstPop %u, Pops height %u, current height %u)",
|
||||
startHeight, obj.GetHeight(), endHeight)
|
||||
continue
|
||||
}
|
||||
if firstIncludedPop == 0 {
|
||||
firstIncludedPop = obj.GetHeight()
|
||||
}
|
||||
lastIncludedPop = obj.GetHeight()
|
||||
overallAmount += amount
|
||||
} else {
|
||||
util.GetAppLogger().Debug(ctx, "the PoP is not part of the reissuance (firstPop %u, Pops height %u, current height %u)",
|
||||
startHeight, obj.GetHeight(), endHeight)
|
||||
if obj.GetHeight()+2*popEpochs > endHeight {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
reIssuanceValue = overallAmount
|
||||
return
|
||||
}
|
||||
|
||||
func (k Keeper) getReissuancesPage(ctx sdk.Context, _ []byte, _ uint64, _ uint64, _ bool, reverse bool) (reissuances []types.Reissuance) {
|
||||
@ -98,8 +185,3 @@ func (k Keeper) getReissuancesPage(ctx sdk.Context, _ []byte, _ uint64, _ uint64
|
||||
}
|
||||
return reissuances
|
||||
}
|
||||
|
||||
func getReissuanceBytes(height int64) []byte {
|
||||
// Adding 1 because 0 will be interpreted as nil, which is an invalid key
|
||||
return big.NewInt(height + 1).Bytes()
|
||||
}
|
||||
|
@ -18,13 +18,52 @@ func createNReissuances(k *daokeeper.Keeper, ctx sdk.Context, n int) []types.Rei
|
||||
for i := range items {
|
||||
items[i].BlockHeight = int64(i)
|
||||
items[i].Proposer = fmt.Sprintf("proposer_%v", i)
|
||||
items[i].Rawtx = daokeeper.GetReissuanceCommand("asset_id", int64(i))
|
||||
items[i].RawTx = daokeeper.GetReissuanceCommand("asset_id", int64(i))
|
||||
items[i].TxID = ""
|
||||
items[i].FirstIncludedPop = int64(i)
|
||||
items[i].LastIncludedPop = int64(i)
|
||||
k.StoreReissuance(ctx, items[i])
|
||||
}
|
||||
return items
|
||||
}
|
||||
|
||||
func TestReissuanceComputation(t *testing.T) {
|
||||
t.Parallel()
|
||||
k, ctx := keepertest.DaoKeeper(t)
|
||||
var reissuanceValue uint64 = 99869000000
|
||||
numChallenges := 1000
|
||||
popepoch := int64(config.GetConfig().PopEpochs)
|
||||
_ = createNChallenge(k, ctx, numChallenges)
|
||||
|
||||
reIssuanceValue1, firstIncludedPop, lastIncludedPop, err := k.ComputeReIssuanceValue(ctx, 0, 780*popepoch)
|
||||
assert.Nil(t, err)
|
||||
|
||||
// explaining the numbers:
|
||||
// the Pops/Challenges start with 1*PopEpoch, ... n*PopEpoch
|
||||
indexFirst := firstIncludedPop / popepoch
|
||||
indexLast := lastIncludedPop / popepoch
|
||||
assert.Equal(t, indexFirst, int64(1))
|
||||
assert.Equal(t, indexLast, int64(778))
|
||||
expSum := reissuanceValue * uint64(indexLast-indexFirst+1) // add 1 to count for the one that is missing by subtraction
|
||||
assert.Equal(t, expSum, reIssuanceValue1)
|
||||
|
||||
var lastReIssuance types.Reissuance
|
||||
lastReIssuance.FirstIncludedPop = firstIncludedPop
|
||||
lastReIssuance.LastIncludedPop = lastIncludedPop
|
||||
k.StoreReissuance(ctx, lastReIssuance)
|
||||
lastReIssuanceValue2nd, firstIncludedPop, lastIncludedPop, err0 := k.ComputeReIssuanceValue(ctx, lastIncludedPop, 1000*int64(config.GetConfig().PopEpochs))
|
||||
assert.Nil(t, err0)
|
||||
indexFirst2nd := firstIncludedPop / popepoch
|
||||
indexLast2nd := lastIncludedPop / popepoch
|
||||
assert.Equal(t, indexLast+1, indexFirst2nd)
|
||||
assert.Equal(t, int64(numChallenges-2), indexLast2nd)
|
||||
expSum = reissuanceValue * uint64(indexLast2nd-indexFirst2nd+1) // add the [0] of the
|
||||
assert.Equal(t, expSum, lastReIssuanceValue2nd)
|
||||
expectedSum := uint64(numChallenges-2) * reissuanceValue
|
||||
computedSum := lastReIssuanceValue2nd + reIssuanceValue1
|
||||
assert.Equal(t, expectedSum, computedSum)
|
||||
}
|
||||
|
||||
func TestGetReissuances(t *testing.T) {
|
||||
t.Parallel()
|
||||
keeper, ctx := keepertest.DaoKeeper(t)
|
||||
@ -38,7 +77,7 @@ func TestGetReissuances(t *testing.T) {
|
||||
|
||||
func TestReissuanceValueComputation(t *testing.T) {
|
||||
t.Parallel()
|
||||
popsPerEpoch := float64(config.GetConfig().PoPEpochs)
|
||||
popsPerEpoch := float64(config.GetConfig().PopEpochs)
|
||||
assert.Equal(t, "998.69000000", daokeeper.GetReissuanceAsStringValue(1))
|
||||
assert.Equal(t, "499.34000000", daokeeper.GetReissuanceAsStringValue(int64(daokeeper.PopsPerCycle*popsPerEpoch*1+1)))
|
||||
assert.Equal(t, "249.67000000", daokeeper.GetReissuanceAsStringValue(int64(daokeeper.PopsPerCycle*popsPerEpoch*2+1)))
|
||||
|
@ -112,6 +112,34 @@ func (mr *MockBankKeeperMockRecorder) BlockedAddr(addr interface{}) *gomock.Call
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BlockedAddr", reflect.TypeOf((*MockBankKeeper)(nil).BlockedAddr), addr)
|
||||
}
|
||||
|
||||
// BurnCoins mocks base method.
|
||||
func (m *MockBankKeeper) BurnCoins(ctx types.Context, moduleName string, amt types.Coins) error {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "BurnCoins", ctx, moduleName, amt)
|
||||
ret0, _ := ret[0].(error)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// BurnCoins indicates an expected call of BurnCoins.
|
||||
func (mr *MockBankKeeperMockRecorder) BurnCoins(ctx, moduleName, amt interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BurnCoins", reflect.TypeOf((*MockBankKeeper)(nil).BurnCoins), ctx, moduleName, amt)
|
||||
}
|
||||
|
||||
// GetBalance mocks base method.
|
||||
func (m *MockBankKeeper) GetBalance(ctx types.Context, addr types.AccAddress, denom string) types.Coin {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "GetBalance", ctx, addr, denom)
|
||||
ret0, _ := ret[0].(types.Coin)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// GetBalance indicates an expected call of GetBalance.
|
||||
func (mr *MockBankKeeperMockRecorder) GetBalance(ctx, addr, denom interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBalance", reflect.TypeOf((*MockBankKeeper)(nil).GetBalance), ctx, addr, denom)
|
||||
}
|
||||
|
||||
// MintCoins mocks base method.
|
||||
func (m *MockBankKeeper) MintCoins(ctx types.Context, moduleName string, amt types.Coins) error {
|
||||
m.ctrl.T.Helper()
|
||||
@ -126,6 +154,20 @@ func (mr *MockBankKeeperMockRecorder) MintCoins(ctx, moduleName, amt interface{}
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MintCoins", reflect.TypeOf((*MockBankKeeper)(nil).MintCoins), ctx, moduleName, amt)
|
||||
}
|
||||
|
||||
// SendCoinsFromAccountToModule mocks base method.
|
||||
func (m *MockBankKeeper) SendCoinsFromAccountToModule(ctx types.Context, senderAddr types.AccAddress, recipientModule string, amt types.Coins) error {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "SendCoinsFromAccountToModule", ctx, senderAddr, recipientModule, amt)
|
||||
ret0, _ := ret[0].(error)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// SendCoinsFromAccountToModule indicates an expected call of SendCoinsFromAccountToModule.
|
||||
func (mr *MockBankKeeperMockRecorder) SendCoinsFromAccountToModule(ctx, senderAddr, recipientModule, amt interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendCoinsFromAccountToModule", reflect.TypeOf((*MockBankKeeper)(nil).SendCoinsFromAccountToModule), ctx, senderAddr, recipientModule, amt)
|
||||
}
|
||||
|
||||
// SendCoinsFromModuleToAccount mocks base method.
|
||||
func (m *MockBankKeeper) SendCoinsFromModuleToAccount(ctx types.Context, senderModule string, recipientAddr types.AccAddress, amt types.Coins) error {
|
||||
m.ctrl.T.Helper()
|
||||
|
@ -3,3 +3,5 @@ package types
|
||||
const PercentageDao float64 = 0.61
|
||||
const PercentageInvestor float64 = 0.31
|
||||
const PercentagePop float64 = 0.08
|
||||
const PercentageChallenger float64 = 0.02
|
||||
const PercentageChallengee float64 = 0.06
|
||||
|
@ -22,4 +22,5 @@ var (
|
||||
ErrDistributionNotFound = errorsmod.Register(ModuleName, 13, "distribution not found")
|
||||
ErrInvalidChallenge = errorsmod.Register(ModuleName, 14, "invalid challenge")
|
||||
ErrFailedPoPRewardsIssuance = errorsmod.Register(ModuleName, 15, "PoP rewards issuance failed")
|
||||
ErrResolvingStagedClaims = errorsmod.Register(ModuleName, 16, "resolving staged claims failed")
|
||||
)
|
||||
|
@ -17,7 +17,10 @@ type AccountKeeper interface {
|
||||
type BankKeeper interface {
|
||||
SpendableCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins
|
||||
SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error
|
||||
SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error
|
||||
BlockedAddr(addr sdk.AccAddress) bool
|
||||
MintCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error
|
||||
BurnCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error
|
||||
GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin
|
||||
// Methods imported from bank should be defined here
|
||||
}
|
||||
|
@ -10,12 +10,15 @@ const TypeMsgReissueRDDLProposal = "reissue_rddl_proposal"
|
||||
|
||||
var _ sdk.Msg = &MsgReissueRDDLProposal{}
|
||||
|
||||
func NewMsgReissueRDDLProposal(creator string, proposer string, tx string, blockHeight int64) *MsgReissueRDDLProposal {
|
||||
func NewMsgReissueRDDLProposal(creator string, proposer string, tx string, blockHeight int64,
|
||||
firstIncludedPop int64, lastIncludedPop int64) *MsgReissueRDDLProposal {
|
||||
return &MsgReissueRDDLProposal{
|
||||
Creator: creator,
|
||||
Proposer: proposer,
|
||||
Tx: tx,
|
||||
BlockHeight: blockHeight,
|
||||
Creator: creator,
|
||||
Proposer: proposer,
|
||||
Tx: tx,
|
||||
BlockHeight: blockHeight,
|
||||
FirstIncludedPop: firstIncludedPop,
|
||||
LastIncludedPop: lastIncludedPop,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -23,10 +23,12 @@ var _ = math.Inf
|
||||
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
|
||||
|
||||
type Reissuance struct {
|
||||
Proposer string `protobuf:"bytes,1,opt,name=proposer,proto3" json:"proposer,omitempty"`
|
||||
Rawtx string `protobuf:"bytes,2,opt,name=rawtx,proto3" json:"rawtx,omitempty"`
|
||||
TxID string `protobuf:"bytes,3,opt,name=txID,proto3" json:"txID,omitempty"`
|
||||
BlockHeight int64 `protobuf:"varint,4,opt,name=blockHeight,proto3" json:"blockHeight,omitempty"`
|
||||
Proposer string `protobuf:"bytes,1,opt,name=proposer,proto3" json:"proposer,omitempty"`
|
||||
RawTx string `protobuf:"bytes,2,opt,name=rawTx,proto3" json:"rawTx,omitempty"`
|
||||
TxID string `protobuf:"bytes,3,opt,name=txID,proto3" json:"txID,omitempty"`
|
||||
BlockHeight int64 `protobuf:"varint,4,opt,name=blockHeight,proto3" json:"blockHeight,omitempty"`
|
||||
FirstIncludedPop int64 `protobuf:"varint,5,opt,name=firstIncludedPop,proto3" json:"firstIncludedPop,omitempty"`
|
||||
LastIncludedPop int64 `protobuf:"varint,6,opt,name=lastIncludedPop,proto3" json:"lastIncludedPop,omitempty"`
|
||||
}
|
||||
|
||||
func (m *Reissuance) Reset() { *m = Reissuance{} }
|
||||
@ -69,9 +71,9 @@ func (m *Reissuance) GetProposer() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *Reissuance) GetRawtx() string {
|
||||
func (m *Reissuance) GetRawTx() string {
|
||||
if m != nil {
|
||||
return m.Rawtx
|
||||
return m.RawTx
|
||||
}
|
||||
return ""
|
||||
}
|
||||
@ -90,6 +92,20 @@ func (m *Reissuance) GetBlockHeight() int64 {
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *Reissuance) GetFirstIncludedPop() int64 {
|
||||
if m != nil {
|
||||
return m.FirstIncludedPop
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *Reissuance) GetLastIncludedPop() int64 {
|
||||
if m != nil {
|
||||
return m.LastIncludedPop
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*Reissuance)(nil), "planetmintgo.dao.Reissuance")
|
||||
}
|
||||
@ -97,21 +113,23 @@ func init() {
|
||||
func init() { proto.RegisterFile("planetmintgo/dao/reissuance.proto", fileDescriptor_35cf062bd4436e27) }
|
||||
|
||||
var fileDescriptor_35cf062bd4436e27 = []byte{
|
||||
// 209 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x2c, 0xc8, 0x49, 0xcc,
|
||||
0x4b, 0x2d, 0xc9, 0xcd, 0xcc, 0x2b, 0x49, 0xcf, 0xd7, 0x4f, 0x49, 0xcc, 0xd7, 0x2f, 0x4a, 0xcd,
|
||||
0x2c, 0x2e, 0x2e, 0x4d, 0xcc, 0x4b, 0x4e, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x40,
|
||||
0x56, 0xa2, 0x97, 0x92, 0x98, 0xaf, 0x54, 0xc2, 0xc5, 0x15, 0x04, 0x57, 0x25, 0x24, 0xc5, 0xc5,
|
||||
0x51, 0x50, 0x94, 0x5f, 0x90, 0x5f, 0x9c, 0x5a, 0x24, 0xc1, 0xa8, 0xc0, 0xa8, 0xc1, 0x19, 0x04,
|
||||
0xe7, 0x0b, 0x89, 0x70, 0xb1, 0x16, 0x25, 0x96, 0x97, 0x54, 0x48, 0x30, 0x81, 0x25, 0x20, 0x1c,
|
||||
0x21, 0x21, 0x2e, 0x96, 0x92, 0x0a, 0x4f, 0x17, 0x09, 0x66, 0xb0, 0x20, 0x98, 0x2d, 0xa4, 0xc0,
|
||||
0xc5, 0x9d, 0x94, 0x93, 0x9f, 0x9c, 0xed, 0x91, 0x9a, 0x99, 0x9e, 0x51, 0x22, 0xc1, 0xa2, 0xc0,
|
||||
0xa8, 0xc1, 0x1c, 0x84, 0x2c, 0xe4, 0xe4, 0x79, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c,
|
||||
0x0f, 0x1e, 0xc9, 0x31, 0x4e, 0x78, 0x2c, 0xc7, 0x70, 0xe1, 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, 0x72,
|
||||
0x0c, 0x51, 0xfa, 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0x08, 0xc7,
|
||||
0x22, 0x31, 0x75, 0xd3, 0xf3, 0xf5, 0x2b, 0xc0, 0xbe, 0x2b, 0xa9, 0x2c, 0x48, 0x2d, 0x4e, 0x62,
|
||||
0x03, 0xfb, 0xcc, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0x56, 0x20, 0xa3, 0x6c, 0xfe, 0x00, 0x00,
|
||||
0x00,
|
||||
// 248 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x90, 0xbf, 0x4a, 0xc5, 0x30,
|
||||
0x14, 0x87, 0x1b, 0xef, 0x1f, 0xf4, 0x38, 0x78, 0x09, 0x0e, 0xc1, 0x21, 0x54, 0xa7, 0x22, 0xd8,
|
||||
0x0c, 0xbe, 0x81, 0x38, 0xd8, 0x4d, 0x8a, 0x93, 0x5b, 0xda, 0xc6, 0xde, 0x60, 0x6f, 0x4f, 0x48,
|
||||
0x52, 0xac, 0x6f, 0xe1, 0x63, 0x89, 0xd3, 0x1d, 0x1d, 0xa5, 0x7d, 0x11, 0x21, 0xc2, 0xb5, 0x7a,
|
||||
0xb7, 0xf3, 0xfb, 0xce, 0x37, 0x7d, 0x70, 0x6e, 0x1a, 0xd9, 0x2a, 0xbf, 0xd1, 0xad, 0xaf, 0x51,
|
||||
0x54, 0x12, 0x85, 0x55, 0xda, 0xb9, 0x4e, 0xb6, 0xa5, 0x4a, 0x8d, 0x45, 0x8f, 0x74, 0x35, 0x55,
|
||||
0xd2, 0x4a, 0xe2, 0xc5, 0x07, 0x01, 0xc8, 0x77, 0x1a, 0x3d, 0x83, 0x43, 0x63, 0xd1, 0xa0, 0x53,
|
||||
0x96, 0x91, 0x98, 0x24, 0x47, 0xf9, 0x6e, 0xd3, 0x53, 0x58, 0x58, 0xf9, 0xf2, 0xd0, 0xb3, 0x83,
|
||||
0xf0, 0xf8, 0x19, 0x94, 0xc2, 0xdc, 0xf7, 0xd9, 0x2d, 0x9b, 0x05, 0x18, 0x6e, 0x1a, 0xc3, 0x71,
|
||||
0xd1, 0x60, 0xf9, 0x7c, 0xa7, 0x74, 0xbd, 0xf6, 0x6c, 0x1e, 0x93, 0x64, 0x96, 0x4f, 0x11, 0xbd,
|
||||
0x84, 0xd5, 0x93, 0xb6, 0xce, 0x67, 0x6d, 0xd9, 0x74, 0x95, 0xaa, 0xee, 0xd1, 0xb0, 0x45, 0xd0,
|
||||
0xf6, 0x38, 0x4d, 0xe0, 0xa4, 0x91, 0x7f, 0xd5, 0x65, 0x50, 0xff, 0xe3, 0x9b, 0xec, 0x7d, 0xe0,
|
||||
0x64, 0x3b, 0x70, 0xf2, 0x35, 0x70, 0xf2, 0x36, 0xf2, 0x68, 0x3b, 0xf2, 0xe8, 0x73, 0xe4, 0xd1,
|
||||
0xa3, 0xa8, 0xb5, 0x5f, 0x77, 0x45, 0x5a, 0xe2, 0x46, 0xfc, 0x36, 0x98, 0x9c, 0x57, 0x35, 0x8a,
|
||||
0x3e, 0x44, 0xf3, 0xaf, 0x46, 0xb9, 0x62, 0x19, 0x82, 0x5d, 0x7f, 0x07, 0x00, 0x00, 0xff, 0xff,
|
||||
0xc5, 0x5a, 0x83, 0x1d, 0x55, 0x01, 0x00, 0x00,
|
||||
}
|
||||
|
||||
func (m *Reissuance) Marshal() (dAtA []byte, err error) {
|
||||
@ -134,6 +152,16 @@ func (m *Reissuance) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if m.LastIncludedPop != 0 {
|
||||
i = encodeVarintReissuance(dAtA, i, uint64(m.LastIncludedPop))
|
||||
i--
|
||||
dAtA[i] = 0x30
|
||||
}
|
||||
if m.FirstIncludedPop != 0 {
|
||||
i = encodeVarintReissuance(dAtA, i, uint64(m.FirstIncludedPop))
|
||||
i--
|
||||
dAtA[i] = 0x28
|
||||
}
|
||||
if m.BlockHeight != 0 {
|
||||
i = encodeVarintReissuance(dAtA, i, uint64(m.BlockHeight))
|
||||
i--
|
||||
@ -146,10 +174,10 @@ func (m *Reissuance) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i--
|
||||
dAtA[i] = 0x1a
|
||||
}
|
||||
if len(m.Rawtx) > 0 {
|
||||
i -= len(m.Rawtx)
|
||||
copy(dAtA[i:], m.Rawtx)
|
||||
i = encodeVarintReissuance(dAtA, i, uint64(len(m.Rawtx)))
|
||||
if len(m.RawTx) > 0 {
|
||||
i -= len(m.RawTx)
|
||||
copy(dAtA[i:], m.RawTx)
|
||||
i = encodeVarintReissuance(dAtA, i, uint64(len(m.RawTx)))
|
||||
i--
|
||||
dAtA[i] = 0x12
|
||||
}
|
||||
@ -184,7 +212,7 @@ func (m *Reissuance) Size() (n int) {
|
||||
if l > 0 {
|
||||
n += 1 + l + sovReissuance(uint64(l))
|
||||
}
|
||||
l = len(m.Rawtx)
|
||||
l = len(m.RawTx)
|
||||
if l > 0 {
|
||||
n += 1 + l + sovReissuance(uint64(l))
|
||||
}
|
||||
@ -195,6 +223,12 @@ func (m *Reissuance) Size() (n int) {
|
||||
if m.BlockHeight != 0 {
|
||||
n += 1 + sovReissuance(uint64(m.BlockHeight))
|
||||
}
|
||||
if m.FirstIncludedPop != 0 {
|
||||
n += 1 + sovReissuance(uint64(m.FirstIncludedPop))
|
||||
}
|
||||
if m.LastIncludedPop != 0 {
|
||||
n += 1 + sovReissuance(uint64(m.LastIncludedPop))
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
@ -267,7 +301,7 @@ func (m *Reissuance) Unmarshal(dAtA []byte) error {
|
||||
iNdEx = postIndex
|
||||
case 2:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Rawtx", wireType)
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field RawTx", wireType)
|
||||
}
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
@ -295,7 +329,7 @@ func (m *Reissuance) Unmarshal(dAtA []byte) error {
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.Rawtx = string(dAtA[iNdEx:postIndex])
|
||||
m.RawTx = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 3:
|
||||
if wireType != 2 {
|
||||
@ -348,6 +382,44 @@ func (m *Reissuance) Unmarshal(dAtA []byte) error {
|
||||
break
|
||||
}
|
||||
}
|
||||
case 5:
|
||||
if wireType != 0 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field FirstIncludedPop", wireType)
|
||||
}
|
||||
m.FirstIncludedPop = 0
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowReissuance
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
m.FirstIncludedPop |= int64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
case 6:
|
||||
if wireType != 0 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field LastIncludedPop", wireType)
|
||||
}
|
||||
m.LastIncludedPop = 0
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowReissuance
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
m.LastIncludedPop |= int64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipReissuance(dAtA[iNdEx:])
|
||||
|
@ -120,10 +120,12 @@ func (m *MsgReportPopResultResponse) XXX_DiscardUnknown() {
|
||||
var xxx_messageInfo_MsgReportPopResultResponse proto.InternalMessageInfo
|
||||
|
||||
type MsgReissueRDDLProposal struct {
|
||||
Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"`
|
||||
Proposer string `protobuf:"bytes,2,opt,name=proposer,proto3" json:"proposer,omitempty"`
|
||||
Tx string `protobuf:"bytes,3,opt,name=tx,proto3" json:"tx,omitempty"`
|
||||
BlockHeight int64 `protobuf:"varint,4,opt,name=blockHeight,proto3" json:"blockHeight,omitempty"`
|
||||
Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"`
|
||||
Proposer string `protobuf:"bytes,2,opt,name=proposer,proto3" json:"proposer,omitempty"`
|
||||
Tx string `protobuf:"bytes,3,opt,name=tx,proto3" json:"tx,omitempty"`
|
||||
BlockHeight int64 `protobuf:"varint,4,opt,name=blockHeight,proto3" json:"blockHeight,omitempty"`
|
||||
FirstIncludedPop int64 `protobuf:"varint,5,opt,name=firstIncludedPop,proto3" json:"firstIncludedPop,omitempty"`
|
||||
LastIncludedPop int64 `protobuf:"varint,6,opt,name=lastIncludedPop,proto3" json:"lastIncludedPop,omitempty"`
|
||||
}
|
||||
|
||||
func (m *MsgReissueRDDLProposal) Reset() { *m = MsgReissueRDDLProposal{} }
|
||||
@ -187,6 +189,20 @@ func (m *MsgReissueRDDLProposal) GetBlockHeight() int64 {
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *MsgReissueRDDLProposal) GetFirstIncludedPop() int64 {
|
||||
if m != nil {
|
||||
return m.FirstIncludedPop
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *MsgReissueRDDLProposal) GetLastIncludedPop() int64 {
|
||||
if m != nil {
|
||||
return m.LastIncludedPop
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type MsgReissueRDDLProposalResponse struct {
|
||||
}
|
||||
|
||||
@ -839,61 +855,63 @@ func init() {
|
||||
func init() { proto.RegisterFile("planetmintgo/dao/tx.proto", fileDescriptor_7117c47dbc1828c7) }
|
||||
|
||||
var fileDescriptor_7117c47dbc1828c7 = []byte{
|
||||
// 864 bytes of a gzipped FileDescriptorProto
|
||||
// 896 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x56, 0x4f, 0x6f, 0x1b, 0x45,
|
||||
0x14, 0xf7, 0xc6, 0xa9, 0x83, 0x5f, 0xac, 0x96, 0x4e, 0x4d, 0xba, 0x59, 0x9c, 0xad, 0xd9, 0x56,
|
||||
0xc5, 0xad, 0xa8, 0x17, 0x8a, 0x84, 0x04, 0x1c, 0x10, 0xc1, 0x12, 0x44, 0x62, 0x45, 0xb4, 0x2d,
|
||||
0x17, 0x84, 0x14, 0xad, 0xbd, 0xa3, 0xf5, 0x28, 0xf6, 0xce, 0x66, 0x66, 0x5c, 0xb9, 0xe2, 0x82,
|
||||
0xfa, 0x09, 0x38, 0x71, 0xe2, 0xc6, 0x85, 0x63, 0x90, 0xf8, 0x10, 0x39, 0x46, 0x9c, 0x38, 0x21,
|
||||
0x94, 0x1c, 0xf2, 0x35, 0xd0, 0xce, 0xce, 0xfe, 0x71, 0x76, 0x63, 0xfb, 0x92, 0xcc, 0x7b, 0xbf,
|
||||
0xdf, 0x7b, 0xef, 0xe7, 0x37, 0x6f, 0x9e, 0x0d, 0xbb, 0xd1, 0xc4, 0x0b, 0xb1, 0x98, 0x92, 0x50,
|
||||
0x04, 0xd4, 0xf6, 0x3d, 0x6a, 0x8b, 0x79, 0x3f, 0x62, 0x54, 0x50, 0xf4, 0x76, 0x11, 0xea, 0xfb,
|
||||
0x1e, 0x35, 0xba, 0x25, 0xf2, 0x68, 0xec, 0x4d, 0x26, 0x38, 0x0c, 0x70, 0x12, 0x63, 0x3c, 0x2c,
|
||||
0x31, 0xe2, 0xe3, 0x11, 0xc3, 0x27, 0x33, 0xcc, 0x85, 0x22, 0x3d, 0x29, 0x91, 0x7c, 0xc2, 0x05,
|
||||
0x23, 0xc3, 0x99, 0x20, 0x34, 0x3c, 0xa2, 0xcc, 0xc7, 0x4c, 0x51, 0xf7, 0x4a, 0xd4, 0xc8, 0x63,
|
||||
0xde, 0x94, 0x2b, 0xf8, 0xae, 0x37, 0x25, 0x21, 0xb5, 0xe5, 0x5f, 0xe5, 0x6a, 0x07, 0x34, 0xa0,
|
||||
0xf2, 0x68, 0xc7, 0x27, 0xe5, 0xdd, 0x1d, 0x51, 0x3e, 0xa5, 0xfc, 0x28, 0x01, 0x12, 0x43, 0x41,
|
||||
0xf7, 0x13, 0xcb, 0x9e, 0xf2, 0xc0, 0x7e, 0xf5, 0x51, 0xfc, 0x2f, 0x01, 0x2c, 0x02, 0xc8, 0xe1,
|
||||
0x81, 0x8b, 0x23, 0xca, 0xc4, 0x21, 0x8d, 0x5c, 0xcc, 0x67, 0x13, 0x81, 0x74, 0xd8, 0x1a, 0x31,
|
||||
0xec, 0x09, 0xca, 0x74, 0xad, 0xab, 0xf5, 0x9a, 0x6e, 0x6a, 0xa2, 0x4f, 0xa1, 0x99, 0xb5, 0x43,
|
||||
0xdf, 0xe8, 0x6a, 0xbd, 0xed, 0xe7, 0xef, 0xf6, 0xaf, 0xf7, 0xb0, 0xff, 0x55, 0x4a, 0x71, 0x73,
|
||||
0xb6, 0xd5, 0x01, 0xa3, 0x5c, 0xca, 0xc5, 0x3c, 0xa2, 0x21, 0xc7, 0xd6, 0xcf, 0x1a, 0xec, 0x48,
|
||||
0x98, 0x70, 0x3e, 0xc3, 0xee, 0x60, 0xf0, 0xed, 0x21, 0xa3, 0x11, 0xe5, 0xde, 0x64, 0x89, 0x1a,
|
||||
0x03, 0xde, 0x8a, 0x24, 0x0b, 0x33, 0x29, 0xa6, 0xe9, 0x66, 0x36, 0xba, 0x0d, 0x1b, 0x62, 0xae,
|
||||
0xd7, 0xa5, 0x77, 0x43, 0xcc, 0x51, 0x17, 0xb6, 0x87, 0x13, 0x3a, 0x3a, 0xfe, 0x06, 0x93, 0x60,
|
||||
0x2c, 0xf4, 0xcd, 0xae, 0xd6, 0xab, 0xbb, 0x45, 0x97, 0xd5, 0x05, 0xb3, 0x5a, 0x41, 0x26, 0x92,
|
||||
0x40, 0xcb, 0xe1, 0x81, 0x43, 0x42, 0xf1, 0x92, 0x1e, 0xe3, 0x70, 0x89, 0xb2, 0x2f, 0x60, 0x3b,
|
||||
0xee, 0x87, 0x9b, 0xcc, 0x84, 0xea, 0xd4, 0x5e, 0xb9, 0x53, 0x4e, 0x4e, 0x72, 0x8b, 0x11, 0xd6,
|
||||
0x0e, 0xb4, 0x8b, 0xa5, 0x32, 0x09, 0x6f, 0x34, 0x09, 0x14, 0x54, 0xae, 0xbc, 0xb3, 0x65, 0x5d,
|
||||
0x42, 0xb0, 0x29, 0xe6, 0x07, 0x03, 0xd5, 0x27, 0x79, 0x5e, 0xa3, 0x53, 0x26, 0x74, 0xaa, 0x34,
|
||||
0x64, 0x22, 0x7f, 0xd7, 0xe0, 0x1d, 0x87, 0x07, 0x83, 0xc2, 0xc4, 0xaf, 0x54, 0xa9, 0xc3, 0xd6,
|
||||
0xc4, 0xe3, 0xf1, 0x64, 0x48, 0x91, 0x75, 0x37, 0x35, 0x63, 0xc4, 0xf7, 0xe8, 0xcb, 0x5c, 0x66,
|
||||
0x6a, 0x22, 0x0b, 0x5a, 0x24, 0x7c, 0x85, 0xb9, 0xa0, 0x4c, 0xc2, 0x9b, 0x12, 0x5e, 0xf0, 0xc5,
|
||||
0xd1, 0x11, 0x8d, 0x24, 0x7c, 0x2b, 0x89, 0x56, 0xa6, 0xf5, 0x00, 0xf6, 0x2a, 0x45, 0x66, 0x1f,
|
||||
0xe3, 0x27, 0x39, 0x92, 0x8b, 0x04, 0x79, 0x3b, 0x4b, 0x3e, 0xc6, 0xd7, 0xd0, 0x2a, 0x3e, 0x74,
|
||||
0x75, 0xf3, 0x0f, 0xcb, 0x37, 0x5f, 0x4c, 0xfb, 0x5d, 0xbc, 0x0d, 0xdc, 0x85, 0x40, 0x35, 0x8d,
|
||||
0x15, 0xc5, 0x33, 0x79, 0xbf, 0x6a, 0x70, 0xc7, 0xe1, 0xc1, 0xf7, 0x91, 0xef, 0x09, 0x7c, 0x28,
|
||||
0x57, 0x06, 0xfa, 0x04, 0x9a, 0xde, 0x4c, 0x8c, 0x29, 0x23, 0xe2, 0x75, 0x22, 0x6d, 0x5f, 0xff,
|
||||
0xfb, 0xaf, 0x67, 0x6d, 0xb5, 0x0d, 0xbe, 0xf4, 0x7d, 0x86, 0x39, 0x7f, 0x21, 0x18, 0x09, 0x03,
|
||||
0x37, 0xa7, 0xa2, 0xcf, 0xa1, 0x91, 0x2c, 0x1d, 0x25, 0x58, 0x2f, 0x0b, 0x4e, 0x2a, 0xec, 0x37,
|
||||
0xcf, 0xfe, 0x7d, 0x50, 0xfb, 0xe3, 0xea, 0xf4, 0xa9, 0xe6, 0xaa, 0x90, 0xcf, 0x6e, 0xbf, 0xb9,
|
||||
0x3a, 0x7d, 0x9a, 0x27, 0xb3, 0x76, 0xe1, 0xfe, 0x35, 0x5d, 0x99, 0xe6, 0xdf, 0x34, 0x00, 0x87,
|
||||
0x07, 0x07, 0x21, 0x49, 0xaf, 0xf6, 0x86, 0x3e, 0x76, 0xa0, 0x49, 0x42, 0x22, 0x88, 0xc4, 0x92,
|
||||
0xa9, 0xcd, 0x1d, 0xc8, 0x04, 0xc8, 0x16, 0x0b, 0x53, 0x53, 0x51, 0xf0, 0x2c, 0xe0, 0x58, 0x8d,
|
||||
0x45, 0xc1, 0x83, 0x76, 0xa0, 0x31, 0x4e, 0xa6, 0xfb, 0x96, 0x9c, 0x35, 0x65, 0x59, 0x6d, 0xb9,
|
||||
0x0e, 0x95, 0xba, 0x54, 0xf4, 0xf3, 0x3f, 0x1b, 0x50, 0x77, 0x78, 0x80, 0x4e, 0xe0, 0x5e, 0xd5,
|
||||
0x7e, 0xea, 0x55, 0x3c, 0xeb, 0xca, 0x3d, 0x62, 0x7c, 0xb8, 0x2e, 0x33, 0x2d, 0x8d, 0x5e, 0x40,
|
||||
0x33, 0x5f, 0x37, 0x66, 0x65, 0x78, 0x86, 0x1b, 0x8f, 0x97, 0xe3, 0x59, 0xd2, 0x63, 0xb8, 0x5b,
|
||||
0xde, 0x1f, 0x8f, 0x57, 0x69, 0x4b, 0x78, 0x46, 0x7f, 0x3d, 0x5e, 0x56, 0x2c, 0x04, 0x54, 0xb1,
|
||||
0x07, 0xde, 0xaf, 0xcc, 0x52, 0x26, 0x1a, 0xf6, 0x9a, 0xc4, 0xac, 0xde, 0x09, 0xdc, 0xab, 0x7a,
|
||||
0xb1, 0xbd, 0x35, 0xf2, 0x48, 0xe6, 0x0d, 0x97, 0xb4, 0xe4, 0x21, 0xa2, 0x1f, 0xa1, 0xb5, 0xf0,
|
||||
0x08, 0xdf, 0xab, 0xcc, 0x50, 0xa4, 0x18, 0x4f, 0x56, 0x52, 0xb2, 0xec, 0x18, 0xee, 0x5c, 0xff,
|
||||
0x7e, 0x7e, 0x74, 0xc3, 0x1d, 0x2c, 0xb0, 0x8c, 0x0f, 0xd6, 0x61, 0x65, 0x65, 0x1c, 0xd8, 0x4a,
|
||||
0x5f, 0x65, 0xa7, 0x32, 0x50, 0xa1, 0xc6, 0xa3, 0x65, 0x68, 0x9a, 0x6e, 0xff, 0xe0, 0xec, 0xc2,
|
||||
0xd4, 0xce, 0x2f, 0x4c, 0xed, 0xbf, 0x0b, 0x53, 0xfb, 0xe5, 0xd2, 0xac, 0x9d, 0x5f, 0x9a, 0xb5,
|
||||
0x7f, 0x2e, 0xcd, 0xda, 0x0f, 0x76, 0x40, 0xc4, 0x78, 0x36, 0xec, 0x8f, 0xe8, 0xd4, 0xce, 0x33,
|
||||
0x15, 0x8e, 0xcf, 0x02, 0x6a, 0xcf, 0x93, 0x9f, 0x69, 0xaf, 0x23, 0xcc, 0x87, 0x0d, 0xf9, 0x53,
|
||||
0xe5, 0xe3, 0xff, 0x03, 0x00, 0x00, 0xff, 0xff, 0x8a, 0x76, 0xbe, 0x3b, 0xc7, 0x09, 0x00, 0x00,
|
||||
0x14, 0xcf, 0x26, 0xa9, 0x83, 0x5f, 0xa2, 0xa6, 0x9d, 0x86, 0x74, 0xb3, 0x24, 0x5b, 0xb3, 0xad,
|
||||
0x8a, 0x1b, 0x51, 0x2f, 0x14, 0x09, 0x09, 0x38, 0x20, 0x82, 0x25, 0xb0, 0xc4, 0x0a, 0x6b, 0x5b,
|
||||
0x2e, 0x08, 0x29, 0x5a, 0x7b, 0x87, 0xf5, 0x28, 0xeb, 0x9d, 0xcd, 0xcc, 0xb8, 0x72, 0xc5, 0xad,
|
||||
0x9f, 0x80, 0x13, 0x27, 0x6e, 0x5c, 0x38, 0x16, 0x89, 0x0f, 0xd1, 0x63, 0xc5, 0x01, 0x71, 0x42,
|
||||
0x28, 0x39, 0xe4, 0x6b, 0xa0, 0x9d, 0x9d, 0xfd, 0x63, 0xef, 0xc6, 0xf6, 0x25, 0x99, 0x79, 0xbf,
|
||||
0xdf, 0xbc, 0xf7, 0x9b, 0xf7, 0xde, 0x3c, 0x2f, 0x1c, 0xc4, 0xa1, 0x17, 0x61, 0x31, 0x26, 0x91,
|
||||
0x08, 0xa8, 0xed, 0x7b, 0xd4, 0x16, 0xd3, 0x4e, 0xcc, 0xa8, 0xa0, 0xe8, 0x56, 0x19, 0xea, 0xf8,
|
||||
0x1e, 0x35, 0x5a, 0x15, 0xf2, 0x70, 0xe4, 0x85, 0x21, 0x8e, 0x02, 0x9c, 0x9e, 0x31, 0xee, 0x57,
|
||||
0x18, 0xc9, 0xf2, 0x94, 0xe1, 0xf3, 0x09, 0xe6, 0x42, 0x91, 0x1e, 0x55, 0x48, 0x3e, 0xe1, 0x82,
|
||||
0x91, 0xc1, 0x44, 0x10, 0x1a, 0x9d, 0x52, 0xe6, 0x63, 0xa6, 0xa8, 0x47, 0x15, 0x6a, 0xec, 0x31,
|
||||
0x6f, 0xcc, 0x15, 0x7c, 0xdb, 0x1b, 0x93, 0x88, 0xda, 0xf2, 0xaf, 0x32, 0xed, 0x05, 0x34, 0xa0,
|
||||
0x72, 0x69, 0x27, 0x2b, 0x65, 0x3d, 0x18, 0x52, 0x3e, 0xa6, 0xfc, 0x34, 0x05, 0xd2, 0x8d, 0x82,
|
||||
0xee, 0xa6, 0x3b, 0x7b, 0xcc, 0x03, 0xfb, 0xf9, 0x87, 0xc9, 0xbf, 0x14, 0xb0, 0x08, 0x20, 0x87,
|
||||
0x07, 0x2e, 0x8e, 0x29, 0x13, 0x7d, 0x1a, 0xbb, 0x98, 0x4f, 0x42, 0x81, 0x74, 0xd8, 0x1a, 0x32,
|
||||
0xec, 0x09, 0xca, 0x74, 0xad, 0xa5, 0xb5, 0x9b, 0x6e, 0xb6, 0x45, 0x9f, 0x40, 0x33, 0x4f, 0x87,
|
||||
0xbe, 0xde, 0xd2, 0xda, 0xdb, 0x4f, 0xde, 0xe9, 0xcc, 0xe7, 0xb0, 0xf3, 0x65, 0x46, 0x71, 0x0b,
|
||||
0xb6, 0x75, 0x08, 0x46, 0x35, 0x94, 0x8b, 0x79, 0x4c, 0x23, 0x8e, 0xad, 0xbf, 0x35, 0xd8, 0x97,
|
||||
0x30, 0xe1, 0x7c, 0x82, 0xdd, 0x6e, 0xf7, 0x9b, 0x3e, 0xa3, 0x31, 0xe5, 0x5e, 0xb8, 0x40, 0x8d,
|
||||
0x01, 0x6f, 0xc5, 0x92, 0x85, 0x99, 0x14, 0xd3, 0x74, 0xf3, 0x3d, 0xba, 0x09, 0xeb, 0x62, 0xaa,
|
||||
0x6f, 0x48, 0xeb, 0xba, 0x98, 0xa2, 0x16, 0x6c, 0x0f, 0x42, 0x3a, 0x3c, 0xfb, 0x1a, 0x93, 0x60,
|
||||
0x24, 0xf4, 0xcd, 0x96, 0xd6, 0xde, 0x70, 0xcb, 0x26, 0x74, 0x0c, 0xb7, 0x7e, 0x24, 0x8c, 0x8b,
|
||||
0x5e, 0x34, 0x0c, 0x27, 0x3e, 0xf6, 0xfb, 0x34, 0xd6, 0x6f, 0x48, 0x5a, 0xc5, 0x8e, 0xda, 0xb0,
|
||||
0x1b, 0x7a, 0xb3, 0xd4, 0x86, 0xa4, 0xce, 0x9b, 0xad, 0x16, 0x98, 0xf5, 0xf7, 0xca, 0xaf, 0x4e,
|
||||
0x60, 0xc7, 0xe1, 0x81, 0x43, 0x22, 0xf1, 0x8c, 0x9e, 0xe1, 0x68, 0xc1, 0x7d, 0x3f, 0x87, 0xed,
|
||||
0x24, 0xcb, 0x6e, 0xda, 0x69, 0x2a, 0xff, 0x47, 0xd5, 0xfc, 0x3b, 0x05, 0xc9, 0x2d, 0x9f, 0xb0,
|
||||
0xf6, 0x61, 0xaf, 0x1c, 0x2a, 0x97, 0xf0, 0x52, 0x93, 0x40, 0x49, 0xe5, 0xd2, 0x4e, 0x58, 0x94,
|
||||
0x7b, 0x04, 0x9b, 0x62, 0xda, 0xeb, 0xaa, 0xec, 0xcb, 0xf5, 0xf2, 0xfc, 0x5b, 0x26, 0x1c, 0xd6,
|
||||
0x69, 0xc8, 0x45, 0xfe, 0xa6, 0xc1, 0xdb, 0x0e, 0x0f, 0xba, 0xa5, 0x77, 0xb4, 0x54, 0xa5, 0x0e,
|
||||
0x5b, 0x49, 0x41, 0x92, 0xfa, 0xac, 0xcb, 0x88, 0xd9, 0x36, 0x41, 0x7c, 0x8f, 0x3e, 0x2b, 0x64,
|
||||
0x66, 0x5b, 0x64, 0xc1, 0x0e, 0x89, 0x9e, 0x63, 0x2e, 0x28, 0x93, 0xf0, 0xa6, 0x84, 0x67, 0x6c,
|
||||
0xc9, 0xe9, 0x98, 0xc6, 0x12, 0xbe, 0x91, 0x9e, 0x56, 0x5b, 0xeb, 0x1e, 0x1c, 0xd5, 0x8a, 0xcc,
|
||||
0xaf, 0xf1, 0x93, 0x6c, 0xf4, 0x59, 0x82, 0xac, 0xce, 0x82, 0x6b, 0x7c, 0x05, 0x3b, 0xe5, 0xf1,
|
||||
0xa1, 0x2a, 0x7f, 0xbf, 0x5a, 0xf9, 0xb2, 0xdb, 0x6f, 0x93, 0x19, 0xe3, 0xce, 0x1c, 0x54, 0xdd,
|
||||
0x58, 0x13, 0x3c, 0x97, 0xf7, 0x8b, 0x06, 0xbb, 0x0e, 0x0f, 0xbe, 0x8b, 0x7d, 0x4f, 0xe0, 0xbe,
|
||||
0x1c, 0x44, 0xe8, 0x63, 0x68, 0x7a, 0x13, 0x31, 0xa2, 0x8c, 0x88, 0x17, 0xa9, 0xb4, 0x13, 0xfd,
|
||||
0xaf, 0x3f, 0x1f, 0xef, 0xa9, 0x19, 0xf3, 0x85, 0xef, 0x33, 0xcc, 0xf9, 0x53, 0xc1, 0x48, 0x14,
|
||||
0xb8, 0x05, 0x15, 0x7d, 0x06, 0x8d, 0x74, 0x94, 0x29, 0xc1, 0x7a, 0x55, 0x70, 0x1a, 0xe1, 0xa4,
|
||||
0xf9, 0xfa, 0xdf, 0x7b, 0x6b, 0xbf, 0x5f, 0xbd, 0x3a, 0xd6, 0x5c, 0x75, 0xe4, 0xd3, 0x9b, 0x2f,
|
||||
0xaf, 0x5e, 0x1d, 0x17, 0xce, 0xac, 0x03, 0xb8, 0x3b, 0xa7, 0x2b, 0xd7, 0xfc, 0xab, 0x06, 0xe0,
|
||||
0xf0, 0xa0, 0x17, 0x91, 0xac, 0xb4, 0xd7, 0xe4, 0xf1, 0x10, 0x9a, 0x24, 0x22, 0x82, 0x48, 0x2c,
|
||||
0xed, 0xda, 0xc2, 0x80, 0x4c, 0x80, 0x7c, 0x5c, 0x31, 0xd5, 0x15, 0x25, 0xcb, 0x0c, 0x8e, 0x55,
|
||||
0x5b, 0x94, 0x2c, 0x68, 0x1f, 0x1a, 0xa3, 0xb4, 0xbb, 0xd3, 0xb1, 0xa1, 0x76, 0xd6, 0x9e, 0x1c,
|
||||
0xb2, 0x4a, 0x5d, 0x26, 0xfa, 0xc9, 0x1f, 0x0d, 0xd8, 0x70, 0x78, 0x80, 0xce, 0xe1, 0x4e, 0xdd,
|
||||
0xd4, 0x6b, 0xd7, 0x3c, 0xeb, 0xda, 0x39, 0x62, 0x7c, 0xb0, 0x2a, 0x33, 0x0b, 0x8d, 0x9e, 0x42,
|
||||
0xb3, 0x18, 0x37, 0x66, 0xed, 0xf1, 0x1c, 0x37, 0x1e, 0x2e, 0xc6, 0x73, 0xa7, 0x67, 0x70, 0xbb,
|
||||
0x3a, 0x3f, 0x1e, 0x2e, 0xd3, 0x96, 0xf2, 0x8c, 0xce, 0x6a, 0xbc, 0x3c, 0x58, 0x04, 0xa8, 0x66,
|
||||
0x0e, 0xbc, 0x57, 0xeb, 0xa5, 0x4a, 0x34, 0xec, 0x15, 0x89, 0x79, 0xbc, 0x73, 0xb8, 0x53, 0xf7,
|
||||
0x62, 0xdb, 0x2b, 0xf8, 0x91, 0xcc, 0x6b, 0x8a, 0xb4, 0xe0, 0x21, 0xa2, 0x1f, 0x60, 0x67, 0xe6,
|
||||
0x11, 0xbe, 0x5b, 0xeb, 0xa1, 0x4c, 0x31, 0x1e, 0x2d, 0xa5, 0xe4, 0xde, 0x31, 0xec, 0xce, 0xff,
|
||||
0xea, 0x3f, 0xb8, 0xa6, 0x06, 0x33, 0x2c, 0xe3, 0xfd, 0x55, 0x58, 0x79, 0x18, 0x07, 0xb6, 0xb2,
|
||||
0x57, 0x79, 0x58, 0x7b, 0x50, 0xa1, 0xc6, 0x83, 0x45, 0x68, 0xe6, 0xee, 0xa4, 0xf7, 0xfa, 0xc2,
|
||||
0xd4, 0xde, 0x5c, 0x98, 0xda, 0x7f, 0x17, 0xa6, 0xf6, 0xf3, 0xa5, 0xb9, 0xf6, 0xe6, 0xd2, 0x5c,
|
||||
0xfb, 0xe7, 0xd2, 0x5c, 0xfb, 0xde, 0x0e, 0x88, 0x18, 0x4d, 0x06, 0x9d, 0x21, 0x1d, 0xdb, 0x85,
|
||||
0xa7, 0xd2, 0xf2, 0x71, 0x40, 0xed, 0x69, 0xfa, 0xf1, 0xf7, 0x22, 0xc6, 0x7c, 0xd0, 0x90, 0x1f,
|
||||
0x40, 0x1f, 0xfd, 0x1f, 0x00, 0x00, 0xff, 0xff, 0xa1, 0x23, 0xab, 0x7b, 0x1d, 0x0a, 0x00, 0x00,
|
||||
}
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
@ -1313,6 +1331,16 @@ func (m *MsgReissueRDDLProposal) MarshalToSizedBuffer(dAtA []byte) (int, error)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if m.LastIncludedPop != 0 {
|
||||
i = encodeVarintTx(dAtA, i, uint64(m.LastIncludedPop))
|
||||
i--
|
||||
dAtA[i] = 0x30
|
||||
}
|
||||
if m.FirstIncludedPop != 0 {
|
||||
i = encodeVarintTx(dAtA, i, uint64(m.FirstIncludedPop))
|
||||
i--
|
||||
dAtA[i] = 0x28
|
||||
}
|
||||
if m.BlockHeight != 0 {
|
||||
i = encodeVarintTx(dAtA, i, uint64(m.BlockHeight))
|
||||
i--
|
||||
@ -1846,6 +1874,12 @@ func (m *MsgReissueRDDLProposal) Size() (n int) {
|
||||
if m.BlockHeight != 0 {
|
||||
n += 1 + sovTx(uint64(m.BlockHeight))
|
||||
}
|
||||
if m.FirstIncludedPop != 0 {
|
||||
n += 1 + sovTx(uint64(m.FirstIncludedPop))
|
||||
}
|
||||
if m.LastIncludedPop != 0 {
|
||||
n += 1 + sovTx(uint64(m.LastIncludedPop))
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
@ -2359,6 +2393,44 @@ func (m *MsgReissueRDDLProposal) Unmarshal(dAtA []byte) error {
|
||||
break
|
||||
}
|
||||
}
|
||||
case 5:
|
||||
if wireType != 0 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field FirstIncludedPop", wireType)
|
||||
}
|
||||
m.FirstIncludedPop = 0
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowTx
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
m.FirstIncludedPop |= int64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
case 6:
|
||||
if wireType != 0 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field LastIncludedPop", wireType)
|
||||
}
|
||||
m.LastIncludedPop = 0
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowTx
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
m.LastIncludedPop |= int64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipTx(dAtA[iNdEx:])
|
||||
|
@ -1,6 +1,7 @@
|
||||
package keeper
|
||||
|
||||
import (
|
||||
"github.com/planetmint/planetmint-go/util"
|
||||
"github.com/planetmint/planetmint-go/x/machine/types"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/store/prefix"
|
||||
@ -10,12 +11,12 @@ import (
|
||||
func (k Keeper) StoreLiquidAttest(ctx sdk.Context, asset types.LiquidAsset) {
|
||||
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.LiquidAssetKey))
|
||||
appendValue := k.cdc.MustMarshal(&asset)
|
||||
store.Set(GetAssetBytes(asset.MachineID), appendValue)
|
||||
store.Set(util.SerializeString(asset.MachineID), appendValue)
|
||||
}
|
||||
|
||||
func (k Keeper) LookupLiquidAsset(ctx sdk.Context, machineID string) (val types.LiquidAsset, found bool) {
|
||||
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.LiquidAssetKey))
|
||||
liquidAsset := store.Get(GetAssetBytes(machineID))
|
||||
liquidAsset := store.Get(util.SerializeString(machineID))
|
||||
|
||||
if liquidAsset == nil {
|
||||
return val, false
|
||||
@ -25,7 +26,3 @@ func (k Keeper) LookupLiquidAsset(ctx sdk.Context, machineID string) (val types.
|
||||
}
|
||||
return val, true
|
||||
}
|
||||
|
||||
func GetAssetBytes(pubKey string) []byte {
|
||||
return []byte(pubKey)
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package keeper
|
||||
|
||||
import (
|
||||
"github.com/planetmint/planetmint-go/util"
|
||||
"github.com/planetmint/planetmint-go/x/machine/types"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/store/prefix"
|
||||
@ -10,12 +11,12 @@ import (
|
||||
func (k Keeper) StoreMachine(ctx sdk.Context, machine types.Machine) {
|
||||
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.MachineKey))
|
||||
appendValue := k.cdc.MustMarshal(&machine)
|
||||
store.Set(GetMachineBytes(machine.IssuerPlanetmint), appendValue)
|
||||
store.Set(util.SerializeString(machine.IssuerPlanetmint), appendValue)
|
||||
}
|
||||
|
||||
func (k Keeper) GetMachine(ctx sdk.Context, index types.MachineIndex) (val types.Machine, found bool) {
|
||||
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.MachineKey))
|
||||
machine := store.Get(GetMachineBytes(index.IssuerPlanetmint))
|
||||
machine := store.Get(util.SerializeString(index.IssuerPlanetmint))
|
||||
|
||||
if machine == nil {
|
||||
return val, false
|
||||
@ -39,10 +40,10 @@ func (k Keeper) StoreMachineIndex(ctx sdk.Context, machine types.Machine) {
|
||||
Address: machine.Address,
|
||||
}
|
||||
|
||||
machineIDIndexKey := GetMachineBytes(machine.MachineId)
|
||||
issuerPlanetmintIndexKey := GetMachineBytes(machine.IssuerPlanetmint)
|
||||
issuerLiquidIndexKey := GetMachineBytes(machine.IssuerLiquid)
|
||||
addressIndexKey := GetMachineBytes(machine.Address)
|
||||
machineIDIndexKey := util.SerializeString(machine.MachineId)
|
||||
issuerPlanetmintIndexKey := util.SerializeString(machine.IssuerPlanetmint)
|
||||
issuerLiquidIndexKey := util.SerializeString(machine.IssuerLiquid)
|
||||
addressIndexKey := util.SerializeString(machine.Address)
|
||||
|
||||
indexAppendValue := k.cdc.MustMarshal(&index)
|
||||
taIndexStore.Set(machineIDIndexKey, indexAppendValue)
|
||||
@ -56,7 +57,7 @@ func (k Keeper) GetMachineIndexByPubKey(ctx sdk.Context, pubKey string) (val typ
|
||||
issuerPlanetmintIndexStore := prefix.NewStore(ctx.KVStore(k.issuerPlanetmintIndexStoreKey), types.KeyPrefix(types.IssuerPlanetmintIndexKey))
|
||||
issuerLiquidIndexStore := prefix.NewStore(ctx.KVStore(k.issuerLiquidIndexStoreKey), types.KeyPrefix(types.IssuerLiquidIndexKey))
|
||||
|
||||
keyBytes := GetMachineBytes(pubKey)
|
||||
keyBytes := util.SerializeString(pubKey)
|
||||
|
||||
taIndex := taIndexStore.Get(keyBytes)
|
||||
if taIndex != nil {
|
||||
@ -88,7 +89,7 @@ func (k Keeper) GetMachineIndexByPubKey(ctx sdk.Context, pubKey string) (val typ
|
||||
func (k Keeper) GetMachineIndexByAddress(ctx sdk.Context, address string) (val types.MachineIndex, found bool) {
|
||||
addressIndexStore := prefix.NewStore(ctx.KVStore(k.addressIndexStoreKey), types.KeyPrefix(types.AddressIndexKey))
|
||||
|
||||
keyBytes := GetMachineBytes(address)
|
||||
keyBytes := util.SerializeString(address)
|
||||
|
||||
adIndex := addressIndexStore.Get(keyBytes)
|
||||
if adIndex != nil {
|
||||
@ -100,7 +101,3 @@ func (k Keeper) GetMachineIndexByAddress(ctx sdk.Context, address string) (val t
|
||||
|
||||
return val, false
|
||||
}
|
||||
|
||||
func GetMachineBytes(pubKey string) []byte {
|
||||
return []byte(pubKey)
|
||||
}
|
||||
|
@ -1,9 +1,9 @@
|
||||
package keeper
|
||||
|
||||
import (
|
||||
"encoding/hex"
|
||||
"errors"
|
||||
|
||||
"github.com/planetmint/planetmint-go/util"
|
||||
"github.com/planetmint/planetmint-go/x/machine/types"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/store/prefix"
|
||||
@ -19,7 +19,7 @@ func (k Keeper) StoreTrustAnchor(ctx sdk.Context, ta types.TrustAnchor, activate
|
||||
} else {
|
||||
appendValue = []byte{0}
|
||||
}
|
||||
pubKeyBytes, err := getTrustAnchorBytes(ta.Pubkey)
|
||||
pubKeyBytes, err := util.SerializeHexString(ta.Pubkey)
|
||||
if err != nil {
|
||||
return errors.New("the given public key could not be decoded (malformed string)")
|
||||
}
|
||||
@ -29,7 +29,7 @@ func (k Keeper) StoreTrustAnchor(ctx sdk.Context, ta types.TrustAnchor, activate
|
||||
|
||||
func (k Keeper) GetTrustAnchor(ctx sdk.Context, pubKey string) (val types.TrustAnchor, activated bool, found bool) {
|
||||
store := prefix.NewStore(ctx.KVStore(k.taStoreKey), types.KeyPrefix(types.TrustAnchorKey))
|
||||
pubKeyBytes, err := getTrustAnchorBytes(pubKey)
|
||||
pubKeyBytes, err := util.SerializeHexString(pubKey)
|
||||
if err != nil {
|
||||
return val, false, false
|
||||
}
|
||||
@ -46,7 +46,3 @@ func (k Keeper) GetTrustAnchor(ctx sdk.Context, pubKey string) (val types.TrustA
|
||||
}
|
||||
return val, false, true
|
||||
}
|
||||
|
||||
func getTrustAnchorBytes(pubKey string) ([]byte, error) {
|
||||
return hex.DecodeString(pubKey)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user