Skip to content

Commit

Permalink
Merge pull request #22 from aurora-is-near/feat/mrLSD/extend-eth-conn…
Browse files Browse the repository at this point in the history
…ector

Feat: extend `eth-connector` utility
  • Loading branch information
mrLSD authored May 8, 2023
2 parents d52cc5a + ecba40e commit 8edac8d
Show file tree
Hide file tree
Showing 8 changed files with 153 additions and 47 deletions.
124 changes: 91 additions & 33 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 8 additions & 1 deletion res/mock_eth_connector/src/connector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub struct FinishDepositCallArgs {
pub msg: Option<Vec<u8>>,
}

#[derive(BorshSerialize, BorshDeserialize)]
#[derive(Debug, BorshSerialize, BorshDeserialize)]
pub struct WithdrawResult {
pub amount: Balance,
pub recipient_id: Address,
Expand All @@ -35,6 +35,13 @@ pub trait ConnectorDeposit {
pub trait ConnectorWithdraw {
#[result_serializer(borsh)]
fn withdraw(
&mut self,
#[serializer(borsh)] recipient_address: Address,
#[serializer(borsh)] amount: Balance,
) -> WithdrawResult;

#[result_serializer(borsh)]
fn engine_withdraw(
&mut self,
#[serializer(borsh)] sender_id: AccountId,
#[serializer(borsh)] recipient_address: Address,
Expand Down
15 changes: 15 additions & 0 deletions res/mock_eth_connector/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,11 +212,26 @@ impl ConnectorWithdraw for EthConnectorContract {
#[payable]
#[result_serializer(borsh)]
fn withdraw(
&mut self,
#[serializer(borsh)] recipient_address: Address,
#[serializer(borsh)] amount: Balance,
) -> WithdrawResult {
WithdrawResult {
recipient_id: recipient_address,
amount,
eth_custodian_address: Address::decode(CUSTODIAN_ADDRESS).unwrap(),
}
}

#[payable]
#[result_serializer(borsh)]
fn engine_withdraw(
&mut self,
#[serializer(borsh)] sender_id: AccountId,
#[serializer(borsh)] recipient_address: Address,
#[serializer(borsh)] amount: Balance,
) -> WithdrawResult {
let _ = sender_id;
WithdrawResult {
recipient_id: recipient_address,
amount,
Expand Down
2 changes: 1 addition & 1 deletion workspace-eth-connector/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ description = "Aurora Workspace Eth Connector is a library for the Aurora Eth Co

[dependencies]
anyhow = "1"
aurora-engine-types = { git = "https://github.com/aurora-is-near/aurora-engine.git", rev = "d9763085157188055f62752fd499ac4c7db8331e", features = ["impl-serde"] }
aurora-engine-types = { git = "https://github.com/aurora-is-near/aurora-engine.git", tag = "2.9.0", default-features = false, features = ["impl-serde", "borsh-compat"] }
aurora-workspace-types = { path = "../workspace-types" }
aurora-workspace-utils = { path = "../workspace-utils" }
borsh = { version = "0.9", default-features = false }
Expand Down
Loading

0 comments on commit 8edac8d

Please sign in to comment.