-
Notifications
You must be signed in to change notification settings - Fork 12
migrate icp flower
Moritz Fuller edited this page Sep 1, 2023
·
6 revisions
- create
initArgs.did
, make surerestoreEnabled
is set to true and don't forget to set the correctprincipal
- add
canister_ids.json
(make mainnet canisterproduction
) - remove both files from
.gitignore
- add
metadata.json
tobackup/data
- run
npm install
npm run icp-backup
dfx canister --network ic stop production
- check backup file manually
DFX_MOC_PATH="$(vessel bin)/moc" dfx deploy --network ic --argument "$(cat initArgs.did)" production --mode reinstall
dfx canister --network ic start production
npm run restore -- --canister-id "$(dfx canister id --network ic production)" --file <latest_backup>.json --pem "$(dfx identity export fpd)" --network ic
- remove
restoreEnabled
frominitArgs.did
npm run upgrade-production
dfx canister --network ic call production initCap
npm run replica && npm run deploy-local && npm run icp-backup
npm run restore -- --canister-id "$(dfx canister id staging)" --file <latest_backup>.json --pem "$(dfx identity export fpd)"
npm run backup -- --canister-id "$(dfx canister id staging)"
- compare the two backup files with one another (use git diff or something similar)
npm run compare
- remove
restoreEnabled
npm run upgrade:staging
✅ _registryState : [(TokenIndex, AccountIdentifier)]
-> registry : [(TokenIndex, AccountIdentifier)]
_registryState : [(TokenIndex, AccountIdentifier)]
-> registry : [(TokenIndex, AccountIdentifier)]
- mapping from token index to owner
- mapping from token index to metadata, always
#nonfungible : { metadata : ?Blob; };
- metadata encodes the corresponding asset as the index of the asset in
_assets
(0
index belongs to placeholder, so it'stokenIndex + 1
)
✅ _ownersState : [(AccountIdentifier, [TokenIndex])]
-> owners : [(AccountIdentifier, [TokenIndex])]
_ownersState : [(AccountIdentifier, [TokenIndex])]
-> owners : [(AccountIdentifier, [TokenIndex])]
- mapping from account identifier to owned tokens
- all listings
type Listing = {
seller : Principal;
price : Nat64;
locked : ?Time;
};
public type Listing = {
seller : Principal;
price : Nat64;
locked : ?Time;
sellerFrontend : ?Text;
buyerFrontend : ?Text;
};
🚨 _tokenSettlementState : [(TokenIndex, Settlement)]
-> tokenSettlement : [(TokenIndex, Settlement)]
_tokenSettlementState : [(TokenIndex, Settlement)]
-> tokenSettlement : [(TokenIndex, Settlement)]
- when a user locks a token, a settlement is created and the account the ICP has to be sent to returned
- on settlement, the entry is removed
type Settlement = {
seller : Principal;
price : Nat64;
subaccount : SubAccount;
buyer : AccountIdentifier;
};
public type Settlement = {
seller : Principal;
price : Nat64;
subaccount : SubAccount;
buyer : AccountIdentifier;
sellerFrontend : ?Text;
buyerFrontend : ?Text;
};
- related to escrow payments, not needed for power equalizer
- not used
- related to escrow payments, not needed for power equalizer
- record of all transactions
- when loading the chunks, we have to provide a
transactionCount
type Transaction = {
token : TokenIdentifier;
seller : Principal;
price : Nat64;
buyer : AccountIdentifier;
time : Time;
};
- total collection size
- canister deployer
- used for minting
- all the assets in this collection
- each token maps to an asset
- btcflower has a
highres
key, we either have to manually add that (bad) or ignore it (also bad) - we could just point people to the asset caniste to retrieve the high res
- instead of including the assets in the backup file, we will upload them after a successfull backup
type Asset = {
name : Text;
thumbnail : ?File;
highres: ?File;
metadata: ?File;
payload : File;
};
public type Asset = {
name : Text;
thumbnail : ?File;
metadata : ?File;
payload : File;
};
- has the collection been revealed yet
- only transactions that occurred during sale
- because of batch sale
tokens
is an array (only difference totransactions
) - when loading the chunks, we have to provide a
saleTransactionCount
type SaleTransaction = {
tokens : [TokenIndex];
seller : Principal;
price : Nat64;
buyer : AccountIdentifier;
time : Time;
};
✅ _salesSettlementsState : [(AccountIdentifier, Sale)]
-> salesSettlements : [(AccountIdentifier, Sale)]
_salesSettlementsState : [(AccountIdentifier, Sale)]
-> salesSettlements : [(AccountIdentifier, Sale)]
- irrelevant because sale is over
✅ _failedSales : [(AccountIdentifier, SubAccount)]
-> failedSales : [(AccountIdentifier, SubAccount)]
_failedSales : [(AccountIdentifier, SubAccount)]
-> failedSales : [(AccountIdentifier, SubAccount)]
- irrelevant because sale is over
- has to be
[]
if sale is over
- not used in BTC Flower, but used in power equalizer
- has to be calculated from
saleTransactions
- irrelevant because sale is over