Skip to content

Commit

Permalink
fix flatten file for xtoken bridge
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoch05 committed Apr 2, 2024
1 parent 9ed887e commit 6912f48
Show file tree
Hide file tree
Showing 16 changed files with 682 additions and 576 deletions.
2 changes: 1 addition & 1 deletion helix-contract/address/ln-dev.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"chains": {
"sepolia": {
"name": "sepolia",
"url": "https://rpc2.sepolia.org",
"url": "https://1rpc.io/sepolia",
"dao": "0x88a39B052d477CfdE47600a7C9950a441Ce61cb4",
"chainId": 11155111,
"lzChainId": 10161,
Expand Down
19 changes: 12 additions & 7 deletions helix-contract/address/ln-product.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,11 @@
"blastPoints": "0x2536FE9ab3F511540F2f9e2eC2A805005C3Dd800",
"deployer": "0x9bc1C7567DDBcaF2212185b6665D755d842d01E4",
"ormpPort": "0x0000000005d961F950adA391C1511c92bbc64D9F"
},
"ethereum": {
"name": "ethereum",
"url": "https://1rpc.io/eth",
"chainId": 1
}
},
"messagers": {
Expand Down Expand Up @@ -174,30 +179,30 @@
}
},
"ProxyAdmin": {
"common": "0x601dE3B81c7cE04BecE3b29e5cEe4F3251d250dB",
"others": "0x601dE3B81c7cE04BecE3b29e5cEe4F3251d250dB",
"blast": "0x7684389eAa307e25Af38A31873E31Cc3B513EE01",
"zkSync": "0xA0d8a3C04580a8503ed3Ff30deBb22B83EE615F4"
},
"LnOppositeBridgeLogic": {
"common": "0x90873fa1bbd028F22277567530A22E05f7721D37"
"others": "0x90873fa1bbd028F22277567530A22E05f7721D37"
},
"LnOppositeBridgeProxy": {
"common": "0x48d769d5C7ff75703cDd1543A1a2ed9bC9044A23"
"others": "0x48d769d5C7ff75703cDd1543A1a2ed9bC9044A23"
},
"LnDefaultBridgeLogic": {
"common": "0x8af688056c6614acb5A78c62e1f9f49022C0452f",
"others": "0x8af688056c6614acb5A78c62e1f9f49022C0452f",
"zkSync": "0xefD0DE72e407A55E9b624A91E6d5D6A0CE8490D1"
},
"LnDefaultBridgeProxy": {
"common": "0x94C614DAeFDbf151E1BB53d6A201ae5fF56A9337",
"others": "0x94C614DAeFDbf151E1BB53d6A201ae5fF56A9337",
"zkSync": "0x767Bc046c989f5e63683fB530f939DD34b91ceAC"
},
"LnV3BridgeLogic": {
"common": "0xdf383487CB33a3C78a884494e2456910d79d361c",
"others": "0xdf383487CB33a3C78a884494e2456910d79d361c",
"blast": "0x38f4fc6c734b7148e9c375e24bd868778efDb701"
},
"LnV3BridgeProxy": {
"common": "0xbA5D580B18b6436411562981e02c8A9aA1776D10",
"others": "0xbA5D580B18b6436411562981e02c8A9aA1776D10",
"blast": "0xB180D7DcB5CC161C862aD60442FA37527546cAFC"
},
"deployer": "0x80D4c766C5142D1313D531Afe7384D0D5E108Db3",
Expand Down
32 changes: 26 additions & 6 deletions helix-contract/deploy/deploy_xtoken_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const pangolinNetwork = {
url: "https://pangolin-rpc.darwinia.network",
dao: "0x88a39B052d477CfdE47600a7C9950a441Ce61cb4",
messager: "0xf7F461728DC89de5EF6615715678b5f5b12bb98A",
backing: "0x7E3105E3A13D55d824b6322cbD2049f098a097F6",
backing: "0x24f8a04F0cA0730F4b8eC3241F15aCc6b3f8Da0a",
guard: "0x4CA75992d2750BEC270731A72DfDedE6b9E71cC7",
chainid: 43
};
Expand All @@ -22,22 +22,42 @@ const sepoliaNetwork = {
url: "https://rpc-sepolia.rockx.com",
dao: "0x88a39B052d477CfdE47600a7C9950a441Ce61cb4",
messager: "0xf7F461728DC89de5EF6615715678b5f5b12bb98A",
issuing: "0x3B36c2Db4CC5E92Af015Eb572A1C95C95599a8bF",
issuing: "0x1aeC008Af5c604be3525d0bB70fFcc4D7281f30C",
guard: "0x4CA75992d2750BEC270731A72DfDedE6b9E71cC7",
chainid: 11155111
};

const darwiniaNetwork = {
name: "darwinia-dvm",
url: "https://rpc.darwinia.network",
dao: "0x88a39B052d477CfdE47600a7C9950a441Ce61cb4",
messager: "0x65Be094765731F394bc6d9DF53bDF3376F1Fc8B0",
backing: "0xa64D1c284280b22f921E7B2A55040C7bbfD4d9d0",
issuing: "0xf6372ab2d35B32156A19F2d2F23FA6dDeFBE58bd",
chainid: 46
};

const crabNetwork = {
name: "crab-dvm",
url: "https://crab-rpc.darwinia.network",
dao: "0x88a39B052d477CfdE47600a7C9950a441Ce61cb4",
messager: "0x65Be094765731F394bc6d9DF53bDF3376F1Fc8B0",
backing: "0xa64D1c284280b22f921E7B2A55040C7bbfD4d9d0",
issuing: "0xf6372ab2d35B32156A19F2d2F23FA6dDeFBE58bd",
chainid: 44
};

