Add staking contract to deployment

This commit is contained in:
Simon Warta 2020-05-22 13:45:23 +02:00
parent c70bf607c8
commit 833c0f64fa
4 changed files with 57 additions and 0 deletions

View File

@ -1,2 +1,3 @@
1f6285492e7ea00596ef472ba166cb96ac3f91d694cb8c8e15f7c023ac451947 cw-erc20.wasm
7c0e964c9a46f53af8a4097fbf45edf9670c1813b99f4ecb1084ccadb30de2fe cw-nameservice.wasm
0f08a890443dbf644f61a7dc3aa7b2a03e9d142dd1b718aa8b7f8a80b886bff1 staking.wasm

Binary file not shown.

55
scripts/wasmd/deploy_staking.js Executable file
View File

@ -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);
},
);

View File

@ -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"