-
Notifications
You must be signed in to change notification settings - Fork 202
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(inflation): add burn method (#1823)
* feat(inflation): add burn method * Update CHANGELOG.md
- Loading branch information
Showing
10 changed files
with
678 additions
and
57 deletions.
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
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,53 @@ | ||
package keeper_test | ||
|
||
import ( | ||
"fmt" | ||
"testing" | ||
|
||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
"github.com/stretchr/testify/require" | ||
|
||
"github.com/NibiruChain/nibiru/x/common/testutil" | ||
"github.com/NibiruChain/nibiru/x/common/testutil/testapp" | ||
"github.com/NibiruChain/nibiru/x/inflation/types" | ||
) | ||
|
||
func init() { | ||
testapp.EnsureNibiruPrefix() | ||
} | ||
|
||
func TestBurn(t *testing.T) { | ||
testCases := []struct { | ||
name string | ||
sender sdk.AccAddress | ||
burnCoin sdk.Coin | ||
expectedErr error | ||
}{ | ||
{ | ||
name: "pass", | ||
sender: testutil.AccAddress(), | ||
burnCoin: sdk.NewCoin("nibiru", sdk.NewInt(100)), | ||
expectedErr: nil, | ||
}, | ||
} | ||
for _, tc := range testCases { | ||
t.Run(fmt.Sprintf("Case %s", tc.name), func(t *testing.T) { | ||
nibiruApp, ctx := testapp.NewNibiruTestAppAndContext() | ||
require.NoError(t, | ||
nibiruApp.BankKeeper.MintCoins( | ||
ctx, types.ModuleName, sdk.NewCoins(tc.burnCoin))) | ||
require.NoError(t, | ||
nibiruApp.BankKeeper.SendCoinsFromModuleToAccount( | ||
ctx, types.ModuleName, tc.sender, sdk.NewCoins(tc.burnCoin)), | ||
) | ||
|
||
// Burn coins | ||
err := nibiruApp.InflationKeeper.Burn(ctx, sdk.NewCoins(tc.burnCoin), tc.sender) | ||
if tc.expectedErr != nil { | ||
require.EqualError(t, err, tc.expectedErr.Error()) | ||
} else { | ||
require.NoError(t, err) | ||
} | ||
}) | ||
} | ||
} |
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
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
Oops, something went wrong.