From f524e5d98ed4b8c0a6161df9fc0e7154a194e706 Mon Sep 17 00:00:00 2001 From: victor118 Date: Fri, 7 Jun 2024 20:00:51 +0200 Subject: [PATCH] Free mint white list implementation => needed by white whale smart contracts --- app/app.go | 29 +++- .../osmosis/tokenfactory/v1beta1/params.proto | 2 + x/tokenfactory/keeper/bankactions.go | 41 ++++-- x/tokenfactory/keeper/msg_server.go | 2 +- x/tokenfactory/types/params.go | 35 ++++- x/tokenfactory/types/params.pb.go | 131 +++++++++++++----- 6 files changed, 180 insertions(+), 60 deletions(-) diff --git a/app/app.go b/app/app.go index d1a314c..3cecc9c 100644 --- a/app/app.go +++ b/app/app.go @@ -158,7 +158,7 @@ import ( const ( Bech32Prefix = "chihuahua" Name = "chihuahua" - UpgradeName = "v7" + UpgradeName = "v7.0.1" NodeDir = ".chihuahuad" ) @@ -880,7 +880,7 @@ func New( //alliancemoduletypes.StoreKey, //ibchookstypes.StoreKey, //tokenfactorytypes.ModuleName, - liquiditytypes.ModuleName, + //liquiditytypes.ModuleName, }, } @@ -1170,6 +1170,31 @@ func (app *App) RegisterUpgradeHandlers(cfg module.Configurator) { } return vm, err }) + + app.UpgradeKeeper.SetUpgradeHandler("v7.0.1", func(ctx sdk.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { + + tokenFactoryParams := app.TokenFactoryKeeper.GetParams(ctx) + tokenFactoryParams.BuildersAddresses = []tokenfactorytypes.WeightedAddress{ + { + Address: "chihuahua1yjak0p2f6yjwhvf00r0wd4kqhdpvn57qc887m3", + Weight: sdk.NewDecWithPrec(10, 2), //will receive 10% of commission from minting tokens + }, + { + Address: "chihuahua1jpfqqpna4nasv53gkn08ta9ygfryq38l8af602", + Weight: sdk.NewDecWithPrec(90, 2), //will receive 90% of commission from minting tokens + }, + } + tokenFactoryParams.DenomCreationFee = nil + tokenFactoryParams.DenomCreationGasConsume = 50_000 + tokenFactoryParams.BuildersCommission = sdk.NewDecWithPrec(1, 2) //1% of minted token goes to builders + + tokenFactoryParams.FreeMintWhitelistAddresses = []string{ + "chihuahua1e85rxa4r8utk6ee0j93serytcchgeayqteeystkshqsvryk55egs6l9jhu", + "chihuahua1hplyuj2hzxd75q8686g9vm3uzrrny9ggvt8aza2csupgdp98vg2sp0e3h0", + } + errParams := app.TokenFactoryKeeper.SetParams(ctx, tokenFactoryParams) + return vm, errParams + }) } // SimulationManager implements the SimulationApp interface diff --git a/proto/osmosis/tokenfactory/v1beta1/params.proto b/proto/osmosis/tokenfactory/v1beta1/params.proto index b4a9c81..2557d22 100755 --- a/proto/osmosis/tokenfactory/v1beta1/params.proto +++ b/proto/osmosis/tokenfactory/v1beta1/params.proto @@ -49,4 +49,6 @@ message Params { (gogoproto.moretags) = "yaml:\"builders_addresses\"", (gogoproto.nullable) = false ]; + + repeated string free_mint_whitelist_addresses = 5; } \ No newline at end of file diff --git a/x/tokenfactory/keeper/bankactions.go b/x/tokenfactory/keeper/bankactions.go index 73c06cf..935cc09 100644 --- a/x/tokenfactory/keeper/bankactions.go +++ b/x/tokenfactory/keeper/bankactions.go @@ -9,7 +9,7 @@ import ( "github.com/ChihuahuaChain/chihuahua/x/tokenfactory/types" ) -func (k Keeper) mintTo(ctx sdk.Context, amount sdk.Coin, mintTo string) error { +func (k Keeper) mintTo(ctx sdk.Context, amount sdk.Coin, mintTo string, sender string) error { // verify that denom is an x/tokenfactory denom _, _, err := types.DeconstructDenom(amount.Denom) if err != nil { @@ -33,21 +33,23 @@ func (k Keeper) mintTo(ctx sdk.Context, amount sdk.Coin, mintTo string) error { params := k.GetParams(ctx) comm := params.BuildersCommission buildersAddresses := params.BuildersAddresses - if len(buildersAddresses) > 0 { - decAmount := sdk.NewDecCoinFromCoin(amount) - commAmount := decAmount.Amount.Mul(comm) - totalCommSent := math.NewInt(0) - for _, builderAddr := range buildersAddresses { - accBuilder := sdk.MustAccAddressFromBech32(builderAddr.Address) - builderAmount := commAmount.Mul(builderAddr.Weight).TruncateInt() - builderCoin := sdk.NewCoin(amount.Denom, builderAmount) - error := k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, accBuilder, sdk.NewCoins(builderCoin)) - if error == nil { - totalCommSent = totalCommSent.Add(builderAmount) - } + if !isWhitelistedAddress(sender, params) { + if len(buildersAddresses) > 0 { + decAmount := sdk.NewDecCoinFromCoin(amount) + commAmount := decAmount.Amount.Mul(comm) + totalCommSent := math.NewInt(0) + for _, builderAddr := range buildersAddresses { + accBuilder := sdk.MustAccAddressFromBech32(builderAddr.Address) + builderAmount := commAmount.Mul(builderAddr.Weight).TruncateInt() + builderCoin := sdk.NewCoin(amount.Denom, builderAmount) + error := k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, accBuilder, sdk.NewCoins(builderCoin)) + if error == nil { + totalCommSent = totalCommSent.Add(builderAmount) + } + } + amount = amount.SubAmount(totalCommSent) } - amount = amount.SubAmount(totalCommSent) } return k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, @@ -55,6 +57,17 @@ func (k Keeper) mintTo(ctx sdk.Context, amount sdk.Coin, mintTo string) error { sdk.NewCoins(amount)) } +func isWhitelistedAddress(sender string, params types.Params) bool { + if len(params.FreeMintWhitelistAddresses) > 0 { + for _, addr := range params.FreeMintWhitelistAddresses { + if addr == sender { + return true + } + } + } + return false +} + func (k Keeper) burnFrom(ctx sdk.Context, amount sdk.Coin, burnFrom string) error { // verify that denom is an x/tokenfactory denom _, _, err := types.DeconstructDenom(amount.Denom) diff --git a/x/tokenfactory/keeper/msg_server.go b/x/tokenfactory/keeper/msg_server.go index 89b1f54..e2c74d6 100644 --- a/x/tokenfactory/keeper/msg_server.go +++ b/x/tokenfactory/keeper/msg_server.go @@ -70,7 +70,7 @@ func (server msgServer) Mint(goCtx context.Context, msg *types.MsgMint) (*types. msg.MintToAddress = msg.Sender } - err = server.Keeper.mintTo(ctx, msg.Amount, msg.MintToAddress) + err = server.Keeper.mintTo(ctx, msg.Amount, msg.MintToAddress, msg.Sender) if err != nil { return nil, err } diff --git a/x/tokenfactory/types/params.go b/x/tokenfactory/types/params.go index 73b228c..f5f404d 100644 --- a/x/tokenfactory/types/params.go +++ b/x/tokenfactory/types/params.go @@ -16,10 +16,11 @@ func NewParams(denomCreationFee sdk.Coins) Params { // default tokenfactory module parameters. func DefaultParams() Params { return Params{ - DenomCreationFee: sdk.NewCoins(sdk.NewInt64Coin(sdk.DefaultBondDenom, 10_000_000)), - DenomCreationGasConsume: 2_000_000, - BuildersCommission: sdk.NewDecWithPrec(5, 3), // "0.005" if there is builders addresses, this commission rate from minted amount is redirected to builders - BuildersAddresses: []WeightedAddress(nil), + DenomCreationFee: sdk.NewCoins(sdk.NewInt64Coin(sdk.DefaultBondDenom, 10_000_000)), + DenomCreationGasConsume: 2_000_000, + BuildersCommission: sdk.NewDecWithPrec(5, 3), // "0.005" if there is builders addresses, this commission rate from minted amount is redirected to builders + BuildersAddresses: []WeightedAddress(nil), + FreeMintWhitelistAddresses: []string(nil), } } @@ -41,10 +42,34 @@ func (p Params) Validate() error { if err != nil { return err } + err = validateFreeMintWhitelistAddresses(p.FreeMintWhitelistAddresses) + if err != nil { + return err + } return nil } +func validateFreeMintWhitelistAddresses(i interface{}) error { + v, ok := i.([]string) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + + // whitelist can be empty + if len(v) == 0 { + return nil + } + for i, addr := range v { + _, err := sdk.AccAddressFromBech32(addr) + if err != nil { + return fmt.Errorf("invalid address at %dth", i) + } + + } + return nil +} + func validateBuildersAddresses(i interface{}) error { v, ok := i.([]WeightedAddress) if !ok { @@ -58,8 +83,6 @@ func validateBuildersAddresses(i interface{}) error { weightSum := sdk.ZeroDec() for i, w := range v { - // we allow address to be "" to go to community pool - _, err := sdk.AccAddressFromBech32(w.Address) if err != nil { return fmt.Errorf("invalid address at %dth", i) diff --git a/x/tokenfactory/types/params.pb.go b/x/tokenfactory/types/params.pb.go index 76363ed..572e24b 100644 --- a/x/tokenfactory/types/params.pb.go +++ b/x/tokenfactory/types/params.pb.go @@ -81,9 +81,10 @@ type Params struct { // if denom_creation_fee is an empty array, then this field is used to add more gas consumption // to the base cost. // https://github.com/CosmWasm/token-factory/issues/11 - DenomCreationGasConsume uint64 `protobuf:"varint,2,opt,name=denom_creation_gas_consume,json=denomCreationGasConsume,proto3" json:"denom_creation_gas_consume,omitempty" yaml:"denom_creation_gas_consume"` - BuildersCommission github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=builders_commission,json=buildersCommission,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"builders_commission" yaml:"builders_commission"` - BuildersAddresses []WeightedAddress `protobuf:"bytes,4,rep,name=builders_addresses,json=buildersAddresses,proto3" json:"builders_addresses" yaml:"builders_addresses"` + DenomCreationGasConsume uint64 `protobuf:"varint,2,opt,name=denom_creation_gas_consume,json=denomCreationGasConsume,proto3" json:"denom_creation_gas_consume,omitempty" yaml:"denom_creation_gas_consume"` + BuildersCommission github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=builders_commission,json=buildersCommission,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"builders_commission" yaml:"builders_commission"` + BuildersAddresses []WeightedAddress `protobuf:"bytes,4,rep,name=builders_addresses,json=buildersAddresses,proto3" json:"builders_addresses" yaml:"builders_addresses"` + FreeMintWhitelistAddresses []string `protobuf:"bytes,5,rep,name=free_mint_whitelist_addresses,json=freeMintWhitelistAddresses,proto3" json:"free_mint_whitelist_addresses,omitempty"` } func (m *Params) Reset() { *m = Params{} } @@ -140,6 +141,13 @@ func (m *Params) GetBuildersAddresses() []WeightedAddress { return nil } +func (m *Params) GetFreeMintWhitelistAddresses() []string { + if m != nil { + return m.FreeMintWhitelistAddresses + } + return nil +} + func init() { proto.RegisterType((*WeightedAddress)(nil), "osmosis.tokenfactory.v1beta1.WeightedAddress") proto.RegisterType((*Params)(nil), "osmosis.tokenfactory.v1beta1.Params") @@ -150,41 +158,43 @@ func init() { } var fileDescriptor_cc8299d306f3ff47 = []byte{ - // 529 bytes of a gzipped FileDescriptorProto + // 565 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0xbf, 0x6f, 0xd3, 0x40, - 0x14, 0xc7, 0x73, 0x34, 0x0a, 0xc2, 0x88, 0x5f, 0x07, 0x12, 0x49, 0x40, 0x76, 0xeb, 0x01, 0xa5, - 0x12, 0x3d, 0xab, 0xd0, 0x01, 0x75, 0xab, 0x8d, 0x60, 0x49, 0x25, 0xe4, 0x05, 0x89, 0xc5, 0x3a, - 0xdb, 0x17, 0xfb, 0x94, 0xda, 0x17, 0xf9, 0xce, 0x80, 0x07, 0xc4, 0xcc, 0x86, 0x84, 0xc4, 0xcc, - 0xcc, 0x5f, 0x92, 0xb1, 0x23, 0x62, 0x30, 0x28, 0x59, 0x98, 0xf3, 0x17, 0xa0, 0xdc, 0x9d, 0xa3, - 0xa4, 0xad, 0xaa, 0x4e, 0xbe, 0x7b, 0xef, 0xfb, 0x3e, 0x77, 0xef, 0x7b, 0xcf, 0xc6, 0x2e, 0xe3, - 0x19, 0xe3, 0x94, 0x3b, 0x82, 0x8d, 0x49, 0x3e, 0xc2, 0x91, 0x60, 0x45, 0xe5, 0xbc, 0xdf, 0x0f, - 0x89, 0xc0, 0xfb, 0xce, 0x04, 0x17, 0x38, 0xe3, 0x68, 0x52, 0x30, 0xc1, 0xe0, 0x63, 0x2d, 0x45, - 0xeb, 0x52, 0xa4, 0xa5, 0xfd, 0x07, 0x09, 0x4b, 0x98, 0x14, 0x3a, 0xcb, 0x95, 0xaa, 0xe9, 0x1f, - 0x5c, 0x8a, 0xc7, 0xa5, 0x48, 0x59, 0x41, 0x45, 0x75, 0x4c, 0x04, 0x8e, 0xb1, 0xc0, 0xba, 0xaa, - 0x17, 0xc9, 0xb2, 0x40, 0xe1, 0xd4, 0x46, 0xa7, 0x4c, 0xb5, 0x73, 0x42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0xe0, 0x0d, 0x66, 0xae, 0xcc, 0xa0, 0x8f, 0xfa, 0xfd, 0x41, 0x4e, 0xc6, + 0x21, 0x64, 0x2b, 0x75, 0x92, 0x10, 0xc6, 0x08, 0x4d, 0xeb, 0x3b, 0xc2, 0xec, 0x9e, 0x32, 0xfb, + 0xe9, 0x7f, 0x0c, 0x22, 0x7d, 0x6f, 0xca, 0x56, 0x2e, 0x41, 0x5a, 0x1e, 0x2a, 0xa3, 0xee, 0x3a, + 0x88, 0x3e, 0xe9, 0xeb, 0xa8, 0xaf, 0x8e, 0x1c, 0x58, 0xbd, 0x2a, 0xec, 0x3f, 0xb0, 0xaf, 0xba, + 0xe2, 0xf6, 0xb9, 0x7b, 0xd5, 0xdd, 0xdb, 0x3e, 0x92, 0x8b, 0x58, 0xcb, 0xbb, 0x57, 0x06, 0x3b, + 0x65, 0x0c, 0x75, 0xf4, 0x27, 0xc3, 0x0c, 0xc0, 0x4f, 0x48, 0xca, 0xfd, 0xd3, 0x98, 0x70, 0x18, + 0x13, 0xc6, 0x37, 0x7a, 0xb9, 0xde, 0xda, 0x69, 0xef, 0x7a, 0xcd, 0x95, 0xa8, 0x4f, 0x52, 0x7e, + 0x52, 0x4a, 0xd6, 0x88, 0xae, 0x37, 0x9b, 0x1b, 0xda, 0xd9, 0xdc, 0xd0, 0xfe, 0xcc, 0x0d, 0xed, + 0xf3, 0xc2, 0xa8, 0x9c, 0x2d, 0x8c, 0xca, 0xcf, 0x85, 0x51, 0x79, 0xf7, 0x72, 0xc3, 0x37, 0x37, + 0x26, 0x71, 0x8e, 0xe3, 0x1c, 0xbb, 0x31, 0x26, 0xa9, 0x13, 0x94, 0x4b, 0xe7, 0xc3, 0xf6, 0x6b, + 0x14, 0x6e, 0x0e, 0x6a, 0xe2, 0xfd, 0xbc, 0xf8, 0x17, 0x00, 0x00, 0xff, 0xff, 0xdc, 0x47, 0x72, + 0x6a, 0x11, 0x04, 0x00, 0x00, } func (this *WeightedAddress) Equal(that interface{}) bool { @@ -274,6 +284,15 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.FreeMintWhitelistAddresses) > 0 { + for iNdEx := len(m.FreeMintWhitelistAddresses) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.FreeMintWhitelistAddresses[iNdEx]) + copy(dAtA[i:], m.FreeMintWhitelistAddresses[iNdEx]) + i = encodeVarintParams(dAtA, i, uint64(len(m.FreeMintWhitelistAddresses[iNdEx]))) + i-- + dAtA[i] = 0x2a + } + } if len(m.BuildersAddresses) > 0 { for iNdEx := len(m.BuildersAddresses) - 1; iNdEx >= 0; iNdEx-- { { @@ -369,6 +388,12 @@ func (m *Params) Size() (n int) { n += 1 + l + sovParams(uint64(l)) } } + if len(m.FreeMintWhitelistAddresses) > 0 { + for _, s := range m.FreeMintWhitelistAddresses { + l = len(s) + n += 1 + l + sovParams(uint64(l)) + } + } return n } @@ -644,6 +669,38 @@ func (m *Params) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FreeMintWhitelistAddresses", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthParams + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FreeMintWhitelistAddresses = append(m.FreeMintWhitelistAddresses, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipParams(dAtA[iNdEx:])