-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
3,490 additions
and
191 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,42 @@ | ||
# ETH connector | ||
|
||
## Build | ||
1. For production set in the Makefile | ||
``` | ||
FEATURES = contract | ||
``` | ||
1.1. For **development and testing** set in the Makefile | ||
``` | ||
FEATURES = contract,integration-test | ||
``` | ||
2. Build release: `$ make release` | ||
3. Run tests: `$ cargo test` | ||
4. Deploying process is common for Aurora itself. Please reference [README.md](../README.md) | ||
## Initialize eth-conenctor | ||
With `near-cli` run: | ||
``` | ||
$ near call <NEAR_ACC> new_eth_connector '{"prover_account": "<PROVER_NEAR_ACCOUNT>", "eth_custodian_address": "<ETH_ADDRESS>"}' --account-id <NEAR_ACC> | ||
|
||
``` | ||
## ETH connector specific methods | ||
* new_eth_connector (call once) | ||
* deposit (mutable) | ||
* withdraw (mutable, payable) | ||
* finish_deposit_near (private, mutable) | ||
* ft_total_supply (view) | ||
* ft_total_supply_near (view) | ||
* ft_total_supply_eth (view) | ||
* ft_balance_of (view) | ||
* ft_balance_of_eth (view) | ||
* ft_transfer (mutable, payable) | ||
* ft_resolve_transfer (private, mutable) | ||
* ft_transfer_call (mutable, payable) | ||
* ft_on_transfer (private, mutable) | ||
* storage_deposit (mutable) | ||
* storage_withdraw (mutable, payable) | ||
* storage_balance_of (view) | ||
## Ethereum specific flow | ||
Follow by [this instruction](https://github.com/aurora-is-near/eth-connector/blob/master/README.md). |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,28 @@ | ||
use crate::sdk; | ||
|
||
pub type PausedMask = u8; | ||
|
||
pub trait AdminControlled { | ||
/// Returns true if the current account is owner | ||
fn is_owner(&self) -> bool { | ||
sdk::current_account_id() == sdk::predecessor_account_id() | ||
} | ||
|
||
/// Return the current mask representing all paused events. | ||
fn get_paused(&self) -> PausedMask; | ||
|
||
/// Update mask with all paused events. | ||
/// Implementor is responsible for guaranteeing that this function can only be | ||
/// called by owner of the contract. | ||
fn set_paused(&mut self, paused: PausedMask); | ||
|
||
/// Return if the contract is paused for the current flag and user | ||
fn is_paused(&self, flag: PausedMask) -> bool { | ||
(self.get_paused() & flag) != 0 && !self.is_owner() | ||
} | ||
|
||
/// Asserts the passed paused flag is not set. Panics with "ERR_PAUSED" if the flag is set. | ||
fn assert_not_paused(&self, flag: PausedMask) { | ||
assert!(!self.is_paused(flag), "ERR_PAUSED"); | ||
} | ||
} |
Oops, something went wrong.