Skip to content
This repository has been archived by the owner on May 16, 2024. It is now read-only.

Commit

Permalink
feat: configuring DDC Mainnet environment
Browse files Browse the repository at this point in the history
  • Loading branch information
yahortsaryk committed Sep 12, 2023
1 parent 35edbc0 commit abdaee4
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 38 deletions.
17 changes: 13 additions & 4 deletions scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
```
Expand All @@ -18,22 +18,22 @@ 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:
```
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:
```
Expand All @@ -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.
4 changes: 2 additions & 2 deletions scripts/ddc-setup/ddcBucketSetup.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 ...`);
Expand Down Expand Up @@ -166,7 +166,7 @@ async function main() {
}
}

console.log(`Setup Finished`, "\n");
console.log( "\n", `Setup Finished`, "\n");
process.exit(0);
}

Expand Down
69 changes: 37 additions & 32 deletions scripts/ddc-setup/ddcConfig.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const GEN = 0x10000000000000000n; // UINT64_MAX

module.exports = {

devnet: {
blockchainUrl: "wss://archive.devnet.cere.network/ws",
clusters: [
Expand Down Expand Up @@ -49,6 +50,7 @@ module.exports = {
},
],
},

testnet: {
blockchainUrl: "wss://archive.testnet.cere.network/ws",
clusters: [
Expand Down Expand Up @@ -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` },
}
]
}
],
},

};

0 comments on commit abdaee4

Please sign in to comment.