Skip to content

Commit

Permalink
Transfers from Aurora to Eth (#56)
Browse files Browse the repository at this point in the history
* init aurora fast bridge

* init near contract

* init token transfer hex args

* extract tokens count from borsh

* init transfer

* add foundry

* remove foundery

* const for wNEAR and USDC

* register usdc tokens

* callback

* registered tokens map

* token registration

* set up address as a parametr

* args in callback

* only token=fee

* withdraw tokens on error

* fix conntract for aurora

* whitelist

* add readme

* naming fix

* deploy test on testnet

* add licence

* NEAR_FAST_BRIDGE_ACCOUNT to env var and add .env.example file

* remove destruct function

* use nearRepresentative function

* check that token is registered

* add instruction how to get init token transfer arg

* add whitelist manager role

* move constants into contract

* check signer balance

* checks before tokens transfer

* Add Aurora network unlock functionality (#61)

* apply formatting

* storage deposit to const

* defaul admin role

* _is_equal function

* pass aurora engine address in init

* comment about possible race condition

* update dependency

* rename to AuroraEngineAccountIdOnNear

* update fast-bridge-common

* Upgrade for Aurora Account

* update tests

* proxy in test

* deploy fix

* fix utils

* don't transfer wNEAR

* EvmErc20 -> IEvmErc20

* Update contract build

* disable whitelist

* move WNEAR ADRESS to env variable

* remove unused var

* check wNear balace before transfer

* Improve variables naming

* Aurora-to-eth Fast Bridge: sandbox test and contract fixes  (#96)

Fast Bridge contract:
* Contract changes: optimize using `calldata` instead of `memory` and `external` instead of `public` for eligible functions.
* fix: not charge wNEAR from a user a few times.
* fix: not charge yoctoNEAR from a user for transfers.
* fix withdraw function, fix double withdraw vulnerability.
* Stylistic fixes
* Create one basic test for aurora fast-bridge to sandbox: 
  - deploy fast-bridge contract on NEAR and Aurora.
  - use the mock contracts for token, eth-client, and eth-prover.
  - init transfer.
  - unlock and withdraw tokens.

---------

Co-authored-by: karim-en <[email protected]>

* check refundAmount

* unlock tokens to auroraSender from transfer message

* remove unused var

* deploy and upgrade

* update utils for using config

* use config in tests

* Update aurora/configs/aurora-testnet.json

* Deploy on testnet

* update aurora fast bridge address in make

* set whitelist mode command

* Small fixes for Aurora-to-Eth fast bridge (#105)

* fix init transfer callback gas

* add miss srg

* Disable whitelist mode by default

* Add script to disable/enable whitelist mode

* fix comments

* rebuild near contract

* tokensRegistration -> registerToken

* rename functions in aurora tests

* unPause -> unpause

* address -> account id for Near account id

* rename withdraw_from_near -> fast_bridge_withdraw_on_near

* withdraw -> withdrawFromImplicitNearAccount

* getNearAccountId -> getImplicitNearAccountIdForSelf

* const for ETH RPC ENDPOINT URL

* use arrayify method

* use tag for fast-bridge-common

* remove unused near-plugins-derive

* improve naming

* make fmt command

* separate utils functions

* use tag for eth_type

* don't approve spending wNEAR

* add comments

* Upgrade the contract on testnet

* Update expanded contract?

---------

Co-authored-by: karim-en <[email protected]>
  • Loading branch information
olga24912 and karim-en authored Sep 8, 2023
1 parent 4f5959c commit 0ed081a
Show file tree
Hide file tree
Showing 42 changed files with 12,195 additions and 1,182 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,18 @@ jobs:
echo 'Eth contract changed'
exit 1
fi
test-aurora-fast-bridge:
runs-on: self-hosted
name: Test aurora fast-bridge
steps:
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
- name: Clone the repository
uses: actions/checkout@v3
with:
submodules: recursive
- name: Test
run: |
make test-aurora-fast-bridge
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ eth/build

## testing_ui
near/testing_ui/.cache/**
near/testing_ui/dist/**
near/testing_ui/dist/**
/aurora/integration-tests/target/
/aurora/contracts/out/
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "aurora/integration-tests/aurora-contracts-sdk"]
path = aurora/integration-tests/aurora-contracts-sdk
url = https://github.com/aurora-is-near/aurora-contracts-sdk
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
test-aurora-fast-bridge:
cd aurora && \
yarn && \
cd ../near && \
./build_for_tests.sh && \
cd ../aurora/integration-tests && \
cargo test --all --jobs 4 -- --test-threads 4
2 changes: 2 additions & 0 deletions aurora/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
AURORA_PRIVATE_KEY=
MASTER_ACCOUNT="olga24912_3.testnet"
4 changes: 4 additions & 0 deletions aurora/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules/
artifacts/
cache/
.env
Loading

0 comments on commit 0ed081a

Please sign in to comment.