Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: merge to Goerli testnet #103

Open
wants to merge 31 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
dcbf41d
upgrade contracts
lightsing Nov 16, 2021
357feef
upgrade blockscout
lightsing Nov 16, 2021
e2adb75
upgrade regnbue-bridge
lightsing Nov 16, 2021
bef187d
add faucet as submodule
lightsing Nov 16, 2021
15de4dd
upgrade contracts and faucet
lightsing Nov 16, 2021
b6bf5de
deploy tokens and minor changes
lightsing Nov 16, 2021
8027cc0
add exchange migration sql generation
lightsing Nov 17, 2021
948740d
update blockscout
lightsing Nov 17, 2021
87ca771
reorder startup seq
lightsing Nov 17, 2021
0faae15
add goerli deploy
lightsing Nov 18, 2021
ee45d18
add misc scripts
lightsing Nov 23, 2021
a4f6282
add eth_listener
lightsing Nov 23, 2021
5c43ea3
upgrade contracts
lightsing Nov 23, 2021
ba5484f
upgrade listener
lightsing Nov 23, 2021
c9f00e6
update submodule
lightsing Nov 30, 2021
49641bc
increaseAllowance
lightsing Dec 8, 2021
6885671
run misc
lightsing Dec 8, 2021
60ef9cd
update eth_listener
lightsing Dec 13, 2021
edcb6ae
update
lightsing Dec 15, 2021
8fdcf72
update
lightsing Dec 16, 2021
751dd39
add gen_config
lightsing Dec 16, 2021
fdeadc0
write back
lightsing Dec 16, 2021
b323b9b
add into run.sh
lightsing Dec 16, 2021
56deec4
fix typo
lightsing Dec 16, 2021
edaa1b0
disable conurrent transcation
lightsing Dec 16, 2021
9ba5579
re-point to master
lightsing Dec 23, 2021
f40ca6a
update regnbue-bridge
lightsing Dec 23, 2021
a0628b3
add env preset
lightsing Dec 23, 2021
94db465
update README
lightsing Dec 23, 2021
d51acd1
Merge remote-tracking branch 'origin/master' into feat/goerli
lightsing Dec 23, 2021
44bb51e
change rev
0xmountaintop Dec 24, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,9 @@
[submodule "blockscout"]
path = blockscout
url = git@github.com:fluidex/blockscout.git
[submodule "faucet"]
path = faucet
url = git@github.com:fluidex/faucet.git
[submodule "eth_listener"]
path = eth_listener
url = https://github.com/fluidex/eth_listener
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ Ubuntu 20.04 is the only supported environment currently. You could speed up the
# including rust / docker / docker-compose / nodejs etc.
$ bash scripts/install_all.sh

# set the keystore path and password env in `goerli.env` to test on goerli
$ source goerli.env

# compile zk circuits and setup circuits locally
# start databases and message queue with docker compose
# and launch all the services
Expand Down Expand Up @@ -71,6 +74,7 @@ set env `DX_CLEAN` with `false` (case insensitive) to skip data purging stage wh
# TODOs

* Data availability. And change original inputs as private, then use their hash as the (single) public input.
* Local dev-net might be broken cause by recent changes (move to goerli).

# Known Issues

