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

added assertion that asserts that the amount being transfered is larger than 0 #131

Closed
wants to merge 3 commits into from

Conversation

jasperdg
Copy link

There is no use-case for transferring 0 tokens to an account and it could cause overflows on receiving contract's end.

@jasperdg jasperdg changed the title added that asserts that the amount being transfered is larger than 0 added assertion that asserts that the amount being transfered is larger than 0 Feb 14, 2021
Copy link
Collaborator

@evgenykuzyakov evgenykuzyakov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove other changes such as attaching storage

@@ -171,7 +176,10 @@ impl FungibleTokenResolver for Contract {
amount
}
}
PromiseResult::Failed => amount,
PromiseResult::Failed => {
Promise::new(sender_id.to_string()).transfer(initial_storage_deposit.into());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be abused, since the receiver can return a promise that fails, which doesn't generate a refund.

So this fungible contract core implementation can't be sure that there was refund.

It's a limitation of NEAR protocol cross-contracts right now.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup agreed, reset to 8da15fa

Copy link
Collaborator

@evgenykuzyakov evgenykuzyakov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added change in 1240e83

@oysterpack
Copy link

oysterpack commented Feb 18, 2021

The StorageManager trait is not fully compliant with the proposed standard interface.

  • amount arg on storage_withdraw function should be optional:
fn storage_withdraw(&mut self, amount: Option<U128>) -> AccountStorageBalance; 

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

Successfully merging this pull request may close these issues.

4 participants