diff --git a/scripts/wasmd/contracts/checksums.sha256 b/scripts/wasmd/contracts/checksums.sha256 index 119ff0b5..623f51f3 100644 --- a/scripts/wasmd/contracts/checksums.sha256 +++ b/scripts/wasmd/contracts/checksums.sha256 @@ -1,2 +1,3 @@ 1f6285492e7ea00596ef472ba166cb96ac3f91d694cb8c8e15f7c023ac451947 cw-erc20.wasm 7c0e964c9a46f53af8a4097fbf45edf9670c1813b99f4ecb1084ccadb30de2fe cw-nameservice.wasm +0f08a890443dbf644f61a7dc3aa7b2a03e9d142dd1b718aa8b7f8a80b886bff1 staking.wasm diff --git a/scripts/wasmd/contracts/staking.wasm b/scripts/wasmd/contracts/staking.wasm new file mode 100644 index 00000000..332510ea Binary files /dev/null and b/scripts/wasmd/contracts/staking.wasm differ diff --git a/scripts/wasmd/deploy_staking.js b/scripts/wasmd/deploy_staking.js new file mode 100755 index 00000000..b102d744 --- /dev/null +++ b/scripts/wasmd/deploy_staking.js @@ -0,0 +1,55 @@ +#!/usr/bin/env node + +/* eslint-disable @typescript-eslint/camelcase */ +const { SigningCosmWasmClient, Secp256k1Pen } = require("@cosmwasm/sdk"); +const fs = require("fs"); + +const httpUrl = "http://localhost:1317"; +const faucet = { + mnemonic: + "economy stock theory fatal elder harbor betray wasp final emotion task crumble siren bottom lizard educate guess current outdoor pair theory focus wife stone", + address: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6", +}; + +const codeMeta = { + source: "", // not intended to be published + builder: "cosmwasm/rust-optimizer:0.8.0", +}; + +const bounty = { + label: "Bounty", + initMsg: { + name: "Bounty", + symbol: "BOUNTY", + decimals: 3, + validator: "cosmosvaloper1ea5cpmcj2vf5d0xwurncx7zdnmkuc6eq696h9a", // cosmosvaloper17mggn4znyeyg25wd7498qxl7r2jhgue8u4qjcq + exit_tax: "0.005", // 0.5 % + min_withdrawal: "7", + }, +}; + +async function main() { + const pen = await Secp256k1Pen.fromMnemonic(faucet.mnemonic); + const client = new SigningCosmWasmClient(httpUrl, faucet.address, (signBytes) => pen.sign(signBytes)); + + const wasm = fs.readFileSync(__dirname + "/contracts/staking.wasm"); + const uploadReceipt = await client.upload(wasm, codeMeta, "Upload Staking code"); + console.info(`Upload succeeded. Receipt: ${JSON.stringify(uploadReceipt)}`); + + for (const { label, initMsg } of [bounty]) { + const memo = `Create an staking instance "${label}"`; + const { contractAddress } = await client.instantiate(uploadReceipt.codeId, initMsg, label, memo); + console.info(`Contract "${label}" instantiated at ${contractAddress}`); + } +} + +main().then( + () => { + console.info("Done deploying staking instances."); + process.exit(0); + }, + (error) => { + console.error(error); + process.exit(1); + }, +); diff --git a/scripts/wasmd/init.sh b/scripts/wasmd/init.sh index 389f3725..eeba36fb 100755 --- a/scripts/wasmd/init.sh +++ b/scripts/wasmd/init.sh @@ -11,3 +11,4 @@ echo "Okay, thank you for your patience." SCRIPT_DIR="$(realpath "$(dirname "$0")")" "$SCRIPT_DIR/deploy_erc20.js" "$SCRIPT_DIR/deploy_nameservice.js" +"$SCRIPT_DIR/deploy_staking.js"