Expand Down
2 changes: 1 addition & 1 deletion blockscout
Submodule blockscout updated 35 files
+1 −0 .gitignore
+29 −1 README.md
+57 −5 docker/docker-compose.yaml
+5 −0 docker/static-nodes.json
+5 −0 geth/bootstrap/Dockerfile
+13 −0 geth/bootstrap/entrypoint.sh
+13 −0 geth/sealer/Dockerfile
+23 −0 geth/sealer/entrypoint.sh
+859 −0 geth/sealer/genesis.json
+1 −0 geth/sealer/keystore/0x06a73506e9d3f6203b6064bc08c27b37c45f2a8e.json
+1 −0 geth/sealer/keystore/0x0bf3dabd2960e57c2c2080d617942575d3b44ef0.json
+1 −0 geth/sealer/keystore/0x1162f9fcf3fe109b7b0d0ccb80053ede60b87264.json
+1 −0 geth/sealer/keystore/0x1267596f9b2ef01999ce2016344fbdeb981ebc31.json
+1 −0 geth/sealer/keystore/0x1ddf3877af5e7fcbf8d2c4f2bbe93fe1290c8e39.json
+1 −0 geth/sealer/keystore/0x2917bdc1b6b1c6e8d1bdf44e2667b0db0dfaa913.json
+1 −0 geth/sealer/keystore/0x3577c97da04a1cf179bcf651cb41fbdd1b3e4e43.json
+1 −0 geth/sealer/keystore/0x4c8aaf5fa16383ece728f87215944282c0b3df5e.json
+1 −0 geth/sealer/keystore/0x6322d578540162df9d0a6246a3cfafd09869a648.json
+1 −0 geth/sealer/keystore/0x7c839332996f0e40fe3bdaa41b5bd8236aba1569.json
+1 −0 geth/sealer/keystore/0x8044095db5ad1bb91ed9e3fc60d009995b0d3ca2.json
+1 −0 geth/sealer/keystore/0x808a44f3f9a43fbd46335dbe42c73a2db36bcee2.json
+1 −0 geth/sealer/keystore/0x82450858794895daac528c3031aa09f4348302f3.json
+1 −0 geth/sealer/keystore/0x8703a2a49f7bb2c1015d99f46d7c14d4be2b9edd.json
+1 −0 geth/sealer/keystore/0x9637408a4d7553a59c8a9809c3174cdf4ad48d1f.json
+1 −0 geth/sealer/keystore/0xcc763a4eabe1ea0629cec5dd8789bd80f5f2b8e2.json
+1 −0 geth/sealer/keystore/0xd684c78b000c036e9cefd493fce68a16aed7cac3.json
+1 −0 geth/sealer/keystore/0xe01b335ba44a028d73ba1b7f957eb6b25be539a4.json
+1 −0 geth/sealer/keystore/0xe70632a1af6d02f8b289c840a255921fb85b3aba.json
+1 −0 geth/sealer/keystore/0xf12a0fc715f214d0fc8b8b9fcd3236bbc849a1e6.json
+1 −0 geth/sealer/keystore/0xf3e6f862844c9b2bc064485e657636761ebddd42.json
+1 −0 geth/sealer/keystore/0xf65288232d80f1e4325d8dd5a0b82f4ac67b2bab.json
+1 −0 geth/sealer/password
+1 −0 geth/sealer/sealer1.key
+1 −0 geth/sealer/sealer2.key
+1 −0 geth/sealer/sealer3.key
1 change: 1 addition & 0 deletions eth_listener
Submodule eth_listener added at 7fc77c
1 change: 1 addition & 0 deletions faucet
Submodule faucet added at e281c0
5 changes: 5 additions & 0 deletions goerli.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export WEB3_URL='https://goerli.infura.io/v3/591481dbcf78432fa0786256ff0ef929'
export DX_NETWORK=goerli
export CHAIN_ID=5
export KEYSTORE_PATH=''
export KEYSTORE_PASSWORD=''
1 change: 1 addition & 0 deletions misc/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/node_modules
20 changes: 20 additions & 0 deletions misc/accounts.jsonl
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{"account_id":0,"mnemonic":"ready relief cabbage liar nation leisure genuine wolf juice logic scale bridge drill word leader leader gossip shrug enough kangaroo knock educate merry secret","priv_key":"0x46e2acccb36d276fd357b2928c95210ada30e551a0e7791302d8e9735dc4a779","eth_addr":"0x452aC94C662F4Bc2b29f3689E38D8E45884b35ee"}
{"account_id":1,"mnemonic":"olympic comfort palm large heavy verb acid lion attract vast dash memory olympic syrup announce sure body cruise flip merge fabric frame question result","priv_key":"0x977e9bb2a7c13351c149b26784081882673741d8616c79feeb472b6378fed81d","eth_addr":"0x6286d0A2FC1d4C12a4ACc274018b401c68157Fdb"}
{"account_id":2,"mnemonic":"mixture latin cage defense recipe mention rather pledge fix sea casino start fluid final place exhibit enroll clarify salad mobile recipe ask buyer assume","priv_key":"0xa2ef80f6d150a3f7e64a4f2fe3193a84fed24f932f0e59a50f990ece39679135","eth_addr":"0xf40e08F651f2f7f96f5602114E5A77F1A7BEeA5d"}
{"account_id":3,"mnemonic":"zone steel market aunt chimney galaxy imitate sibling divide sister until front tail blush source maze equal globe include weather any reason fault awful","priv_key":"0x4434f4547080599945b6b171739e754f7a5ae93855ba933b991c4e7b3ef57339","eth_addr":"0xeD94298D30812327f22fA01cA9fAABAead2440Af"}
{"account_id":4,"mnemonic":"also sausage kite amused mercy joke genius pioneer trash woman blush never afraid trim laptop maid bike museum reform spring pretty brand retreat shaft","priv_key":"0x940cdded1e7c8a2284c68fe75586564e956144dbb7cf0ee198ad120bbf997168","eth_addr":"0xc79030AFa00571BdA193846ff5B1F10bC1cf9a1E"}
{"account_id":5,"mnemonic":"space boy neck venue govern flag prefer busy convince uncle gold figure chief degree park hand dose vintage tide scare exotic distance february wash","priv_key":"0x160276a92fce4c44039c24471f4c3ca7cacab358094ecd1b4863897eb2bcdba7","eth_addr":"0xec9C8B21a9f8e5Eb22373eDf7D0860Df0b98EBa5"}
{"account_id":6,"mnemonic":"mention notable lady spin meadow fiber rare member comic drastic dwarf phone prevent dizzy lesson noise post butter pilot case virus animal entire safe","priv_key":"0xd33e3c7db96471ad4b3a34504a43cbed773dc5a6a21bd5acdcac7cba5aa06cce","eth_addr":"0x92f9a57b427Ee5D7599D12CeBae3f3F4f89C7392"}
{"account_id":7,"mnemonic":"boost route aisle brother disorder squeeze tuna bridge purchase aunt acid liberty pen topple end lunch suffer favorite wear essence donkey scatter unaware taste","priv_key":"0x81946fe3c8c92e3f8b3b15ded2ec94bd227493c81240a773d2866d46ba34d79d","eth_addr":"0xB0660beF4DBF9e28eB422D46F3844CB41cc24717"}
{"account_id":8,"mnemonic":"embark music govern stick clarify settle tent adapt dragon rubber keep few fashion casino eagle text denial mule survey fitness wonder wonder basic upset","priv_key":"0xce1489b4675348244d15e0369f7a848befb1257f6d51196d9e9d9b1209c19a7e","eth_addr":"0x94c8C37116Df235bF56A3F9C4cbdd1b6a43F3af0"}
{"account_id":9,"mnemonic":"bread regret similar crack hero exercise day then corn verify vocal refuse spy endless second split canoe horse slice trip soccer bench sausage candy","priv_key":"0xbc66c297a75dba2e94790145fbc11b8aca5506ee6189f4733f50d8435a96e4e1","eth_addr":"0x3705EE1c0BcaEBd05c1FC971A2e3931a8D1BE77A"}
{"account_id":10,"mnemonic":"artefact wood town zoo tiny isolate typical salad always choice mesh tool explain sign fence ghost peasant dragon rebel chef payment must real sadness","priv_key":"0x005c149d49d661b95c4e5ba042cdd8b8e9e5593842c3d317a2f46568b3afcf02","eth_addr":"0xe9206889b78E5b339853a1F08bE7E5295aAf9Db3"}
{"account_id":11,"mnemonic":"whisper mountain upset upper tragic elegant grace veteran increase indoor copy teach antenna glue gauge fury concert cream swear clay fetch safe van hawk","priv_key":"0x709efe9f80cb5196cb0485c52b4df52d3467e03e1b1a1efd6d0c29d38b5fad95","eth_addr":"0x550df4b307884A751a6c60947126D3EB3D36D476"}
{"account_id":12,"mnemonic":"worth program ostrich fame one track shoot eternal grunt transfer broccoli oval legal more member tenant cheap barrel idea tuna live kit detail husband","priv_key":"0x262ac634a06fe4bdf28093d9cd330efa661f0e323663923ab5464f66d127156f","eth_addr":"0xfD2F21Af21bd9901A55F95f53911F99B0f4d961D"}
{"account_id":13,"mnemonic":"degree cabin section turtle history aspect credit subway vicious erase tip meadow remove salute fine welcome drum share speed era patrol stock right vicious","priv_key":"0x6477d1fbdc97591c2d2c54541ae3a09dd1b19ad20921c91c5ddcfbc0f53c9b8d","eth_addr":"0x9ddB77695AB6F5289f71889F8A1FcfF3Bb881769"}
{"account_id":14,"mnemonic":"tiger base process wealth depend suggest horse above expose forget oak basic leave hope curious stuff engine praise moon road endless arch mesh interest","priv_key":"0x4e0c4cebc1456ef8cf20d93edc757c6d3c973cee924582b1580d698dcecc06dc","eth_addr":"0x616B71Cbcd8006F577673960700CB1811C2C4775"}
{"account_id":15,"mnemonic":"verb anchor host hand actor pull patrol wear gossip enough bamboo horn cycle festival picture unfair target vault reduce eyebrow miss lucky orange guide","priv_key":"0x7105836e5d903f273075ab50429c36c08afb0b786986c3612b522bf59bcecc20","eth_addr":"0xfD4f6976e084CbBC8Dee5956B09bF32f94786eb9"}
{"account_id":16,"mnemonic":"sound select report rug run cave provide index grief foster bar someone garage donate nominee crew once oil sausage flight tail holiday style afford","priv_key":"0xcd73077a9bb493ada626df70a3ebcd6a4df420be1870524b7ae4176596884aba","eth_addr":"0x7e99AE2709D761FBc3B3a23e0c0874Ba4aBBF229"}
{"account_id":17,"mnemonic":"extra glove demise parade space april fashion mixture section barrel prize emerge flip sight pride swift beyond fresh check never scene ring anchor hazard","priv_key":"0x4976112050d262bfa62f56a12892590eb912f78c9b6a2df5098070940c72288e","eth_addr":"0x63C8C465dC4bb57723b2EC78Cb2aD50a2C804b1a"}
{"account_id":18,"mnemonic":"camp awful sand include refuse cash reveal mystery pupil salad length plunge square admit vocal draft found side same clock hurt length say figure","priv_key":"0x8d3aa186bd7ff3a72dd7f7367b4f893dc7758c5154596a9b2a7b1c10bf8750b7","eth_addr":"0x09C4Ad711EfB0B9c4D3D9133b56c5Ab6DD1B4CD0"}
{"account_id":19,"mnemonic":"chat cabin first fit zero avoid engine screen guitar young wool later occur element enroll amount brush melody seminar believe gossip alpha pool inch","priv_key":"0x5ee6b5badcda025167c8bccb0044d0df416dbae910b8bea5726145de3e9cf3ad","eth_addr":"0xd889eec15E43E9FfD49ae05fC131a8B374D3BDEb"}
13 changes: 13 additions & 0 deletions misc/accounts.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
let accounts = require("fs").readFileSync("./accounts.jsonl", "utf-8").split("\n").filter(Boolean).map(JSON.parse);

