Skip to content

Commit

Permalink
add Withdrawable to transfer
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuahannan committed Jul 19, 2023
1 parent eef53f9 commit 0b47d4d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions contracts/FungibleToken-v2.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ access(all) contract FungibleToken {
access(all) resource interface Transferor {
/// Function for a direct transfer instead of having to do a deposit and withdrawal
///
access(all) fun transfer(amount: UFix64, receiver: Capability<&{FungibleToken.Receiver}>) {
access(Withdrawable) fun transfer(amount: UFix64, receiver: Capability<&{FungibleToken.Receiver}>) {
pre {
receiver.check(): "Could not borrow a reference to the NFT receiver"
}
Expand Down Expand Up @@ -242,7 +242,7 @@ access(all) contract FungibleToken {

/// Function for a direct transfer instead of having to do a deposit and withdrawal
///
access(all) fun transfer(amount: UFix64, receiver: Capability<&{FungibleToken.Receiver}>) {
access(Withdrawable) fun transfer(amount: UFix64, receiver: Capability<&{FungibleToken.Receiver}>) {
post {
self.getBalance() == before(self.getBalance()) - amount:
"New Vault balance from the sender must be the difference of the previous balance and the withdrawn Vault balance"
Expand Down
Loading

0 comments on commit 0b47d4d

Please sign in to comment.