defuse/contract/tokens/nep141/
native.rs1use defuse_core::intents::tokens::NativeWithdraw;
2use defuse_near_utils::promise_result_checked_void;
3use near_sdk::{Gas, Promise, near, require};
4
5use crate::contract::{Contract, ContractExt};
6
7#[near]
8impl Contract {
9 pub(crate) const DO_NATIVE_WITHDRAW_GAS: Gas = Gas::from_tgas(12);
10
11 #[private]
12 pub fn do_native_withdraw(withdraw: NativeWithdraw) -> Promise {
13 require!(
14 promise_result_checked_void(0).is_ok(),
15 "near_withdraw failed",
16 );
17
18 Promise::new(withdraw.receiver_id).transfer(withdraw.amount)
19 }
20}