-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #82 from thesixnetwork/develop
Develop
- Loading branch information
Showing
164 changed files
with
30,617 additions
and
21,072 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,9 +17,9 @@ | |
|
||
.DS_Store | ||
.vscode/ | ||
test/ | ||
./test/ | ||
ts-client/* | ||
vue/node_modules/ | ||
build/ | ||
vue/ | ||
vue/src/store/* | ||
scripts/secrets/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
package app | ||
|
||
import ( | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
|
||
NftmngrKeeper "github.com/thesixnetwork/sixnft/x/nftmngr/keeper" | ||
nftmngrtypes "github.com/thesixnetwork/sixnft/x/nftmngr/types" | ||
) | ||
|
||
func (app *App) MigrationFromV1ToV2Handlers(ctx sdk.Context) { | ||
|
||
// get all NFTSchema | ||
nftSchemasV1 := app.NftmngrKeeper.GetAllNFTSchemaV1(ctx) | ||
|
||
for _, nftSchemaV1 := range nftSchemasV1 { | ||
// migrate list of system actioners to new map | ||
for _, systemActioner := range nftSchemaV1.SystemActioners { | ||
// set system actioner to new map | ||
app.NftmngrKeeper.SetActionExecutor(ctx, nftmngrtypes.ActionExecutor{ | ||
NftSchemaCode: nftSchemaV1.Code, | ||
ExecutorAddress: systemActioner, | ||
Creator: nftSchemaV1.Owner, | ||
}) | ||
} | ||
|
||
// migrate schema to new schema | ||
app.NftmngrKeeper.SetNFTSchema(ctx, nftmngrtypes.NFTSchema{ | ||
Code: nftSchemaV1.Code, | ||
Name: nftSchemaV1.Name, | ||
Owner: nftSchemaV1.Owner, | ||
Description: nftSchemaV1.Name, | ||
OriginData: nftSchemaV1.OriginData, | ||
OnchainData: &nftmngrtypes.OnChainData{ | ||
TokenAttributes: nftSchemaV1.OnchainData.TokenAttributes, | ||
Actions: nftSchemaV1.OnchainData.Actions, | ||
Status: nftSchemaV1.OnchainData.Status, | ||
}, | ||
IsVerified: nftSchemaV1.IsVerified, | ||
MintAuthorization: nftSchemaV1.MintAuthorization, | ||
}) | ||
|
||
// migrate NFT attributes to new schema attributes | ||
for _, nftAttribute := range nftSchemaV1.OnchainData.NftAttributes { | ||
schemaAttibuteConverted, _ := NftmngrKeeper.ConvertDefaultMintValueToSchemaAttributeValue(nftAttribute.DefaultMintValue) | ||
app.NftmngrKeeper.SetSchemaAttribute(ctx, nftmngrtypes.SchemaAttribute{ | ||
NftSchemaCode: nftSchemaV1.Code, | ||
Name: nftAttribute.Name, | ||
DataType: nftAttribute.DataType, | ||
Required: nftAttribute.Required, | ||
DisplayValueField: nftAttribute.DisplayValueField, | ||
DisplayOption: nftAttribute.DisplayOption, | ||
CurrentValue: schemaAttibuteConverted, | ||
HiddenOveride: nftAttribute.HiddenOveride, | ||
HiddenToMarketplace: nftAttribute.HiddenToMarketplace, | ||
Creator: nftSchemaV1.Owner, | ||
}) | ||
} | ||
|
||
// migrate NFT actions to new schema actions | ||
for i, nftAction := range nftSchemaV1.OnchainData.Actions { | ||
app.NftmngrKeeper.SetActionOfSchema(ctx, nftmngrtypes.ActionOfSchema{ | ||
NftSchemaCode: nftSchemaV1.Code, | ||
Name: nftAction.Name, | ||
Index: uint64(i), | ||
}) | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.