function wallet(url) {
const provider = new ethers.providers.JsonRpcProvider(url);
const wallet = new ethers.Wallet(privateKey, provider);
return wallet;
}

async function deploy() {
const backingNetwork = pangolinNetwork;
const issuingNetwork = sepoliaNetwork;
const walletBacking = wallet(pangolinNetwork.url);
const walletIssuing = wallet(sepoliaNetwork.url);
const backingNetwork = crabNetwork;
const issuingNetwork = darwiniaNetwork;
const walletBacking = wallet(backingNetwork.url);
const walletIssuing = wallet(issuingNetwork.url);

// connect messager
const backingMessager = await ethers.getContractAt("MsgportMessager", backingNetwork.messager, walletBacking);
Expand Down
10 changes: 5 additions & 5 deletions helix-contract/deploy/deploy_xtoken_convertor.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ function wallet(configure, network) {

// 2. deploy mapping token factory
async function main() {
const pathConfig = "./address/ln-dev.json";
const pathConfig = "./address/ln-product.json";
const configure = JSON.parse(
fs.readFileSync(pathConfig, "utf8")
);
const network = configure.chains['pangolin'];
const network = configure.chains['darwinia-dvm'];
const w = wallet(configure, network);

// deploy wtoken
Expand All @@ -38,9 +38,9 @@ async function main() {
console.log("wpring address", wtoken.address);
*/

const wtoken = "0x617E55f692FA2feFfdD5D9C513782A479cC1FF57";
const xtokenBacking = '0x7E3105E3A13D55d824b6322cbD2049f098a097F6';
const convertor = await deployxTokenConvertor(w, network.deployer, "xToken-Convertor-v1.0.0", wtoken, xtokenBacking);
const wtoken = "0xE7578598Aac020abFB918f33A20faD5B71d670b4";
const xtokenBacking = '0x2B496f19A420C02490dB859fefeCCD71eDc2c046';
const convertor = await deployxTokenConvertor(w, network.deployer, "xToken-Convertor-v3.0.2-ethereum", wtoken, xtokenBacking);
}

main()
Expand Down
11 changes: 7 additions & 4 deletions helix-contract/deploy/deploy_xtoken_logic.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,18 @@ function wallet(configure, network) {

// 2. deploy mapping token factory
async function main() {
const pathConfig = "./address/ln-dev.json";
const pathConfig = "./address/ln-product.json";
const configure = JSON.parse(
fs.readFileSync(pathConfig, "utf8")
);
const network = configure.chains['sepolia'];
const network = configure.chains['crab-dvm'];
const w = wallet(configure, network);

//const backingLogic = await deployxTokenBacking(w, network.deployer, "xTokenBacking-logic-v1.0.0");
const issuingLogic = await deployxTokenIssuing(w, network.deployer, "xTokenIssuing-logic-v1.0.0");
const backingLogic = await deployxTokenBacking(w, network.deployer, "xTokenBacking-logic-v3.0.2");
const issuingLogic = await deployxTokenIssuing(w, network.deployer, "xTokenIssuing-logic-v3.0.2");

// 0x846EB1FD04aCe26B1d4F1a435292b52f0Ba1febE
// 0x34a66e0e1F8Ba991EbF7dC66380DD053CEFc9964
}

main()
Expand Down
18 changes: 11 additions & 7 deletions helix-contract/deploy/deploy_xtoken_proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,26 @@ async function deployxTokenProxy(wallet, salt, dao, proxyAdminAddress, logicAddr
}

async function deploy() {
const pathConfig = "./address/ln-dev.json";
const env = 'product';
const chain = 'darwinia-dvm';
const pathConfig = `./address/ln-${env}.json`;
const configure = JSON.parse(
fs.readFileSync(pathConfig, "utf8")
);
const network = configure.chains['sepolia'];
const network = configure.chains[chain];
const w = wallet(configure, network);

const xTokenConfigPath = "./address/xtoken-dev.json";
const xTokenConfigPath = `./address/xtoken-${env}.json`;
const xTokenConfig = JSON.parse(
fs.readFileSync(xTokenConfigPath, "utf8")
);

//const backingLogic = xTokenConfig.backingLogic['pangolin'];
//await deployxTokenProxy(w, "xtoken-backing-1.0.0", network.dao, configure.ProxyAdmin.others, backingLogic, network.deployer);
const issuingLogic = xTokenConfig.issuingLogic['sepolia'];
await deployxTokenProxy(w, "xtoken-issuing-1.0.0", network.dao, configure.ProxyAdmin.others, issuingLogic, network.deployer);
const backingLogic = xTokenConfig.backingLogic[chain];
await deployxTokenProxy(w, "xtoken-backing-3.0.2-ethereum", network.dao, configure.ProxyAdmin.others, backingLogic, network.deployer);
//const issuingLogic = xTokenConfig.issuingLogic[chain];
//await deployxTokenProxy(w, "xtoken-issuing-3.0.2", network.dao, configure.ProxyAdmin.others, issuingLogic, network.deployer);
//0xa64D1c284280b22f921E7B2A55040C7bbfD4d9d0
//0xf6372ab2d35B32156A19F2d2F23FA6dDeFBE58bd
}

async function main() {
Expand Down
Loading

0 comments on commit 6912f48

Please sign in to comment.