interface Account {
account_id: number,
mnemonic: string,
priv_key: string,
eth_addr: string,
}

export function getTestAccount(id: number): Account {
let a = accounts[id];
return a;
}
21 changes: 21 additions & 0 deletions misc/gen_config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import * as fs from 'fs';
import secrets from '../contracts/secrets.json';
import tokens from '/tmp/tokens.json';
import deployed from '/tmp/deployed.json';

async function main() {
const listener_template = fs.readFileSync('../eth_listener/config.toml.template', 'utf-8');
const NETWORK = process.env.DX_NETWORK ?? "geth";
const INFRUA_API_KEY = secrets.infuraApiKey;
const CONTRACT_ADDRESS = deployed.FluiDexDelegate;
const INNER_CONTRACT_ADDRESS = deployed.FluiDexDemo;
const BASE_BLOCK = deployed.baseBlock;
fs.writeFileSync("../eth_listener/config.toml", eval("`" + listener_template + "`"));
}

main()
.then(() => process.exit(0))
.catch(error => {
console.error(error);
process.exit(1);
});
59 changes: 59 additions & 0 deletions misc/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import { assert } from 'console';
import { ethers } from 'ethers';
import { Account } from 'fluidex.js';
import { getTestAccount } from './accounts';

import { abi as fluidexAbi } from '../contracts/artifacts/contracts/IFluiDexDelegate.sol/IFluiDexDelegate.json';
import { abi as tokenAbi } from '../faucet/layer1/contracts/artifacts/contracts/ERC20Token.sol/ERC20Token.json';
import { infuraApiKey } from '../contracts/secrets.json';
import tokens from '/tmp/tokens.json';
import deployed from '/tmp/deployed.json';

