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

Silo to silo transfers #225

Merged
merged 51 commits into from
Jan 31, 2024
Merged

Silo to silo transfers #225

merged 51 commits into from
Jan 31, 2024

Conversation

karim-en
Copy link
Collaborator

@karim-en karim-en commented Jul 21, 2023

The PR implements a contract to make silo to silo transfers of the ERC20 tokens that are bridged from near.
The main public functions to interact with the contract:

registerToken(IEvmErc20 token) // To register the token address
storageDeposit(IEvmErc20 token, uint128 storageDepositAmount) // To do the storage deposit
ftTransferCallToNear(IEvmErc20 token, uint128 amount, string receiverId, string calldata message) // To initiate the silo to silo transfer
withdraw(IEvmErc20 token) // To do a refund if the transfer failed

To deploy the contract on testnet run:

yarn hardhat deploy --silo aurora-testnet --network testnet_aurora

To upgrade the contract on testnet run:

yarn hardhat upgrade --silo aurora-testnet --proxy 0x<PROXY_ADDRESS> --network testnet_aurora

silo-to-silo/contracts/SiloToSilo.sol Outdated Show resolved Hide resolved
silo-to-silo/contracts/SiloToSilo.sol Outdated Show resolved Hide resolved
silo-to-silo/contracts/SiloToSilo.sol Outdated Show resolved Hide resolved
silo-to-silo/contracts/SiloToSilo.sol Outdated Show resolved Hide resolved
silo-to-silo/contracts/SiloToSilo.sol Outdated Show resolved Hide resolved
karim-en and others added 10 commits August 8, 2023 15:35
* integration test fro silo to silo

* add aurora-sdk-integartion-test

* split functions

* add module

* change balance

* remove debug println

* fmt

* silo to engine transfer

* withdraw test

* fix withdraw

* refactoring

* check access controll

* check if token is register

* test error on withdraw from near

* fix dependency

* fix String to Uint

* CI: add `silo-to-silo` tests

* Silo2Silo: fix tests

* CI; replace `true` with `recursive`

* Update `.gitignore`

* CI: try to fix path issue

* CI: check submodule dir is exist

* CI: install Foundry

* Add yarn the command `test-token-silo-to-silo`

* CI: call `prepare`

* CI: add toolchain to `mock_token`

* CI: add `actions-rs`

* Ci: run `silo-to-silo` tests on ubuntu

* CI: disable building from test

* CI: add `add wasm32-unknown-unknown` command

* CI: move down ` add wasm32-unknown-unknown`

* CI: re-enable tests

* CI: run tests in parallel

* Apply `cargo fmt`

* CI: use `self-hosted`

* Ignore test `error_on_withdraw_to_near`

---------

Co-authored-by: karim-en <[email protected]>
silo-to-silo/contracts/src/SiloToSilo.sol Show resolved Hide resolved
silo-to-silo/contracts/src/SiloToSilo.sol Outdated Show resolved Hide resolved
silo-to-silo/contracts/src/SiloToSilo.sol Outdated Show resolved Hide resolved
silo-to-silo/integration-tests/mock_token/src/lib.rs Outdated Show resolved Hide resolved
silo-to-silo/contracts/src/SiloToSilo.sol Show resolved Hide resolved
silo-to-silo/contracts/src/SiloToSilo.sol Outdated Show resolved Hide resolved
silo-to-silo/contracts/src/SiloToSilo.sol Outdated Show resolved Hide resolved
silo-to-silo/contracts/src/SiloToSilo.sol Outdated Show resolved Hide resolved
silo-to-silo/contracts/src/SiloToSilo.sol Outdated Show resolved Hide resolved
silo-to-silo/contracts/src/SiloToSilo.sol Outdated Show resolved Hide resolved
silo-to-silo/integration-tests/src/lib.rs Outdated Show resolved Hide resolved
silo-to-silo/integration-tests/src/lib.rs Outdated Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are many functions that accept an optional parameter but later have a default value in case the parameter is None. This makes reading and verifying the tests really hard, as you always need to remember the order of helper function args and what will be the default value in each case. Please avoid using default values, or at least specify them externally (or accept the arguments to the helper function as a structure).

silo-to-silo/contracts/src/SiloToSilo.sol Outdated Show resolved Hide resolved
silo-to-silo/contracts/src/SiloToSilo.sol Outdated Show resolved Hide resolved
karim-en and others added 6 commits October 12, 2023 18:39
* storage deposit outside contract test

* long msg test

* remove unused import

* fix tests

* fix tests

* test transfer eth

* test send eth back

* eth withdraw test
* scripts for interactions

* ft_transfer_call

* Delete silo-to-silo/.openzeppelin/unknown-1313161554.json

---------

Co-authored-by: Karim <[email protected]>
@Near-One Near-One deleted a comment from sept-en Jan 12, 2024
@Near-One Near-One deleted a comment from sept-en Jan 12, 2024
@karim-en karim-en merged commit d71a558 into master Jan 31, 2024
19 checks passed
@karim-en karim-en deleted the silo-to-silo branch January 31, 2024 20:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants