Skip to content

Commit

Permalink
Merge pull request #58 from thesixnetwork/develop
Browse files Browse the repository at this point in the history
Develop v0.6.1
  • Loading branch information
citrusaquarium authored Oct 19, 2022
2 parents 5b26545 + f5163f4 commit 8cc30e4
Show file tree
Hide file tree
Showing 15 changed files with 215 additions and 512 deletions.
320 changes: 71 additions & 249 deletions docs/static/openapi.yml

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions proto/nftmngr/nft_schema_by_contract.proto
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ option go_package = "github.com/thesixnetwork/sixnft/x/nftmngr/types";

message NFTSchemaByContract {
string originContractAddress = 1;
string chain = 2;
repeated string schemaCodes = 3;
repeated string schemaCodes = 2;

}

4 changes: 1 addition & 3 deletions proto/nftmngr/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ service Query {

// Queries a NFTSchemaByContract by index.
rpc NFTSchemaByContract(QueryGetNFTSchemaByContractRequest) returns (QueryGetNFTSchemaByContractResponse) {
option (google.api.http).get = "/thesixnetwork/sixnft/nftmngr/nft_schema_by_contract/{originContractAddress}/{chain}";
option (google.api.http).get = "/thesixnetwork/sixnft/nftmngr/nft_schema_by_contract/{originContractAddress}";
}

// Queries a list of NFTSchemaByContract items.
Expand Down Expand Up @@ -195,8 +195,6 @@ message QueryGetNftCollectionResponse {

message QueryGetNFTSchemaByContractRequest {
string originContractAddress = 1;
string chain = 2;

}

message QueryGetNFTSchemaByContractResponse {
Expand Down
4 changes: 2 additions & 2 deletions scripts/nft-schema.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"code": "sixnetwork.nftexpo",
"code": "sixnetwork.nftexpo2",
"name": "NFTexpoGoerli",
"owner": "0xNFTOWNER",
"origin_data": {
Expand Down Expand Up @@ -268,5 +268,5 @@
},
"nft_attributes_value": []
},
"mint_authorization":"system"
"mint_authorization": "system"
}
28 changes: 28 additions & 0 deletions vue/src/store/generated/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,27 @@ import CosmosCosmosSdkCosmosStakingV1Beta1 from './cosmos/cosmos-sdk/cosmos.stak
import CosmosCosmosSdkCosmosTxV1Beta1 from './cosmos/cosmos-sdk/cosmos.tx.v1beta1'
import CosmosCosmosSdkCosmosUpgradeV1Beta1 from './cosmos/cosmos-sdk/cosmos.upgrade.v1beta1'
import CosmosCosmosSdkCosmosVestingV1Beta1 from './cosmos/cosmos-sdk/cosmos.vesting.v1beta1'
import CosmosIbcGoIbcApplicationsTransferV1 from './cosmos/ibc-go/ibc.applications.transfer.v1'
import CosmosIbcGoIbcCoreChannelV1 from './cosmos/ibc-go/ibc.core.channel.v1'
import CosmosIbcGoIbcCoreClientV1 from './cosmos/ibc-go/ibc.core.client.v1'
import CosmosIbcGoIbcCoreConnectionV1 from './cosmos/ibc-go/ibc.core.connection.v1'
import CosmosIbcGoIbcCorePortV1 from './cosmos/ibc-go/ibc.core.port.v1'
import IbcGoV3IbcApplicationsInterchainAccountsControllerV1 from './ibc-go/v3/ibc.applications.interchain_accounts.controller.v1'
import IbcGoV3IbcApplicationsInterchainAccountsHostV1 from './ibc-go/v3/ibc.applications.interchain_accounts.host.v1'
import IbcGoV3IbcApplicationsTransferV1 from './ibc-go/v3/ibc.applications.transfer.v1'
import IbcGoV3IbcCoreChannelV1 from './ibc-go/v3/ibc.core.channel.v1'
import IbcGoV3IbcCoreClientV1 from './ibc-go/v3/ibc.core.client.v1'
import IbcGoV3IbcCoreConnectionV1 from './ibc-go/v3/ibc.core.connection.v1'
import SixnftSixnftAdmin from './sixnft/sixnft.admin'
import SixnftSixnftEvmsupport from './sixnft/sixnft.evmsupport'
import SixnftSixnftNftmngr from './sixnft/sixnft.nftmngr'
import SixnftSixnftNftoracle from './sixnft/sixnft.nftoracle'
import TendermintSpnTendermintSpnMonitoringp from './tendermint/spn/tendermint.spn.monitoringp'
import ThesixnetworkSixnftSixnftAdmin from './thesixnetwork/sixnft/sixnft.admin'
import ThesixnetworkSixnftSixnftEvmsupport from './thesixnetwork/sixnft/sixnft.evmsupport'
import ThesixnetworkSixnftSixnftNftadmin from './thesixnetwork/sixnft/sixnft.nftadmin'
import ThesixnetworkSixnftSixnftNftmngr from './thesixnetwork/sixnft/sixnft.nftmngr'
import ThesixnetworkSixnftSixnftNftoracle from './thesixnetwork/sixnft/sixnft.nftoracle'
import ThesixnetworkSixnftThesixnetworkSixnftEvmsupport from './thesixnetwork/sixnft/thesixnetwork.sixnft.evmsupport'
import ThesixnetworkSixnftThesixnetworkSixnftNftadmin from './thesixnetwork/sixnft/thesixnetwork.sixnft.nftadmin'
import ThesixnetworkSixnftThesixnetworkSixnftNftmngr from './thesixnetwork/sixnft/thesixnetwork.sixnft.nftmngr'
Expand All @@ -46,13 +60,27 @@ export default {
CosmosCosmosSdkCosmosTxV1Beta1: load(CosmosCosmosSdkCosmosTxV1Beta1, 'cosmos.tx.v1beta1'),
CosmosCosmosSdkCosmosUpgradeV1Beta1: load(CosmosCosmosSdkCosmosUpgradeV1Beta1, 'cosmos.upgrade.v1beta1'),
CosmosCosmosSdkCosmosVestingV1Beta1: load(CosmosCosmosSdkCosmosVestingV1Beta1, 'cosmos.vesting.v1beta1'),
CosmosIbcGoIbcApplicationsTransferV1: load(CosmosIbcGoIbcApplicationsTransferV1, 'ibc.applications.transfer.v1'),
CosmosIbcGoIbcCoreChannelV1: load(CosmosIbcGoIbcCoreChannelV1, 'ibc.core.channel.v1'),
CosmosIbcGoIbcCoreClientV1: load(CosmosIbcGoIbcCoreClientV1, 'ibc.core.client.v1'),
CosmosIbcGoIbcCoreConnectionV1: load(CosmosIbcGoIbcCoreConnectionV1, 'ibc.core.connection.v1'),
CosmosIbcGoIbcCorePortV1: load(CosmosIbcGoIbcCorePortV1, 'ibc.core.port.v1'),
IbcGoV3IbcApplicationsInterchainAccountsControllerV1: load(IbcGoV3IbcApplicationsInterchainAccountsControllerV1, 'ibc.applications.interchain_accounts.controller.v1'),
IbcGoV3IbcApplicationsInterchainAccountsHostV1: load(IbcGoV3IbcApplicationsInterchainAccountsHostV1, 'ibc.applications.interchain_accounts.host.v1'),
IbcGoV3IbcApplicationsTransferV1: load(IbcGoV3IbcApplicationsTransferV1, 'ibc.applications.transfer.v1'),
IbcGoV3IbcCoreChannelV1: load(IbcGoV3IbcCoreChannelV1, 'ibc.core.channel.v1'),
IbcGoV3IbcCoreClientV1: load(IbcGoV3IbcCoreClientV1, 'ibc.core.client.v1'),
IbcGoV3IbcCoreConnectionV1: load(IbcGoV3IbcCoreConnectionV1, 'ibc.core.connection.v1'),
SixnftSixnftAdmin: load(SixnftSixnftAdmin, 'sixnft.admin'),
SixnftSixnftEvmsupport: load(SixnftSixnftEvmsupport, 'sixnft.evmsupport'),
SixnftSixnftNftmngr: load(SixnftSixnftNftmngr, 'sixnft.nftmngr'),
SixnftSixnftNftoracle: load(SixnftSixnftNftoracle, 'sixnft.nftoracle'),
TendermintSpnTendermintSpnMonitoringp: load(TendermintSpnTendermintSpnMonitoringp, 'tendermint.spn.monitoringp'),
ThesixnetworkSixnftSixnftAdmin: load(ThesixnetworkSixnftSixnftAdmin, 'sixnft.admin'),
ThesixnetworkSixnftSixnftEvmsupport: load(ThesixnetworkSixnftSixnftEvmsupport, 'sixnft.evmsupport'),
ThesixnetworkSixnftSixnftNftadmin: load(ThesixnetworkSixnftSixnftNftadmin, 'sixnft.nftadmin'),
ThesixnetworkSixnftSixnftNftmngr: load(ThesixnetworkSixnftSixnftNftmngr, 'sixnft.nftmngr'),
ThesixnetworkSixnftSixnftNftoracle: load(ThesixnetworkSixnftSixnftNftoracle, 'sixnft.nftoracle'),
ThesixnetworkSixnftThesixnetworkSixnftEvmsupport: load(ThesixnetworkSixnftThesixnetworkSixnftEvmsupport, 'thesixnetwork.sixnft.evmsupport'),
ThesixnetworkSixnftThesixnetworkSixnftNftadmin: load(ThesixnetworkSixnftThesixnetworkSixnftNftadmin, 'thesixnetwork.sixnft.nftadmin'),
ThesixnetworkSixnftThesixnetworkSixnftNftmngr: load(ThesixnetworkSixnftThesixnetworkSixnftNftmngr, 'thesixnetwork.sixnft.nftmngr'),
Expand Down
6 changes: 2 additions & 4 deletions x/nftmngr/client/cli/query_nft_schema_by_contract.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,18 @@ func CmdListNFTSchemaByContract() *cobra.Command {

func CmdShowNFTSchemaByContract() *cobra.Command {
cmd := &cobra.Command{
Use: "show-nft-schema-by-contract [origin-contract-address] [chain]",
Use: "show-nft-schema-by-contract [origin-contract-address]",
Short: "shows a NFTSchemaByContract",
Args: cobra.ExactArgs(2),
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) (err error) {
clientCtx := client.GetClientContextFromCmd(cmd)

queryClient := types.NewQueryClient(clientCtx)

argOriginContractAddress := args[0]
argChain := args[1]

params := &types.QueryGetNFTSchemaByContractRequest{
OriginContractAddress: argOriginContractAddress,
Chain: argChain,
}

res, err := queryClient.NFTSchemaByContract(context.Background(), params)
Expand Down
1 change: 0 additions & 1 deletion x/nftmngr/keeper/grpc_query_nft_schema_by_contract.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ func (k Keeper) NFTSchemaByContract(c context.Context, req *types.QueryGetNFTSch
val, found := k.GetNFTSchemaByContract(
ctx,
req.OriginContractAddress,
req.Chain,
)
if !found {
return nil, status.Error(codes.NotFound, "not found")
Expand Down
3 changes: 1 addition & 2 deletions x/nftmngr/keeper/msg_server_create_nft_schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,10 @@ func (k msgServer) CreateNFTSchema(goCtx context.Context, msg *types.MsgCreateNF
k.Keeper.SetNFTSchema(ctx, schema)

// Check if schema by contract already exists
nftSchemaByContract, found := k.Keeper.GetNFTSchemaByContract(ctx, schema.OriginData.OriginContractAddress, schema.OriginData.OriginChain)
nftSchemaByContract, found := k.Keeper.GetNFTSchemaByContract(ctx, schema.OriginData.OriginContractAddress)
if !found {
nftSchemaByContract = types.NFTSchemaByContract{
OriginContractAddress: schema.OriginData.OriginContractAddress,
Chain: schema.OriginData.OriginChain,
SchemaCodes: []string{schema.Code},
}
} else {
Expand Down
5 changes: 0 additions & 5 deletions x/nftmngr/keeper/nft_schema_by_contract.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,19 @@ func (k Keeper) SetNFTSchemaByContract(ctx sdk.Context, nFTSchemaByContract type
b := k.cdc.MustMarshal(&nFTSchemaByContract)
store.Set(types.NFTSchemaByContractKey(
nFTSchemaByContract.OriginContractAddress,
nFTSchemaByContract.Chain,
), b)
}

// GetNFTSchemaByContract returns a nFTSchemaByContract from its index
func (k Keeper) GetNFTSchemaByContract(
ctx sdk.Context,
originContractAddress string,
chain string,

) (val types.NFTSchemaByContract, found bool) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.NFTSchemaByContractKeyPrefix))

b := store.Get(types.NFTSchemaByContractKey(
originContractAddress,
chain,
))
if b == nil {
return val, false
Expand All @@ -41,13 +38,11 @@ func (k Keeper) GetNFTSchemaByContract(
func (k Keeper) RemoveNFTSchemaByContract(
ctx sdk.Context,
originContractAddress string,
chain string,

) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.NFTSchemaByContractKeyPrefix))
store.Delete(types.NFTSchemaByContractKey(
originContractAddress,
chain,
))
}

Expand Down
2 changes: 1 addition & 1 deletion x/nftmngr/types/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func (gs GenesisState) Validate() error {
nFTSchemaByContractIndexMap := make(map[string]struct{})

for _, elem := range gs.NFTSchemaByContractList {
index := string(NFTSchemaByContractKey(elem.OriginContractAddress, elem.Chain))
index := string(NFTSchemaByContractKey(elem.OriginContractAddress))
if _, ok := nFTSchemaByContractIndexMap[index]; ok {
return fmt.Errorf("duplicated index for nFTSchemaByContract")
}
Expand Down
4 changes: 0 additions & 4 deletions x/nftmngr/types/genesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,9 @@ func TestGenesisState_Validate(t *testing.T) {
NFTSchemaByContractList: []types.NFTSchemaByContract{
{
OriginContractAddress: "0",
Chain: "0",
},
{
OriginContractAddress: "1",
Chain: "1",
},
},
NftFeeConfig: &types.NFTFeeConfig{},
Expand Down Expand Up @@ -166,11 +164,9 @@ func TestGenesisState_Validate(t *testing.T) {
NFTSchemaByContractList: []types.NFTSchemaByContract{
{
OriginContractAddress: "0",
Chain: "0",
},
{
OriginContractAddress: "0",
Chain: "0",
},
},
},
Expand Down
5 changes: 0 additions & 5 deletions x/nftmngr/types/key_nft_schema_by_contract.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,12 @@ const (
// NFTSchemaByContractKey returns the store key to retrieve a NFTSchemaByContract from the index fields
func NFTSchemaByContractKey(
originContractAddress string,
chain string,
) []byte {
var key []byte

originContractAddressBytes := []byte(originContractAddress)
key = append(key, originContractAddressBytes...)
key = append(key, []byte("/")...)

chainBytes := []byte(chain)
key = append(key, chainBytes...)
key = append(key, []byte("/")...)

return key
}
76 changes: 12 additions & 64 deletions x/nftmngr/types/nft_schema_by_contract.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 8cc30e4

Please sign in to comment.