From c59787d6daacd754f8d5fa1b3e779d5fafb04b7c Mon Sep 17 00:00:00 2001 From: Simon Warta Date: Sun, 9 Feb 2020 14:44:25 +0100 Subject: [PATCH] Instantiate ASH and BASH token contract --- scripts/cosm/deploy_erc20.js | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/scripts/cosm/deploy_erc20.js b/scripts/cosm/deploy_erc20.js index 6199806f..953f433b 100755 --- a/scripts/cosm/deploy_erc20.js +++ b/scripts/cosm/deploy_erc20.js @@ -88,7 +88,7 @@ async function main() { const codeId = Number.parseInt(codeIdAttr.value, 10); console.info(`Upload succeeded. Code ID is ${codeId}`); - const initMsg = { + const initMsgAsh = { decimals: 5, name: "Ash token", symbol: "ASH", @@ -103,16 +103,30 @@ async function main() { }, ], }; - const instantiationResult = await instantiateContract(client, pen, codeId, initMsg); - if (instantiationResult.code) { - throw new Error( - `Instantiation failed with code: ${instantiationResult.code}; log: '${instantiationResult.raw_log}'`, - ); + const initMsgBash = { + decimals: 0, + name: "Bash Token", + symbol: "BASH", + initial_balances: [ + { + address: faucetAddress, + amount: "999999999", + }, + { + address: unusedAccount, + amount: "42", + }, + ], + }; + for (const initMsg of [initMsgAsh, initMsgBash]) { + const initResult = await instantiateContract(client, pen, codeId, initMsg); + if (initResult.code) { + throw new Error(`Instantiation failed with code: ${initResult.code}; log: '${initResult.raw_log}'`); + } + const instantiationLogs = logs.parseLogs(initResult.logs); + const contractAddress = logs.findAttribute(instantiationLogs, "message", "contract_address").value; + console.info(`Contract instantiated for ${initMsg.symbol} at ${contractAddress}`); } - const instantiationLogs = logs.parseLogs(instantiationResult.logs); - const contractAddress = logs.findAttribute(instantiationLogs, "message", "contract_address").value; - - console.info(`Contract instantiated at ${contractAddress}`); } main().then(