diff --git a/cosmwasm/deploy-contract.js b/cosmwasm/deploy-contract.js index c695df53..6eb12758 100644 --- a/cosmwasm/deploy-contract.js +++ b/cosmwasm/deploy-contract.js @@ -368,9 +368,10 @@ const upload = (client, wallet, chainName, config, options) => { printInfo('Uploading contract binary'); return uploadContract(client, wallet, config, options) - .then(({ address, codeId }) => { + .then(({ address, codeId, usedSalt }) => { printInfo('Uploaded contract binary'); contractConfig.codeId = codeId; + contractConfig.salt = usedSalt; if (!address) { return; diff --git a/cosmwasm/utils.js b/cosmwasm/utils.js index adf37c55..ea2e33d0 100644 --- a/cosmwasm/utils.js +++ b/cosmwasm/utils.js @@ -35,20 +35,21 @@ const uploadContract = async (client, wallet, config, options) => { return client.upload(account.address, wasm, uploadFee).then(({ checksum, codeId }) => ({ checksum, codeId, account })); }) .then(({ account, checksum, codeId }) => { + const usedSalt = salt || contractName.concat(chainNames); const address = instantiate2 ? instantiate2Address( fromHex(checksum), account.address, - fromHex(getSaltFromKey(salt || contractName.concat(chainNames))), + fromHex(getSaltFromKey(usedSalt)), 'axelar', ) : null; - return { codeId, address }; + return { codeId, address, usedSalt }; }); }; -const instantiateContract = (client, wallet, initMsg, config, { contractName, salt, instantiate2, chainNames, admin }) => { +const instantiateContract = (client, wallet, initMsg, config, { contractName, instantiate2, admin }) => { return wallet .getAccounts() .then(([account]) => { @@ -63,7 +64,7 @@ const instantiateContract = (client, wallet, initMsg, config, { contractName, sa ? client.instantiate2( account.address, contractConfig.codeId, - fromHex(getSaltFromKey(salt || contractName.concat(chainNames))), + contractConfig.salt, initMsg, contractName, initFee,