const amount = 5e11;
const fluidexDelegateAddr = deployed.FluiDexDelegate;
// const fluidexAddr = deployed.FluiDexDemo;

async function main() {
const provider = new ethers.providers.InfuraProvider('goerli', infuraApiKey);
let erc20Txs = new Array();
for (let i = 0; i < 4; ++i) {
const account = getTestAccount(i);
const bjjPubKey = Account.fromMnemonic(account.mnemonic).bjjPubKey;
const wallet = ethers.Wallet.fromMnemonic(account.mnemonic);
const walletSigner = wallet.connect(provider);
// let nonce = await walletSigner.getTransactionCount();

for (const token of tokens) {
const tokenContract = new ethers.Contract(token.address, tokenAbi, walletSigner);
const mint = tokenContract.functions.mint;
const increaseAllowance = tokenContract.functions.increaseAllowance;
// const mintTx = mint(wallet.address, amount, { nonce: nonce++ });
const mintTx = await mint(wallet.address, amount);
await mintTx.wait(1);
// const increaseAllowanceTx = increaseAllowance(fluidexDelegateAddr, amount, { nonce: nonce++ });
const increaseAllowanceTx = await increaseAllowance(fluidexDelegateAddr, amount);
await increaseAllowanceTx.wait(1);
// erc20Txs.push(mintTx);
// erc20Txs.push(increaseAllowanceTx);

const fluidexContract = new ethers.Contract(fluidexDelegateAddr, fluidexAbi, walletSigner);
const depositERC20 = fluidexContract.functions.depositERC20;
// const tx = depositERC20(token.address, bjjPubKey, amount, { nonce: nonce++, gasLimit: 2.5e7 });
const tx = await depositERC20(token.address, bjjPubKey, amount, { gasLimit: 2.5e7 });
await tx.wait(1);
// erc20Txs.push(tx);
}
// console.log('batch send transcations for ', walletSigner.address);
console.log('batch send transcations for ', walletSigner.address);
}
// console.log('wait for all transcation got 1 confirmations');
// @ts-ignore
// await Promise.all(erc20Txs.map((tx) => tx.then((receipt) => receipt.wait(1)).catch((e) => console.log('error occurs: %s\nwait for all transcations for clean shutdown'))));
}

main()
.then(() => process.exit(0))
.catch(error => {
console.error(error);
process.exit(1);
});
18 changes: 18 additions & 0 deletions misc/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "misc",
"version": "1.0.0",
"main": "index.ts",
"license": "MIT",
"author": "Akase Cho",
"private": true,
"dependencies": {
"ethers": "^5.5.1",
"fluidex.js": "fluidex/fluidex.js.git",
"ts-node": "^10.4.0",
"typescript": "^4.5.2"
},
"devDependencies": {
"@tsconfig/node16": "^1.0.2",
"@types/node": "^16.11.9"
}
}
6 changes: 6 additions & 0 deletions misc/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": "@tsconfig/node12/tsconfig.json",
"compilerOptions": {
"resolveJsonModule": true
}
}
Loading