Skip to content

Commit

Permalink
chore: apply suggestions by the code review
Browse files Browse the repository at this point in the history
  • Loading branch information
aleksuss committed Jul 31, 2023
1 parent 042e8ff commit fd29e16
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 17 deletions.
20 changes: 4 additions & 16 deletions engine/src/connector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,13 +182,13 @@ impl<I: IO + Copy> EthConnectorContract<I> {
}

/// Transfer between NEAR accounts
pub fn ft_transfer(&self, data: Vec<u8>) -> PromiseCreateArgs {
pub fn ft_transfer(&self, data: Vec<u8>, attached_gas: NearGas) -> PromiseCreateArgs {
PromiseCreateArgs {
target_account_id: self.get_eth_connector_contract_account(),
method: "engine_ft_transfer".to_string(),
args: data,
attached_balance: Yocto::new(1),
attached_gas: GAS_FOR_FT_TRANSFER,
attached_gas,
}
}

Expand Down Expand Up @@ -250,25 +250,13 @@ impl<I: IO + Copy> EthConnectorContract<I> {
}
}

/// Get accounts counter for statistics.
/// It represents total unique accounts (all-time, including accounts which now have zero balance).
pub fn get_accounts_counter(&self) -> PromiseCreateArgs {
PromiseCreateArgs {
target_account_id: self.get_eth_connector_contract_account(),
method: "get_accounts_counter".to_string(),
args: Vec::new(),
attached_balance: ZERO_ATTACHED_BALANCE,
attached_gas: GAS_FOR_FINISH_DEPOSIT,
}
}

pub fn get_bridge_prover(&self) -> PromiseCreateArgs {
PromiseCreateArgs {
target_account_id: self.get_eth_connector_contract_account(),
method: "get_bridge_prover".to_string(),
args: Vec::new(),
attached_balance: ZERO_ATTACHED_BALANCE,
attached_gas: GAS_FOR_FINISH_DEPOSIT,
attached_gas: VIEW_CALL_GAS,
}
}

Expand Down Expand Up @@ -301,7 +289,7 @@ impl<I: IO + Copy> EthConnectorContract<I> {
method: "ft_metadata".to_string(),
args: Vec::new(),
attached_balance: ZERO_ATTACHED_BALANCE,
attached_gas: GAS_FOR_FINISH_DEPOSIT,
attached_gas: VIEW_CALL_GAS,
}
}

Expand Down
2 changes: 1 addition & 1 deletion engine/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -882,7 +882,7 @@ mod contract {

let promise_arg = EthConnectorContract::init_instance(io)
.sdk_unwrap()
.ft_transfer(input);
.ft_transfer(input, io.prepaid_gas());
let promise_id = unsafe { io.promise_create_call(&promise_arg) };
io.promise_return(promise_id);
}
Expand Down

0 comments on commit fd29e16

Please sign in to comment.