github.com/KiraCore/sekai@v0.3.43/x/layer2/keeper/token_mint_test.go (about)

     1  package keeper_test
     2  
     3  import (
     4  	"github.com/KiraCore/sekai/x/layer2/keeper"
     5  	"github.com/KiraCore/sekai/x/layer2/types"
     6  	sdk "github.com/cosmos/cosmos-sdk/types"
     7  )
     8  
     9  func (suite *KeeperTestSuite) TestTokenInfoSetGetDelete() {
    10  	infos := []types.TokenInfo{
    11  		{
    12  			TokenType:   "adr20",
    13  			Denom:       "ku/bridgebtc",
    14  			Name:        "Bridge BTC",
    15  			Symbol:      "BTC",
    16  			Icon:        "",
    17  			Description: "",
    18  			Website:     "",
    19  			Social:      "",
    20  			Decimals:    8,
    21  			Cap:         sdk.NewInt(1000_000_000),
    22  			Supply:      sdk.ZeroInt(),
    23  			Holders:     0,
    24  			Fee:         sdk.ZeroInt(),
    25  			Owner:       "kira15ky9du8a2wlstz6fpx3p4mqpjyrm5cgqzp4f3d",
    26  		},
    27  		{
    28  			TokenType:   "adr43",
    29  			Denom:       "ku/punk",
    30  			Name:        "Bridge PUNK",
    31  			Symbol:      "PUNK",
    32  			Icon:        "",
    33  			Description: "",
    34  			Website:     "",
    35  			Social:      "",
    36  			Decimals:    0,
    37  			Cap:         sdk.NewInt(1000_000_000),
    38  			Supply:      sdk.ZeroInt(),
    39  			Holders:     0,
    40  			Fee:         sdk.ZeroInt(),
    41  			Owner:       "kira15ky9du8a2wlstz6fpx3p4mqpjyrm5cgqzp4f3d",
    42  			Hash:        "",
    43  			Metadata:    "",
    44  		},
    45  	}
    46  
    47  	for _, info := range infos {
    48  		suite.app.Layer2Keeper.SetTokenInfo(suite.ctx, info)
    49  	}
    50  
    51  	for _, info := range infos {
    52  		c := suite.app.Layer2Keeper.GetTokenInfo(suite.ctx, info.Denom)
    53  		suite.Require().Equal(c, info)
    54  	}
    55  
    56  	allInfos := suite.app.Layer2Keeper.GetTokenInfos(suite.ctx)
    57  	suite.Require().Len(allInfos, 2)
    58  
    59  	suite.app.Layer2Keeper.DeleteTokenInfo(suite.ctx, infos[0].Denom)
    60  
    61  	allInfos = suite.app.Layer2Keeper.GetTokenInfos(suite.ctx)
    62  	suite.Require().Len(allInfos, 1)
    63  }
    64  
    65  func (suite *KeeperTestSuite) TestPow10() {
    66  	suite.Require().Equal(keeper.Pow10(0), sdk.NewInt(1))
    67  	suite.Require().Equal(keeper.Pow10(1), sdk.NewInt(10))
    68  	suite.Require().Equal(keeper.Pow10(2), sdk.NewInt(100))
    69  	suite.Require().Equal(keeper.Pow10(3), sdk.NewInt(1000))
    70  }