-
Notifications
You must be signed in to change notification settings - Fork 174
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f3618c3
commit 5ee21bd
Showing
7 changed files
with
73 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# x/burn | ||
|
||
This is a 'module' used solely to burn tokens properly in line with our x/mint module requirements. | ||
|
||
## Burn address | ||
|
||
- juno1mj7t69y4r2adl3cnuq8y9uundkzawvx6avu7nj |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package burn | ||
|
||
import ( | ||
wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" | ||
|
||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" | ||
) | ||
|
||
// used to override Wasmd's NewBurnCoinMessageHandler | ||
|
||
type BurnerWasmPlugin struct { | ||
bk bankkeeper.Keeper | ||
} | ||
|
||
var _ wasmtypes.Burner = &BurnerWasmPlugin{} | ||
|
||
func NewBurnerPlugin(bk bankkeeper.Keeper) *BurnerWasmPlugin { | ||
return &BurnerWasmPlugin{bk: bk} | ||
} | ||
|
||
func (k *BurnerWasmPlugin) BurnCoins(_ sdk.Context, _ string, _ sdk.Coins) error { | ||
// instead of burning, we just hold in balance and subtract from the x/mint module's total supply | ||
// return k.bk.BurnCoins(ctx, moduleName, amt) | ||
return nil | ||
} | ||
|
||
func (k *BurnerWasmPlugin) SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, _ string, amt sdk.Coins) error { | ||
// we override the default send to instead sent to the "junoburn" module. Then we subtract that from the x/mint module in its query | ||
return k.bk.SendCoinsFromAccountToModule(ctx, senderAddr, ModuleName, amt) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package burn | ||
|
||
const ( | ||
ModuleName = "junoburn" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters