Skip to content

need handle deposited near attatched in execute_actions #56

Open
@marco-sundsk

Description

@marco-sundsk

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

      Participants

      @marco-sundsk

      Issue actions

        need handle deposited near attatched in execute_actions · Issue #56 · ref-finance/ref-contracts