-
Notifications
You must be signed in to change notification settings - Fork 4
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
Bridge v3 #7
Draft
vovac12
wants to merge
8
commits into
bridge-v2
Choose a base branch
from
bridge-v3
base: bridge-v2
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Bridge v3 #7
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
134623c
Update
vovac12 af35127
Merge branch 'bridge-v2' of https://github.com/sora-xor/sora2-evm-con…
vovac12 bc512ee
Update signatures
vovac12 7b8db4a
Add USDT support
vovac12 a3de913
Remove additional code for USDT support
vovac12 7fdf7b0
Remove USDT interface
vovac12 c1599c2
Update gen-config.ts
vovac12 9d212bb
Update deploy config
vovac12 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
|
||
import DeployConfig from "./config"; | ||
|
||
const config: DeployConfig = { | ||
"xorAddress": "0x9826ecfcd937c4518e1c42b3703c7cb908b61197", | ||
"valAddress": "0x88ee18defc56d78417b0d331e794ef75799ca6d1", | ||
"sidechainAssets": [ | ||
], | ||
"erc20Addresses": [ | ||
], | ||
"peers": [ | ||
"0x981bccf6d8593dc49c22cf744a59afa5a2b23118", | ||
"0x90dca3c91c10e802093318123ad8bb8809061765", | ||
"0x457d710255184dbf63c019ab50f65743c6cb072f" | ||
] | ||
}; | ||
|
||
export default config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
#!/bin/bash -v | ||
|
||
npx hardhat gen-config --network mainnet --contract-address 0x1485E9852ac841b52eD44D573036429504f4F602 --sora-endpoint wss://ws.alb.sora.org --peers 0x6C9E8391a0444c739e7e2edd37A2C6e3381b1cbF,0xEf22D478a53bc8BBe854ceF8bA2eb79C49A1a171 --output deploy-data/mainnet.ts | ||
npx hardhat gen-config --network mainnet --contract-address 0x6f984c337ad5b7c2084805042ae942cef462e3ff --sora-endpoint wss://ws.mof.sora.org --peers 0x6C9E8391a0444c739e7e2edd37A2C6e3381b1cbF,0xEf22D478a53bc8BBe854ceF8bA2eb79C49A1a171,0x6219d0ba6a0bafa69cd2b1b15633a3fd864dd371 --output deploy-data/mainnet.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ import { resolve } from "path"; | |
import "solidity-coverage" | ||
|
||
import * as gen_config from "./tasks/gen-config"; | ||
import * as send from "./tasks/send"; | ||
|
||
dotenv({ path: resolve(__dirname, ".env") }); | ||
|
||
|
@@ -57,6 +58,11 @@ const config: HardhatUserConfig = { | |
url: 'https://rpc.sepolia.org', | ||
accounts: [sepoliaPrivateKey], | ||
}, | ||
sepolia2: { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why? they are the same (sepolia and sepolia2) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To have deployment data for test and stage environment |
||
chainId: 11155111, | ||
url: 'https://rpc.sepolia.org', | ||
accounts: [sepoliaPrivateKey], | ||
}, | ||
mainnet: { | ||
chainId: 1, | ||
url: `https://mainnet.infura.io/v3/${infuraKey}`, | ||
|
@@ -87,7 +93,7 @@ const config: HardhatUserConfig = { | |
timeout: 60000 | ||
}, | ||
etherscan: { | ||
apiKey: etherscanKey | ||
apiKey: etherscanKey, | ||
} | ||
}; | ||
|
||
|
@@ -97,4 +103,9 @@ task("gen-config", "Generate config file for given network") | |
.addParam("peers") | ||
.addParam("output").setAction(gen_config.main); | ||
|
||
task("send", "Generate config file for given network") | ||
.addParam("to") | ||
.addParam("amount") | ||
.addParam("token", "Token address", undefined, undefined, true) | ||
.setAction(send.main); | ||
export default config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { HardhatRuntimeEnvironment } from 'hardhat/types'; | ||
import DeployConfig from "../deploy-data/config"; | ||
import { default as mainnetConfig } from "../deploy-data/mainnet" | ||
|
||
async function main() { | ||
const hh: HardhatRuntimeEnvironment = require("hardhat"); | ||
const config = mainnetConfig; | ||
const bridgeAddress = "0x6F984C337aD5b7C2084805042AE942cef462e3ff"; | ||
let tokenAddresses = config.sidechainAssets.map((val) => val.address); | ||
let assetIds = config.sidechainAssets.map((val) => val.asset_id); | ||
await hh.run("verify:verify", { | ||
address: bridgeAddress, | ||
constructorArguments: [ | ||
config.peers, | ||
tokenAddresses, assetIds, config.erc20Addresses, | ||
config.valAddress, config.xorAddress, | ||
'0x0000000000000000000000000000000000000000000000000000000000000000' | ||
], | ||
}); | ||
} | ||
|
||
main().then(() => process.exit(0)).catch((error) => { | ||
console.error(error); | ||
process.exit(1); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { HardhatRuntimeEnvironment } from 'hardhat/types'; | ||
import DeployConfig from "../deploy-data/config"; | ||
import * as sora from "@sora-substrate/util"; | ||
import abi from "../abis/BridgeOld.abi"; | ||
import { writeFile } from "fs/promises"; | ||
import "hardhat-deploy"; | ||
|
||
export async function main({ to, amount, token }) { | ||
const hh: HardhatRuntimeEnvironment = require("hardhat"); | ||
let [deployer] = await hh.getUnnamedAccounts(); | ||
let res; | ||
if (!token) { | ||
res = await hh.deployments.execute("Bridge", { from: deployer, log: true, value: amount }, "sendEthToSidechain", to); | ||
} else { | ||
res = await hh.deployments.execute("Bridge", { from: deployer, log: true }, "sendERC20ToSidechain", to, amount, token); | ||
} | ||
console.log(res); | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Transition from encode to encodePacked is not that necessary but might be taken as it may only affect the order of the params for the statement we sign but not the signature itself
Just make sure that it works fine when passing params to recoverAddress, now it looks okay, but it will not be superfluous to double check it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's needed to prevent signature collision