Skip to content

Commit

Permalink
Merge branch 'main' into fix-withdraw
Browse files Browse the repository at this point in the history
  • Loading branch information
karim-en committed Feb 14, 2025
2 parents 1e68f94 + 3f626ff commit cd3fd0e
Show file tree
Hide file tree
Showing 6 changed files with 245 additions and 134 deletions.
11 changes: 10 additions & 1 deletion near/mock/mock-token/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ use near_sdk::borsh::BorshSerialize;
use near_sdk::collections::LazyOption;
use near_sdk::json_types::U128;
use near_sdk::{
env, log, near, require, AccountId, BorshStorageKey, NearToken, PanicOnDefault, PromiseOrValue,
env, log, near, require, AccountId, BorshStorageKey, NearToken, PanicOnDefault, Promise,
PromiseOrValue,
};

#[near(contract_state)]
Expand Down Expand Up @@ -73,6 +74,14 @@ impl Contract {

this
}

#[payable]
pub fn near_withdraw(&mut self, amount: U128) -> Promise {
self.token
.internal_withdraw(&env::predecessor_account_id(), amount.into());

Promise::new(env::predecessor_account_id()).transfer(NearToken::from_yoctonear(amount.0))
}
}

#[near]
Expand Down
Loading

0 comments on commit cd3fd0e

Please sign in to comment.