2019-05-18 01:42:24 -07:00
|
|
|
package simapp
|
2018-04-06 22:12:00 -07:00
|
|
|
|
|
|
|
import (
|
2018-10-22 11:59:00 -07:00
|
|
|
"io"
|
|
|
|
"os"
|
|
|
|
|
2019-06-05 16:26:17 -07:00
|
|
|
abci "github.com/tendermint/tendermint/abci/types"
|
|
|
|
cmn "github.com/tendermint/tendermint/libs/common"
|
|
|
|
"github.com/tendermint/tendermint/libs/log"
|
2019-08-02 06:20:39 -07:00
|
|
|
dbm "github.com/tendermint/tm-db"
|
2019-06-05 16:26:17 -07:00
|
|
|
|
2018-04-06 22:12:00 -07:00
|
|
|
bam "github.com/cosmos/cosmos-sdk/baseapp"
|
2018-09-13 11:17:32 -07:00
|
|
|
"github.com/cosmos/cosmos-sdk/codec"
|
2018-04-06 22:12:00 -07:00
|
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
2019-06-05 16:26:17 -07:00
|
|
|
"github.com/cosmos/cosmos-sdk/types/module"
|
2019-05-02 12:37:44 -07:00
|
|
|
"github.com/cosmos/cosmos-sdk/version"
|
2018-04-06 22:12:00 -07:00
|
|
|
"github.com/cosmos/cosmos-sdk/x/auth"
|
|
|
|
"github.com/cosmos/cosmos-sdk/x/bank"
|
2019-03-28 16:27:47 -07:00
|
|
|
"github.com/cosmos/cosmos-sdk/x/crisis"
|
2018-09-17 20:02:15 -07:00
|
|
|
distr "github.com/cosmos/cosmos-sdk/x/distribution"
|
2019-05-16 08:25:32 -07:00
|
|
|
"github.com/cosmos/cosmos-sdk/x/genutil"
|
2018-06-21 17:19:14 -07:00
|
|
|
"github.com/cosmos/cosmos-sdk/x/gov"
|
2018-10-19 11:36:00 -07:00
|
|
|
"github.com/cosmos/cosmos-sdk/x/mint"
|
Merge #4209: NFT Module
* in sync with @okwme/cosmos-nft
* remove tmp tx
* structuring and minor changes
* supply and client files
* adding cli client
* complete cli/tx and rest.go
* cleanup and restructuring
* restructure rest folder
* minor updates on clients
* update querier
* encoding for clients and other changes
* genesis, invariants, and keeper updates
* update types
* make golangcibot happy
* renamed and removed bank keeper
* remove handlers for editmetadata, mint, burn, buy
* nft interface
* minor cleanup
* sort collections and nfts
* balance and find
* nft query and tx
* touch ups
* uint in place of int
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* little fixes:
- fix error to err to avoid collision
- error handling
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* module generalization changes
* fixes
* query with data
* minor updates and TODOs
* fix CLI tx
* golang bot fixes
* handlers and txs done
* update module generalization
* Added very basic tests which for some reason do not work
* fix test
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* fixed test, now we should fix implementation, seems to fail
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* fix test, create new struct instead of changing the old one
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* fix handler with new logic
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* let's make it compile
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* single failing test example, need to be fixed and extended
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* single failing test example, need to be fixed and extended
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* reverting work, still problems unmarshalling inside iterator from test
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* Setter in nft.go should return NFT instead of BaseNFT
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* remove TODOS
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* comment out broken tests, we want at least a green mark here
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* little fixes
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* hopefully no conflict
* minor changes for tests
* change nft id to string, refactors
* messy pause
* Changes Balances to OWners add all necessary functions, updated Keeper with UpdateNFT as as well as MintNFT and made sure they all update Owners
* pause dev to merge sdk master
* go.mod changes
* getting closer still need module.go
* builds!!!
* fix lint begin handler tests
* stableish
* re-order nft attributes, add back mint and burn msgs and handlers
* add errors to minting the same NFT and burning an NFT that doesnt exist
* first querier test
* add simulations for nft msgs
* handler tests check tags now (fixed a bug!)
* update simulation
* generic handler
* need to check if it compiles on another machine
* fix weird interface error
* add back cli
* wtfff
* codec error fixed, logs removed. still returning empty arrays of IDs
* Take empty input as yes answer
Closes: #4564
* Add pending log entry
* merged in master
* marshall errors
* build commands
* working!!!
* linting errors
* remove unused func
* pause
* fix burn error
* fix burn error
* tests for querier
* typo
* tests for NFT types
* module spec standard
* tests for Collection and Collections types
* merge w Fede
* tests for Owner Type
* added genesis tests and beefed up keeper, querier, handler & types tests
* linting errors deadcode
* DONT COVER test_common.go
* add msg type tests
* Update x/nft/internal/keeper/key.go
Co-Authored-By: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
* Update x/nft/genesis.go
Co-Authored-By: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
* Update x/nft/client/cli/query.go
Co-Authored-By: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
* Apply suggestions from code review
* typo
* cleanup events
* split events
* more cleanup
* remove restrictions from default handlers
* not sure where these go mod changes came from
* sim generated changes
* make format
* add mint and burn sims
* move NFT interface to nft/exported
* make format
* NFT spec
* Updates
* more updates
* update specs readme
* fix sims
* rest additions
* rest additions
* fix invariant
* minimal nft without name, description or image
* sim
* fix sim
* fix sim
* fix Update methods
* nothing
* simplify update and remove
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* remove test on memory location
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* TEST to get logs, need to be removed
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* fix simulator editMetadata Msg type
* owner not found start with empty collection
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* artifacts on errors in case of failure, else, no artifacts
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* add more invariant checks to handler_tests
* never forget to overwrite
* merge and update spec
* colins feedback
* code coverage test
* code coverage test
* code coverage test
* spelling
* clean up client
* testing code coverage
* testing code coverage
* testing code coverage
* testing code coverage
* testing code coverage
* Update docs/spec/nft/README.md
Co-Authored-By: frog power 4000 <rigel.rozanski@gmail.com>
* Apply suggestions from code review
Co-Authored-By: frog power 4000 <rigel.rozanski@gmail.com>
* minor changes
* integration tests and fixes
* minor golangCI fixes
* Update simapp/app.go
Co-Authored-By: Bot from GolangCI <42910462+golangcibot@users.noreply.github.com>
2019-08-26 09:54:45 -07:00
|
|
|
"github.com/cosmos/cosmos-sdk/x/nft"
|
2018-07-13 17:12:23 -07:00
|
|
|
"github.com/cosmos/cosmos-sdk/x/params"
|
2019-06-05 16:26:17 -07:00
|
|
|
paramsclient "github.com/cosmos/cosmos-sdk/x/params/client"
|
2018-05-23 13:25:56 -07:00
|
|
|
"github.com/cosmos/cosmos-sdk/x/slashing"
|
2019-01-11 12:08:01 -08:00
|
|
|
"github.com/cosmos/cosmos-sdk/x/staking"
|
2019-06-28 13:11:27 -07:00
|
|
|
"github.com/cosmos/cosmos-sdk/x/supply"
|
2018-04-06 22:12:00 -07:00
|
|
|
)
|
|
|
|
|
2019-05-18 01:42:24 -07:00
|
|
|
const appName = "SimApp"
|
2018-04-06 22:12:00 -07:00
|
|
|
|
2018-04-25 21:27:40 -07:00
|
|
|
var (
|
2019-05-18 01:42:24 -07:00
|
|
|
// default home directories for the application CLI
|
|
|
|
DefaultCLIHome = os.ExpandEnv("$HOME/.simapp")
|
2019-05-16 08:25:32 -07:00
|
|
|
|
2019-05-18 01:42:24 -07:00
|
|
|
// default home directories for the application daemon
|
|
|
|
DefaultNodeHome = os.ExpandEnv("$HOME/.simapp")
|
2019-05-16 08:25:32 -07:00
|
|
|
|
2019-06-05 16:26:17 -07:00
|
|
|
// The module BasicManager is in charge of setting up basic,
|
2019-05-16 08:25:32 -07:00
|
|
|
// non-dependant module elements, such as codec registration
|
|
|
|
// and genesis verification.
|
2019-06-05 16:26:17 -07:00
|
|
|
ModuleBasics = module.NewBasicManager(
|
2019-05-16 08:25:32 -07:00
|
|
|
auth.AppModuleBasic{},
|
2019-09-12 12:22:25 -07:00
|
|
|
supply.AppModuleBasic{},
|
|
|
|
genutil.AppModuleBasic{},
|
2019-05-16 08:25:32 -07:00
|
|
|
bank.AppModuleBasic{},
|
|
|
|
staking.AppModuleBasic{},
|
|
|
|
mint.AppModuleBasic{},
|
|
|
|
distr.AppModuleBasic{},
|
2019-07-31 06:59:16 -07:00
|
|
|
gov.NewAppModuleBasic(paramsclient.ProposalHandler, distr.ProposalHandler),
|
2019-05-16 08:25:32 -07:00
|
|
|
params.AppModuleBasic{},
|
|
|
|
crisis.AppModuleBasic{},
|
|
|
|
slashing.AppModuleBasic{},
|
Merge #4209: NFT Module
* in sync with @okwme/cosmos-nft
* remove tmp tx
* structuring and minor changes
* supply and client files
* adding cli client
* complete cli/tx and rest.go
* cleanup and restructuring
* restructure rest folder
* minor updates on clients
* update querier
* encoding for clients and other changes
* genesis, invariants, and keeper updates
* update types
* make golangcibot happy
* renamed and removed bank keeper
* remove handlers for editmetadata, mint, burn, buy
* nft interface
* minor cleanup
* sort collections and nfts
* balance and find
* nft query and tx
* touch ups
* uint in place of int
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* little fixes:
- fix error to err to avoid collision
- error handling
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* module generalization changes
* fixes
* query with data
* minor updates and TODOs
* fix CLI tx
* golang bot fixes
* handlers and txs done
* update module generalization
* Added very basic tests which for some reason do not work
* fix test
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* fixed test, now we should fix implementation, seems to fail
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* fix test, create new struct instead of changing the old one
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* fix handler with new logic
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* let's make it compile
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* single failing test example, need to be fixed and extended
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* single failing test example, need to be fixed and extended
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* reverting work, still problems unmarshalling inside iterator from test
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* Setter in nft.go should return NFT instead of BaseNFT
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* remove TODOS
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* comment out broken tests, we want at least a green mark here
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* little fixes
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* hopefully no conflict
* minor changes for tests
* change nft id to string, refactors
* messy pause
* Changes Balances to OWners add all necessary functions, updated Keeper with UpdateNFT as as well as MintNFT and made sure they all update Owners
* pause dev to merge sdk master
* go.mod changes
* getting closer still need module.go
* builds!!!
* fix lint begin handler tests
* stableish
* re-order nft attributes, add back mint and burn msgs and handlers
* add errors to minting the same NFT and burning an NFT that doesnt exist
* first querier test
* add simulations for nft msgs
* handler tests check tags now (fixed a bug!)
* update simulation
* generic handler
* need to check if it compiles on another machine
* fix weird interface error
* add back cli
* wtfff
* codec error fixed, logs removed. still returning empty arrays of IDs
* Take empty input as yes answer
Closes: #4564
* Add pending log entry
* merged in master
* marshall errors
* build commands
* working!!!
* linting errors
* remove unused func
* pause
* fix burn error
* fix burn error
* tests for querier
* typo
* tests for NFT types
* module spec standard
* tests for Collection and Collections types
* merge w Fede
* tests for Owner Type
* added genesis tests and beefed up keeper, querier, handler & types tests
* linting errors deadcode
* DONT COVER test_common.go
* add msg type tests
* Update x/nft/internal/keeper/key.go
Co-Authored-By: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
* Update x/nft/genesis.go
Co-Authored-By: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
* Update x/nft/client/cli/query.go
Co-Authored-By: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
* Apply suggestions from code review
* typo
* cleanup events
* split events
* more cleanup
* remove restrictions from default handlers
* not sure where these go mod changes came from
* sim generated changes
* make format
* add mint and burn sims
* move NFT interface to nft/exported
* make format
* NFT spec
* Updates
* more updates
* update specs readme
* fix sims
* rest additions
* rest additions
* fix invariant
* minimal nft without name, description or image
* sim
* fix sim
* fix sim
* fix Update methods
* nothing
* simplify update and remove
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* remove test on memory location
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* TEST to get logs, need to be removed
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* fix simulator editMetadata Msg type
* owner not found start with empty collection
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* artifacts on errors in case of failure, else, no artifacts
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* add more invariant checks to handler_tests
* never forget to overwrite
* merge and update spec
* colins feedback
* code coverage test
* code coverage test
* code coverage test
* spelling
* clean up client
* testing code coverage
* testing code coverage
* testing code coverage
* testing code coverage
* testing code coverage
* Update docs/spec/nft/README.md
Co-Authored-By: frog power 4000 <rigel.rozanski@gmail.com>
* Apply suggestions from code review
Co-Authored-By: frog power 4000 <rigel.rozanski@gmail.com>
* minor changes
* integration tests and fixes
* minor golangCI fixes
* Update simapp/app.go
Co-Authored-By: Bot from GolangCI <42910462+golangcibot@users.noreply.github.com>
2019-08-26 09:54:45 -07:00
|
|
|
nft.AppModuleBasic{},
|
2019-05-16 08:25:32 -07:00
|
|
|
)
|
2019-07-18 05:43:56 -07:00
|
|
|
|
|
|
|
// module account permissions
|
|
|
|
maccPerms = map[string][]string{
|
|
|
|
auth.FeeCollectorName: nil,
|
|
|
|
distr.ModuleName: nil,
|
|
|
|
mint.ModuleName: {supply.Minter},
|
|
|
|
staking.BondedPoolName: {supply.Burner, supply.Staking},
|
|
|
|
staking.NotBondedPoolName: {supply.Burner, supply.Staking},
|
|
|
|
gov.ModuleName: {supply.Burner},
|
|
|
|
}
|
2019-06-05 16:26:17 -07:00
|
|
|
)
|
2019-05-16 08:25:32 -07:00
|
|
|
|
|
|
|
// custom tx codec
|
|
|
|
func MakeCodec() *codec.Codec {
|
|
|
|
var cdc = codec.New()
|
|
|
|
ModuleBasics.RegisterCodec(cdc)
|
|
|
|
sdk.RegisterCodec(cdc)
|
|
|
|
codec.RegisterCrypto(cdc)
|
|
|
|
return cdc
|
|
|
|
}
|
|
|
|
|
2019-08-13 13:59:01 -07:00
|
|
|
// SimApp extends an ABCI application, but with most of its parameters exported.
|
|
|
|
// They are exported for convenience in creating helper functions, as object
|
|
|
|
// capabilities aren't needed for testing.
|
2019-05-18 01:42:24 -07:00
|
|
|
type SimApp struct {
|
2018-04-06 22:12:00 -07:00
|
|
|
*bam.BaseApp
|
2018-09-13 11:17:32 -07:00
|
|
|
cdc *codec.Codec
|
2018-04-06 22:12:00 -07:00
|
|
|
|
2019-04-10 16:33:50 -07:00
|
|
|
invCheckPeriod uint
|
2019-03-28 16:27:47 -07:00
|
|
|
|
2018-04-06 22:12:00 -07:00
|
|
|
// keys to access the substores
|
2019-07-31 06:59:16 -07:00
|
|
|
keys map[string]*sdk.KVStoreKey
|
|
|
|
tkeys map[string]*sdk.TransientStoreKey
|
2018-04-06 22:12:00 -07:00
|
|
|
|
2019-05-16 08:25:32 -07:00
|
|
|
// keepers
|
2019-08-13 13:59:01 -07:00
|
|
|
AccountKeeper auth.AccountKeeper
|
|
|
|
BankKeeper bank.Keeper
|
|
|
|
SupplyKeeper supply.Keeper
|
|
|
|
StakingKeeper staking.Keeper
|
|
|
|
SlashingKeeper slashing.Keeper
|
|
|
|
MintKeeper mint.Keeper
|
|
|
|
DistrKeeper distr.Keeper
|
|
|
|
GovKeeper gov.Keeper
|
|
|
|
CrisisKeeper crisis.Keeper
|
|
|
|
ParamsKeeper params.Keeper
|
Merge #4209: NFT Module
* in sync with @okwme/cosmos-nft
* remove tmp tx
* structuring and minor changes
* supply and client files
* adding cli client
* complete cli/tx and rest.go
* cleanup and restructuring
* restructure rest folder
* minor updates on clients
* update querier
* encoding for clients and other changes
* genesis, invariants, and keeper updates
* update types
* make golangcibot happy
* renamed and removed bank keeper
* remove handlers for editmetadata, mint, burn, buy
* nft interface
* minor cleanup
* sort collections and nfts
* balance and find
* nft query and tx
* touch ups
* uint in place of int
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* little fixes:
- fix error to err to avoid collision
- error handling
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* module generalization changes
* fixes
* query with data
* minor updates and TODOs
* fix CLI tx
* golang bot fixes
* handlers and txs done
* update module generalization
* Added very basic tests which for some reason do not work
* fix test
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* fixed test, now we should fix implementation, seems to fail
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* fix test, create new struct instead of changing the old one
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* fix handler with new logic
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* let's make it compile
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* single failing test example, need to be fixed and extended
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* single failing test example, need to be fixed and extended
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* reverting work, still problems unmarshalling inside iterator from test
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* Setter in nft.go should return NFT instead of BaseNFT
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* remove TODOS
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* comment out broken tests, we want at least a green mark here
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* little fixes
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* hopefully no conflict
* minor changes for tests
* change nft id to string, refactors
* messy pause
* Changes Balances to OWners add all necessary functions, updated Keeper with UpdateNFT as as well as MintNFT and made sure they all update Owners
* pause dev to merge sdk master
* go.mod changes
* getting closer still need module.go
* builds!!!
* fix lint begin handler tests
* stableish
* re-order nft attributes, add back mint and burn msgs and handlers
* add errors to minting the same NFT and burning an NFT that doesnt exist
* first querier test
* add simulations for nft msgs
* handler tests check tags now (fixed a bug!)
* update simulation
* generic handler
* need to check if it compiles on another machine
* fix weird interface error
* add back cli
* wtfff
* codec error fixed, logs removed. still returning empty arrays of IDs
* Take empty input as yes answer
Closes: #4564
* Add pending log entry
* merged in master
* marshall errors
* build commands
* working!!!
* linting errors
* remove unused func
* pause
* fix burn error
* fix burn error
* tests for querier
* typo
* tests for NFT types
* module spec standard
* tests for Collection and Collections types
* merge w Fede
* tests for Owner Type
* added genesis tests and beefed up keeper, querier, handler & types tests
* linting errors deadcode
* DONT COVER test_common.go
* add msg type tests
* Update x/nft/internal/keeper/key.go
Co-Authored-By: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
* Update x/nft/genesis.go
Co-Authored-By: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
* Update x/nft/client/cli/query.go
Co-Authored-By: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
* Apply suggestions from code review
* typo
* cleanup events
* split events
* more cleanup
* remove restrictions from default handlers
* not sure where these go mod changes came from
* sim generated changes
* make format
* add mint and burn sims
* move NFT interface to nft/exported
* make format
* NFT spec
* Updates
* more updates
* update specs readme
* fix sims
* rest additions
* rest additions
* fix invariant
* minimal nft without name, description or image
* sim
* fix sim
* fix sim
* fix Update methods
* nothing
* simplify update and remove
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* remove test on memory location
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* TEST to get logs, need to be removed
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* fix simulator editMetadata Msg type
* owner not found start with empty collection
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* artifacts on errors in case of failure, else, no artifacts
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* add more invariant checks to handler_tests
* never forget to overwrite
* merge and update spec
* colins feedback
* code coverage test
* code coverage test
* code coverage test
* spelling
* clean up client
* testing code coverage
* testing code coverage
* testing code coverage
* testing code coverage
* testing code coverage
* Update docs/spec/nft/README.md
Co-Authored-By: frog power 4000 <rigel.rozanski@gmail.com>
* Apply suggestions from code review
Co-Authored-By: frog power 4000 <rigel.rozanski@gmail.com>
* minor changes
* integration tests and fixes
* minor golangCI fixes
* Update simapp/app.go
Co-Authored-By: Bot from GolangCI <42910462+golangcibot@users.noreply.github.com>
2019-08-26 09:54:45 -07:00
|
|
|
NFTKeeper nft.Keeper
|
2019-05-16 08:25:32 -07:00
|
|
|
|
|
|
|
// the module manager
|
2019-06-05 16:26:17 -07:00
|
|
|
mm *module.Manager
|
2019-08-13 15:16:03 -07:00
|
|
|
|
|
|
|
// simulation manager
|
|
|
|
sm *module.SimulationManager
|
2018-04-06 22:12:00 -07:00
|
|
|
}
|
|
|
|
|
2019-05-18 01:42:24 -07:00
|
|
|
// NewSimApp returns a reference to an initialized SimApp.
|
2019-07-18 05:43:56 -07:00
|
|
|
func NewSimApp(
|
|
|
|
logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool,
|
|
|
|
invCheckPeriod uint, baseAppOptions ...func(*bam.BaseApp),
|
|
|
|
) *SimApp {
|
2019-03-28 16:27:47 -07:00
|
|
|
|
2018-04-26 19:59:30 -07:00
|
|
|
cdc := MakeCodec()
|
|
|
|
|
2018-07-18 16:24:16 -07:00
|
|
|
bApp := bam.NewBaseApp(appName, logger, db, auth.DefaultTxDecoder(cdc), baseAppOptions...)
|
2018-07-12 16:58:51 -07:00
|
|
|
bApp.SetCommitMultiStoreTracer(traceStore)
|
2019-05-02 12:37:44 -07:00
|
|
|
bApp.SetAppVersion(version.Version)
|
2018-07-12 16:58:51 -07:00
|
|
|
|
2019-07-31 06:59:16 -07:00
|
|
|
keys := sdk.NewKVStoreKeys(bam.MainStoreKey, auth.StoreKey, staking.StoreKey,
|
|
|
|
supply.StoreKey, mint.StoreKey, distr.StoreKey, slashing.StoreKey,
|
Merge #4209: NFT Module
* in sync with @okwme/cosmos-nft
* remove tmp tx
* structuring and minor changes
* supply and client files
* adding cli client
* complete cli/tx and rest.go
* cleanup and restructuring
* restructure rest folder
* minor updates on clients
* update querier
* encoding for clients and other changes
* genesis, invariants, and keeper updates
* update types
* make golangcibot happy
* renamed and removed bank keeper
* remove handlers for editmetadata, mint, burn, buy
* nft interface
* minor cleanup
* sort collections and nfts
* balance and find
* nft query and tx
* touch ups
* uint in place of int
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* little fixes:
- fix error to err to avoid collision
- error handling
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* module generalization changes
* fixes
* query with data
* minor updates and TODOs
* fix CLI tx
* golang bot fixes
* handlers and txs done
* update module generalization
* Added very basic tests which for some reason do not work
* fix test
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* fixed test, now we should fix implementation, seems to fail
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* fix test, create new struct instead of changing the old one
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* fix handler with new logic
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* let's make it compile
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* single failing test example, need to be fixed and extended
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* single failing test example, need to be fixed and extended
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* reverting work, still problems unmarshalling inside iterator from test
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* Setter in nft.go should return NFT instead of BaseNFT
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* remove TODOS
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* comment out broken tests, we want at least a green mark here
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* little fixes
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* hopefully no conflict
* minor changes for tests
* change nft id to string, refactors
* messy pause
* Changes Balances to OWners add all necessary functions, updated Keeper with UpdateNFT as as well as MintNFT and made sure they all update Owners
* pause dev to merge sdk master
* go.mod changes
* getting closer still need module.go
* builds!!!
* fix lint begin handler tests
* stableish
* re-order nft attributes, add back mint and burn msgs and handlers
* add errors to minting the same NFT and burning an NFT that doesnt exist
* first querier test
* add simulations for nft msgs
* handler tests check tags now (fixed a bug!)
* update simulation
* generic handler
* need to check if it compiles on another machine
* fix weird interface error
* add back cli
* wtfff
* codec error fixed, logs removed. still returning empty arrays of IDs
* Take empty input as yes answer
Closes: #4564
* Add pending log entry
* merged in master
* marshall errors
* build commands
* working!!!
* linting errors
* remove unused func
* pause
* fix burn error
* fix burn error
* tests for querier
* typo
* tests for NFT types
* module spec standard
* tests for Collection and Collections types
* merge w Fede
* tests for Owner Type
* added genesis tests and beefed up keeper, querier, handler & types tests
* linting errors deadcode
* DONT COVER test_common.go
* add msg type tests
* Update x/nft/internal/keeper/key.go
Co-Authored-By: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
* Update x/nft/genesis.go
Co-Authored-By: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
* Update x/nft/client/cli/query.go
Co-Authored-By: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
* Apply suggestions from code review
* typo
* cleanup events
* split events
* more cleanup
* remove restrictions from default handlers
* not sure where these go mod changes came from
* sim generated changes
* make format
* add mint and burn sims
* move NFT interface to nft/exported
* make format
* NFT spec
* Updates
* more updates
* update specs readme
* fix sims
* rest additions
* rest additions
* fix invariant
* minimal nft without name, description or image
* sim
* fix sim
* fix sim
* fix Update methods
* nothing
* simplify update and remove
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* remove test on memory location
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* TEST to get logs, need to be removed
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* fix simulator editMetadata Msg type
* owner not found start with empty collection
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* artifacts on errors in case of failure, else, no artifacts
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* add more invariant checks to handler_tests
* never forget to overwrite
* merge and update spec
* colins feedback
* code coverage test
* code coverage test
* code coverage test
* spelling
* clean up client
* testing code coverage
* testing code coverage
* testing code coverage
* testing code coverage
* testing code coverage
* Update docs/spec/nft/README.md
Co-Authored-By: frog power 4000 <rigel.rozanski@gmail.com>
* Apply suggestions from code review
Co-Authored-By: frog power 4000 <rigel.rozanski@gmail.com>
* minor changes
* integration tests and fixes
* minor golangCI fixes
* Update simapp/app.go
Co-Authored-By: Bot from GolangCI <42910462+golangcibot@users.noreply.github.com>
2019-08-26 09:54:45 -07:00
|
|
|
gov.StoreKey, params.StoreKey, nft.StoreKey)
|
2019-09-18 11:28:02 -07:00
|
|
|
tkeys := sdk.NewTransientStoreKeys(params.TStoreKey)
|
2019-07-31 06:59:16 -07:00
|
|
|
|
2019-07-18 05:43:56 -07:00
|
|
|
app := &SimApp{
|
2019-06-28 13:11:27 -07:00
|
|
|
BaseApp: bApp,
|
|
|
|
cdc: cdc,
|
|
|
|
invCheckPeriod: invCheckPeriod,
|
2019-07-31 06:59:16 -07:00
|
|
|
keys: keys,
|
|
|
|
tkeys: tkeys,
|
2018-04-06 22:12:00 -07:00
|
|
|
}
|
|
|
|
|
2019-05-16 08:25:32 -07:00
|
|
|
// init params keeper and subspaces
|
2019-08-13 13:59:01 -07:00
|
|
|
app.ParamsKeeper = params.NewKeeper(app.cdc, keys[params.StoreKey], tkeys[params.TStoreKey], params.DefaultCodespace)
|
|
|
|
authSubspace := app.ParamsKeeper.Subspace(auth.DefaultParamspace)
|
|
|
|
bankSubspace := app.ParamsKeeper.Subspace(bank.DefaultParamspace)
|
|
|
|
stakingSubspace := app.ParamsKeeper.Subspace(staking.DefaultParamspace)
|
|
|
|
mintSubspace := app.ParamsKeeper.Subspace(mint.DefaultParamspace)
|
|
|
|
distrSubspace := app.ParamsKeeper.Subspace(distr.DefaultParamspace)
|
|
|
|
slashingSubspace := app.ParamsKeeper.Subspace(slashing.DefaultParamspace)
|
|
|
|
govSubspace := app.ParamsKeeper.Subspace(gov.DefaultParamspace).WithKeyTable(gov.ParamKeyTable())
|
|
|
|
crisisSubspace := app.ParamsKeeper.Subspace(crisis.DefaultParamspace)
|
2019-05-16 08:25:32 -07:00
|
|
|
|
|
|
|
// add keepers
|
2019-08-13 13:59:01 -07:00
|
|
|
app.AccountKeeper = auth.NewAccountKeeper(app.cdc, keys[auth.StoreKey], authSubspace, auth.ProtoBaseAccount)
|
|
|
|
app.BankKeeper = bank.NewBaseKeeper(app.AccountKeeper, bankSubspace, bank.DefaultCodespace, app.ModuleAccountAddrs())
|
|
|
|
app.SupplyKeeper = supply.NewKeeper(app.cdc, keys[supply.StoreKey], app.AccountKeeper, app.BankKeeper, maccPerms)
|
2019-09-18 11:28:02 -07:00
|
|
|
stakingKeeper := staking.NewKeeper(app.cdc, keys[staking.StoreKey],
|
2019-08-13 13:59:01 -07:00
|
|
|
app.SupplyKeeper, stakingSubspace, staking.DefaultCodespace)
|
|
|
|
app.MintKeeper = mint.NewKeeper(app.cdc, keys[mint.StoreKey], mintSubspace, &stakingKeeper, app.SupplyKeeper, auth.FeeCollectorName)
|
|
|
|
app.DistrKeeper = distr.NewKeeper(app.cdc, keys[distr.StoreKey], distrSubspace, &stakingKeeper,
|
|
|
|
app.SupplyKeeper, distr.DefaultCodespace, auth.FeeCollectorName, app.ModuleAccountAddrs())
|
|
|
|
app.SlashingKeeper = slashing.NewKeeper(app.cdc, keys[slashing.StoreKey], &stakingKeeper,
|
2019-05-16 08:25:32 -07:00
|
|
|
slashingSubspace, slashing.DefaultCodespace)
|
2019-08-13 13:59:01 -07:00
|
|
|
app.CrisisKeeper = crisis.NewKeeper(crisisSubspace, invCheckPeriod, app.SupplyKeeper, auth.FeeCollectorName)
|
Merge #4209: NFT Module
* in sync with @okwme/cosmos-nft
* remove tmp tx
* structuring and minor changes
* supply and client files
* adding cli client
* complete cli/tx and rest.go
* cleanup and restructuring
* restructure rest folder
* minor updates on clients
* update querier
* encoding for clients and other changes
* genesis, invariants, and keeper updates
* update types
* make golangcibot happy
* renamed and removed bank keeper
* remove handlers for editmetadata, mint, burn, buy
* nft interface
* minor cleanup
* sort collections and nfts
* balance and find
* nft query and tx
* touch ups
* uint in place of int
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* little fixes:
- fix error to err to avoid collision
- error handling
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* module generalization changes
* fixes
* query with data
* minor updates and TODOs
* fix CLI tx
* golang bot fixes
* handlers and txs done
* update module generalization
* Added very basic tests which for some reason do not work
* fix test
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* fixed test, now we should fix implementation, seems to fail
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* fix test, create new struct instead of changing the old one
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* fix handler with new logic
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* let's make it compile
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* single failing test example, need to be fixed and extended
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* single failing test example, need to be fixed and extended
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* reverting work, still problems unmarshalling inside iterator from test
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* Setter in nft.go should return NFT instead of BaseNFT
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* remove TODOS
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* comment out broken tests, we want at least a green mark here
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* little fixes
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* hopefully no conflict
* minor changes for tests
* change nft id to string, refactors
* messy pause
* Changes Balances to OWners add all necessary functions, updated Keeper with UpdateNFT as as well as MintNFT and made sure they all update Owners
* pause dev to merge sdk master
* go.mod changes
* getting closer still need module.go
* builds!!!
* fix lint begin handler tests
* stableish
* re-order nft attributes, add back mint and burn msgs and handlers
* add errors to minting the same NFT and burning an NFT that doesnt exist
* first querier test
* add simulations for nft msgs
* handler tests check tags now (fixed a bug!)
* update simulation
* generic handler
* need to check if it compiles on another machine
* fix weird interface error
* add back cli
* wtfff
* codec error fixed, logs removed. still returning empty arrays of IDs
* Take empty input as yes answer
Closes: #4564
* Add pending log entry
* merged in master
* marshall errors
* build commands
* working!!!
* linting errors
* remove unused func
* pause
* fix burn error
* fix burn error
* tests for querier
* typo
* tests for NFT types
* module spec standard
* tests for Collection and Collections types
* merge w Fede
* tests for Owner Type
* added genesis tests and beefed up keeper, querier, handler & types tests
* linting errors deadcode
* DONT COVER test_common.go
* add msg type tests
* Update x/nft/internal/keeper/key.go
Co-Authored-By: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
* Update x/nft/genesis.go
Co-Authored-By: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
* Update x/nft/client/cli/query.go
Co-Authored-By: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
* Apply suggestions from code review
* typo
* cleanup events
* split events
* more cleanup
* remove restrictions from default handlers
* not sure where these go mod changes came from
* sim generated changes
* make format
* add mint and burn sims
* move NFT interface to nft/exported
* make format
* NFT spec
* Updates
* more updates
* update specs readme
* fix sims
* rest additions
* rest additions
* fix invariant
* minimal nft without name, description or image
* sim
* fix sim
* fix sim
* fix Update methods
* nothing
* simplify update and remove
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* remove test on memory location
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* TEST to get logs, need to be removed
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* fix simulator editMetadata Msg type
* owner not found start with empty collection
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* artifacts on errors in case of failure, else, no artifacts
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* add more invariant checks to handler_tests
* never forget to overwrite
* merge and update spec
* colins feedback
* code coverage test
* code coverage test
* code coverage test
* spelling
* clean up client
* testing code coverage
* testing code coverage
* testing code coverage
* testing code coverage
* testing code coverage
* Update docs/spec/nft/README.md
Co-Authored-By: frog power 4000 <rigel.rozanski@gmail.com>
* Apply suggestions from code review
Co-Authored-By: frog power 4000 <rigel.rozanski@gmail.com>
* minor changes
* integration tests and fixes
* minor golangCI fixes
* Update simapp/app.go
Co-Authored-By: Bot from GolangCI <42910462+golangcibot@users.noreply.github.com>
2019-08-26 09:54:45 -07:00
|
|
|
app.NFTKeeper = nft.NewKeeper(app.cdc, keys[nft.StoreKey])
|
2019-05-16 08:25:32 -07:00
|
|
|
|
|
|
|
// register the proposal types
|
2019-04-30 09:31:38 -07:00
|
|
|
govRouter := gov.NewRouter()
|
|
|
|
govRouter.AddRoute(gov.RouterKey, gov.ProposalHandler).
|
2019-08-13 13:59:01 -07:00
|
|
|
AddRoute(params.RouterKey, params.NewParamChangeProposalHandler(app.ParamsKeeper)).
|
|
|
|
AddRoute(distr.RouterKey, distr.NewCommunityPoolSpendProposalHandler(app.DistrKeeper))
|
|
|
|
app.GovKeeper = gov.NewKeeper(app.cdc, keys[gov.StoreKey], govSubspace,
|
|
|
|
app.SupplyKeeper, &stakingKeeper, gov.DefaultCodespace, govRouter)
|
2018-04-18 09:36:55 -07:00
|
|
|
|
2018-09-18 14:54:28 -07:00
|
|
|
// register the staking hooks
|
2019-05-16 08:25:32 -07:00
|
|
|
// NOTE: stakingKeeper above is passed by reference, so that it will contain these hooks
|
2019-08-13 13:59:01 -07:00
|
|
|
app.StakingKeeper = *stakingKeeper.SetHooks(
|
|
|
|
staking.NewMultiStakingHooks(app.DistrKeeper.Hooks(), app.SlashingKeeper.Hooks()),
|
2019-08-06 12:11:55 -07:00
|
|
|
)
|
2019-05-16 08:25:32 -07:00
|
|
|
|
2019-08-06 12:11:55 -07:00
|
|
|
// NOTE: Any module instantiated in the module manager that is later modified
|
|
|
|
// must be passed by reference here.
|
2019-06-05 16:26:17 -07:00
|
|
|
app.mm = module.NewManager(
|
2019-08-13 13:59:01 -07:00
|
|
|
genutil.NewAppModule(app.AccountKeeper, app.StakingKeeper, app.BaseApp.DeliverTx),
|
|
|
|
auth.NewAppModule(app.AccountKeeper),
|
|
|
|
bank.NewAppModule(app.BankKeeper, app.AccountKeeper),
|
|
|
|
crisis.NewAppModule(&app.CrisisKeeper),
|
|
|
|
supply.NewAppModule(app.SupplyKeeper, app.AccountKeeper),
|
|
|
|
gov.NewAppModule(app.GovKeeper, app.SupplyKeeper),
|
|
|
|
mint.NewAppModule(app.MintKeeper),
|
2019-08-28 07:58:25 -07:00
|
|
|
distr.NewAppModule(app.DistrKeeper, app.SupplyKeeper),
|
2019-08-13 13:59:01 -07:00
|
|
|
slashing.NewAppModule(app.SlashingKeeper, app.StakingKeeper),
|
2019-08-26 07:57:21 -07:00
|
|
|
staking.NewAppModule(app.StakingKeeper, app.AccountKeeper, app.SupplyKeeper),
|
Merge #4209: NFT Module
* in sync with @okwme/cosmos-nft
* remove tmp tx
* structuring and minor changes
* supply and client files
* adding cli client
* complete cli/tx and rest.go
* cleanup and restructuring
* restructure rest folder
* minor updates on clients
* update querier
* encoding for clients and other changes
* genesis, invariants, and keeper updates
* update types
* make golangcibot happy
* renamed and removed bank keeper
* remove handlers for editmetadata, mint, burn, buy
* nft interface
* minor cleanup
* sort collections and nfts
* balance and find
* nft query and tx
* touch ups
* uint in place of int
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* little fixes:
- fix error to err to avoid collision
- error handling
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* module generalization changes
* fixes
* query with data
* minor updates and TODOs
* fix CLI tx
* golang bot fixes
* handlers and txs done
* update module generalization
* Added very basic tests which for some reason do not work
* fix test
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* fixed test, now we should fix implementation, seems to fail
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* fix test, create new struct instead of changing the old one
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* fix handler with new logic
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* let's make it compile
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* single failing test example, need to be fixed and extended
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* single failing test example, need to be fixed and extended
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* reverting work, still problems unmarshalling inside iterator from test
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* Setter in nft.go should return NFT instead of BaseNFT
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* remove TODOS
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* comment out broken tests, we want at least a green mark here
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* little fixes
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* hopefully no conflict
* minor changes for tests
* change nft id to string, refactors
* messy pause
* Changes Balances to OWners add all necessary functions, updated Keeper with UpdateNFT as as well as MintNFT and made sure they all update Owners
* pause dev to merge sdk master
* go.mod changes
* getting closer still need module.go
* builds!!!
* fix lint begin handler tests
* stableish
* re-order nft attributes, add back mint and burn msgs and handlers
* add errors to minting the same NFT and burning an NFT that doesnt exist
* first querier test
* add simulations for nft msgs
* handler tests check tags now (fixed a bug!)
* update simulation
* generic handler
* need to check if it compiles on another machine
* fix weird interface error
* add back cli
* wtfff
* codec error fixed, logs removed. still returning empty arrays of IDs
* Take empty input as yes answer
Closes: #4564
* Add pending log entry
* merged in master
* marshall errors
* build commands
* working!!!
* linting errors
* remove unused func
* pause
* fix burn error
* fix burn error
* tests for querier
* typo
* tests for NFT types
* module spec standard
* tests for Collection and Collections types
* merge w Fede
* tests for Owner Type
* added genesis tests and beefed up keeper, querier, handler & types tests
* linting errors deadcode
* DONT COVER test_common.go
* add msg type tests
* Update x/nft/internal/keeper/key.go
Co-Authored-By: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
* Update x/nft/genesis.go
Co-Authored-By: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
* Update x/nft/client/cli/query.go
Co-Authored-By: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
* Apply suggestions from code review
* typo
* cleanup events
* split events
* more cleanup
* remove restrictions from default handlers
* not sure where these go mod changes came from
* sim generated changes
* make format
* add mint and burn sims
* move NFT interface to nft/exported
* make format
* NFT spec
* Updates
* more updates
* update specs readme
* fix sims
* rest additions
* rest additions
* fix invariant
* minimal nft without name, description or image
* sim
* fix sim
* fix sim
* fix Update methods
* nothing
* simplify update and remove
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* remove test on memory location
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* TEST to get logs, need to be removed
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* fix simulator editMetadata Msg type
* owner not found start with empty collection
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* artifacts on errors in case of failure, else, no artifacts
Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>
* add more invariant checks to handler_tests
* never forget to overwrite
* merge and update spec
* colins feedback
* code coverage test
* code coverage test
* code coverage test
* spelling
* clean up client
* testing code coverage
* testing code coverage
* testing code coverage
* testing code coverage
* testing code coverage
* Update docs/spec/nft/README.md
Co-Authored-By: frog power 4000 <rigel.rozanski@gmail.com>
* Apply suggestions from code review
Co-Authored-By: frog power 4000 <rigel.rozanski@gmail.com>
* minor changes
* integration tests and fixes
* minor golangCI fixes
* Update simapp/app.go
Co-Authored-By: Bot from GolangCI <42910462+golangcibot@users.noreply.github.com>
2019-08-26 09:54:45 -07:00
|
|
|
nft.NewAppModule(app.NFTKeeper),
|
2018-12-04 14:53:52 -08:00
|
|
|
)
|
2018-09-18 14:54:28 -07:00
|
|
|
|
2019-05-16 08:25:32 -07:00
|
|
|
// During begin block slashing happens after distr.BeginBlocker so that
|
|
|
|
// there is nothing left over in the validator fee pool, so as to keep the
|
|
|
|
// CanWithdrawInvariant invariant.
|
|
|
|
app.mm.SetOrderBeginBlockers(mint.ModuleName, distr.ModuleName, slashing.ModuleName)
|
|
|
|
|
2019-08-06 12:11:55 -07:00
|
|
|
app.mm.SetOrderEndBlockers(crisis.ModuleName, gov.ModuleName, staking.ModuleName)
|
2019-05-16 08:25:32 -07:00
|
|
|
|
2019-08-06 12:11:55 -07:00
|
|
|
// NOTE: The genutils moodule must occur after staking so that pools are
|
|
|
|
// properly initialized with tokens from genesis accounts.
|
|
|
|
app.mm.SetOrderInitGenesis(
|
2019-09-12 12:22:25 -07:00
|
|
|
auth.ModuleName, distr.ModuleName, staking.ModuleName,
|
|
|
|
bank.ModuleName, slashing.ModuleName, gov.ModuleName,
|
2019-08-28 07:58:25 -07:00
|
|
|
mint.ModuleName, supply.ModuleName, crisis.ModuleName, nft.ModuleName,
|
|
|
|
genutil.ModuleName,
|
2019-08-06 12:11:55 -07:00
|
|
|
)
|
2019-05-16 08:25:32 -07:00
|
|
|
|
2019-08-13 13:59:01 -07:00
|
|
|
app.mm.RegisterInvariants(&app.CrisisKeeper)
|
2019-05-16 08:25:32 -07:00
|
|
|
app.mm.RegisterRoutes(app.Router(), app.QueryRouter())
|
|
|
|
|
2019-08-28 07:58:25 -07:00
|
|
|
// create the simulation manager and define the order of the modules for deterministic simulations
|
|
|
|
//
|
|
|
|
// NOTE: this is not required apps that don't use the simulator for fuzz testing
|
|
|
|
// transactions
|
|
|
|
app.sm = module.NewSimulationManager(
|
|
|
|
auth.NewAppModule(app.AccountKeeper),
|
|
|
|
bank.NewAppModule(app.BankKeeper, app.AccountKeeper),
|
|
|
|
supply.NewAppModule(app.SupplyKeeper, app.AccountKeeper),
|
|
|
|
gov.NewAppModule(app.GovKeeper, app.SupplyKeeper),
|
|
|
|
mint.NewAppModule(app.MintKeeper),
|
|
|
|
distr.NewAppModule(app.DistrKeeper, app.SupplyKeeper),
|
|
|
|
staking.NewAppModule(app.StakingKeeper, app.AccountKeeper, app.SupplyKeeper),
|
|
|
|
slashing.NewAppModule(app.SlashingKeeper, app.StakingKeeper),
|
|
|
|
// nft.NewAppModule(app.NFTKeeper),
|
|
|
|
)
|
|
|
|
|
2019-08-13 15:16:03 -07:00
|
|
|
app.sm.RegisterStoreDecoders()
|
|
|
|
|
2019-05-16 08:25:32 -07:00
|
|
|
// initialize stores
|
2019-07-31 06:59:16 -07:00
|
|
|
app.MountKVStores(keys)
|
|
|
|
app.MountTransientStores(tkeys)
|
2018-08-04 22:56:48 -07:00
|
|
|
|
2018-04-06 22:12:00 -07:00
|
|
|
// initialize BaseApp
|
2019-05-16 08:25:32 -07:00
|
|
|
app.SetInitChainer(app.InitChainer)
|
2018-06-01 14:24:48 -07:00
|
|
|
app.SetBeginBlocker(app.BeginBlocker)
|
2019-08-13 13:59:01 -07:00
|
|
|
app.SetAnteHandler(auth.NewAnteHandler(app.AccountKeeper, app.SupplyKeeper, auth.DefaultSigVerificationGasConsumer))
|
2018-10-04 17:20:43 -07:00
|
|
|
app.SetEndBlocker(app.EndBlocker)
|
|
|
|
|
2018-12-18 08:17:50 -08:00
|
|
|
if loadLatest {
|
2019-07-31 06:59:16 -07:00
|
|
|
err := app.LoadLatestVersion(app.keys[bam.MainStoreKey])
|
2018-12-18 08:17:50 -08:00
|
|
|
if err != nil {
|
|
|
|
cmn.Exit(err.Error())
|
|
|
|
}
|
2018-04-06 22:12:00 -07:00
|
|
|
}
|
|
|
|
return app
|
|
|
|
}
|
|
|
|
|
2019-05-16 08:25:32 -07:00
|
|
|
// application updates every begin block
|
2019-05-18 01:42:24 -07:00
|
|
|
func (app *SimApp) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) abci.ResponseBeginBlock {
|
2019-05-16 08:25:32 -07:00
|
|
|
return app.mm.BeginBlock(ctx, req)
|
2018-06-01 14:24:48 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
// application updates every end block
|
2019-05-18 01:42:24 -07:00
|
|
|
func (app *SimApp) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock {
|
2019-05-16 08:25:32 -07:00
|
|
|
return app.mm.EndBlock(ctx, req)
|
2018-06-01 14:24:48 -07:00
|
|
|
}
|
|
|
|
|
2019-05-16 08:25:32 -07:00
|
|
|
// application update at chain initialization
|
2019-05-18 01:42:24 -07:00
|
|
|
func (app *SimApp) InitChainer(ctx sdk.Context, req abci.RequestInitChain) abci.ResponseInitChain {
|
2018-11-26 04:21:23 -08:00
|
|
|
var genesisState GenesisState
|
2019-05-16 08:25:32 -07:00
|
|
|
app.cdc.MustUnmarshalJSON(req.AppStateBytes, &genesisState)
|
|
|
|
return app.mm.InitGenesis(ctx, genesisState)
|
2018-04-06 22:12:00 -07:00
|
|
|
}
|
2018-04-24 06:46:39 -07:00
|
|
|
|
2018-11-13 07:14:09 -08:00
|
|
|
// load a particular height
|
2019-05-18 01:42:24 -07:00
|
|
|
func (app *SimApp) LoadHeight(height int64) error {
|
2019-07-31 06:59:16 -07:00
|
|
|
return app.LoadVersion(height, app.keys[bam.MainStoreKey])
|
2018-11-13 07:14:09 -08:00
|
|
|
}
|
2019-07-18 05:43:56 -07:00
|
|
|
|
|
|
|
// ModuleAccountAddrs returns all the app's module account addresses.
|
|
|
|
func (app *SimApp) ModuleAccountAddrs() map[string]bool {
|
|
|
|
modAccAddrs := make(map[string]bool)
|
|
|
|
for acc := range maccPerms {
|
2019-08-15 15:29:21 -07:00
|
|
|
modAccAddrs[supply.NewModuleAddress(acc).String()] = true
|
2019-07-18 05:43:56 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
return modAccAddrs
|
|
|
|
}
|
2019-08-13 13:59:01 -07:00
|
|
|
|
|
|
|
// Codec returns simapp's codec
|
|
|
|
func (app *SimApp) Codec() *codec.Codec {
|
|
|
|
return app.cdc
|
|
|
|
}
|
|
|
|
|
|
|
|
// GetKey returns the KVStoreKey for the provided store key
|
|
|
|
func (app *SimApp) GetKey(storeKey string) *sdk.KVStoreKey {
|
|
|
|
return app.keys[storeKey]
|
|
|
|
}
|
|
|
|
|
|
|
|
// GetTKey returns the TransientStoreKey for the provided store key
|
|
|
|
func (app *SimApp) GetTKey(storeKey string) *sdk.TransientStoreKey {
|
|
|
|
return app.tkeys[storeKey]
|
|
|
|
}
|
|
|
|
|
|
|
|
// GetMaccPerms returns a copy of the module account permissions
|
|
|
|
func GetMaccPerms() map[string][]string {
|
|
|
|
dupMaccPerms := make(map[string][]string)
|
|
|
|
for k, v := range maccPerms {
|
|
|
|
dupMaccPerms[k] = v
|
|
|
|
}
|
|
|
|
return dupMaccPerms
|
|
|
|
}
|