From 76503200d64a3c755b51abb8c1f4628f940aa1ec Mon Sep 17 00:00:00 2001 From: yahortsaryk Date: Sat, 1 Jul 2023 01:58:56 +0200 Subject: [PATCH] chore(scripts): ddc setup script is moved to scripts folder --- bucket/scripts/.gitignore | 2 - bucket/scripts/init.js | 129 - bucket/scripts/metadata.json | 4959 ----------------- bucket/scripts/package-lock.json | 789 --- bucket/scripts/package.json | 8 - scripts/.gitignore | 3 +- .../ddc-setup/ddcConfig.js | 2 +- scripts/ddc-setup/ddcSetup.js | 147 + scripts/deployment/deploy.js | 2 +- scripts/examples/ddcBucketDemo.js | 2 +- scripts/examples/ddcBucketPrint.js | 2 +- scripts/examples/ddcNftRegistryDemo.js | 2 +- scripts/package.json | 3 +- scripts/sdk/src/deploymentRegistry.js | 13 +- scripts/sdk/src/polkadotWrappers.js | 11 +- 15 files changed, 175 insertions(+), 5899 deletions(-) delete mode 100644 bucket/scripts/.gitignore delete mode 100644 bucket/scripts/init.js delete mode 100644 bucket/scripts/metadata.json delete mode 100644 bucket/scripts/package-lock.json delete mode 100644 bucket/scripts/package.json rename bucket/scripts/config.js => scripts/ddc-setup/ddcConfig.js (99%) create mode 100644 scripts/ddc-setup/ddcSetup.js diff --git a/bucket/scripts/.gitignore b/bucket/scripts/.gitignore deleted file mode 100644 index 1929c324..00000000 --- a/bucket/scripts/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -node_modules/ -secrets.txt diff --git a/bucket/scripts/init.js b/bucket/scripts/init.js deleted file mode 100644 index 281fe009..00000000 --- a/bucket/scripts/init.js +++ /dev/null @@ -1,129 +0,0 @@ -import { config } from './config.js'; -import * as fs from 'fs'; - -import { ContractPromise } from '@polkadot/api-contract'; -import { ApiPromise, WsProvider, Keyring } from '@polkadot/api'; -import { cryptoWaitReady, mnemonicGenerate } from "@polkadot/util-crypto"; - -const INIT_ENV = process.env.INIT_ENV; -const SUPERADMIN_MNEMONIC = process.env.SUPERADMIN; -const CERE = 10_000_000_000n; - -const txOptions = { - storageDepositLimit: null, - gasLimit: 100_000_000_000n, -}; - -async function signAndSendPromise(txn, signer) { - return new Promise((res, rej) => { - txn - .signAndSend(signer, ({ events = [], status, blockNumber }) => { - if (status.isInvalid) { - console.log(" Transaction invalid"); - rej("Transaction invalid"); - } else if (status.isReady) { - console.log(" Transaction is ready"); - } else if (status.isBroadcast) { - console.log(" Transaction has been broadcasted"); - } else if (status.isInBlock) { - const blockHash = status.asInBlock.toHex(); - console.log(` Transaction is in block: ${blockHash} of ${blockNumber}`); - } else if (status.isFinalized) { - const blockHash = status.asFinalized.toHex(); - console.log(` Transaction has been included in blockHash ${blockHash} of ${blockNumber}`); - const treasuryDeposit = events.find( - (event) => event.event.toHuman().method === "Deposit" && event.event.toHuman().section === "treasury", - ); - const txFee = treasuryDeposit ? treasuryDeposit.event.toHuman().data.value : undefined; - const txFeeParsed = txFee ? (parseFloat(txFee.replace(" mCERE", "")) / 1000) * 2 : undefined; - - if (events.find(event => event.event.toHuman().method === "ExtrinsicSuccess")) res({ blockHash, txFeeParsed, events }); - else rej("No success found: " + blockHash); - } - }) - .catch((err) => rej(err)); - }); -} - -function createUser() { - const keyring = new Keyring({ type: "sr25519" }); - const mnemonic = mnemonicGenerate(12); - const account = keyring.addFromUri(mnemonic); - - return { - mnemonic: mnemonic, - address: account.address, - addressBase64: Buffer.from(account.publicKey).toString("base64"), - }; -} - -const cfg = config[INIT_ENV]; -if (cfg === undefined) { - console.error("Please provide INIT_ENV as one of ", Object.keys(config)); - process.exit(-1); -} -console.log(cfg); - -await cryptoWaitReady(); -const keyring = new Keyring({ type: "sr25519" }); -const alice = keyring.addFromUri("//Alice"); -const sadmin = keyring.addFromUri(SUPERADMIN_MNEMONIC); -console.log(`Superadmin: ${sadmin.address}`); - -// Contract metadata -const metadata = fs.readFileSync('./metadata.json', 'utf8'); - -// Construct -const wsProvider = new WsProvider(cfg.ws_provider); -const api = await ApiPromise.create({ provider: wsProvider }); -const contract = new ContractPromise(api, metadata, cfg.contract_address); - -console.log("1. adminGrantPermission"); -const res = await signAndSendPromise(await contract.tx.adminGrantPermission(txOptions, sadmin.address, "SuperAdmin"), sadmin); - -console.log("2. accountSetUsdPerCere"); -await signAndSendPromise(await contract.tx.accountSetUsdPerCere(txOptions, 1000n * CERE), sadmin); - -console.log("3. cdnNodeTrustManager"); -await signAndSendPromise(await contract.tx.cdnNodeTrustManager(txOptions, sadmin.address), sadmin); - -console.log("4. nodeTrustManager"); -await signAndSendPromise(await contract.tx.nodeTrustManager(txOptions, sadmin.address), sadmin); - -console.log("5. cdnNodeCreate"); -for (let i = 0; i < cfg.cdn_node_params.length; i++) { - await signAndSendPromise(await contract.tx.cdnNodeCreate(txOptions, JSON.stringify(cfg.cdn_node_params[i])), sadmin); -} - -for (let id in cfg.cdn_cluster) { - const clu = cfg.cdn_cluster[id]; - console.log("6. cdnClusterCreate, cluster: ", id, clu); - await signAndSendPromise(await contract.tx.cdnClusterCreate(txOptions, clu.cdn_nodes), sadmin); -} - -console.log("7. nodeCreate"); -for (let i = 0; i < cfg.storage_node_params.length; i++) { - const param = JSON.stringify(cfg.storage_node_params[i]); - const user = createUser(); - fs.appendFileSync('secrets.txt', `${user.address}: ${user.mnemonic} -- ${INIT_ENV} storage ${i}\n`); - console.log(` node ${i}: address ${user.address}, param ${param}`); - await signAndSendPromise(await contract.tx.nodeCreate(txOptions, 1n * CERE, param, 100000n, "ACTIVE", user.address), sadmin); -} - -for (let id in cfg.cluster) { - const clu = cfg.cluster[id]; - - console.log("8. clusterCreate, cluster: ", id, clu); - await signAndSendPromise(await contract.tx.clusterCreate(txOptions, alice.address, clu.vnodes, clu.storage_nodes, JSON.stringify(clu.param)), sadmin); - - console.log("9. clusterReserveResource, cluster: ", id); - await signAndSendPromise(await contract.tx.clusterReserveResource(txOptions, id, 100000n), sadmin); -} - -// console.log("cdnNodeChangeParams"); -// for (let i = 0; i < cfg.cdn_node_params.length; i++) { -// await signAndSendPromise(await contract.tx.cdnNodeChangeParams(txOptions, i+1, JSON.stringify(cfg.cdn_node_params[i])), sadmin); -// } - -//console.log(res.events.map(event => event.event.toHuman())); -process.exit(0); diff --git a/bucket/scripts/metadata.json b/bucket/scripts/metadata.json deleted file mode 100644 index 5233dd85..00000000 --- a/bucket/scripts/metadata.json +++ /dev/null @@ -1,4959 +0,0 @@ -{ - "source": { - "hash": "0x17173e6d800d4555fa6b27c1cb7a5bf509796c993c1ed7e1206e8ef27c21fb48", - "language": "ink! 3.4.0", - "compiler": "rustc 1.69.0-nightly" - }, - "contract": { - "name": "ddc_bucket", - "version": "0.5.2", - "authors": [ - "Aurélien Nicolas " - ], - "description": "DDC v2 Smart Contracts -- Orchestrate the network around clusters and buckets", - "license": "Apache-2.0" - }, - "V3": { - "spec": { - "constructors": [ - { - "args": [], - "docs": [ - "Create a new contract.", - "", - "The caller will be admin of the contract." - ], - "label": "new", - "payable": false, - "selector": "0x9bae9d5e" - } - ], - "docs": [], - "events": [ - { - "args": [ - { - "docs": [], - "indexed": true, - "label": "bucket_id", - "type": { - "displayName": [ - "BucketId" - ], - "type": 9 - } - }, - { - "docs": [], - "indexed": true, - "label": "owner_id", - "type": { - "displayName": [ - "AccountId" - ], - "type": 8 - } - } - ], - "docs": [ - " A bucket was created. The given account is its first owner and payer of resources." - ], - "label": "BucketCreated" - }, - { - "args": [ - { - "docs": [], - "indexed": true, - "label": "bucket_id", - "type": { - "displayName": [ - "BucketId" - ], - "type": 9 - } - }, - { - "docs": [], - "indexed": true, - "label": "cluster_id", - "type": { - "displayName": [ - "ClusterId" - ], - "type": 9 - } - }, - { - "docs": [], - "indexed": false, - "label": "resource", - "type": { - "displayName": [ - "Resource" - ], - "type": 9 - } - } - ], - "docs": [ - " Some amount of resources of a cluster were allocated to a bucket." - ], - "label": "BucketAllocated" - }, - { - "args": [ - { - "docs": [], - "indexed": true, - "label": "bucket_id", - "type": { - "displayName": [ - "BucketId" - ], - "type": 9 - } - }, - { - "docs": [], - "indexed": true, - "label": "cluster_id", - "type": { - "displayName": [ - "ClusterId" - ], - "type": 9 - } - } - ], - "docs": [ - " The due costs of a bucket was settled from the bucket payer to the cluster." - ], - "label": "BucketSettlePayment" - }, - { - "args": [ - { - "docs": [], - "indexed": true, - "label": "bucket_id", - "type": { - "displayName": [ - "BucketId" - ], - "type": 9 - } - }, - { - "docs": [], - "indexed": true, - "label": "public_availability", - "type": { - "displayName": [ - "bool" - ], - "type": 3 - } - } - ], - "docs": [ - " The availiablity of the bucket was updated." - ], - "label": "BucketAvailabilityUpdated" - }, - { - "args": [ - { - "docs": [], - "indexed": true, - "label": "cluster_id", - "type": { - "displayName": [ - "ClusterId" - ], - "type": 9 - } - }, - { - "docs": [], - "indexed": true, - "label": "manager", - "type": { - "displayName": [ - "AccountId" - ], - "type": 8 - } - }, - { - "docs": [], - "indexed": false, - "label": "cluster_params", - "type": { - "displayName": [ - "ClusterParams" - ], - "type": 16 - } - } - ], - "docs": [ - " A new cluster was created." - ], - "label": "ClusterCreated" - }, - { - "args": [ - { - "docs": [], - "indexed": true, - "label": "cluster_id", - "type": { - "displayName": [ - "ClusterId" - ], - "type": 9 - } - }, - { - "docs": [], - "indexed": true, - "label": "node_id", - "type": { - "displayName": [ - "NodeId" - ], - "type": 9 - } - } - ], - "docs": [ - " A vnode was re-assigned to new node." - ], - "label": "ClusterNodeReplaced" - }, - { - "args": [ - { - "docs": [], - "indexed": true, - "label": "cluster_id", - "type": { - "displayName": [ - "ClusterId" - ], - "type": 9 - } - }, - { - "docs": [], - "indexed": false, - "label": "resource", - "type": { - "displayName": [ - "Resource" - ], - "type": 9 - } - } - ], - "docs": [ - " Some resources were reserved for the cluster from the nodes." - ], - "label": "ClusterReserveResource" - }, - { - "args": [ - { - "docs": [], - "indexed": true, - "label": "cluster_id", - "type": { - "displayName": [ - "ClusterId" - ], - "type": 9 - } - }, - { - "docs": [], - "indexed": true, - "label": "provider_id", - "type": { - "displayName": [ - "AccountId" - ], - "type": 8 - } - } - ], - "docs": [ - " The share of revenues of a cluster for a provider was distributed." - ], - "label": "ClusterDistributeRevenues" - }, - { - "args": [ - { - "docs": [], - "indexed": true, - "label": "cluster_id", - "type": { - "displayName": [ - "ClusterId" - ], - "type": 9 - } - }, - { - "docs": [], - "indexed": true, - "label": "manager", - "type": { - "displayName": [ - "AccountId" - ], - "type": 8 - } - } - ], - "docs": [ - " A new cluster was created." - ], - "label": "CdnClusterCreated" - }, - { - "args": [ - { - "docs": [], - "indexed": true, - "label": "cluster_id", - "type": { - "displayName": [ - "ClusterId" - ], - "type": 9 - } - }, - { - "docs": [], - "indexed": true, - "label": "provider_id", - "type": { - "displayName": [ - "AccountId" - ], - "type": 8 - } - } - ], - "docs": [ - " The respective share of revenues of a CDN cluster for a provider was distributed." - ], - "label": "CdnClusterDistributeRevenues" - }, - { - "args": [ - { - "docs": [], - "indexed": true, - "label": "node_id", - "type": { - "displayName": [ - "NodeId" - ], - "type": 9 - } - }, - { - "docs": [], - "indexed": true, - "label": "provider_id", - "type": { - "displayName": [ - "AccountId" - ], - "type": 8 - } - }, - { - "docs": [], - "indexed": false, - "label": "undistributed_payment", - "type": { - "displayName": [ - "Balance" - ], - "type": 12 - } - } - ], - "docs": [ - " A node was created. The given account is its owner and recipient of revenues." - ], - "label": "CdnNodeCreated" - }, - { - "args": [ - { - "docs": [], - "indexed": true, - "label": "node_id", - "type": { - "displayName": [ - "NodeId" - ], - "type": 9 - } - }, - { - "docs": [], - "indexed": true, - "label": "provider_id", - "type": { - "displayName": [ - "AccountId" - ], - "type": 8 - } - }, - { - "docs": [], - "indexed": false, - "label": "rent_per_month", - "type": { - "displayName": [ - "Balance" - ], - "type": 12 - } - }, - { - "docs": [], - "indexed": false, - "label": "node_params", - "type": { - "displayName": [ - "NodeParams" - ], - "type": 16 - } - } - ], - "docs": [ - " A node was created. The given account is its owner and recipient of revenues." - ], - "label": "NodeCreated" - }, - { - "args": [ - { - "docs": [], - "indexed": true, - "label": "account_id", - "type": { - "displayName": [ - "AccountId" - ], - "type": 8 - } - }, - { - "docs": [], - "indexed": false, - "label": "value", - "type": { - "displayName": [ - "Balance" - ], - "type": 12 - } - } - ], - "docs": [ - " Tokens were deposited on an account." - ], - "label": "Deposit" - }, - { - "args": [ - { - "docs": [], - "indexed": true, - "label": "account_id", - "type": { - "displayName": [ - "AccountId" - ], - "type": 8 - } - }, - { - "docs": [], - "indexed": false, - "label": "permission", - "type": { - "displayName": [ - "Permission" - ], - "type": 77 - } - } - ], - "docs": [ - " A permission was granted to the account." - ], - "label": "GrantPermission" - }, - { - "args": [ - { - "docs": [], - "indexed": true, - "label": "account_id", - "type": { - "displayName": [ - "AccountId" - ], - "type": 8 - } - }, - { - "docs": [], - "indexed": false, - "label": "permission", - "type": { - "displayName": [ - "Permission" - ], - "type": 77 - } - } - ], - "docs": [ - " A permission was revoked from the account." - ], - "label": "RevokePermission" - } - ], - "messages": [ - { - "args": [ - { - "label": "bucket_params", - "type": { - "displayName": [ - "BucketParams" - ], - "type": 16 - } - }, - { - "label": "cluster_id", - "type": { - "displayName": [ - "ClusterId" - ], - "type": 9 - } - }, - { - "label": "owner_id", - "type": { - "displayName": [ - "Option" - ], - "type": 43 - } - } - ], - "docs": [ - " Create a new bucket and return its `bucket_id`.", - "", - " The caller will be its first owner and payer of resources.", - "", - " `bucket_params` is configuration used by clients and nodes. See the [data structure of BucketParams](https://docs.cere.network/ddc/protocols/contract-params-schema)", - "", - " The bucket can be connected to a single cluster (currently). Allocate cluster resources with the function `bucket_alloc_into_cluster`" - ], - "label": "bucket_create", - "mutates": true, - "payable": true, - "returnType": { - "displayName": [ - "BucketId" - ], - "type": 9 - }, - "selector": "0x0aeb2379" - }, - { - "args": [ - { - "label": "bucket_id", - "type": { - "displayName": [ - "BucketId" - ], - "type": 9 - } - }, - { - "label": "owner_id", - "type": { - "displayName": [ - "AccountId" - ], - "type": 8 - } - } - ], - "docs": [ - " Change owner of the bucket", - "", - " Provide the account of new owner" - ], - "label": "bucket_change_owner", - "mutates": true, - "payable": true, - "returnType": { - "displayName": [], - "type": 44 - }, - "selector": "0xc7d0c2cd" - }, - { - "args": [ - { - "label": "bucket_id", - "type": { - "displayName": [ - "BucketId" - ], - "type": 9 - } - }, - { - "label": "resource", - "type": { - "displayName": [ - "Resource" - ], - "type": 9 - } - } - ], - "docs": [ - " Allocate some resources of a cluster to a bucket.", - "", - " The amount of resources is given per vnode (total resources will be `resource` times the number of vnodes)." - ], - "label": "bucket_alloc_into_cluster", - "mutates": true, - "payable": false, - "returnType": { - "displayName": [], - "type": 44 - }, - "selector": "0x4c482d19" - }, - { - "args": [ - { - "label": "bucket_id", - "type": { - "displayName": [ - "BucketId" - ], - "type": 9 - } - } - ], - "docs": [ - " Settle the due costs of a bucket from its payer account to the cluster account." - ], - "label": "bucket_settle_payment", - "mutates": true, - "payable": false, - "returnType": null, - "selector": "0x15974555" - }, - { - "args": [ - { - "label": "bucket_id", - "type": { - "displayName": [ - "BucketId" - ], - "type": 9 - } - }, - { - "label": "params", - "type": { - "displayName": [ - "BucketParams" - ], - "type": 16 - } - } - ], - "docs": [ - " Change the `bucket_params`, which is configuration used by clients and nodes.", - "", - " See the [data structure of BucketParams](https://docs.cere.network/ddc/protocols/contract-params-schema)" - ], - "label": "bucket_change_params", - "mutates": true, - "payable": true, - "returnType": null, - "selector": "0x9f2d075b" - }, - { - "args": [ - { - "label": "bucket_id", - "type": { - "displayName": [ - "BucketId" - ], - "type": 9 - } - } - ], - "docs": [ - " Get the current status of a bucket." - ], - "label": "bucket_get", - "mutates": false, - "payable": false, - "returnType": { - "displayName": [ - "Result" - ], - "type": 45 - }, - "selector": "0x3802cb77" - }, - { - "args": [ - { - "label": "offset", - "type": { - "displayName": [ - "u32" - ], - "type": 9 - } - }, - { - "label": "limit", - "type": { - "displayName": [ - "u32" - ], - "type": 9 - } - }, - { - "label": "filter_owner_id", - "type": { - "displayName": [ - "Option" - ], - "type": 43 - } - } - ], - "docs": [ - " Iterate through all buckets.", - "", - " The algorithm for paging is: start with `offset = 1` and `limit = 20`. The function returns a `(results, max_id)`. Call again with `offset += limit`, until `offset >= max_id`.", - " The optimal `limit` depends on the size of params.", - "", - " The results can be filtered by owner. Note that paging must still be completed fully." - ], - "label": "bucket_list", - "mutates": false, - "payable": false, - "returnType": { - "displayName": [], - "type": 49 - }, - "selector": "0x417ab584" - }, - { - "args": [ - { - "label": "owner_id", - "type": { - "displayName": [ - "AccountId" - ], - "type": 8 - } - } - ], - "docs": [ - " Iterate through all buckets and return only those owned by owner", - "", - " This method returns bucket struct, not the status" - ], - "label": "bucket_list_for_account", - "mutates": false, - "payable": false, - "returnType": { - "displayName": [ - "Vec" - ], - "type": 6 - }, - "selector": "0xc434cf57" - }, - { - "args": [ - { - "label": "bucket_id", - "type": { - "displayName": [ - "BucketId" - ], - "type": 9 - } - }, - { - "label": "public_availability", - "type": { - "displayName": [ - "bool" - ], - "type": 3 - } - } - ], - "docs": [ - " Set availiablity of the bucket" - ], - "label": "bucket_set_availability", - "mutates": true, - "payable": false, - "returnType": { - "displayName": [], - "type": 44 - }, - "selector": "0x053eb3ce" - }, - { - "args": [ - { - "label": "bucket_id", - "type": { - "displayName": [ - "BucketId" - ], - "type": 9 - } - }, - { - "label": "new_resource_cap", - "type": { - "displayName": [ - "Resource" - ], - "type": 9 - } - } - ], - "docs": [ - " Set max resource cap to be charged by CDN for public bucket" - ], - "label": "bucket_set_resource_cap", - "mutates": true, - "payable": false, - "returnType": { - "displayName": [], - "type": 44 - }, - "selector": "0x85010c6d" - }, - { - "args": [ - { - "label": "bucket_id", - "type": { - "displayName": [ - "BucketId" - ], - "type": 9 - } - } - ], - "docs": [ - " Set permission for the reader of the bucket" - ], - "label": "get_bucket_writers", - "mutates": true, - "payable": false, - "returnType": { - "displayName": [ - "Vec" - ], - "type": 14 - }, - "selector": "0x499cd4b7" - }, - { - "args": [ - { - "label": "bucket_id", - "type": { - "displayName": [ - "BucketId" - ], - "type": 9 - } - }, - { - "label": "writer", - "type": { - "displayName": [ - "AccountId" - ], - "type": 8 - } - } - ], - "docs": [ - " Set permission for the writer of the bucket" - ], - "label": "bucket_set_writer_perm", - "mutates": true, - "payable": false, - "returnType": { - "displayName": [], - "type": 44 - }, - "selector": "0xea2e477a" - }, - { - "args": [ - { - "label": "bucket_id", - "type": { - "displayName": [ - "BucketId" - ], - "type": 9 - } - }, - { - "label": "writer", - "type": { - "displayName": [ - "AccountId" - ], - "type": 8 - } - } - ], - "docs": [ - " Revoke permission for the writer of the bucket" - ], - "label": "bucket_revoke_writer_perm", - "mutates": true, - "payable": false, - "returnType": { - "displayName": [], - "type": 44 - }, - "selector": "0x2b3d8dd1" - }, - { - "args": [ - { - "label": "bucket_id", - "type": { - "displayName": [ - "BucketId" - ], - "type": 9 - } - } - ], - "docs": [ - " Set permission for the reader of the bucket" - ], - "label": "get_bucket_readers", - "mutates": true, - "payable": false, - "returnType": { - "displayName": [ - "Vec" - ], - "type": 14 - }, - "selector": "0xb9a7cc1c" - }, - { - "args": [ - { - "label": "bucket_id", - "type": { - "displayName": [ - "BucketId" - ], - "type": 9 - } - }, - { - "label": "reader", - "type": { - "displayName": [ - "AccountId" - ], - "type": 8 - } - } - ], - "docs": [ - " Set permission for the reader of the bucket" - ], - "label": "bucket_set_reader_perm", - "mutates": true, - "payable": false, - "returnType": { - "displayName": [], - "type": 44 - }, - "selector": "0xfc0e94ea" - }, - { - "args": [ - { - "label": "bucket_id", - "type": { - "displayName": [ - "BucketId" - ], - "type": 9 - } - }, - { - "label": "writer", - "type": { - "displayName": [ - "AccountId" - ], - "type": 8 - } - } - ], - "docs": [ - " Revoke permission for the reader of the bucket" - ], - "label": "bucket_revoke_reader_perm", - "mutates": true, - "payable": false, - "returnType": { - "displayName": [], - "type": 44 - }, - "selector": "0xe9bfed5a" - }, - { - "args": [ - { - "label": "cluster_id", - "type": { - "displayName": [ - "ClusterId" - ], - "type": 9 - } - }, - { - "label": "node_ids", - "type": { - "displayName": [ - "Vec" - ], - "type": 20 - } - }, - { - "label": "v_nodes", - "type": { - "displayName": [ - "Vec" - ], - "type": 21 - } - } - ], - "docs": [ - " Removes a node to an existing cluster", - "", - " The caller will be its first manager." - ], - "label": "cluster_remove_node", - "mutates": true, - "payable": true, - "returnType": null, - "selector": "0x793e0778" - }, - { - "args": [ - { - "label": "cluster_id", - "type": { - "displayName": [ - "ClusterId" - ], - "type": 9 - } - }, - { - "label": "node_ids", - "type": { - "displayName": [ - "Vec" - ], - "type": 20 - } - }, - { - "label": "v_nodes", - "type": { - "displayName": [ - "Vec" - ], - "type": 21 - } - } - ], - "docs": [ - " Adds node to an existing cluster", - "", - " The caller will be its first manager." - ], - "label": "cluster_add_node", - "mutates": true, - "payable": true, - "returnType": null, - "selector": "0xf7496bdc" - }, - { - "args": [ - { - "label": "_unused", - "type": { - "displayName": [ - "AccountId" - ], - "type": 8 - } - }, - { - "label": "v_nodes", - "type": { - "displayName": [ - "Vec" - ], - "type": 21 - } - }, - { - "label": "node_ids", - "type": { - "displayName": [ - "Vec" - ], - "type": 20 - } - }, - { - "label": "cluster_params", - "type": { - "displayName": [ - "ClusterParams" - ], - "type": 16 - } - } - ], - "docs": [ - " Create a new cluster and return its `cluster_id`.", - "", - " The caller will be its first manager.", - "", - " The cluster is split in a number of vnodes. The vnodes are assigned to the given physical nodes in a round-robin. Only nodes of providers that trust the cluster manager can be used (see `node_trust_manager`). The assignment can be changed with the function `cluster_replace_node`.", - "", - " `cluster_params` is configuration used by clients and nodes. In particular, this describes the semantics of vnodes. See the [data structure of ClusterParams](https://docs.cere.network/ddc/protocols/contract-params-schema)" - ], - "label": "cluster_create", - "mutates": true, - "payable": true, - "returnType": { - "displayName": [ - "ClusterId" - ], - "type": 9 - }, - "selector": "0x4c0f21f6" - }, - { - "args": [ - { - "label": "cluster_id", - "type": { - "displayName": [ - "ClusterId" - ], - "type": 9 - } - }, - { - "label": "amount", - "type": { - "displayName": [ - "Resource" - ], - "type": 9 - } - } - ], - "docs": [ - " As manager, reserve more resources for the cluster from the free capacity of nodes.", - "", - " The amount of resources is given per vnode (total resources will be `resource` times the number of vnodes)." - ], - "label": "cluster_reserve_resource", - "mutates": true, - "payable": false, - "returnType": { - "displayName": [], - "type": 44 - }, - "selector": "0xb5e38125" - }, - { - "args": [ - { - "label": "node_id", - "type": { - "displayName": [ - "NodeId" - ], - "type": 9 - } - }, - { - "label": "new_tag", - "type": { - "displayName": [ - "NodeTag" - ], - "type": 31 - } - } - ], - "docs": [ - " As manager, change a node tag" - ], - "label": "cluster_change_node_tag", - "mutates": true, - "payable": false, - "returnType": { - "displayName": [], - "type": 44 - }, - "selector": "0x9640d48e" - }, - { - "args": [ - { - "label": "cluster_id", - "type": { - "displayName": [ - "ClusterId" - ], - "type": 9 - } - }, - { - "label": "v_nodes", - "type": { - "displayName": [ - "Vec" - ], - "type": 22 - } - }, - { - "label": "new_node_id", - "type": { - "displayName": [ - "NodeId" - ], - "type": 9 - } - } - ], - "docs": [ - " As manager, re-assign a vnode to another physical node.", - "", - " The cluster manager can only use nodes of providers that trust him (see `node_trust_manager`), or any nodes if he is also SuperAdmin." - ], - "label": "cluster_replace_node", - "mutates": true, - "payable": false, - "returnType": { - "displayName": [], - "type": 44 - }, - "selector": "0x48194ab1" - }, - { - "args": [ - { - "label": "cluster_id", - "type": { - "displayName": [ - "ClusterId" - ], - "type": 9 - } - } - ], - "docs": [ - " Trigger the distribution of revenues from the cluster to the providers." - ], - "label": "cluster_distribute_revenues", - "mutates": true, - "payable": false, - "returnType": null, - "selector": "0xe71e66fc" - }, - { - "args": [ - { - "label": "cluster_id", - "type": { - "displayName": [ - "ClusterId" - ], - "type": 9 - } - }, - { - "label": "params", - "type": { - "displayName": [ - "ClusterParams" - ], - "type": 16 - } - } - ], - "docs": [ - " Change the `cluster_params`, which is configuration used by clients and nodes.", - "", - " See the [data structure of ClusterParams](https://docs.cere.network/ddc/protocols/contract-params-schema)" - ], - "label": "cluster_change_params", - "mutates": true, - "payable": true, - "returnType": null, - "selector": "0x1207912c" - }, - { - "args": [ - { - "label": "cluster_id", - "type": { - "displayName": [ - "ClusterId" - ], - "type": 9 - } - } - ], - "docs": [ - " Get the current status of a cluster." - ], - "label": "cluster_get", - "mutates": false, - "payable": false, - "returnType": { - "displayName": [ - "Result" - ], - "type": 51 - }, - "selector": "0xe75411f5" - }, - { - "args": [ - { - "label": "offset", - "type": { - "displayName": [ - "u32" - ], - "type": 9 - } - }, - { - "label": "limit", - "type": { - "displayName": [ - "u32" - ], - "type": 9 - } - }, - { - "label": "filter_manager_id", - "type": { - "displayName": [ - "Option" - ], - "type": 43 - } - } - ], - "docs": [ - " Iterate through all clusters.", - "", - " The algorithm for paging is: start with `offset = 1` and `limit = 20`. The function returns a `(results, max_id)`. Call again with `offset += limit`, until `offset >= max_id`.", - " The optimal `limit` depends on the size of params.", - "", - " The results can be filtered by manager. Note that paging must still be completed fully." - ], - "label": "cluster_list", - "mutates": false, - "payable": false, - "returnType": { - "displayName": [], - "type": 53 - }, - "selector": "0xd9db9d44" - }, - { - "args": [ - { - "label": "cdn_node_ids", - "type": { - "displayName": [ - "Vec" - ], - "type": 20 - } - } - ], - "docs": [ - " Create a new cluster and return its `cluster_id`.", - "", - " The caller will be its first manager.", - "", - " The CDN node ids are provided, which will form a cluster." - ], - "label": "cdn_cluster_create", - "mutates": true, - "payable": true, - "returnType": { - "displayName": [ - "ClusterId" - ], - "type": 9 - }, - "selector": "0x4344cd7e" - }, - { - "args": [ - { - "label": "cluster_id", - "type": { - "displayName": [ - "ClusterId" - ], - "type": 9 - } - }, - { - "label": "usd_per_gb", - "type": { - "displayName": [ - "Balance" - ], - "type": 12 - } - } - ], - "docs": [ - " Set rate for streaming (price per gb)" - ], - "label": "cdn_set_rate", - "mutates": true, - "payable": true, - "returnType": { - "displayName": [], - "type": 44 - }, - "selector": "0x7578922a" - }, - { - "args": [ - { - "label": "cluster_id", - "type": { - "displayName": [ - "ClusterId" - ], - "type": 9 - } - } - ], - "docs": [ - " Get rate for streaming (price per gb)" - ], - "label": "cdn_get_rate", - "mutates": false, - "payable": true, - "returnType": { - "displayName": [ - "Balance" - ], - "type": 12 - }, - "selector": "0xa1e3ea8a" - }, - { - "args": [ - { - "label": "cluster_id", - "type": { - "displayName": [ - "ClusterId" - ], - "type": 9 - } - }, - { - "label": "aggregates_accounts", - "type": { - "displayName": [ - "Vec" - ], - "type": 55 - } - }, - { - "label": "aggregates_nodes", - "type": { - "displayName": [ - "Vec" - ], - "type": 57 - } - }, - { - "label": "aggregates_buckets", - "type": { - "displayName": [ - "Vec" - ], - "type": 59 - } - }, - { - "label": "era", - "type": { - "displayName": [ - "u64" - ], - "type": 23 - } - } - ], - "docs": [ - " As validator, charge payments from users and allocate undistributed payments to CDN nodes.", - "", - " As a result CDN cluster revenue increases, which can be distributed between CDN node providers via method cdn_cluster_distribute_revenues." - ], - "label": "cdn_cluster_put_revenue", - "mutates": true, - "payable": false, - "returnType": { - "displayName": [], - "type": 44 - }, - "selector": "0x7219be3f" - }, - { - "args": [ - { - "label": "cluster_id", - "type": { - "displayName": [ - "ClusterId" - ], - "type": 9 - } - } - ], - "docs": [ - " Trigger the distribution of revenues from the cluster to the CDN node providers.", - "", - " Anyone can call this method.", - "", - " Undistributed payments will be trasnferred, CDN cluster revenue will decrease." - ], - "label": "cdn_cluster_distribute_revenues", - "mutates": true, - "payable": false, - "returnType": null, - "selector": "0xfa8d570d" - }, - { - "args": [ - { - "label": "cluster_id", - "type": { - "displayName": [ - "ClusterId" - ], - "type": 9 - } - } - ], - "docs": [ - " Get the current status of a cluster." - ], - "label": "cdn_cluster_get", - "mutates": false, - "payable": false, - "returnType": { - "displayName": [ - "Result" - ], - "type": 61 - }, - "selector": "0x4b22fbf1" - }, - { - "args": [ - { - "label": "offset", - "type": { - "displayName": [ - "u32" - ], - "type": 9 - } - }, - { - "label": "limit", - "type": { - "displayName": [ - "u32" - ], - "type": 9 - } - }, - { - "label": "filter_manager_id", - "type": { - "displayName": [ - "Option" - ], - "type": 43 - } - } - ], - "docs": [ - " Iterate through all clusters.", - "", - " The algorithm for paging is: start with `offset = 1` and `limit = 20`. The function returns a `(results, max_id)`. Call again with `offset += limit`, until `offset >= max_id`.", - " The optimal `limit` depends on the size of params.", - "", - " The results can be filtered by manager. Note that paging must still be completed fully." - ], - "label": "cdn_cluster_list", - "mutates": false, - "payable": false, - "returnType": { - "displayName": [], - "type": 63 - }, - "selector": "0xb242a64f" - }, - { - "args": [ - { - "label": "cdn_owner", - "type": { - "displayName": [ - "AccountId" - ], - "type": 8 - } - }, - { - "label": "node_id", - "type": { - "displayName": [ - "NodeId" - ], - "type": 9 - } - }, - { - "label": "commit", - "type": { - "displayName": [ - "Commit" - ], - "type": 37 - } - } - ], - "docs": [ - " CDN node operator sets the commit for current era." - ], - "label": "set_commit", - "mutates": true, - "payable": false, - "returnType": null, - "selector": "0xe445e1fd" - }, - { - "args": [ - { - "label": "cdn_owner", - "type": { - "displayName": [ - "AccountId" - ], - "type": 8 - } - } - ], - "docs": [ - " Return the last commit submitted by CDN node operator" - ], - "label": "get_commit", - "mutates": false, - "payable": false, - "returnType": { - "displayName": [ - "Vec" - ], - "type": 35 - }, - "selector": "0x5329f551" - }, - { - "args": [ - { - "label": "node", - "type": { - "displayName": [ - "NodeId" - ], - "type": 9 - } - } - ], - "docs": [ - " Return last era validated per CDN node" - ], - "label": "get_validated_commit", - "mutates": false, - "payable": false, - "returnType": { - "displayName": [ - "EraAndTimestamp" - ], - "type": 40 - }, - "selector": "0x7d497bc1" - }, - { - "args": [ - { - "label": "era_config", - "type": { - "displayName": [ - "EraConfig" - ], - "type": 65 - } - } - ], - "docs": [ - " Set the new configs for era" - ], - "label": "set_era", - "mutates": true, - "payable": false, - "returnType": { - "displayName": [], - "type": 44 - }, - "selector": "0x49a5b8f7" - }, - { - "args": [], - "docs": [ - " Return current status of an era" - ], - "label": "get_era", - "mutates": false, - "payable": false, - "returnType": { - "displayName": [ - "EraStatus" - ], - "type": 66 - }, - "selector": "0x617f696b" - }, - { - "args": [], - "docs": [ - " Return current era settings" - ], - "label": "get_era_settings", - "mutates": false, - "payable": false, - "returnType": { - "displayName": [ - "EraConfig" - ], - "type": 65 - }, - "selector": "0x84b61468" - }, - { - "args": [ - { - "label": "manager", - "type": { - "displayName": [ - "AccountId" - ], - "type": 8 - } - } - ], - "docs": [ - " As node provider, authorize a cluster manager to use his nodes." - ], - "label": "cdn_node_trust_manager", - "mutates": true, - "payable": true, - "returnType": null, - "selector": "0x372daa96" - }, - { - "args": [ - { - "label": "manager", - "type": { - "displayName": [ - "AccountId" - ], - "type": 8 - } - } - ], - "docs": [ - " As node provider, revoke the authorization of a cluster manager to use his nodes." - ], - "label": "cdn_node_distrust_manager", - "mutates": true, - "payable": false, - "returnType": null, - "selector": "0xf67f5438" - }, - { - "args": [ - { - "label": "node_params", - "type": { - "displayName": [ - "Params" - ], - "type": 16 - } - } - ], - "docs": [ - " Create a new node and return its `node_id`.", - "", - " The caller will be its owner.", - "", - " `node_params` is configuration used by clients and nodes. In particular, this contains the URL to the service. See the [data structure of NodeParams](https://docs.cere.network/ddc/protocols/contract-params-schema)" - ], - "label": "cdn_node_create", - "mutates": true, - "payable": true, - "returnType": { - "displayName": [ - "NodeId" - ], - "type": 9 - }, - "selector": "0xe8aa4ade" - }, - { - "args": [ - { - "label": "node_id", - "type": { - "displayName": [ - "NodeId" - ], - "type": 9 - } - }, - { - "label": "params", - "type": { - "displayName": [ - "NodeParams" - ], - "type": 16 - } - } - ], - "docs": [ - " Change the `node_params`, which is configuration used by clients and nodes.", - "", - " See the [data structure of NodeParams](https://docs.cere.network/ddc/protocols/contract-params-schema)" - ], - "label": "cdn_node_change_params", - "mutates": true, - "payable": true, - "returnType": null, - "selector": "0xf52c20f5" - }, - { - "args": [ - { - "label": "node_id", - "type": { - "displayName": [ - "NodeId" - ], - "type": 9 - } - } - ], - "docs": [ - " Get the current state of the cdn node" - ], - "label": "cdn_node_get", - "mutates": false, - "payable": false, - "returnType": { - "displayName": [ - "Result" - ], - "type": 68 - }, - "selector": "0xf9a5a813" - }, - { - "args": [ - { - "label": "offset", - "type": { - "displayName": [ - "u32" - ], - "type": 9 - } - }, - { - "label": "limit", - "type": { - "displayName": [ - "u32" - ], - "type": 9 - } - }, - { - "label": "filter_provider_id", - "type": { - "displayName": [ - "Option" - ], - "type": 43 - } - } - ], - "docs": [ - " Iterate through all nodes.", - "", - " The algorithm for paging is: start with `offset = 1` and `limit = 20`. The function returns a `(results, max_id)`. Call again with `offset += limit`, until `offset >= max_id`.", - " The optimal `limit` depends on the size of params.", - "", - " The results can be filtered by owner. Note that paging must still be completed fully." - ], - "label": "cdn_node_list", - "mutates": false, - "payable": false, - "returnType": { - "displayName": [], - "type": 70 - }, - "selector": "0xf8589aae" - }, - { - "args": [ - { - "label": "manager", - "type": { - "displayName": [ - "AccountId" - ], - "type": 8 - } - } - ], - "docs": [ - " As node provider, authorize a cluster manager to use his nodes." - ], - "label": "node_trust_manager", - "mutates": true, - "payable": true, - "returnType": null, - "selector": "0x6fd54a01" - }, - { - "args": [ - { - "label": "manager", - "type": { - "displayName": [ - "AccountId" - ], - "type": 8 - } - } - ], - "docs": [ - " As node provider, revoke the authorization of a cluster manager to use his nodes." - ], - "label": "node_distrust_manager", - "mutates": true, - "payable": false, - "returnType": null, - "selector": "0x40912279" - }, - { - "args": [ - { - "label": "rent_per_month", - "type": { - "displayName": [ - "Balance" - ], - "type": 12 - } - }, - { - "label": "node_params", - "type": { - "displayName": [ - "NodeParams" - ], - "type": 16 - } - }, - { - "label": "capacity", - "type": { - "displayName": [ - "Resource" - ], - "type": 9 - } - }, - { - "label": "node_tag", - "type": { - "displayName": [ - "NodeTag" - ], - "type": 31 - } - }, - { - "label": "pubkey", - "type": { - "displayName": [ - "AccountId" - ], - "type": 8 - } - } - ], - "docs": [ - " Create a new node and return its `node_id`.", - "", - " The caller will be its owner.", - "", - " `node_params` is configuration used by clients and nodes. In particular, this contains the URL to the service. See the [data structure of NodeParams](https://docs.cere.network/ddc/protocols/contract-params-schema)" - ], - "label": "node_create", - "mutates": true, - "payable": true, - "returnType": { - "displayName": [ - "NodeId" - ], - "type": 9 - }, - "selector": "0xb77ac1bb" - }, - { - "args": [ - { - "label": "node_id", - "type": { - "displayName": [ - "NodeId" - ], - "type": 9 - } - }, - { - "label": "params", - "type": { - "displayName": [ - "NodeParams" - ], - "type": 16 - } - } - ], - "docs": [ - " Change the `node_params`, which is configuration used by clients and nodes.", - "", - " See the [data structure of NodeParams](https://docs.cere.network/ddc/protocols/contract-params-schema)" - ], - "label": "node_change_params", - "mutates": true, - "payable": true, - "returnType": null, - "selector": "0x258ccb2a" - }, - { - "args": [ - { - "label": "node_id", - "type": { - "displayName": [ - "NodeId" - ], - "type": 9 - } - } - ], - "docs": [ - " Get the current status of a node." - ], - "label": "node_get", - "mutates": false, - "payable": false, - "returnType": { - "displayName": [ - "Result" - ], - "type": 72 - }, - "selector": "0x847f3997" - }, - { - "args": [ - { - "label": "pubkey", - "type": { - "displayName": [ - "AccountId" - ], - "type": 8 - } - } - ], - "docs": [ - " Get the current status of a node by a public key." - ], - "label": "node_get_by_pubkey", - "mutates": false, - "payable": false, - "returnType": { - "displayName": [ - "Result" - ], - "type": 72 - }, - "selector": "0x7f6c82d4" - }, - { - "args": [ - { - "label": "offset", - "type": { - "displayName": [ - "u32" - ], - "type": 9 - } - }, - { - "label": "limit", - "type": { - "displayName": [ - "u32" - ], - "type": 9 - } - }, - { - "label": "filter_provider_id", - "type": { - "displayName": [ - "Option" - ], - "type": 43 - } - } - ], - "docs": [ - " Iterate through all nodes.", - "", - " The algorithm for paging is: start with `offset = 1` and `limit = 20`. The function returns a `(results, max_id)`. Call again with `offset += limit`, until `offset >= max_id`.", - " The optimal `limit` depends on the size of params.", - "", - " The results can be filtered by owner. Note that paging must still be completed fully." - ], - "label": "node_list", - "mutates": false, - "payable": false, - "returnType": { - "displayName": [], - "type": 74 - }, - "selector": "0x423286d6" - }, - { - "args": [], - "docs": [ - " Get the Fee Percentage Basis Points that will be charged by the protocol" - ], - "label": "get_fee_bp", - "mutates": false, - "payable": false, - "returnType": { - "displayName": [ - "u32" - ], - "type": 9 - }, - "selector": "0x0d5daf5f" - }, - { - "args": [ - { - "label": "fee_bp", - "type": { - "displayName": [ - "u32" - ], - "type": 9 - } - } - ], - "docs": [ - " Return the last commit submitted by CDN node operator" - ], - "label": "set_fee_bp", - "mutates": true, - "payable": false, - "returnType": { - "displayName": [], - "type": 44 - }, - "selector": "0xc5e3e2ca" - }, - { - "args": [], - "docs": [ - " Return fees accumulated by the protocol" - ], - "label": "get_protocol_revenues", - "mutates": false, - "payable": false, - "returnType": { - "displayName": [ - "Cash" - ], - "type": 19 - }, - "selector": "0x07c63885" - }, - { - "args": [ - { - "label": "amount", - "type": { - "displayName": [ - "u128" - ], - "type": 12 - } - } - ], - "docs": [ - " Pay the revenues accumulated by the protocol" - ], - "label": "protocol_withdraw_revenues", - "mutates": true, - "payable": false, - "returnType": { - "displayName": [], - "type": 44 - }, - "selector": "0x85c6fa6d" - }, - { - "args": [], - "docs": [ - " As user, deposit tokens on the account of the caller from the transaction value. This deposit", - " can be used to pay for the services to buckets of the account." - ], - "label": "account_deposit", - "mutates": true, - "payable": true, - "returnType": { - "displayName": [], - "type": 44 - }, - "selector": "0xc311af62" - }, - { - "args": [ - { - "label": "bond_amount", - "type": { - "displayName": [ - "Balance" - ], - "type": 12 - } - } - ], - "docs": [ - " As user, bond some amount of tokens from the withdrawable balance. These funds will be used to pay for CDN node service." - ], - "label": "account_bond", - "mutates": true, - "payable": true, - "returnType": { - "displayName": [], - "type": 44 - }, - "selector": "0xe9fad0bf" - }, - { - "args": [ - { - "label": "amount_to_unbond", - "type": { - "displayName": [ - "Cash" - ], - "type": 19 - } - } - ], - "docs": [ - " As user, unbond a specified amount of tokens. The tokens will be locked for some time, as defined by contract owner." - ], - "label": "account_unbond", - "mutates": true, - "payable": true, - "returnType": { - "displayName": [], - "type": 44 - }, - "selector": "0xf7ea2c67" - }, - { - "args": [], - "docs": [ - " As user, move the unbonded tokens back to withdrawable balance state.", - "", - " This can be triggered after unbonded_timestamp" - ], - "label": "account_withdraw_unbonded", - "mutates": true, - "payable": true, - "returnType": { - "displayName": [], - "type": 44 - }, - "selector": "0x98173716" - }, - { - "args": [ - { - "label": "account_id", - "type": { - "displayName": [ - "AccountId" - ], - "type": 8 - } - } - ], - "docs": [ - " Get the current status of an account." - ], - "label": "account_get", - "mutates": false, - "payable": false, - "returnType": { - "displayName": [ - "Result" - ], - "type": 76 - }, - "selector": "0x1d4220fa" - }, - { - "args": [], - "docs": [ - " Get the current conversion rate between the native currency and an external currency (USD)." - ], - "label": "account_get_usd_per_cere", - "mutates": false, - "payable": false, - "returnType": { - "displayName": [ - "Balance" - ], - "type": 12 - }, - "selector": "0xe4a4652a" - }, - { - "args": [ - { - "label": "usd_per_cere", - "type": { - "displayName": [ - "Balance" - ], - "type": 12 - } - } - ], - "docs": [ - " As price oracle, set the current conversion rate between the native currency and an external currency (USD).", - "", - " This requires the permission SetExchangeRate or SuperAdmin." - ], - "label": "account_set_usd_per_cere", - "mutates": true, - "payable": false, - "returnType": null, - "selector": "0x48d45ee8" - }, - { - "args": [ - { - "label": "grantee", - "type": { - "displayName": [ - "AccountId" - ], - "type": 8 - } - }, - { - "label": "permission", - "type": { - "displayName": [ - "Permission" - ], - "type": 77 - } - } - ], - "docs": [ - " Check whether the given account has the given permission currently,", - " or the SuperAdmin permission." - ], - "label": "has_permission", - "mutates": false, - "payable": false, - "returnType": { - "displayName": [ - "bool" - ], - "type": 3 - }, - "selector": "0xe0942492" - }, - { - "args": [ - { - "label": "grantee", - "type": { - "displayName": [ - "AccountId" - ], - "type": 8 - } - }, - { - "label": "permission", - "type": { - "displayName": [ - "Permission" - ], - "type": 77 - } - } - ], - "docs": [ - " As SuperAdmin, grant any permission to any account." - ], - "label": "admin_grant_permission", - "mutates": true, - "payable": true, - "returnType": null, - "selector": "0xbe41ea55" - }, - { - "args": [ - { - "label": "grantee", - "type": { - "displayName": [ - "AccountId" - ], - "type": 8 - } - }, - { - "label": "permission", - "type": { - "displayName": [ - "Permission" - ], - "type": 77 - } - } - ], - "docs": [ - " As SuperAdmin, revoke any permission to any account." - ], - "label": "admin_revoke_permission", - "mutates": true, - "payable": false, - "returnType": null, - "selector": "0x6b150666" - }, - { - "args": [ - { - "label": "amount", - "type": { - "displayName": [ - "Balance" - ], - "type": 12 - } - } - ], - "docs": [ - " As SuperAdmin, withdraw the funds held in custody in this contract.", - "", - " This is a temporary measure to allow migrating the funds to a new version of the contract." - ], - "label": "admin_withdraw", - "mutates": true, - "payable": false, - "returnType": null, - "selector": "0x2f6e0868" - }, - { - "args": [ - { - "label": "config", - "type": { - "displayName": [ - "FeeConfig" - ], - "type": 78 - } - } - ], - "docs": [ - " As SuperAdmin, set the network and cluster fee configuration." - ], - "label": "admin_set_fee_config", - "mutates": true, - "payable": false, - "returnType": null, - "selector": "0x00d441e7" - }, - { - "args": [], - "docs": [ - " Get all Account IDs stored in the SC" - ], - "label": "get_accounts", - "mutates": false, - "payable": true, - "returnType": { - "displayName": [ - "Vec" - ], - "type": 14 - }, - "selector": "0xef03ead7" - } - ] - }, - "storage": { - "struct": { - "fields": [ - { - "layout": { - "struct": { - "fields": [ - { - "layout": { - "cell": { - "key": "0x0000000000000000000000000000000000000000000000000000000000000000", - "ty": 0 - } - }, - "name": null - } - ] - } - }, - "name": "perms" - }, - { - "layout": { - "struct": { - "fields": [ - { - "layout": { - "cell": { - "key": "0x0100000000000000000000000000000000000000000000000000000000000000", - "ty": 6 - } - }, - "name": null - } - ] - } - }, - "name": "buckets" - }, - { - "layout": { - "struct": { - "fields": [ - { - "layout": { - "cell": { - "key": "0x0200000000000000000000000000000000000000000000000000000000000000", - "ty": 13 - } - }, - "name": "writers" - }, - { - "layout": { - "cell": { - "key": "0x0300000000000000000000000000000000000000000000000000000000000000", - "ty": 13 - } - }, - "name": "readers" - } - ] - } - }, - "name": "buckets_perms" - }, - { - "layout": { - "struct": { - "fields": [ - { - "layout": { - "cell": { - "key": "0x0400000000000000000000000000000000000000000000000000000000000000", - "ty": 15 - } - }, - "name": null - } - ] - } - }, - "name": "bucket_params" - }, - { - "layout": { - "struct": { - "fields": [ - { - "layout": { - "cell": { - "key": "0x0500000000000000000000000000000000000000000000000000000000000000", - "ty": 17 - } - }, - "name": null - } - ] - } - }, - "name": "clusters" - }, - { - "layout": { - "struct": { - "fields": [ - { - "layout": { - "cell": { - "key": "0x0600000000000000000000000000000000000000000000000000000000000000", - "ty": 24 - } - }, - "name": null - } - ] - } - }, - "name": "cdn_clusters" - }, - { - "layout": { - "struct": { - "fields": [ - { - "layout": { - "cell": { - "key": "0x0700000000000000000000000000000000000000000000000000000000000000", - "ty": 15 - } - }, - "name": null - } - ] - } - }, - "name": "cluster_params" - }, - { - "layout": { - "struct": { - "fields": [ - { - "layout": { - "cell": { - "key": "0x0800000000000000000000000000000000000000000000000000000000000000", - "ty": 26 - } - }, - "name": null - } - ] - } - }, - "name": "cdn_nodes" - }, - { - "layout": { - "struct": { - "fields": [ - { - "layout": { - "cell": { - "key": "0x0900000000000000000000000000000000000000000000000000000000000000", - "ty": 15 - } - }, - "name": null - } - ] - } - }, - "name": "cdn_node_params" - }, - { - "layout": { - "struct": { - "fields": [ - { - "layout": { - "cell": { - "key": "0x0a00000000000000000000000000000000000000000000000000000000000000", - "ty": 28 - } - }, - "name": "account_node" - }, - { - "layout": { - "cell": { - "key": "0x0b00000000000000000000000000000000000000000000000000000000000000", - "ty": 29 - } - }, - "name": "nodes" - } - ] - } - }, - "name": "nodes" - }, - { - "layout": { - "struct": { - "fields": [ - { - "layout": { - "cell": { - "key": "0x0c00000000000000000000000000000000000000000000000000000000000000", - "ty": 15 - } - }, - "name": null - } - ] - } - }, - "name": "node_params" - }, - { - "layout": { - "struct": { - "fields": [ - { - "layout": { - "cell": { - "key": "0x0d00000000000000000000000000000000000000000000000000000000000000", - "ty": 32 - } - }, - "name": null - }, - { - "layout": { - "struct": { - "fields": [ - { - "layout": { - "cell": { - "key": "0x0e00000000000000000000000000000000000000000000000000000000000000", - "ty": 12 - } - }, - "name": null - } - ] - } - }, - "name": null - }, - { - "layout": { - "cell": { - "key": "0x0f00000000000000000000000000000000000000000000000000000000000000", - "ty": 14 - } - }, - "name": null - } - ] - } - }, - "name": "accounts" - }, - { - "layout": { - "struct": { - "fields": [ - { - "layout": { - "struct": { - "fields": [ - { - "layout": { - "cell": { - "key": "0x1000000000000000000000000000000000000000000000000000000000000000", - "ty": 12 - } - }, - "name": "network_fee_bp" - }, - { - "layout": { - "cell": { - "key": "0x1100000000000000000000000000000000000000000000000000000000000000", - "ty": 8 - } - }, - "name": "network_fee_destination" - }, - { - "layout": { - "cell": { - "key": "0x1200000000000000000000000000000000000000000000000000000000000000", - "ty": 12 - } - }, - "name": "cluster_management_fee_bp" - } - ] - } - }, - "name": null - } - ] - } - }, - "name": "network_fee" - }, - { - "layout": { - "struct": { - "fields": [ - { - "layout": { - "cell": { - "key": "0x1300000000000000000000000000000000000000000000000000000000000000", - "ty": 8 - } - }, - "name": "operator_id" - }, - { - "layout": { - "cell": { - "key": "0x1400000000000000000000000000000000000000000000000000000000000000", - "ty": 34 - } - }, - "name": "commits" - }, - { - "layout": { - "cell": { - "key": "0x1500000000000000000000000000000000000000000000000000000000000000", - "ty": 39 - } - }, - "name": "validated_commits" - }, - { - "layout": { - "struct": { - "fields": [ - { - "layout": { - "cell": { - "key": "0x1600000000000000000000000000000000000000000000000000000000000000", - "ty": 23 - } - }, - "name": "start" - }, - { - "layout": { - "cell": { - "key": "0x1700000000000000000000000000000000000000000000000000000000000000", - "ty": 23 - } - }, - "name": "interval" - }, - { - "layout": { - "cell": { - "key": "0x1800000000000000000000000000000000000000000000000000000000000000", - "ty": 23 - } - }, - "name": "commit_duration" - }, - { - "layout": { - "cell": { - "key": "0x1900000000000000000000000000000000000000000000000000000000000000", - "ty": 23 - } - }, - "name": "validation_duration" - } - ] - } - }, - "name": "era_settings" - } - ] - } - }, - "name": "committer_store" - }, - { - "layout": { - "struct": { - "fields": [ - { - "layout": { - "cell": { - "key": "0x1a00000000000000000000000000000000000000000000000000000000000000", - "ty": 8 - } - }, - "name": "admin" - }, - { - "layout": { - "cell": { - "key": "0x1b00000000000000000000000000000000000000000000000000000000000000", - "ty": 9 - } - }, - "name": "fee_bp" - }, - { - "layout": { - "struct": { - "fields": [ - { - "layout": { - "cell": { - "key": "0x1c00000000000000000000000000000000000000000000000000000000000000", - "ty": 12 - } - }, - "name": null - } - ] - } - }, - "name": "revenues" - } - ] - } - }, - "name": "protocol_store" - }, - { - "layout": { - "struct": { - "fields": [ - { - "layout": { - "cell": { - "key": "0x1d00000000000000000000000000000000000000000000000000000000000000", - "ty": 41 - } - }, - "name": null - } - ] - } - }, - "name": "topology_store" - } - ] - } - }, - "types": [ - { - "id": 0, - "type": { - "def": { - "composite": { - "fields": [ - { - "name": "offset_key", - "type": 4, - "typeName": "Key" - } - ] - } - }, - "params": [ - { - "name": "K", - "type": 1 - }, - { - "name": "V", - "type": 3 - } - ], - "path": [ - "ink_storage", - "lazy", - "mapping", - "Mapping" - ] - } - }, - { - "id": 1, - "type": { - "def": { - "sequence": { - "type": 2 - } - } - } - }, - { - "id": 2, - "type": { - "def": { - "primitive": "u8" - } - } - }, - { - "id": 3, - "type": { - "def": { - "primitive": "bool" - } - } - }, - { - "id": 4, - "type": { - "def": { - "composite": { - "fields": [ - { - "type": 5, - "typeName": "[u8; 32]" - } - ] - } - }, - "path": [ - "ink_primitives", - "Key" - ] - } - }, - { - "id": 5, - "type": { - "def": { - "array": { - "len": 32, - "type": 2 - } - } - } - }, - { - "id": 6, - "type": { - "def": { - "sequence": { - "type": 7 - } - } - } - }, - { - "id": 7, - "type": { - "def": { - "composite": { - "fields": [ - { - "name": "owner_id", - "type": 8, - "typeName": "AccountId" - }, - { - "name": "cluster_id", - "type": 9, - "typeName": "ClusterId" - }, - { - "name": "flow", - "type": 10, - "typeName": "Flow" - }, - { - "name": "resource_reserved", - "type": 9, - "typeName": "Resource" - }, - { - "name": "public_availability", - "type": 3, - "typeName": "bool" - }, - { - "name": "resource_consumption_cap", - "type": 9, - "typeName": "Resource" - } - ] - } - }, - "path": [ - "ddc_bucket", - "ddc_bucket", - "bucket", - "entity", - "Bucket" - ] - } - }, - { - "id": 8, - "type": { - "def": { - "composite": { - "fields": [ - { - "type": 5, - "typeName": "[u8; 32]" - } - ] - } - }, - "path": [ - "ink_env", - "types", - "AccountId" - ] - } - }, - { - "id": 9, - "type": { - "def": { - "primitive": "u32" - } - } - }, - { - "id": 10, - "type": { - "def": { - "composite": { - "fields": [ - { - "name": "from", - "type": 8, - "typeName": "AccountId" - }, - { - "name": "schedule", - "type": 11, - "typeName": "Schedule" - } - ] - } - }, - "path": [ - "ddc_bucket", - "ddc_bucket", - "flow", - "Flow" - ] - } - }, - { - "id": 11, - "type": { - "def": { - "composite": { - "fields": [ - { - "name": "rate", - "type": 12, - "typeName": "Balance" - }, - { - "name": "offset", - "type": 12, - "typeName": "Balance" - } - ] - } - }, - "path": [ - "ddc_bucket", - "ddc_bucket", - "schedule", - "Schedule" - ] - } - }, - { - "id": 12, - "type": { - "def": { - "primitive": "u128" - } - } - }, - { - "id": 13, - "type": { - "def": { - "composite": { - "fields": [ - { - "name": "offset_key", - "type": 4, - "typeName": "Key" - } - ] - } - }, - "params": [ - { - "name": "K", - "type": 9 - }, - { - "name": "V", - "type": 14 - } - ], - "path": [ - "ink_storage", - "lazy", - "mapping", - "Mapping" - ] - } - }, - { - "id": 14, - "type": { - "def": { - "sequence": { - "type": 8 - } - } - } - }, - { - "id": 15, - "type": { - "def": { - "sequence": { - "type": 16 - } - } - } - }, - { - "id": 16, - "type": { - "def": { - "primitive": "str" - } - } - }, - { - "id": 17, - "type": { - "def": { - "sequence": { - "type": 18 - } - } - } - }, - { - "id": 18, - "type": { - "def": { - "composite": { - "fields": [ - { - "name": "manager_id", - "type": 8, - "typeName": "AccountId" - }, - { - "name": "resource_per_vnode", - "type": 9, - "typeName": "Resource" - }, - { - "name": "resource_used", - "type": 9, - "typeName": "Resource" - }, - { - "name": "revenues", - "type": 19, - "typeName": "Cash" - }, - { - "name": "node_ids", - "type": 20, - "typeName": "Vec" - }, - { - "name": "v_nodes", - "type": 21, - "typeName": "Vec>" - }, - { - "name": "total_rent", - "type": 12, - "typeName": "Balance" - } - ] - } - }, - "path": [ - "ddc_bucket", - "ddc_bucket", - "cluster", - "entity", - "Cluster" - ] - } - }, - { - "id": 19, - "type": { - "def": { - "composite": { - "fields": [ - { - "name": "value", - "type": 12, - "typeName": "Balance" - } - ] - } - }, - "path": [ - "ddc_bucket", - "ddc_bucket", - "cash", - "Cash" - ] - } - }, - { - "id": 20, - "type": { - "def": { - "sequence": { - "type": 9 - } - } - } - }, - { - "id": 21, - "type": { - "def": { - "sequence": { - "type": 22 - } - } - } - }, - { - "id": 22, - "type": { - "def": { - "sequence": { - "type": 23 - } - } - } - }, - { - "id": 23, - "type": { - "def": { - "primitive": "u64" - } - } - }, - { - "id": 24, - "type": { - "def": { - "sequence": { - "type": 25 - } - } - } - }, - { - "id": 25, - "type": { - "def": { - "composite": { - "fields": [ - { - "name": "manager_id", - "type": 8, - "typeName": "AccountId" - }, - { - "name": "cdn_nodes", - "type": 20, - "typeName": "Vec" - }, - { - "name": "resources_used", - "type": 9, - "typeName": "Resource" - }, - { - "name": "revenues", - "type": 19, - "typeName": "Cash" - }, - { - "name": "usd_per_gb", - "type": 12, - "typeName": "Balance" - } - ] - } - }, - "path": [ - "ddc_bucket", - "ddc_bucket", - "cdn_cluster", - "entity", - "CdnCluster" - ] - } - }, - { - "id": 26, - "type": { - "def": { - "sequence": { - "type": 27 - } - } - } - }, - { - "id": 27, - "type": { - "def": { - "composite": { - "fields": [ - { - "name": "provider_id", - "type": 8, - "typeName": "ProviderId" - }, - { - "name": "undistributed_payment", - "type": 12, - "typeName": "Balance" - } - ] - } - }, - "path": [ - "ddc_bucket", - "ddc_bucket", - "cdn_node", - "entity", - "CdnNode" - ] - } - }, - { - "id": 28, - "type": { - "def": { - "composite": { - "fields": [ - { - "name": "offset_key", - "type": 4, - "typeName": "Key" - } - ] - } - }, - "params": [ - { - "name": "K", - "type": 8 - }, - { - "name": "V", - "type": 9 - } - ], - "path": [ - "ink_storage", - "lazy", - "mapping", - "Mapping" - ] - } - }, - { - "id": 29, - "type": { - "def": { - "sequence": { - "type": 30 - } - } - } - }, - { - "id": 30, - "type": { - "def": { - "composite": { - "fields": [ - { - "name": "provider_id", - "type": 8, - "typeName": "ProviderId" - }, - { - "name": "rent_per_month", - "type": 12, - "typeName": "Balance" - }, - { - "name": "free_resource", - "type": 9, - "typeName": "Resource" - }, - { - "name": "node_tag", - "type": 31, - "typeName": "NodeTag" - } - ] - } - }, - "path": [ - "ddc_bucket", - "ddc_bucket", - "node", - "entity", - "Node" - ] - } - }, - { - "id": 31, - "type": { - "def": { - "variant": { - "variants": [ - { - "index": 0, - "name": "UNKNOWN" - }, - { - "index": 1, - "name": "ACTIVE" - }, - { - "index": 2, - "name": "ADDING" - }, - { - "index": 3, - "name": "DELETING" - }, - { - "index": 4, - "name": "OFFLINE" - } - ] - } - }, - "path": [ - "ddc_bucket", - "ddc_bucket", - "node", - "entity", - "NodeTag" - ] - } - }, - { - "id": 32, - "type": { - "def": { - "composite": { - "fields": [ - { - "name": "offset_key", - "type": 4, - "typeName": "Key" - } - ] - } - }, - "params": [ - { - "name": "K", - "type": 8 - }, - { - "name": "V", - "type": 33 - } - ], - "path": [ - "ink_storage", - "lazy", - "mapping", - "Mapping" - ] - } - }, - { - "id": 33, - "type": { - "def": { - "composite": { - "fields": [ - { - "name": "deposit", - "type": 19, - "typeName": "Cash" - }, - { - "name": "bonded", - "type": 19, - "typeName": "Cash" - }, - { - "name": "negative", - "type": 19, - "typeName": "Cash" - }, - { - "name": "unbonded_amount", - "type": 19, - "typeName": "Cash" - }, - { - "name": "unbonded_timestamp", - "type": 23, - "typeName": "u64" - }, - { - "name": "payable_schedule", - "type": 11, - "typeName": "Schedule" - } - ] - } - }, - "path": [ - "ddc_bucket", - "ddc_bucket", - "account", - "entity", - "Account" - ] - } - }, - { - "id": 34, - "type": { - "def": { - "composite": { - "fields": [ - { - "name": "offset_key", - "type": 4, - "typeName": "Key" - } - ] - } - }, - "params": [ - { - "name": "K", - "type": 8 - }, - { - "name": "V", - "type": 35 - } - ], - "path": [ - "ink_storage", - "lazy", - "mapping", - "Mapping" - ] - } - }, - { - "id": 35, - "type": { - "def": { - "sequence": { - "type": 36 - } - } - } - }, - { - "id": 36, - "type": { - "def": { - "tuple": [ - 9, - 37 - ] - } - } - }, - { - "id": 37, - "type": { - "def": { - "composite": { - "fields": [ - { - "name": "hash", - "type": 38, - "typeName": "Hash" - }, - { - "name": "total_logs", - "type": 12, - "typeName": "u128" - }, - { - "name": "from_timestamp", - "type": 23, - "typeName": "u64" - }, - { - "name": "to_timestamp", - "type": 23, - "typeName": "u64" - } - ] - } - }, - "path": [ - "ddc_bucket", - "ddc_bucket", - "committer", - "store", - "Commit" - ] - } - }, - { - "id": 38, - "type": { - "def": { - "composite": { - "fields": [ - { - "type": 5, - "typeName": "[u8; 32]" - } - ] - } - }, - "path": [ - "ink_env", - "types", - "Hash" - ] - } - }, - { - "id": 39, - "type": { - "def": { - "composite": { - "fields": [ - { - "name": "offset_key", - "type": 4, - "typeName": "Key" - } - ] - } - }, - "params": [ - { - "name": "K", - "type": 9 - }, - { - "name": "V", - "type": 40 - } - ], - "path": [ - "ink_storage", - "lazy", - "mapping", - "Mapping" - ] - } - }, - { - "id": 40, - "type": { - "def": { - "tuple": [ - 23, - 23 - ] - } - } - }, - { - "id": 41, - "type": { - "def": { - "composite": { - "fields": [ - { - "name": "offset_key", - "type": 4, - "typeName": "Key" - } - ] - } - }, - "params": [ - { - "name": "K", - "type": 42 - }, - { - "name": "V", - "type": 9 - } - ], - "path": [ - "ink_storage", - "lazy", - "mapping", - "Mapping" - ] - } - }, - { - "id": 42, - "type": { - "def": { - "tuple": [ - 9, - 23 - ] - } - } - }, - { - "id": 43, - "type": { - "def": { - "variant": { - "variants": [ - { - "index": 0, - "name": "None" - }, - { - "fields": [ - { - "type": 8 - } - ], - "index": 1, - "name": "Some" - } - ] - } - }, - "params": [ - { - "name": "T", - "type": 8 - } - ], - "path": [ - "Option" - ] - } - }, - { - "id": 44, - "type": { - "def": { - "tuple": [] - } - } - }, - { - "id": 45, - "type": { - "def": { - "variant": { - "variants": [ - { - "fields": [ - { - "type": 46 - } - ], - "index": 0, - "name": "Ok" - }, - { - "fields": [ - { - "type": 48 - } - ], - "index": 1, - "name": "Err" - } - ] - } - }, - "params": [ - { - "name": "T", - "type": 46 - }, - { - "name": "E", - "type": 48 - } - ], - "path": [ - "Result" - ] - } - }, - { - "id": 46, - "type": { - "def": { - "composite": { - "fields": [ - { - "name": "bucket_id", - "type": 9, - "typeName": "BucketId" - }, - { - "name": "bucket", - "type": 47, - "typeName": "BucketInStatus" - }, - { - "name": "params", - "type": 16, - "typeName": "BucketParams" - }, - { - "name": "writer_ids", - "type": 14, - "typeName": "Vec" - }, - { - "name": "reader_ids", - "type": 14, - "typeName": "Vec" - }, - { - "name": "rent_covered_until_ms", - "type": 23, - "typeName": "u64" - } - ] - } - }, - "path": [ - "ddc_bucket", - "ddc_bucket", - "bucket", - "entity", - "BucketStatus" - ] - } - }, - { - "id": 47, - "type": { - "def": { - "composite": { - "fields": [ - { - "name": "owner_id", - "type": 8, - "typeName": "AccountId" - }, - { - "name": "cluster_id", - "type": 9, - "typeName": "ClusterId" - }, - { - "name": "resource_reserved", - "type": 9, - "typeName": "Resource" - }, - { - "name": "public_availability", - "type": 3, - "typeName": "bool" - }, - { - "name": "resource_consumption_cap", - "type": 9, - "typeName": "Resource" - } - ] - } - }, - "path": [ - "ddc_bucket", - "ddc_bucket", - "bucket", - "entity", - "BucketInStatus" - ] - } - }, - { - "id": 48, - "type": { - "def": { - "variant": { - "variants": [ - { - "index": 0, - "name": "BucketDoesNotExist" - }, - { - "index": 1, - "name": "ClusterDoesNotExist" - }, - { - "index": 2, - "name": "ParamsTooBig" - }, - { - "index": 3, - "name": "VNodeDoesNotExist" - }, - { - "index": 4, - "name": "BondingPeriodNotFinished" - }, - { - "index": 5, - "name": "BucketClusterAlreadyConnected" - }, - { - "index": 6, - "name": "BucketClusterNotSetup" - }, - { - "index": 7, - "name": "NodeDoesNotExist" - }, - { - "index": 8, - "name": "NodeAlreadyExists" - }, - { - "index": 9, - "name": "FlowDoesNotExist" - }, - { - "index": 10, - "name": "AccountDoesNotExist" - }, - { - "index": 11, - "name": "ParamsDoesNotExist" - }, - { - "index": 12, - "name": "UnauthorizedProvider" - }, - { - "index": 13, - "name": "UnauthorizedOwner" - }, - { - "index": 14, - "name": "UnauthorizedClusterManager" - }, - { - "index": 15, - "name": "ClusterManagerIsNotTrusted" - }, - { - "index": 16, - "name": "TransferFailed" - }, - { - "index": 17, - "name": "InsufficientBalance" - }, - { - "index": 18, - "name": "InsufficientResources" - }, - { - "index": 19, - "name": "Unauthorized" - }, - { - "index": 20, - "name": "UnknownNode" - } - ] - } - }, - "path": [ - "ddc_bucket", - "ddc_bucket", - "Error" - ] - } - }, - { - "id": 49, - "type": { - "def": { - "tuple": [ - 50, - 9 - ] - } - } - }, - { - "id": 50, - "type": { - "def": { - "sequence": { - "type": 46 - } - } - } - }, - { - "id": 51, - "type": { - "def": { - "variant": { - "variants": [ - { - "fields": [ - { - "type": 52 - } - ], - "index": 0, - "name": "Ok" - }, - { - "fields": [ - { - "type": 48 - } - ], - "index": 1, - "name": "Err" - } - ] - } - }, - "params": [ - { - "name": "T", - "type": 52 - }, - { - "name": "E", - "type": 48 - } - ], - "path": [ - "Result" - ] - } - }, - { - "id": 52, - "type": { - "def": { - "composite": { - "fields": [ - { - "name": "cluster_id", - "type": 9, - "typeName": "ClusterId" - }, - { - "name": "cluster", - "type": 18, - "typeName": "Cluster" - }, - { - "name": "params", - "type": 16, - "typeName": "Params" - } - ] - } - }, - "path": [ - "ddc_bucket", - "ddc_bucket", - "cluster", - "entity", - "ClusterStatus" - ] - } - }, - { - "id": 53, - "type": { - "def": { - "tuple": [ - 54, - 9 - ] - } - } - }, - { - "id": 54, - "type": { - "def": { - "sequence": { - "type": 52 - } - } - } - }, - { - "id": 55, - "type": { - "def": { - "sequence": { - "type": 56 - } - } - } - }, - { - "id": 56, - "type": { - "def": { - "tuple": [ - 8, - 12 - ] - } - } - }, - { - "id": 57, - "type": { - "def": { - "sequence": { - "type": 58 - } - } - } - }, - { - "id": 58, - "type": { - "def": { - "tuple": [ - 9, - 12 - ] - } - } - }, - { - "id": 59, - "type": { - "def": { - "sequence": { - "type": 60 - } - } - } - }, - { - "id": 60, - "type": { - "def": { - "tuple": [ - 9, - 9 - ] - } - } - }, - { - "id": 61, - "type": { - "def": { - "variant": { - "variants": [ - { - "fields": [ - { - "type": 62 - } - ], - "index": 0, - "name": "Ok" - }, - { - "fields": [ - { - "type": 48 - } - ], - "index": 1, - "name": "Err" - } - ] - } - }, - "params": [ - { - "name": "T", - "type": 62 - }, - { - "name": "E", - "type": 48 - } - ], - "path": [ - "Result" - ] - } - }, - { - "id": 62, - "type": { - "def": { - "composite": { - "fields": [ - { - "name": "cluster_id", - "type": 9, - "typeName": "ClusterId" - }, - { - "name": "cluster", - "type": 25, - "typeName": "CdnCluster" - } - ] - } - }, - "path": [ - "ddc_bucket", - "ddc_bucket", - "cdn_cluster", - "entity", - "CdnClusterStatus" - ] - } - }, - { - "id": 63, - "type": { - "def": { - "tuple": [ - 64, - 9 - ] - } - } - }, - { - "id": 64, - "type": { - "def": { - "sequence": { - "type": 62 - } - } - } - }, - { - "id": 65, - "type": { - "def": { - "composite": { - "fields": [ - { - "name": "start", - "type": 23, - "typeName": "u64" - }, - { - "name": "interval", - "type": 23, - "typeName": "u64" - }, - { - "name": "commit_duration", - "type": 23, - "typeName": "u64" - }, - { - "name": "validation_duration", - "type": 23, - "typeName": "u64" - } - ] - } - }, - "path": [ - "ddc_bucket", - "ddc_bucket", - "committer", - "store", - "EraConfig" - ] - } - }, - { - "id": 66, - "type": { - "def": { - "composite": { - "fields": [ - { - "name": "current_era", - "type": 23, - "typeName": "u64" - }, - { - "name": "current_phase", - "type": 67, - "typeName": "Phase" - }, - { - "name": "previous_era", - "type": 23, - "typeName": "u64" - }, - { - "name": "prev_era_from_timestamp", - "type": 23, - "typeName": "u64" - }, - { - "name": "prev_era_to_timestamp", - "type": 23, - "typeName": "u64" - } - ] - } - }, - "path": [ - "ddc_bucket", - "ddc_bucket", - "committer", - "store", - "EraStatus" - ] - } - }, - { - "id": 67, - "type": { - "def": { - "variant": { - "variants": [ - { - "index": 0, - "name": "Commit" - }, - { - "index": 1, - "name": "Valiadation" - }, - { - "index": 2, - "name": "Payout" - } - ] - } - }, - "path": [ - "ddc_bucket", - "ddc_bucket", - "committer", - "store", - "Phase" - ] - } - }, - { - "id": 68, - "type": { - "def": { - "variant": { - "variants": [ - { - "fields": [ - { - "type": 69 - } - ], - "index": 0, - "name": "Ok" - }, - { - "fields": [ - { - "type": 48 - } - ], - "index": 1, - "name": "Err" - } - ] - } - }, - "params": [ - { - "name": "T", - "type": 69 - }, - { - "name": "E", - "type": 48 - } - ], - "path": [ - "Result" - ] - } - }, - { - "id": 69, - "type": { - "def": { - "composite": { - "fields": [ - { - "name": "node_id", - "type": 9, - "typeName": "NodeId" - }, - { - "name": "node", - "type": 27, - "typeName": "CdnNode" - }, - { - "name": "params", - "type": 16, - "typeName": "Params" - } - ] - } - }, - "path": [ - "ddc_bucket", - "ddc_bucket", - "cdn_node", - "entity", - "CdnNodeStatus" - ] - } - }, - { - "id": 70, - "type": { - "def": { - "tuple": [ - 71, - 9 - ] - } - } - }, - { - "id": 71, - "type": { - "def": { - "sequence": { - "type": 69 - } - } - } - }, - { - "id": 72, - "type": { - "def": { - "variant": { - "variants": [ - { - "fields": [ - { - "type": 73 - } - ], - "index": 0, - "name": "Ok" - }, - { - "fields": [ - { - "type": 48 - } - ], - "index": 1, - "name": "Err" - } - ] - } - }, - "params": [ - { - "name": "T", - "type": 73 - }, - { - "name": "E", - "type": 48 - } - ], - "path": [ - "Result" - ] - } - }, - { - "id": 73, - "type": { - "def": { - "composite": { - "fields": [ - { - "name": "node_id", - "type": 9, - "typeName": "NodeId" - }, - { - "name": "node", - "type": 30, - "typeName": "Node" - }, - { - "name": "params", - "type": 16, - "typeName": "Params" - } - ] - } - }, - "path": [ - "ddc_bucket", - "ddc_bucket", - "node", - "entity", - "NodeStatus" - ] - } - }, - { - "id": 74, - "type": { - "def": { - "tuple": [ - 75, - 9 - ] - } - } - }, - { - "id": 75, - "type": { - "def": { - "sequence": { - "type": 73 - } - } - } - }, - { - "id": 76, - "type": { - "def": { - "variant": { - "variants": [ - { - "fields": [ - { - "type": 33 - } - ], - "index": 0, - "name": "Ok" - }, - { - "fields": [ - { - "type": 48 - } - ], - "index": 1, - "name": "Err" - } - ] - } - }, - "params": [ - { - "name": "T", - "type": 33 - }, - { - "name": "E", - "type": 48 - } - ], - "path": [ - "Result" - ] - } - }, - { - "id": 77, - "type": { - "def": { - "variant": { - "variants": [ - { - "fields": [ - { - "type": 8, - "typeName": "AccountId" - } - ], - "index": 0, - "name": "ManagerTrustedBy" - }, - { - "index": 1, - "name": "SetExchangeRate" - }, - { - "index": 2, - "name": "SuperAdmin" - } - ] - } - }, - "path": [ - "ddc_bucket", - "ddc_bucket", - "perm", - "entity", - "Permission" - ] - } - }, - { - "id": 78, - "type": { - "def": { - "composite": { - "fields": [ - { - "name": "network_fee_bp", - "type": 12, - "typeName": "BasisPoints" - }, - { - "name": "network_fee_destination", - "type": 8, - "typeName": "AccountId" - }, - { - "name": "cluster_management_fee_bp", - "type": 12, - "typeName": "BasisPoints" - } - ] - } - }, - "path": [ - "ddc_bucket", - "ddc_bucket", - "network_fee", - "FeeConfig" - ] - } - } - ] - } -} \ No newline at end of file diff --git a/bucket/scripts/package-lock.json b/bucket/scripts/package-lock.json deleted file mode 100644 index 0411d6de..00000000 --- a/bucket/scripts/package-lock.json +++ /dev/null @@ -1,789 +0,0 @@ -{ - "name": "scripts", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "dependencies": { - "@polkadot/api": "^10.9.1", - "@polkadot/api-contract": "^10.9.1", - "@polkadot/util-crypto": "^12.3.2" - } - }, - "node_modules/@noble/curves": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.1.0.tgz", - "integrity": "sha512-091oBExgENk/kGj3AZmtBDMpxQPDtxQABR2B9lb1JbVTs6ytdzZNwvhxQ4MWasRNEzlbEH8jCWFCwhF/Obj5AA==", - "dependencies": { - "@noble/hashes": "1.3.1" - }, - "funding": { - "url": "https://paulmillr.com/funding/" - } - }, - "node_modules/@noble/hashes": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.1.tgz", - "integrity": "sha512-EbqwksQwz9xDRGfDST86whPBgM65E0OH/pCgqW0GBVzO22bNE+NuIbeTb714+IfSjU3aRk47EUvXIb5bTsenKA==", - "engines": { - "node": ">= 16" - }, - "funding": { - "url": "https://paulmillr.com/funding/" - } - }, - "node_modules/@polkadot/api": { - "version": "10.9.1", - "resolved": "https://registry.npmjs.org/@polkadot/api/-/api-10.9.1.tgz", - "integrity": "sha512-ND/2UqZBWvtt4PfV03OStTKg0mxmPk4UpMAgJKutdgsz/wP9CYJ1KbjwFgPNekL9JnzbKQsWyQNPVrcw7kQk8A==", - "dependencies": { - "@polkadot/api-augment": "10.9.1", - "@polkadot/api-base": "10.9.1", - "@polkadot/api-derive": "10.9.1", - "@polkadot/keyring": "^12.3.1", - "@polkadot/rpc-augment": "10.9.1", - "@polkadot/rpc-core": "10.9.1", - "@polkadot/rpc-provider": "10.9.1", - "@polkadot/types": "10.9.1", - "@polkadot/types-augment": "10.9.1", - "@polkadot/types-codec": "10.9.1", - "@polkadot/types-create": "10.9.1", - "@polkadot/types-known": "10.9.1", - "@polkadot/util": "^12.3.1", - "@polkadot/util-crypto": "^12.3.1", - "eventemitter3": "^5.0.1", - "rxjs": "^7.8.1", - "tslib": "^2.5.3" - }, - "engines": { - "node": ">=16" - } - }, - "node_modules/@polkadot/api-augment": { - "version": "10.9.1", - "resolved": "https://registry.npmjs.org/@polkadot/api-augment/-/api-augment-10.9.1.tgz", - "integrity": "sha512-kRZZvCFVcN4hAH4dJ+Qzfdy27/4EEq3oLDf3ihj0LTVrAezSWcKPGE3EVFy+Mn6Lo4SUc7RVyoKvIUhSk2l4Dg==", - "dependencies": { - "@polkadot/api-base": "10.9.1", - "@polkadot/rpc-augment": "10.9.1", - "@polkadot/types": "10.9.1", - "@polkadot/types-augment": "10.9.1", - "@polkadot/types-codec": "10.9.1", - "@polkadot/util": "^12.3.1", - "tslib": "^2.5.3" - }, - "engines": { - "node": ">=16" - } - }, - "node_modules/@polkadot/api-base": { - "version": "10.9.1", - "resolved": "https://registry.npmjs.org/@polkadot/api-base/-/api-base-10.9.1.tgz", - "integrity": "sha512-Q3m2KzlceMK2kX8bhnUZWk3RT6emmijeeFZZQgCePpEcrSeNjnqG4qjuTPgkveaOkUT8MAoDc5Avuzcc2jlW9g==", - "dependencies": { - "@polkadot/rpc-core": "10.9.1", - "@polkadot/types": "10.9.1", - "@polkadot/util": "^12.3.1", - "rxjs": "^7.8.1", - "tslib": "^2.5.3" - }, - "engines": { - "node": ">=16" - } - }, - "node_modules/@polkadot/api-contract": { - "version": "10.9.1", - "resolved": "https://registry.npmjs.org/@polkadot/api-contract/-/api-contract-10.9.1.tgz", - "integrity": "sha512-BJjFYSFtsUlClC3mgvPNQ5h/7LZd5gVfexwl+mDgLd/6SN4dUBQjIXhlIL5a1cGYjq3EROuu7t0agG2DIaiZMQ==", - "dependencies": { - "@polkadot/api": "10.9.1", - "@polkadot/api-augment": "10.9.1", - "@polkadot/types": "10.9.1", - "@polkadot/types-codec": "10.9.1", - "@polkadot/types-create": "10.9.1", - "@polkadot/util": "^12.3.1", - "@polkadot/util-crypto": "^12.3.1", - "rxjs": "^7.8.1", - "tslib": "^2.5.3" - }, - "engines": { - "node": ">=16" - } - }, - "node_modules/@polkadot/api-derive": { - "version": "10.9.1", - "resolved": "https://registry.npmjs.org/@polkadot/api-derive/-/api-derive-10.9.1.tgz", - "integrity": "sha512-mRud1UZCFIc4Z63qAoGSIHh/foyUYADfy1RQYCmPpeFKfIdCIrHpd7xFdJXTOMYOS0BwlM6u4qli/ZT4XigezQ==", - "dependencies": { - "@polkadot/api": "10.9.1", - "@polkadot/api-augment": "10.9.1", - "@polkadot/api-base": "10.9.1", - "@polkadot/rpc-core": "10.9.1", - "@polkadot/types": "10.9.1", - "@polkadot/types-codec": "10.9.1", - "@polkadot/util": "^12.3.1", - "@polkadot/util-crypto": "^12.3.1", - "rxjs": "^7.8.1", - "tslib": "^2.5.3" - }, - "engines": { - "node": ">=16" - } - }, - "node_modules/@polkadot/keyring": { - "version": "12.3.2", - "resolved": "https://registry.npmjs.org/@polkadot/keyring/-/keyring-12.3.2.tgz", - "integrity": "sha512-NTdtDeI0DP9l/45hXynNABeP5VB8piw5YR+CbUxK2e36xpJWVXwbcOepzslg5ghE9rs8UKJb30Z/HqTU4sBY0Q==", - "dependencies": { - "@polkadot/util": "12.3.2", - "@polkadot/util-crypto": "12.3.2", - "tslib": "^2.5.3" - }, - "engines": { - "node": ">=16" - }, - "peerDependencies": { - "@polkadot/util": "12.3.2", - "@polkadot/util-crypto": "12.3.2" - } - }, - "node_modules/@polkadot/networks": { - "version": "12.3.2", - "resolved": "https://registry.npmjs.org/@polkadot/networks/-/networks-12.3.2.tgz", - "integrity": "sha512-uCkyybKoeEm1daKr0uT/9oNDHDDzCy2/ZdVl346hQqfdR1Ct3BaxMjxqvdmb5N8aCw0cBWSfgsxAYtw8ESmllQ==", - "dependencies": { - "@polkadot/util": "12.3.2", - "@substrate/ss58-registry": "^1.40.0", - "tslib": "^2.5.3" - }, - "engines": { - "node": ">=16" - } - }, - "node_modules/@polkadot/rpc-augment": { - "version": "10.9.1", - "resolved": "https://registry.npmjs.org/@polkadot/rpc-augment/-/rpc-augment-10.9.1.tgz", - "integrity": "sha512-MaLHkNlyqN20ZRYr6uNd1BZr1OsrnX9qLAmsl0mcrri1vPGRH6VHjfFH1RBLkikpWD82v17g0l2hLwdV1ZHMcw==", - "dependencies": { - "@polkadot/rpc-core": "10.9.1", - "@polkadot/types": "10.9.1", - "@polkadot/types-codec": "10.9.1", - "@polkadot/util": "^12.3.1", - "tslib": "^2.5.3" - }, - "engines": { - "node": ">=16" - } - }, - "node_modules/@polkadot/rpc-core": { - "version": "10.9.1", - "resolved": "https://registry.npmjs.org/@polkadot/rpc-core/-/rpc-core-10.9.1.tgz", - "integrity": "sha512-ZtA8B8SfXSAwVkBlCcKRHw0eSM7ec/sbiNOM5GasXPeRujUgT7lOwSH2GbUZSqe9RfRDMp6DvO9c2JoGc3LLWw==", - "dependencies": { - "@polkadot/rpc-augment": "10.9.1", - "@polkadot/rpc-provider": "10.9.1", - "@polkadot/types": "10.9.1", - "@polkadot/util": "^12.3.1", - "rxjs": "^7.8.1", - "tslib": "^2.5.3" - }, - "engines": { - "node": ">=16" - } - }, - "node_modules/@polkadot/rpc-provider": { - "version": "10.9.1", - "resolved": "https://registry.npmjs.org/@polkadot/rpc-provider/-/rpc-provider-10.9.1.tgz", - "integrity": "sha512-4QzT2QzD+320+eT6b79sGAA85Tt3Bb8fQvse4r5Mom2iiBd2SO81vOhxSAOaIe4GUsw25VzFJmsbe7+OObItdg==", - "dependencies": { - "@polkadot/keyring": "^12.3.1", - "@polkadot/types": "10.9.1", - "@polkadot/types-support": "10.9.1", - "@polkadot/util": "^12.3.1", - "@polkadot/util-crypto": "^12.3.1", - "@polkadot/x-fetch": "^12.3.1", - "@polkadot/x-global": "^12.3.1", - "@polkadot/x-ws": "^12.3.1", - "eventemitter3": "^5.0.1", - "mock-socket": "^9.2.1", - "nock": "^13.3.1", - "tslib": "^2.5.3" - }, - "engines": { - "node": ">=16" - }, - "optionalDependencies": { - "@substrate/connect": "0.7.26" - } - }, - "node_modules/@polkadot/types": { - "version": "10.9.1", - "resolved": "https://registry.npmjs.org/@polkadot/types/-/types-10.9.1.tgz", - "integrity": "sha512-AG33i2ZGGfq7u+5rkAdGrXAQHHl844/Yv+junH5ZzX69xiCoWO1bH/yzDUNBdpki2GlACWvF9nLYh3F2tVF93w==", - "dependencies": { - "@polkadot/keyring": "^12.3.1", - "@polkadot/types-augment": "10.9.1", - "@polkadot/types-codec": "10.9.1", - "@polkadot/types-create": "10.9.1", - "@polkadot/util": "^12.3.1", - "@polkadot/util-crypto": "^12.3.1", - "rxjs": "^7.8.1", - "tslib": "^2.5.3" - }, - "engines": { - "node": ">=16" - } - }, - "node_modules/@polkadot/types-augment": { - "version": "10.9.1", - "resolved": "https://registry.npmjs.org/@polkadot/types-augment/-/types-augment-10.9.1.tgz", - "integrity": "sha512-OY9/jTMFRFqYdkUnfcGwqMLC64A0Q25bjvCuVQCVjsPFKE3wl0Kt5rNT01eV2UmLXrR6fY0xWbR2w80bLA7CIQ==", - "dependencies": { - "@polkadot/types": "10.9.1", - "@polkadot/types-codec": "10.9.1", - "@polkadot/util": "^12.3.1", - "tslib": "^2.5.3" - }, - "engines": { - "node": ">=16" - } - }, - "node_modules/@polkadot/types-codec": { - "version": "10.9.1", - "resolved": "https://registry.npmjs.org/@polkadot/types-codec/-/types-codec-10.9.1.tgz", - "integrity": "sha512-mJ5OegKGraY1FLvEa8FopRCr3pQrhDkcn5RNOjmgJQozENVeRaxhk0NwxYz7IojFvSDnKnc6lNQfKaaSe5pLHg==", - "dependencies": { - "@polkadot/util": "^12.3.1", - "@polkadot/x-bigint": "^12.3.1", - "tslib": "^2.5.3" - }, - "engines": { - "node": ">=16" - } - }, - "node_modules/@polkadot/types-create": { - "version": "10.9.1", - "resolved": "https://registry.npmjs.org/@polkadot/types-create/-/types-create-10.9.1.tgz", - "integrity": "sha512-OVz50MGTTuiuVnRP/zAx4CTuLioc0hsiwNwqN2lNhmIJGtnQ4Vy/7mQRsIWehiYz6g0Vzzm5B3qWkTXO1NSN5w==", - "dependencies": { - "@polkadot/types-codec": "10.9.1", - "@polkadot/util": "^12.3.1", - "tslib": "^2.5.3" - }, - "engines": { - "node": ">=16" - } - }, - "node_modules/@polkadot/types-known": { - "version": "10.9.1", - "resolved": "https://registry.npmjs.org/@polkadot/types-known/-/types-known-10.9.1.tgz", - "integrity": "sha512-zCMVWc4pJtkbMFPu72bD4IhvV/gkHXPX3C5uu92WdmCfnn0vEIEsMKWlVXVVvQQZKAqvs/awpqIfrUtEViOGEA==", - "dependencies": { - "@polkadot/networks": "^12.3.1", - "@polkadot/types": "10.9.1", - "@polkadot/types-codec": "10.9.1", - "@polkadot/types-create": "10.9.1", - "@polkadot/util": "^12.3.1", - "tslib": "^2.5.3" - }, - "engines": { - "node": ">=16" - } - }, - "node_modules/@polkadot/types-support": { - "version": "10.9.1", - "resolved": "https://registry.npmjs.org/@polkadot/types-support/-/types-support-10.9.1.tgz", - "integrity": "sha512-XsieuLDsszvMZQlleacQBfx07i/JkwQV/UxH9q8Hz7Okmaz9pEVEW1h3ka2/cPuC7a4l32JhaORBUYshBZNdJg==", - "dependencies": { - "@polkadot/util": "^12.3.1", - "tslib": "^2.5.3" - }, - "engines": { - "node": ">=16" - } - }, - "node_modules/@polkadot/util": { - "version": "12.3.2", - "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-12.3.2.tgz", - "integrity": "sha512-y/JShcGyOamCUiSIg++XZuLHt1ktSKBaSH2K5Nw5NXlgP0+7am+GZzqPB8fQ4qhYLruEOv+YRiz0GC1Zr9S+wg==", - "dependencies": { - "@polkadot/x-bigint": "12.3.2", - "@polkadot/x-global": "12.3.2", - "@polkadot/x-textdecoder": "12.3.2", - "@polkadot/x-textencoder": "12.3.2", - "@types/bn.js": "^5.1.1", - "bn.js": "^5.2.1", - "tslib": "^2.5.3" - }, - "engines": { - "node": ">=16" - } - }, - "node_modules/@polkadot/util-crypto": { - "version": "12.3.2", - "resolved": "https://registry.npmjs.org/@polkadot/util-crypto/-/util-crypto-12.3.2.tgz", - "integrity": "sha512-pTpx+YxolY0BDT4RcGmgeKbHHD/dI6Ll9xRsqmVdIjpcVVY20uDNTyXs81ZNtfKgyod1y9JQkfNv2Dz9iEpTkQ==", - "dependencies": { - "@noble/curves": "1.1.0", - "@noble/hashes": "1.3.1", - "@polkadot/networks": "12.3.2", - "@polkadot/util": "12.3.2", - "@polkadot/wasm-crypto": "^7.2.1", - "@polkadot/wasm-util": "^7.2.1", - "@polkadot/x-bigint": "12.3.2", - "@polkadot/x-randomvalues": "12.3.2", - "@scure/base": "1.1.1", - "tslib": "^2.5.3" - }, - "engines": { - "node": ">=16" - }, - "peerDependencies": { - "@polkadot/util": "12.3.2" - } - }, - "node_modules/@polkadot/wasm-bridge": { - "version": "7.2.1", - "resolved": "https://registry.npmjs.org/@polkadot/wasm-bridge/-/wasm-bridge-7.2.1.tgz", - "integrity": "sha512-uV/LHREDBGBbHrrv7HTki+Klw0PYZzFomagFWII4lp6Toj/VCvRh5WMzooVC+g/XsBGosAwrvBhoModabyHx+A==", - "dependencies": { - "@polkadot/wasm-util": "7.2.1", - "tslib": "^2.5.0" - }, - "engines": { - "node": ">=16" - }, - "peerDependencies": { - "@polkadot/util": "*", - "@polkadot/x-randomvalues": "*" - } - }, - "node_modules/@polkadot/wasm-crypto": { - "version": "7.2.1", - "resolved": "https://registry.npmjs.org/@polkadot/wasm-crypto/-/wasm-crypto-7.2.1.tgz", - "integrity": "sha512-SA2+33S9TAwGhniKgztVN6pxUKpGfN4Tre/eUZGUfpgRkT92wIUT2GpGWQE+fCCqGQgADrNiBcwt6XwdPqMQ4Q==", - "dependencies": { - "@polkadot/wasm-bridge": "7.2.1", - "@polkadot/wasm-crypto-asmjs": "7.2.1", - "@polkadot/wasm-crypto-init": "7.2.1", - "@polkadot/wasm-crypto-wasm": "7.2.1", - "@polkadot/wasm-util": "7.2.1", - "tslib": "^2.5.0" - }, - "engines": { - "node": ">=16" - }, - "peerDependencies": { - "@polkadot/util": "*", - "@polkadot/x-randomvalues": "*" - } - }, - "node_modules/@polkadot/wasm-crypto-asmjs": { - "version": "7.2.1", - "resolved": "https://registry.npmjs.org/@polkadot/wasm-crypto-asmjs/-/wasm-crypto-asmjs-7.2.1.tgz", - "integrity": "sha512-z/d21bmxyVfkzGsKef/FWswKX02x5lK97f4NPBZ9XBeiFkmzlXhdSnu58/+b1sKsRAGdW/Rn/rTNRDhW0GqCAg==", - "dependencies": { - "tslib": "^2.5.0" - }, - "engines": { - "node": ">=16" - }, - "peerDependencies": { - "@polkadot/util": "*" - } - }, - "node_modules/@polkadot/wasm-crypto-init": { - "version": "7.2.1", - "resolved": "https://registry.npmjs.org/@polkadot/wasm-crypto-init/-/wasm-crypto-init-7.2.1.tgz", - "integrity": "sha512-GcEXtwN9LcSf32V9zSaYjHImFw16hCyo2Xzg4GLLDPPeaAAfbFr2oQMgwyDbvBrBjLKHVHjsPZyGhXae831amw==", - "dependencies": { - "@polkadot/wasm-bridge": "7.2.1", - "@polkadot/wasm-crypto-asmjs": "7.2.1", - "@polkadot/wasm-crypto-wasm": "7.2.1", - "@polkadot/wasm-util": "7.2.1", - "tslib": "^2.5.0" - }, - "engines": { - "node": ">=16" - }, - "peerDependencies": { - "@polkadot/util": "*", - "@polkadot/x-randomvalues": "*" - } - }, - "node_modules/@polkadot/wasm-crypto-wasm": { - "version": "7.2.1", - "resolved": "https://registry.npmjs.org/@polkadot/wasm-crypto-wasm/-/wasm-crypto-wasm-7.2.1.tgz", - "integrity": "sha512-DqyXE4rSD0CVlLIw88B58+HHNyrvm+JAnYyuEDYZwCvzUWOCNos/DDg9wi/K39VAIsCCKDmwKqkkfIofuOj/lA==", - "dependencies": { - "@polkadot/wasm-util": "7.2.1", - "tslib": "^2.5.0" - }, - "engines": { - "node": ">=16" - }, - "peerDependencies": { - "@polkadot/util": "*" - } - }, - "node_modules/@polkadot/wasm-util": { - "version": "7.2.1", - "resolved": "https://registry.npmjs.org/@polkadot/wasm-util/-/wasm-util-7.2.1.tgz", - "integrity": "sha512-FBSn/3aYJzhN0sYAYhHB8y9JL8mVgxLy4M1kUXYbyo+8GLRQEN5rns8Vcb8TAlIzBWgVTOOptYBvxo0oj0h7Og==", - "dependencies": { - "tslib": "^2.5.0" - }, - "engines": { - "node": ">=16" - }, - "peerDependencies": { - "@polkadot/util": "*" - } - }, - "node_modules/@polkadot/x-bigint": { - "version": "12.3.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-bigint/-/x-bigint-12.3.2.tgz", - "integrity": "sha512-JLqLgfGXe/x+hZJETd5ZqfpVsbwyMsH5Nn1Q20ineMMjXN/ig+kVR8Mc15LXBMuw4g7LldFW6UUrotWnuMI8Yw==", - "dependencies": { - "@polkadot/x-global": "12.3.2", - "tslib": "^2.5.3" - }, - "engines": { - "node": ">=16" - } - }, - "node_modules/@polkadot/x-fetch": { - "version": "12.3.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-fetch/-/x-fetch-12.3.2.tgz", - "integrity": "sha512-3IEuZ5S+RI/t33NsdPLIIa5COfDCfpUW2sbaByEczn75aD1jLqJZSEDwiBniJ2osyNd4uUxBf6e5jw7LAZeZJg==", - "dependencies": { - "@polkadot/x-global": "12.3.2", - "node-fetch": "^3.3.1", - "tslib": "^2.5.3" - }, - "engines": { - "node": ">=16" - } - }, - "node_modules/@polkadot/x-global": { - "version": "12.3.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-global/-/x-global-12.3.2.tgz", - "integrity": "sha512-yVZq6oIegjlyh5rUZiTklgu+fL+W/DG1ypEa02683tUCB3avV5cA3PAHKptMSlb6FpweHu37lKKrqfAWrraDxg==", - "dependencies": { - "tslib": "^2.5.3" - }, - "engines": { - "node": ">=16" - } - }, - "node_modules/@polkadot/x-randomvalues": { - "version": "12.3.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-randomvalues/-/x-randomvalues-12.3.2.tgz", - "integrity": "sha512-ywjIs8CWpvOGmq+3cGCNPOHxAjPHdBUiXyDccftx5BRVdmtbt36gK/V84bKr6Xs73FGu0jprUAOSRRsLZX/3dg==", - "dependencies": { - "@polkadot/x-global": "12.3.2", - "tslib": "^2.5.3" - }, - "engines": { - "node": ">=16" - }, - "peerDependencies": { - "@polkadot/util": "12.3.2", - "@polkadot/wasm-util": "*" - } - }, - "node_modules/@polkadot/x-textdecoder": { - "version": "12.3.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-textdecoder/-/x-textdecoder-12.3.2.tgz", - "integrity": "sha512-lY5bfA5xArJRWEJlYOlQQMJeTjWD8s0yMhchirVgf5xj8Id9vPGeUoneH+VFDEwgXxrqBvDFJ4smN4T/r6a/fg==", - "dependencies": { - "@polkadot/x-global": "12.3.2", - "tslib": "^2.5.3" - }, - "engines": { - "node": ">=16" - } - }, - "node_modules/@polkadot/x-textencoder": { - "version": "12.3.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-textencoder/-/x-textencoder-12.3.2.tgz", - "integrity": "sha512-iP3qEBiHzBckQ9zeY7ZHRWuu7mCEg5SMpOugs6UODRk8sx6KHzGQYlghBbWLit0uppPDVE0ifEwZ2n73djJHWQ==", - "dependencies": { - "@polkadot/x-global": "12.3.2", - "tslib": "^2.5.3" - }, - "engines": { - "node": ">=16" - } - }, - "node_modules/@polkadot/x-ws": { - "version": "12.3.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-ws/-/x-ws-12.3.2.tgz", - "integrity": "sha512-yM9Z64pLNlHpJE43+Xtr+iUXmYpFFY5u5hrke2PJt13O48H8f9Vb9cRaIh94appLyICoS0aekGhDkGH+MCspBA==", - "dependencies": { - "@polkadot/x-global": "12.3.2", - "tslib": "^2.5.3", - "ws": "^8.13.0" - }, - "engines": { - "node": ">=16" - } - }, - "node_modules/@scure/base": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.1.tgz", - "integrity": "sha512-ZxOhsSyxYwLJj3pLZCefNitxsj093tb2vq90mp2txoYeBqbcjDjqFhyM8eUjq/uFm6zJ+mUuqxlS2FkuSY1MTA==", - "funding": [ - { - "type": "individual", - "url": "https://paulmillr.com/funding/" - } - ] - }, - "node_modules/@substrate/connect": { - "version": "0.7.26", - "resolved": "https://registry.npmjs.org/@substrate/connect/-/connect-0.7.26.tgz", - "integrity": "sha512-uuGSiroGuKWj1+38n1kY5HReer5iL9bRwPCzuoLtqAOmI1fGI0hsSI2LlNQMAbfRgr7VRHXOk5MTuQf5ulsFRw==", - "optional": true, - "dependencies": { - "@substrate/connect-extension-protocol": "^1.0.1", - "eventemitter3": "^4.0.7", - "smoldot": "1.0.4" - } - }, - "node_modules/@substrate/connect-extension-protocol": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@substrate/connect-extension-protocol/-/connect-extension-protocol-1.0.1.tgz", - "integrity": "sha512-161JhCC1csjH3GE5mPLEd7HbWtwNSPJBg3p1Ksz9SFlTzj/bgEwudiRN2y5i0MoLGCIJRYKyKGMxVnd29PzNjg==", - "optional": true - }, - "node_modules/@substrate/connect/node_modules/eventemitter3": { - "version": "4.0.7", - "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", - "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==", - "optional": true - }, - "node_modules/@substrate/ss58-registry": { - "version": "1.40.0", - "resolved": "https://registry.npmjs.org/@substrate/ss58-registry/-/ss58-registry-1.40.0.tgz", - "integrity": "sha512-QuU2nBql3J4KCnOWtWDw4n1K4JU0T79j54ZZvm/9nhsX6AIar13FyhsaBfs6QkJ2ixTQAnd7TocJIoJRWbqMZA==" - }, - "node_modules/@types/bn.js": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/@types/bn.js/-/bn.js-5.1.1.tgz", - "integrity": "sha512-qNrYbZqMx0uJAfKnKclPh+dTwK33KfLHYqtyODwd5HnXOjnkhc4qgn3BrK6RWyGZm5+sIFE7Q7Vz6QQtJB7w7g==", - "dependencies": { - "@types/node": "*" - } - }, - "node_modules/@types/node": { - "version": "20.3.1", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.3.1.tgz", - "integrity": "sha512-EhcH/wvidPy1WeML3TtYFGR83UzjxeWRen9V402T8aUGYsCHOmfoisV3ZSg03gAFIbLq8TnWOJ0f4cALtnSEUg==" - }, - "node_modules/bn.js": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", - "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==" - }, - "node_modules/data-uri-to-buffer": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-4.0.1.tgz", - "integrity": "sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A==", - "engines": { - "node": ">= 12" - } - }, - "node_modules/debug": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", - "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", - "dependencies": { - "ms": "2.1.2" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/eventemitter3": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.1.tgz", - "integrity": "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==" - }, - "node_modules/fetch-blob": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/fetch-blob/-/fetch-blob-3.2.0.tgz", - "integrity": "sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/jimmywarting" - }, - { - "type": "paypal", - "url": "https://paypal.me/jimmywarting" - } - ], - "dependencies": { - "node-domexception": "^1.0.0", - "web-streams-polyfill": "^3.0.3" - }, - "engines": { - "node": "^12.20 || >= 14.13" - } - }, - "node_modules/formdata-polyfill": { - "version": "4.0.10", - "resolved": "https://registry.npmjs.org/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz", - "integrity": "sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==", - "dependencies": { - "fetch-blob": "^3.1.2" - }, - "engines": { - "node": ">=12.20.0" - } - }, - "node_modules/json-stringify-safe": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", - "integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==" - }, - "node_modules/lodash": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" - }, - "node_modules/mock-socket": { - "version": "9.2.1", - "resolved": "https://registry.npmjs.org/mock-socket/-/mock-socket-9.2.1.tgz", - "integrity": "sha512-aw9F9T9G2zpGipLLhSNh6ZpgUyUl4frcVmRN08uE1NWPWg43Wx6+sGPDbQ7E5iFZZDJW5b5bypMeAEHqTbIFag==", - "engines": { - "node": ">= 8" - } - }, - "node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" - }, - "node_modules/nock": { - "version": "13.3.1", - "resolved": "https://registry.npmjs.org/nock/-/nock-13.3.1.tgz", - "integrity": "sha512-vHnopocZuI93p2ccivFyGuUfzjq2fxNyNurp7816mlT5V5HF4SzXu8lvLrVzBbNqzs+ODooZ6OksuSUNM7Njkw==", - "dependencies": { - "debug": "^4.1.0", - "json-stringify-safe": "^5.0.1", - "lodash": "^4.17.21", - "propagate": "^2.0.0" - }, - "engines": { - "node": ">= 10.13" - } - }, - "node_modules/node-domexception": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz", - "integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/jimmywarting" - }, - { - "type": "github", - "url": "https://paypal.me/jimmywarting" - } - ], - "engines": { - "node": ">=10.5.0" - } - }, - "node_modules/node-fetch": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-3.3.1.tgz", - "integrity": "sha512-cRVc/kyto/7E5shrWca1Wsea4y6tL9iYJE5FBCius3JQfb/4P4I295PfhgbJQBLTx6lATE4z+wK0rPM4VS2uow==", - "dependencies": { - "data-uri-to-buffer": "^4.0.0", - "fetch-blob": "^3.1.4", - "formdata-polyfill": "^4.0.10" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/node-fetch" - } - }, - "node_modules/pako": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/pako/-/pako-2.1.0.tgz", - "integrity": "sha512-w+eufiZ1WuJYgPXbV/PO3NCMEc3xqylkKHzp8bxp1uW4qaSNQUkwmLLEc3kKsfz8lpV1F8Ht3U1Cm+9Srog2ug==", - "optional": true - }, - "node_modules/propagate": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/propagate/-/propagate-2.0.1.tgz", - "integrity": "sha512-vGrhOavPSTz4QVNuBNdcNXePNdNMaO1xj9yBeH1ScQPjk/rhg9sSlCXPhMkFuaNNW/syTvYqsnbIJxMBfRbbag==", - "engines": { - "node": ">= 8" - } - }, - "node_modules/rxjs": { - "version": "7.8.1", - "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.1.tgz", - "integrity": "sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg==", - "dependencies": { - "tslib": "^2.1.0" - } - }, - "node_modules/smoldot": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/smoldot/-/smoldot-1.0.4.tgz", - "integrity": "sha512-N3TazI1C4GGrseFH/piWyZCCCRJTRx2QhDfrUKRT4SzILlW5m8ayZ3QTKICcz1C/536T9cbHHJyP7afxI6Mi1A==", - "optional": true, - "dependencies": { - "pako": "^2.0.4", - "ws": "^8.8.1" - } - }, - "node_modules/tslib": { - "version": "2.5.3", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.3.tgz", - "integrity": "sha512-mSxlJJwl3BMEQCUNnxXBU9jP4JBktcEGhURcPR6VQVlnP0FdDEsIaz0C35dXNGLyRfrATNofF0F5p2KPxQgB+w==" - }, - "node_modules/web-streams-polyfill": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.2.1.tgz", - "integrity": "sha512-e0MO3wdXWKrLbL0DgGnUV7WHVuw9OUvL4hjgnPkIeEvESk74gAITi5G606JtZPp39cd8HA9VQzCIvA49LpPN5Q==", - "engines": { - "node": ">= 8" - } - }, - "node_modules/ws": { - "version": "8.13.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz", - "integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==", - "engines": { - "node": ">=10.0.0" - }, - "peerDependencies": { - "bufferutil": "^4.0.1", - "utf-8-validate": ">=5.0.2" - }, - "peerDependenciesMeta": { - "bufferutil": { - "optional": true - }, - "utf-8-validate": { - "optional": true - } - } - } - } -} diff --git a/bucket/scripts/package.json b/bucket/scripts/package.json deleted file mode 100644 index bc305466..00000000 --- a/bucket/scripts/package.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "type": "module", - "dependencies": { - "@polkadot/api": "^10.9.1", - "@polkadot/api-contract": "^10.9.1", - "@polkadot/util-crypto": "^12.3.2" - } -} diff --git a/scripts/.gitignore b/scripts/.gitignore index 99600f94..87b5d6ff 100644 --- a/scripts/.gitignore +++ b/scripts/.gitignore @@ -1,2 +1,3 @@ node_modules -yarn-error.log \ No newline at end of file +yarn-error.log +secrets.txt \ No newline at end of file diff --git a/bucket/scripts/config.js b/scripts/ddc-setup/ddcConfig.js similarity index 99% rename from bucket/scripts/config.js rename to scripts/ddc-setup/ddcConfig.js index 0323cfe1..0517238f 100644 --- a/bucket/scripts/config.js +++ b/scripts/ddc-setup/ddcConfig.js @@ -1,6 +1,6 @@ const GEN = 0x10000000000000000n; // UINT64_MAX -export const config = { +module.exports = { devnet: { ws_provider: "wss://archive.devnet.cere.network/ws", contract_address: "6SfBsKbfPUTN35GCcqAHSMY4MemedK2A73VeJ34Z2FV6PB4r", diff --git a/scripts/ddc-setup/ddcSetup.js b/scripts/ddc-setup/ddcSetup.js new file mode 100644 index 00000000..eb3e99e3 --- /dev/null +++ b/scripts/ddc-setup/ddcSetup.js @@ -0,0 +1,147 @@ +const fs = require("fs"); +const { + connect, + accountFromUri, + sendTx, + getContract, + CERE, + MGAS, + ddcBucket, + randomAccount, + deploymentRegistry, + config +} = require("../sdk/src"); +const ddcConfig = require('./ddcConfig.js'); +const log = console.log; + +const DDC_BUCKET_CONTRACT_NAME = config.DDC_BUCKET_CONTRACT_NAME; +const INIT_ENV = process.env.INIT_ENV; +const SUPERADMIN_MNEMONIC = process.env.SUPERADMIN; + + +const ddcEnvConfig = ddcConfig[INIT_ENV]; +if (ddcEnvConfig === undefined) { + console.error("Please provide INIT_ENV as one of ", Object.keys(ddcConfig)); + process.exit(-1); +} +console.log(ddcEnvConfig); + +deploymentRegistry.initContract( + DDC_BUCKET_CONTRACT_NAME, + INIT_ENV, + ddcEnvConfig.contract_address +); + + +async function main() { + const {api, chainName, getExplorerUrl} = await connect(ddcEnvConfig.ws_provider); + log("Connected to blockchain:", chainName); + + const sadmin = accountFromUri(SUPERADMIN_MNEMONIC); + console.log(`Superadmin: ${sadmin.address}`); + + const bucketContract = getContract(DDC_BUCKET_CONTRACT_NAME, INIT_ENV, api); + log("Using bucket contract", DDC_BUCKET_CONTRACT_NAME, "at", bucketContract.address.toString()); + + const txOptions = { + storageDepositLimit: null, + gasLimit: 100_000_000_000n, + }; + + { + log("1. accountSetUsdPerCere"); + const tx = bucketContract.tx.accountSetUsdPerCere( + txOptions, + 1000n * CERE + ); + + const result = await sendTx(sadmin, tx); + log(getExplorerUrl(result), "\n"); + } + + { + log("2. grantTrustedManagerPermission"); + const tx = bucketContract.tx.grantTrustedManagerPermission( + txOptions, + sadmin.address + ); + const result = await sendTx(sadmin, tx); + log(getExplorerUrl(result), "\n"); + } + + const cdnNodesKeys = [] + { + console.log("3. cdnNodeCreate"); + for (let i = 0; i < ddcEnvConfig.cdn_node_params.length; i++) { + const cdnNodeKey = ddcEnvConfig.cdn_node_params[i].publicKey; + cdnNodesKeys.push(cdnNodeKey); + + const tx = bucketContract.tx.cdnNodeCreate( + txOptions, + cdnNodeKey, + JSON.stringify(ddcEnvConfig.cdn_node_params[i]) + ); + + const result = await sendTx(sadmin, tx); + log(getExplorerUrl(result), "\n"); + } + } + + const storageNodesKeys = [] + { + console.log("4. nodeCreate"); + for (let i = 0; i < ddcEnvConfig.storage_node_params.length; i++) { + const param = JSON.stringify(ddcEnvConfig.storage_node_params[i]); + const user = randomAccount(); + + fs.appendFileSync('secrets.txt', `${user.address}: ${user.mnemonic} -- ${INIT_ENV} storage ${i}\n`); + console.log(` node ${i}: address ${user.address}, param ${param}`); + + const storageNodeKey = user.address; + storageNodesKeys.push(storageNodeKey); + + const tx = bucketContract.tx.nodeCreate( + txOptions, + storageNodeKey, + param, + 100000n, + 1n * CERE + ); + + const result = await sendTx(sadmin, tx); + log(getExplorerUrl(result), "\n"); + } + } + + const clustersIds = []; + { + for (let key in ddcEnvConfig.cluster) { + console.log("5. clusterCreate "); + + const tx1 = bucketContract.tx.clusterCreate( + txOptions, + JSON.stringify(ddcEnvConfig.cluster[key].param) + ); + + const result1 = await sendTx(sadmin, tx1); + log(getExplorerUrl(result1), "\n"); + const { clusterId } = ddcBucket.findClusterCreatedEvent(result1.contractEvents); + clustersIds.push(clusterId); + + const tx2 = bucketContract.tx.clusterReserveResource( + txOptions, + clusterId, + 100000n + ); + const result2 = await sendTx(sadmin, tx2); + log(getExplorerUrl(result2), "\n"); + } + } + + // TODO: Add Storage nodes and CDN nodes to clusters + + process.exit(0); +} + + +main().then(log, log); \ No newline at end of file diff --git a/scripts/deployment/deploy.js b/scripts/deployment/deploy.js index db7ddbdb..f4c84976 100644 --- a/scripts/deployment/deploy.js +++ b/scripts/deployment/deploy.js @@ -30,7 +30,7 @@ const deployContract = async ( log("From account", account.address); if (maybeCodeHash) { - deploymentRegistry.initContracts(); + deploymentRegistry.initDefaultContracts(); } await deploy( diff --git a/scripts/examples/ddcBucketDemo.js b/scripts/examples/ddcBucketDemo.js index b02c6e61..2edcbc6b 100644 --- a/scripts/examples/ddcBucketDemo.js +++ b/scripts/examples/ddcBucketDemo.js @@ -19,7 +19,7 @@ const BUCKET_CONTRACT_NAME = config.DDC_BUCKET_CONTRACT_NAME; const SEED = config.ACTOR_SEED; const RPC = config.DEVNET_RPC_ENDPOINT; -deploymentRegistry.initContracts(); +deploymentRegistry.initDefaultContracts(); async function main() { const {api, chainName, getExplorerUrl} = await connect(RPC); diff --git a/scripts/examples/ddcBucketPrint.js b/scripts/examples/ddcBucketPrint.js index 2558f333..5d6e5530 100644 --- a/scripts/examples/ddcBucketPrint.js +++ b/scripts/examples/ddcBucketPrint.js @@ -13,7 +13,7 @@ const CONTRACT_NAME = config.DDC_BUCKET_CONTRACT_NAME; const RPC = config.DEVNET_RPC_ENDPOINT; const ACCOUNT_FILTER = null; // get data about all accounts. -deploymentRegistry.initContracts(); +deploymentRegistry.initDefaultContracts(); async function main() { const {api, chainName} = await connect(RPC); diff --git a/scripts/examples/ddcNftRegistryDemo.js b/scripts/examples/ddcNftRegistryDemo.js index c56f2743..26c6aa72 100644 --- a/scripts/examples/ddcNftRegistryDemo.js +++ b/scripts/examples/ddcNftRegistryDemo.js @@ -17,7 +17,7 @@ const NFT_REGISTRY_CONTRACT_NAME = config.DDC_NFT_REGISTRY_CONTRACT_NAME; const SEED = config.ACTOR_SEED; const RPC = config.DEVNET_RPC_ENDPOINT; -deploymentRegistry.initContracts(); +deploymentRegistry.initDefaultContracts(); async function main() { const {api, chainName, getExplorerUrl} = await connect(RPC); diff --git a/scripts/package.json b/scripts/package.json index d7122bb0..22eab1b1 100644 --- a/scripts/package.json +++ b/scripts/package.json @@ -9,6 +9,7 @@ "demo-nft-registry": "yarn ensure-deps && node examples/ddcNftRegistryDemo.js", "deploy-ddc-bucket": "yarn ensure-deps && node deployment/ddcBucketDeploy.js", "deploy-ddc-nft-registry": "yarn ensure-deps && node deployment/ddcNftRegistryDeploy.js", - "print-ddc-bucket": "yarn ensure-deps && node examples/ddcBucketPrint.js" + "print-ddc-bucket": "yarn ensure-deps && node examples/ddcBucketPrint.js", + "ddc-setup": "yarn ensure-deps && node ddc-setup/ddcSetup.js" } } \ No newline at end of file diff --git a/scripts/sdk/src/deploymentRegistry.js b/scripts/sdk/src/deploymentRegistry.js index de060568..96cd965a 100644 --- a/scripts/sdk/src/deploymentRegistry.js +++ b/scripts/sdk/src/deploymentRegistry.js @@ -5,7 +5,7 @@ const ddcBucketAbi = require("./abi/ddc_bucket.json"); const ddcNftRegistryAbi = require("./abi/ddc_nft_registry.json"); -function initContracts() { +function initDefaultContracts() { registerABI(config.DDC_BUCKET_CONTRACT_NAME, ddcBucketAbi); @@ -43,7 +43,16 @@ function initContracts() { } +function initContract(name, env, address) { + registerABI(name, ddcBucketAbi); + registerContract( + name, + env, + address + ); +} module.exports = { - initContracts, + initDefaultContracts, + initContract } diff --git a/scripts/sdk/src/polkadotWrappers.js b/scripts/sdk/src/polkadotWrappers.js index e36e6eb5..7151fc61 100644 --- a/scripts/sdk/src/polkadotWrappers.js +++ b/scripts/sdk/src/polkadotWrappers.js @@ -22,10 +22,15 @@ async function connect(rpcUrl) { } function randomAccount() { - const mnemonic = mnemonicGenerate(12); const keyring = new Keyring({type: 'sr25519'}); - const account =keyring.addFromMnemonic(mnemonic); - return account; + const mnemonic = mnemonicGenerate(12); + const account = keyring.addFromMnemonic(mnemonic); + + return { + account, + mnemonic, + address: account.address, + }; } function accountFromUri(uri) {