0.8.0 • Published 12 months ago
@redstone-finance/sui-connector v0.8.0
sui-connector
Deploying and testing
- Install sui-cli - https://docs.sui.io/references/cli/client
- Setup localnet - https://docs.sui.io/guides/developer/getting-started/local-network
Deploy
NETWORK=localnet SKIP_FAUCET=true PRIVATE_KEY=... yarn deploy This will create object_ids.[NETWORK].json file to be used by other scripts.
⚠⚠⚠ Remember to transfer the AdminCap and UpgradeCap to MultiSig Account! ⚠⚠⚠
Transferring objects
sui client transfer --object-id <OBJECT_ID> --to <RECIPIENT_ADDRESS> Tests
NETWORK=localnet yarn test
NETWORK=localnet yarn sample-runWorking with ledger
Checking the ledger public key
- Connect the ledger
- Run the Sui application on it or rerun it when the ledger has gone into sleep mode
- WARN ON THE account ID (Default set to 0, as the first account) inside ledger-utils.ts
- Run
yarn ledger-utilsUpgrading contract's config
- Check multi sig address for the selected sig public keys; See
MULTI_SIG_PK_HEXESin get-multi-sig-address.ts - Fill the config values in make-price-adapter-config.ts
- Run
yarn update-configand save the returned Base64-encoded result asTRANSACTION_DATA - Send the
TRANSACTION_DATAto EVERY signer defined in point 1 (for the multi-sig account) - For the every particular signer, connect the ledger, then run
yarn ledger-utils $TRANSACTION_DATA - Collect all responses, put it into combine-signatures.ts
- Run
yarn combine-signaturesand savemultiSigSignaturethe returned value asMULTISIGSIG - Run
sui client execute-signed-tx --tx-bytes $TRANSACTION_DATA --signatures $MULTISIGSIGUpgrading contract's package
- Copy the version of the contract to be upgraded - name it with suffix
_vN(for example,price_adapter_v2) - Define the
DEPLOY_DIRpath inside your .env file - Perform the contract changes as described here.
- Follow the steps above
- Instead of points 2. and 3., run
yarn upgrade-package. - The command will generate a
TRANSACTION_DATAto sign, which also contains the bytecode of the upgraded source.
- Instead of points 2. and 3., run
- After invoking the
execute-signed-tx, save the identifier of newly created package to theobject_ids.mainnet.jsonfile inside the newly copied directory (as in 1.)
Start of using the new version
It prevents writing to the object by the old logic, from the OLD relayer. Following the steps below, the OLD version relayer will stop working, because it requires the version objects compatibility. You will be able to read the written values in ANY version of the package.
- So firstly run a NEW relayer (which will be failing as their package version is different from object's version)
- Then migrate the object version in the new package to allow the new relayer to work,
by folowing the steps as described here, but
- Pass the version number to the
main(N)function in migrate-object-version.ts - Instead of points 2. and 3., run
yarn migrate-object-version. - The command will generate a
TRANSACTION_DATAto sign
- Pass the version number to the