Skip to content

Commit

Permalink
MintAndBurnReplyUpdate
Browse files Browse the repository at this point in the history
This update allows the implementation of extension handlers that listen to Minting and Burning tokens.

Example: I am building a lending protocol that implements my lending blueprint and the token's blueprint. I want to allow lenders to deposit "X" tokens in my lending process and get back temporally tokens that they can later use to claim back their lended tokens. So, I need a way to listen when my lending process mint new tokens to instantly transfer them to the lender who made a deposit.

Now with this update, I can write handlers to listen to "Mint-Notice" and "Burn-Notice" to do further logic.
  • Loading branch information
ItsJackAnton committed Jul 15, 2024
1 parent 5645d8f commit 15475ad
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions blueprints/token.lua
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ Handlers.add('mint', Handlers.utils.hasMatchingTag('Action', 'Mint'), function(m
TotalSupply = utils.add(TotalSupply, msg.Quantity)
ao.send({
Target = msg.From,
Action = "Mint-Notice",
Data = Colors.gray .. "Successfully minted " .. Colors.blue .. msg.Quantity .. Colors.reset
})
else
Expand Down Expand Up @@ -237,6 +238,7 @@ Handlers.add('burn', Handlers.utils.hasMatchingTag('Action', 'Burn'), function(m

ao.send({
Target = msg.From,
Action = "Burn-Notice",
Data = Colors.gray .. "Successfully burned " .. Colors.blue .. msg.Quantity .. Colors.reset
})
end)

0 comments on commit 15475ad

Please sign in to comment.