ethereum: remove wormhole from token name
This commit is contained in:
parent
5e855b2d2c
commit
a58c5ae950
|
@ -0,0 +1,16 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
curl --location --request GET 'https://eth-rpc-acala.aca-api.network/' \
|
||||||
|
--header 'Content-Type: application/json' \
|
||||||
|
--data-raw '{
|
||||||
|
"jsonrpc": "2.0",
|
||||||
|
"method": "eth_getEthGas",
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"gasLimit": 21000000,
|
||||||
|
"storageLimit": 64100
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"id": 1
|
||||||
|
}'
|
||||||
|
printf "\n"
|
|
@ -17,28 +17,27 @@ contract BridgeImplementation is Bridge {
|
||||||
|
|
||||||
function initialize() initializer public virtual {
|
function initialize() initializer public virtual {
|
||||||
// this function needs to be exposed for an upgrade to pass
|
// this function needs to be exposed for an upgrade to pass
|
||||||
uint8 finality;
|
address tokenContract;
|
||||||
uint16 chain = chainId();
|
uint16 chain = chainId();
|
||||||
|
|
||||||
// Wormhole chain ids explicitly enumerated
|
// Wormhole chain ids explicitly enumerated
|
||||||
if (chain == 2) { finality = 15; // ethereum
|
if (chain == 2) { tokenContract = 0x44bD47a8Bc18398227d6f40E1693Cf897bb9855E; // ethereum
|
||||||
} else if (chain == 4) { finality = 15; // bsc
|
} else if (chain == 4) { tokenContract = 0x1877a83023A87849D89a076466531b6a5DEa7eb2; // bsc
|
||||||
} else if (chain == 5) { finality = 15; // polygon
|
} else if (chain == 5) { tokenContract = 0xB9A1c8873a7a36c2Eb6D8c1A19702106CdAE6edd; // polygon
|
||||||
} else if (chain == 6) { finality = 1; // avalanche
|
} else if (chain == 6) { tokenContract = 0x276a65900C97A3726319742e74F75bC4f56A0BfD; // avalanche
|
||||||
} else if (chain == 7) { finality = 1; // oasis
|
} else if (chain == 7) { tokenContract = 0x95BeDdFba786Aa1A5b3294aa6166cB125B961e34; // oasis
|
||||||
} else if (chain == 9) { finality = 1; // aurora
|
} else if (chain == 9) { tokenContract = 0x1Cd0b07Dc82482f057b3cf19775e8453309c5356; // aurora
|
||||||
} else if (chain == 10) { finality = 1; // fantom
|
} else if (chain == 10) { tokenContract = 0x40D0A808241cafd9D70700963d205FeA9c0B1C9D; // fantom
|
||||||
} else if (chain == 11) { finality = 1; // karura
|
} else if (chain == 11) { tokenContract = 0x9002933919Aa83c38D01bDfBd788A9dfF42f3880; // karura
|
||||||
} else if (chain == 12) { finality = 1; // acala
|
// Acala EVM was down at the time of this migration
|
||||||
} else if (chain == 13) { finality = 1; // klaytn
|
// } else if (chain == 12) { tokenContract = 0x0000000000000000000000000000000000000000; // acala
|
||||||
} else if (chain == 14) { finality = 1; // celo
|
} else if (chain == 13) { tokenContract = 0xA7601785478622E720d41454CB390852cd2B9788; // klaytn
|
||||||
} else if (chain == 16) { finality = 1; // moonbeam
|
} else if (chain == 14) { tokenContract = 0xADE06bc75Dc1FC3fB7442e0CFb8Ca544B23aF789; // celo
|
||||||
} else if (chain == 17) { finality = 32; // neon
|
|
||||||
} else {
|
} else {
|
||||||
revert("Unknown chain id.");
|
revert("Unknown chain id.");
|
||||||
}
|
}
|
||||||
|
|
||||||
setFinality(finality);
|
setTokenImplementation(tokenContract);
|
||||||
}
|
}
|
||||||
|
|
||||||
modifier initializer() {
|
modifier initializer() {
|
||||||
|
|
|
@ -36,7 +36,7 @@ contract TokenImplementation is TokenState, Context {
|
||||||
}
|
}
|
||||||
|
|
||||||
function name() public view returns (string memory) {
|
function name() public view returns (string memory) {
|
||||||
return string(abi.encodePacked(_state.name, " (Wormhole)"));
|
return string(abi.encodePacked(_state.name));
|
||||||
}
|
}
|
||||||
|
|
||||||
function symbol() public view returns (string memory) {
|
function symbol() public view returns (string memory) {
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
// run with:
|
||||||
|
// npm run deploy-token-implementation-only
|
||||||
|
// e.g. Ethereum Mainnet
|
||||||
|
// INFURA_KEY="" MNEMONIC="" npm run deploy-token-implementation-only -- --network mainnet
|
||||||
|
// e.g. BSC
|
||||||
|
// MNEMONIC="" npm run deploy-token-implementation-only -- --network binance
|
||||||
|
// e.g. Polygon
|
||||||
|
// MNEMONIC="" npm run deploy-token-implementation-only -- --network polygon
|
||||||
|
const TokenImplementation = artifacts.require("TokenImplementation");
|
||||||
|
module.exports = async function(deployer, network) {
|
||||||
|
if (network === "test") return;
|
||||||
|
await deployer.deploy(TokenImplementation);
|
||||||
|
};
|
|
@ -23,6 +23,7 @@
|
||||||
"migrate": "mkdir -p build/contracts && cp node_modules/@openzeppelin/contracts/build/contracts/* build/contracts/ && truffle migrate --to 4",
|
"migrate": "mkdir -p build/contracts && cp node_modules/@openzeppelin/contracts/build/contracts/* build/contracts/ && truffle migrate --to 4",
|
||||||
"flatten": "mkdir -p node_modules/@poanet/solidity-flattener/contracts && cp -r contracts/* node_modules/@poanet/solidity-flattener/contracts/ && poa-solidity-flattener",
|
"flatten": "mkdir -p node_modules/@poanet/solidity-flattener/contracts && cp -r contracts/* node_modules/@poanet/solidity-flattener/contracts/ && poa-solidity-flattener",
|
||||||
"deploy-bridge-implementation-only": "mkdir -p build/contracts && cp node_modules/@openzeppelin/contracts/build/contracts/* build/contracts/ && truffle migrate --f 6 --to 6",
|
"deploy-bridge-implementation-only": "mkdir -p build/contracts && cp node_modules/@openzeppelin/contracts/build/contracts/* build/contracts/ && truffle migrate --f 6 --to 6",
|
||||||
|
"deploy-token-implementation-only": "mkdir -p build/contracts && cp node_modules/@openzeppelin/contracts/build/contracts/* build/contracts/ && truffle migrate --f 7 --to 7",
|
||||||
"deploy-read-only": "mkdir -p build/contracts && cp node_modules/@openzeppelin/contracts/build/contracts/* build/contracts/ && truffle migrate --f 1 --to 2",
|
"deploy-read-only": "mkdir -p build/contracts && cp node_modules/@openzeppelin/contracts/build/contracts/* build/contracts/ && truffle migrate --f 1 --to 2",
|
||||||
"deploy_weth9": "mkdir -p build/contracts && cp node_modules/@openzeppelin/contracts/build/contracts/* build/contracts/ && truffle migrate --f 9",
|
"deploy_weth9": "mkdir -p build/contracts && cp node_modules/@openzeppelin/contracts/build/contracts/* build/contracts/ && truffle migrate --f 9",
|
||||||
"deploy-batched-vaa-sender": "mkdir -p build/contracts && cp node_modules/@openzeppelin/contracts/build/contracts/* build/contracts/ && truffle migrate --f 10 --to 10",
|
"deploy-batched-vaa-sender": "mkdir -p build/contracts && cp node_modules/@openzeppelin/contracts/build/contracts/* build/contracts/ && truffle migrate --f 10 --to 10",
|
||||||
|
|
|
@ -248,8 +248,8 @@ contract("Bridge", function () {
|
||||||
// symbol (TT)
|
// symbol (TT)
|
||||||
assert.equal(log.payload.substr(74, 64), "5454000000000000000000000000000000000000000000000000000000000000")
|
assert.equal(log.payload.substr(74, 64), "5454000000000000000000000000000000000000000000000000000000000000")
|
||||||
|
|
||||||
// name (TestToken (Wormhole))
|
// name (TestToken)
|
||||||
assert.equal(log.payload.substr(138, 64), "54657374546f6b656e2028576f726d686f6c6529000000000000000000000000")
|
assert.equal(log.payload.substr(138, 64), "54657374546f6b656e0000000000000000000000000000000000000000000000")
|
||||||
})
|
})
|
||||||
|
|
||||||
it("should correctly deploy a wrapped asset for a token attestation", async function () {
|
it("should correctly deploy a wrapped asset for a token attestation", async function () {
|
||||||
|
@ -298,7 +298,7 @@ contract("Bridge", function () {
|
||||||
assert.equal(symbol, "TT");
|
assert.equal(symbol, "TT");
|
||||||
|
|
||||||
const name = await initializedWrappedAsset.methods.name().call();
|
const name = await initializedWrappedAsset.methods.name().call();
|
||||||
assert.equal(name, "TestToken (Wormhole)");
|
assert.equal(name, "TestToken");
|
||||||
|
|
||||||
const decimals = await initializedWrappedAsset.methods.decimals().call();
|
const decimals = await initializedWrappedAsset.methods.decimals().call();
|
||||||
assert.equal(decimals, 18);
|
assert.equal(decimals, 18);
|
||||||
|
@ -383,7 +383,7 @@ contract("Bridge", function () {
|
||||||
assert.equal(symbol, "UU");
|
assert.equal(symbol, "UU");
|
||||||
|
|
||||||
const name = await initializedWrappedAsset.methods.name().call();
|
const name = await initializedWrappedAsset.methods.name().call();
|
||||||
assert.equal(name, "Tree (Wormhole)");
|
assert.equal(name, "Tree");
|
||||||
|
|
||||||
const decimals = await initializedWrappedAsset.methods.decimals().call();
|
const decimals = await initializedWrappedAsset.methods.decimals().call();
|
||||||
assert.equal(decimals, 18);
|
assert.equal(decimals, 18);
|
||||||
|
|
Loading…
Reference in New Issue