-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from aurora-is-near/pure-evm-connector
Pure no-std eth-connector implementation
- Loading branch information
Showing
22 changed files
with
2,348 additions
and
4 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Cargo.lock |
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,42 @@ | ||
[package] | ||
name = "pure-eth-connector" | ||
version = "0.1.0" | ||
authors = ["Near Inc <hello@near.org>"] | ||
edition = "2018" | ||
license = "Apache2" | ||
publish = false | ||
resolver = "2" | ||
|
||
[lib] | ||
crate-type = ["cdylib", "rlib"] | ||
|
||
[profile.dev] | ||
panic = "abort" | ||
|
||
[profile.release] | ||
codegen-units = 1 | ||
# Tell `rustc` to optimize for small code size. | ||
opt-level = "z" | ||
lto = true | ||
debug = false | ||
panic = "abort" | ||
debug-assertions = false | ||
|
||
[dependencies] | ||
wee_alloc = { version = "0.4.5", default-features = false } | ||
rlp = { version = "0.5", default-features = false } | ||
borsh = { version = "0.8", default-features = false } | ||
primitive-types = { version = "0.8.0", default-features = false, features = ["rlp"] } | ||
hex = { version = "0.4", default-features = false, features = ["alloc"] } | ||
sha3 = { version = "0.8", default-features = false } | ||
ethabi = { git = "https://github.com/darwinia-network/ethabi", branch = "xavier-no-std", default-features = false } | ||
rjson = "0.3.1" | ||
|
||
[dev-dependencies] | ||
near-sdk = { git = "https://github.com/near/near-sdk-rs", tag = "3.0.0" } | ||
near-sdk-sim = { git = "https://github.com/near/near-sdk-rs", tag = "3.0.0" } | ||
funty = "=1.1.0" # temp pin of funty as 1.2.0 is API breaking | ||
|
||
[features] | ||
default = ["log"] | ||
log = [] |
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,47 @@ | ||
NEAR_ACC=nostd01.eth-connector.testnet | ||
MASTER_NEAR_ACC=eth-connector.testnet | ||
#NEAR_ACC=dev-1616437086828-5300267 | ||
|
||
build-with-features: | ||
@RUSTFLAGS='-C link-arg=-s' cargo build --lib --target wasm32-unknown-unknown --release -Z avoid-dev-deps | ||
@mkdir -p res && cp target/wasm32-unknown-unknown/release/pure_eth_connector.wasm ./res/ | ||
@cp res/pure_eth_connector.wasm ~/dev/vagrant/near/ || true | ||
@cp ~/dev/rs/near/eth-connector/pure-eth-connector/Makefile ~/dev/vagrant/near/ || true | ||
@ls -lh res | ||
|
||
build-without-features: | ||
@RUSTFLAGS='-C link-arg=-s' cargo build --lib --target wasm32-unknown-unknown --no-default-features --release -Z avoid-dev-deps | ||
@mkdir -p res && cp target/wasm32-unknown-unknown/release/pure_eth_connector.wasm ./res/ | ||
@cp res/pure_eth_connector.wasm ~/dev/vagrant/near/ || true | ||
@cp ~/dev/rs/near/eth-connector/pure-eth-connector/Makefile ~/dev/vagrant/near/ || true | ||
@ls -lh res | ||
|
||
clippy: | ||
@cargo clippy --lib --target wasm32-unknown-unknown | ||
|
||
fmt: | ||
@cargo fmt | ||
|
||
test: | ||
@cargo test -- --nocapture | ||
|
||
dev-deploy: | ||
@near dev-deploy -f pure_eth_connector.wasm | ||
|
||
pure-deploy: | ||
@near deploy ${NEAR_ACC} pure_eth_connector.wasm | ||
|
||
balance-of: | ||
@near view ${NEAR_ACC} ft_balance_of --args '{"account_id":"testlocal.testnet"}' --account-id ${NEAR_ACC} | ||
|
||
init-contract: | ||
@near call ${NEAR_ACC} new '{"prover_account": "nostd01.eth-connector.testnet", "eth_custodian_address": "A0DA4462a8e18299b43BAb74F3D9D4dd73B832f3"}' --account-id ${NEAR_ACC} | ||
|
||
deposit: | ||
@near call ${NEAR_ACC} deposit '{"log_index":0,"log_entry_data":[248,251,148,160,218,68,98,168,225,130,153,180,59,171,116,243,217,212,221,115,184,50,243,248,66,160,91,253,175,236,57,174,146,96,226,220,66,250,35,21,1,244,101,251,175,87,166,187,188,197,23,157,14,86,105,51,218,174,160,0,0,0,0,0,0,0,0,0,0,0,0,137,27,39,73,35,139,39,255,88,233,81,8,142,85,176,77,231,29,195,116,184,160,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,96,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,116,188,146,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,194,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,17,116,101,115,116,108,111,99,97,108,46,116,101,115,116,110,101,116,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"receipt_index":0,"receipt_data":[249,2,6,1,130,98,212,185,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,0,0,0,16,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,32,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,248,253,248,251,148,160,218,68,98,168,225,130,153,180,59,171,116,243,217,212,221,115,184,50,243,248,66,160,91,253,175,236,57,174,146,96,226,220,66,250,35,21,1,244,101,251,175,87,166,187,188,197,23,157,14,86,105,51,218,174,160,0,0,0,0,0,0,0,0,0,0,0,0,137,27,39,73,35,139,39,255,88,233,81,8,142,85,176,77,231,29,195,116,184,160,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,96,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,116,188,146,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,194,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,17,116,101,115,116,108,111,99,97,108,46,116,101,115,116,110,101,116,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"header_data":[249,2,10,160,52,175,28,35,212,43,219,118,100,50,155,243,67,151,135,25,107,63,152,47,27,12,152,84,217,12,55,46,152,0,27,209,160,236,241,119,41,165,201,28,176,193,50,105,138,144,20,102,185,249,31,127,18,132,218,106,114,131,158,60,163,247,161,58,74,148,195,209,112,108,44,194,22,138,43,214,152,220,160,114,168,112,46,237,105,13,160,136,150,190,124,203,215,26,177,22,122,114,88,32,157,249,176,74,228,176,62,200,3,164,220,187,78,66,232,223,55,69,150,160,118,196,96,197,96,10,249,177,143,193,228,135,86,120,113,174,85,212,247,104,218,99,25,111,31,205,135,41,156,57,124,190,160,11,137,69,203,17,143,230,78,116,142,231,228,166,250,243,175,251,128,92,231,109,252,212,60,130,203,250,201,72,54,102,41,185,1,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,64,0,0,0,16,16,0,128,0,128,0,192,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,32,0,64,0,0,0,0,0,128,0,1,0,0,0,0,0,0,0,0,8,0,0,0,0,1,0,0,0,0,0,0,0,0,0,2,0,0,0,0,2,0,0,0,0,0,0,2,0,66,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,48,0,0,1,0,0,0,0,0,0,0,8,0,0,0,0,0,0,0,128,0,0,0,0,0,0,0,0,16,0,0,0,0,0,0,0,0,4,0,0,4,0,0,64,0,0,0,0,0,32,0,0,2,0,0,0,0,0,0,0,0,0,16,0,0,0,0,0,0,0,0,0,2,0,0,0,0,5,64,0,0,0,0,17,0,0,32,0,64,0,0,0,1,0,0,0,0,0,0,0,8,0,0,0,0,0,0,0,8,0,0,0,0,0,0,0,8,0,64,0,8,2,0,0,0,0,0,0,0,0,0,0,0,132,23,190,160,119,131,150,74,168,131,122,18,0,131,100,11,213,132,96,80,190,238,140,115,112,105,100,101,114,49,48,1,0,92,232,160,108,84,192,236,215,221,108,3,203,227,241,55,170,71,149,12,225,89,118,4,252,87,168,230,200,179,177,65,40,61,23,65,136,191,224,164,14,79,193,69,164],"proof":[[248,113,160,191,130,100,43,198,25,70,230,107,127,147,206,10,34,24,53,38,15,190,133,85,218,172,121,58,216,57,211,81,181,104,226,160,44,196,36,108,23,215,156,136,179,114,2,36,249,248,242,60,163,116,55,75,27,155,203,12,210,211,28,47,38,78,132,123,128,128,128,128,128,128,160,148,123,179,172,166,113,217,60,161,148,169,218,181,106,200,124,214,60,70,50,1,244,213,68,180,214,73,135,185,174,53,244,128,128,128,128,128,128,128,128],[249,2,13,48,185,2,9,249,2,6,1,130,98,212,185,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,0,0,0,16,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,32,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,248,253,248,251,148,160,218,68,98,168,225,130,153,180,59,171,116,243,217,212,221,115,184,50,243,248,66,160,91,253,175,236,57,174,146,96,226,220,66,250,35,21,1,244,101,251,175,87,166,187,188,197,23,157,14,86,105,51,218,174,160,0,0,0,0,0,0,0,0,0,0,0,0,137,27,39,73,35,139,39,255,88,233,81,8,142,85,176,77,231,29,195,116,184,160,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,96,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,116,188,146,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,194,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,17,116,101,115,116,108,111,99,97,108,46,116,101,115,116,110,101,116,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]],"skip_bridge_call":false}' --account-id ${NEAR_ACC} --gas 300000000000000 | ||
|
||
withdraw: | ||
@near call ${NEAR_ACC} withdraw '{"recipient_id": "b9f7219e434EAA7021Ae5f9Ecd0CaBc2405447A3", "amount": 3}' --account-id ${NEAR_ACC} | ||
|
||
remove-create-acc: | ||
@near delete ${NEAR_ACC} ${MASTER_NEAR_ACC} && near create-account ${NEAR_ACC} --masterAccount=${MASTER_NEAR_ACC} --initialBalance=10 |
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,3 @@ | ||
[toolchain] | ||
channel = "nightly-2021-03-25" | ||
targets = ["wasm32-unknown-unknown"] |
Oops, something went wrong.