Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

need handle deposited near attatched in execute_actions #56

Open
marco-sundsk opened this issue Nov 11, 2021 · 0 comments
Open

need handle deposited near attatched in execute_actions #56

marco-sundsk opened this issue Nov 11, 2021 · 0 comments

Comments

@marco-sundsk
Copy link
Contributor

If user call swap or execute_actions with some near attatched, the contract now does not count them into user's storage deposited nor refund them. When the amonut is large, it would cause much trouble for user to re-claim them back.

The fix may be like this:

#[payable]
pub fn execute_actions(
  ... ...
  if env::attached_deposit() == 0 {
     ... ...
  } else {
      account.near_amount += env::attached_deposit();
  }
  ... ...
}

Then, user can call storage_withdraw to re-claim unused deposited near back by himself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant