Skip to content

Commit

Permalink
remove burn method
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuahannan committed Jan 23, 2024
1 parent 5acae21 commit 9f24a73
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
16 changes: 5 additions & 11 deletions contracts/FungibleToken.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,17 @@ access(all) contract interface FungibleToken: ViewResolver {
access(all) entitlement Withdraw

/// The event that is emitted when tokens are withdrawn from a Vault
/// ****TODO**** Add view helper functions so that this event can be emitted
/// only when the amount is non-zero and the from address is non-nil
access(all) event Withdrawn(amount: UFix64, type: String, from: Address?, fromUUID: UInt64, withdrawnUUID: UInt64)

/// The event that is emitted when tokens are deposited to a Vault
/// ****TODO**** Add view helper functions so that this event can be emitted
/// only when the amount is non-zero and the to address is non-nil
access(all) event Deposited(amount: UFix64, type: String, to: Address?, toUUID: UInt64, depositedUUID: UInt64)

/// Event that is emitted when the global burn method is called with a non-zero balance
/// ****TODO**** Add Burner contract so that this event can be emitted
access(all) event Burned(amount: UFix64, type: String, fromUUID: UInt64)

/// Balance
Expand Down Expand Up @@ -200,15 +205,4 @@ access(all) contract interface FungibleToken: ViewResolver {
result.getBalance() == 0.0: "The newly created Vault must have zero balance"
}
}

/// Method to burn a FungibleToken Vault
/// contract implementations should provide an implementation for this function
/// that subtracts the vault balance from the token's total supply
access(all) fun burn(_ vault: @{FungibleToken.Vault}) {
pre {
self.publicTypes().contains(vault.getType())
vault.balance > 0.0: "Do not use the burn method unless the vault balance is greater than zero!"
emit Burned(amount: vault.balance, type: vault.getType().identifier, fromUUID: vault.uuid)
}
}
}
Loading

0 comments on commit 9f24a73

Please sign in to comment.