diff --git a/scripts/README.md b/scripts/README.md index 3dad84e..3b847f0 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -9,7 +9,7 @@ Also, check the [config file](./sdk/src/config/index.js), to ensure that you are The [examples](./examples/) folder contains scripts that demonstrate how to properly send transacrions to DDC Bucket contracts using the [@polkadot/api](https://polkadot.js.org/docs/api/) library. These simple scenarious should help other team members to clarify the business logic flow, and quickly detect issues related to various business constraints and infrastructue constraints (i.e. gas price, attached tokens, method signature, etc.). Scripts should be updated while the contract is evolving to reflect the actual logic. -#### DDC Bucket scenario +#### DDC Contract demo scenario Run the script as: ``` @@ -18,7 +18,7 @@ ENV=devnet yarn run demo-ddc-bucket The execution progress will be displayed in the console along with links to explorer that will help you to investigate the details of each transaction -#### Display DDC Bucket state +#### Display DDC Contract state Run the script as: ``` @@ -26,14 +26,14 @@ ENV=devnet yarn run print-ddc-bucket ``` -## Deployment using script +## Deployment DDC Contract using script The [deployment](./deployment/) folder contains scripts that allow you to deploy artifacts to a local or remote network. Typically, these scripts are used for EDC, Devnet and QAnet environments during development. For Testnet and Mainnet environments, it is recomended to upload the contract code manually and assert all the required keys, attached tokens, gas limits, etc. during deployment and contract instantianating. -#### DDC Bucket deployment +#### DDC Contract deployment Run the script as: ``` @@ -42,6 +42,15 @@ yarn run deploy-ddc-bucket Optionally, the command can accept a code hash as the first parameter, and constructor name as the second parameter. In order to use these options, your contract artifacts [must be registered](./sdk/src/deploymentRegistry.js) to retrieve the required metadata from artifacts. +#### DDC Contract setup + +Run the script as: +``` +DDC_CONTRACT='6PZ6ndAdULxsnzLjyNmPuWonS9jSxTRgXN1EtVMnbi41VZZg' SUPERADMIN='//Alice' ENV='devnet' yarn run setup-ddc-bucket +``` +Use the DDC Contract address in place of the `DDC_CONTRACT` variable that you want to configure, the admin of DDC Contract from the deployment step in place of `SUPERADMIN` variable, and DDC environment that you are targeting in place of the `ENV` variable + + #### Build and Deploy all contracts To run both building and deployment for all contracts, you can use the [build-and-deploy.sh](./../build-and-deploy.sh) script. diff --git a/scripts/ddc-setup/ddcBucketSetup.js b/scripts/ddc-setup/ddcBucketSetup.js index a945195..773079e 100644 --- a/scripts/ddc-setup/ddcBucketSetup.js +++ b/scripts/ddc-setup/ddcBucketSetup.js @@ -51,7 +51,7 @@ async function main() { gasLimit: 100_000_000_000n, }; - console.log(`Setup Started`, "\n"); + console.log( "\n", `Setup Started`, "\n"); { log(`Setting USD per CERE rate ...`); @@ -166,7 +166,7 @@ async function main() { } } - console.log(`Setup Finished`, "\n"); + console.log( "\n", `Setup Finished`, "\n"); process.exit(0); } diff --git a/scripts/ddc-setup/ddcConfig.js b/scripts/ddc-setup/ddcConfig.js index d4c5057..387eb7a 100644 --- a/scripts/ddc-setup/ddcConfig.js +++ b/scripts/ddc-setup/ddcConfig.js @@ -1,6 +1,7 @@ const GEN = 0x10000000000000000n; // UINT64_MAX module.exports = { + devnet: { blockchainUrl: "wss://archive.devnet.cere.network/ws", clusters: [ @@ -49,6 +50,7 @@ module.exports = { }, ], }, + testnet: { blockchainUrl: "wss://archive.testnet.cere.network/ws", clusters: [ @@ -115,37 +117,40 @@ module.exports = { ], }, - // mainnet: { - // ws_provider: "wss://archive.testnet.cere.network/ws", - // contract_address: "6So8eqxMyWAxJ4ZZ2wCcJym7Cy6BYkc4V8GZZD9wgdCqWMQB", - // cluster: { - // 1n: { - // param: { replicationFactor: 3 }, - // vnodes: [ [0n], [GEN / 3n], [GEN * 2n / 3n] ], - // storage_nodes: [1n, 2n, 3n], - // }, - // }, - // storage_node_params: [ - // { url: `https://node-0.v2.us.storage.mainnet.cere.network` }, - // { url: `https://node-1.v2.us.storage.mainnet.cere.network` }, - // { url: `https://node-2.v2.us.storage.mainnet.cere.network` }, - // ], - // cdn_cluster: { - // 0n: { - // cdn_nodes: [1n, 2n], - // }, - // }, - // cdn_node_params: [ - // { - // url: `https://node-0.v2.us.cdn.mainnet.cere.network`, - // publicKey: "0x86af4db1e433ad221b6fa3c1a9fc4de694ab59408ca57584e50d8fd420e7b45b", - // }, - // { - // url: `https://node-1.v2.us.cdn.mainnet.cere.network`, - // publicKey: "0x9a9fb6c479ef7c8f3af54dc0720f08a73d532815d525aa8d69d965e56512440e", - // }, - // ], - // }, - + mainnet: { + blockchainUrl: "wss://archive.qanet.cere.network/ws", + clusters: [ + { + params: { replicationFactor: 3 }, + storageNodes: [ + { + pubKey: "0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d", + vNodes: [0n], + params: { url: `https://node-0.v2.us.storage.mainnet.cere.network` }, + }, + { + pubKey: "0x8eaf04151687736326c9fea17e25fc5287613693c912909cb226aa4794f26a48", + vNodes: [GEN / 3n], + params: { url: `https://node-1.v2.us.storage.mainnet.cere.network` } + }, + { + pubKey: "0x90b5ab205c6974c9ea841be688864633dc9ca8a357843eeacf2314649965fe22", + vNodes: [GEN * 2n / 3n], + params: { url: `https://node-2.v2.us.storage.mainnet.cere.network` } + } + ], + cdnNodes: [ + { + pubKey: "0xfe65717dad0447d715f660a0a58411de509b42e6efb8375f562f58a554d5860e", + params: { url: `https://node-0.v2.us.cdn.mainnet.cere.network` }, + }, + { + pubKey: "0x1e07379407fecc4b89eb7dbd287c2c781cfb1907a96947a3eb18e4f8e7198625", + params: { url: `https://node-1.v2.us.cdn.mainnet.cere.network` }, + } + ] + } + ], + }, };