Fix registerChain
This commit is contained in:
parent
6b2e573558
commit
6708487721
2
Makefile
2
Makefile
|
@ -33,7 +33,7 @@ sdk/js/src/icco/__tests__/tilt.json:
|
||||||
## Deploy Contracts to Tilt
|
## Deploy Contracts to Tilt
|
||||||
tilt-deploy: ethereum terra
|
tilt-deploy: ethereum terra
|
||||||
@if ! pgrep tilt; then echo "Error: tilt not running. Start it before running tests"; exit 1; fi
|
@if ! pgrep tilt; then echo "Error: tilt not running. Start it before running tests"; exit 1; fi
|
||||||
cd ethereum && make tilt-deploy
|
cd ethereum && make tilt-deploy && npx truffle exec scripts/register_tilt_contributors.js --network eth_devnet
|
||||||
# cd terra && make terrad-deploy
|
# cd terra && make terrad-deploy
|
||||||
# cd ethereum && node scripts/
|
# cd ethereum && node scripts/
|
||||||
|
|
||||||
|
|
|
@ -5,25 +5,30 @@ const elliptic = require("elliptic");
|
||||||
const TokenSaleConductor = artifacts.require("TokenSaleConductor");
|
const TokenSaleConductor = artifacts.require("TokenSaleConductor");
|
||||||
const TokenSaleContributor = artifacts.require("TokenSaleContributor");
|
const TokenSaleContributor = artifacts.require("TokenSaleContributor");
|
||||||
|
|
||||||
//sdk.setDefaultWasm("node");
|
|
||||||
|
|
||||||
const ConductorImplementationFullABI = jsonfile.readFileSync(
|
const ConductorImplementationFullABI = jsonfile.readFileSync(
|
||||||
"../build/contracts/ConductorImplementation.json"
|
"../build/contracts/ConductorImplementation.json"
|
||||||
).abi;
|
).abi;
|
||||||
|
|
||||||
|
const fs = require("fs");
|
||||||
|
|
||||||
|
const tilt = JSON.parse(
|
||||||
|
fs.readFileSync(`${__dirname}/../../tilt.json`, "utf8")
|
||||||
|
);
|
||||||
|
|
||||||
module.exports = async function(callback) {
|
module.exports = async function(callback) {
|
||||||
try {
|
try {
|
||||||
const emitters = new Map();
|
const emitters = new Map();
|
||||||
{
|
{
|
||||||
|
// TODO: grab this from the tilt.json file...
|
||||||
// const solanaProgAddr = "22mamxmojFWBdbGqaxTH46HBAgAY2bJRiGJJHfNRNQ95"; //TBD Not used, because I could not get WH sdk to be available in tilt.
|
// const solanaProgAddr = "22mamxmojFWBdbGqaxTH46HBAgAY2bJRiGJJHfNRNQ95"; //TBD Not used, because I could not get WH sdk to be available in tilt.
|
||||||
const solanaEmitterAddr =
|
const solanaEmitterAddr =
|
||||||
"0xaeab35a8d36bbaad38154ca4ca6a0770e7009326316d59ef2c8a2123e90d174c"; // Derived from solanaProgAddr using await sdk.getEmitterAddressSolana(..);
|
"0xaeab35a8d36bbaad38154ca4ca6a0770e7009326316d59ef2c8a2123e90d174c"; // Derived from solanaProgAddr using await sdk.getEmitterAddressSolana(..);
|
||||||
|
|
||||||
// Build chainId -> ContributorAddr map.
|
// Build chainId -> ContributorAddr map.
|
||||||
const ethEmitterAddress =
|
const ethEmitterAddress =
|
||||||
"0x000000000000000000000000" + TokenSaleContributor.address.substr(2);
|
"0x000000000000000000000000" + tilt.ethContributorAddress.substring(2);
|
||||||
const bscEmitterAddress =
|
const bscEmitterAddress =
|
||||||
"0x000000000000000000000000" + TokenSaleContributor.address.substr(2);
|
"0x000000000000000000000000" + tilt.bscContributorAddress.substring(2);
|
||||||
emitters.set(1, solanaEmitterAddr);
|
emitters.set(1, solanaEmitterAddr);
|
||||||
emitters.set(2, ethEmitterAddress);
|
emitters.set(2, ethEmitterAddress);
|
||||||
emitters.set(4, bscEmitterAddress);
|
emitters.set(4, bscEmitterAddress);
|
||||||
|
@ -50,4 +55,4 @@ module.exports = async function(callback) {
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
callback(e);
|
callback(e);
|
||||||
}
|
}
|
||||||
};
|
};
|
|
@ -1,13 +1,18 @@
|
||||||
import { ethers } from "ethers";
|
import { ethers } from "ethers";
|
||||||
|
import { ChainId } from "@certusone/wormhole-sdk";
|
||||||
|
|
||||||
import { Conductor__factory } from "../ethers-contracts";
|
import { Conductor__factory } from "../ethers-contracts";
|
||||||
|
|
||||||
export async function registerChainOnEth(
|
export async function registerChainOnEth(
|
||||||
conductorAddress: string,
|
conductorAddress: string,
|
||||||
signedVaa: Uint8Array,
|
contributorChain: ChainId,
|
||||||
|
contributorAddress: Uint8Array,
|
||||||
wallet: ethers.Wallet
|
wallet: ethers.Wallet
|
||||||
): Promise<ethers.ContractReceipt> {
|
): Promise<ethers.ContractReceipt> {
|
||||||
const contributor = Conductor__factory.connect(conductorAddress, wallet);
|
const contributor = Conductor__factory.connect(conductorAddress, wallet);
|
||||||
const tx = await contributor.registerChain(signedVaa);
|
const tx = await contributor.registerChain(
|
||||||
|
contributorChain,
|
||||||
|
contributorAddress
|
||||||
|
);
|
||||||
return tx.wait();
|
return tx.wait();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue