diff --git a/api/irismod/token/v1/token.pulsar.go b/api/irismod/token/v1/token.pulsar.go index 3cb3ad88..715473ef 100644 --- a/api/irismod/token/v1/token.pulsar.go +++ b/api/irismod/token/v1/token.pulsar.go @@ -893,6 +893,7 @@ var ( fd_Params_token_tax_rate protoreflect.FieldDescriptor fd_Params_issue_token_base_fee protoreflect.FieldDescriptor fd_Params_mint_token_fee_ratio protoreflect.FieldDescriptor + fd_Params_enable_erc20 protoreflect.FieldDescriptor ) func init() { @@ -901,6 +902,7 @@ func init() { fd_Params_token_tax_rate = md_Params.Fields().ByName("token_tax_rate") fd_Params_issue_token_base_fee = md_Params.Fields().ByName("issue_token_base_fee") fd_Params_mint_token_fee_ratio = md_Params.Fields().ByName("mint_token_fee_ratio") + fd_Params_enable_erc20 = md_Params.Fields().ByName("enable_erc20") } var _ protoreflect.Message = (*fastReflection_Params)(nil) @@ -986,6 +988,12 @@ func (x *fastReflection_Params) Range(f func(protoreflect.FieldDescriptor, proto return } } + if x.EnableErc20 != false { + value := protoreflect.ValueOfBool(x.EnableErc20) + if !f(fd_Params_enable_erc20, value) { + return + } + } } // Has reports whether a field is populated. @@ -1007,6 +1015,8 @@ func (x *fastReflection_Params) Has(fd protoreflect.FieldDescriptor) bool { return x.IssueTokenBaseFee != nil case "irismod.token.v1.Params.mint_token_fee_ratio": return x.MintTokenFeeRatio != "" + case "irismod.token.v1.Params.enable_erc20": + return x.EnableErc20 != false default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.Params")) @@ -1029,6 +1039,8 @@ func (x *fastReflection_Params) Clear(fd protoreflect.FieldDescriptor) { x.IssueTokenBaseFee = nil case "irismod.token.v1.Params.mint_token_fee_ratio": x.MintTokenFeeRatio = "" + case "irismod.token.v1.Params.enable_erc20": + x.EnableErc20 = false default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.Params")) @@ -1054,6 +1066,9 @@ func (x *fastReflection_Params) Get(descriptor protoreflect.FieldDescriptor) pro case "irismod.token.v1.Params.mint_token_fee_ratio": value := x.MintTokenFeeRatio return protoreflect.ValueOfString(value) + case "irismod.token.v1.Params.enable_erc20": + value := x.EnableErc20 + return protoreflect.ValueOfBool(value) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.Params")) @@ -1080,6 +1095,8 @@ func (x *fastReflection_Params) Set(fd protoreflect.FieldDescriptor, value proto x.IssueTokenBaseFee = value.Message().Interface().(*v1beta1.Coin) case "irismod.token.v1.Params.mint_token_fee_ratio": x.MintTokenFeeRatio = value.Interface().(string) + case "irismod.token.v1.Params.enable_erc20": + x.EnableErc20 = value.Bool() default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.Params")) @@ -1109,6 +1126,8 @@ func (x *fastReflection_Params) Mutable(fd protoreflect.FieldDescriptor) protore panic(fmt.Errorf("field token_tax_rate of message irismod.token.v1.Params is not mutable")) case "irismod.token.v1.Params.mint_token_fee_ratio": panic(fmt.Errorf("field mint_token_fee_ratio of message irismod.token.v1.Params is not mutable")) + case "irismod.token.v1.Params.enable_erc20": + panic(fmt.Errorf("field enable_erc20 of message irismod.token.v1.Params is not mutable")) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.Params")) @@ -1129,6 +1148,8 @@ func (x *fastReflection_Params) NewField(fd protoreflect.FieldDescriptor) protor return protoreflect.ValueOfMessage(m.ProtoReflect()) case "irismod.token.v1.Params.mint_token_fee_ratio": return protoreflect.ValueOfString("") + case "irismod.token.v1.Params.enable_erc20": + return protoreflect.ValueOfBool(false) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: irismod.token.v1.Params")) @@ -1210,6 +1231,9 @@ func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods { if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) } + if x.EnableErc20 { + n += 2 + } if x.unknownFields != nil { n += len(x.unknownFields) } @@ -1239,6 +1263,16 @@ func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } + if x.EnableErc20 { + i-- + if x.EnableErc20 { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x20 + } if len(x.MintTokenFeeRatio) > 0 { i -= len(x.MintTokenFeeRatio) copy(dAtA[i:], x.MintTokenFeeRatio) @@ -1416,6 +1450,26 @@ func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods { } x.MintTokenFeeRatio = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 4: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field EnableErc20", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + x.EnableErc20 = bool(v != 0) default: iNdEx = preIndex skippy, err := runtime.Skip(dAtA[iNdEx:]) @@ -1573,6 +1627,7 @@ type Params struct { TokenTaxRate string `protobuf:"bytes,1,opt,name=token_tax_rate,json=tokenTaxRate,proto3" json:"token_tax_rate,omitempty"` IssueTokenBaseFee *v1beta1.Coin `protobuf:"bytes,2,opt,name=issue_token_base_fee,json=issueTokenBaseFee,proto3" json:"issue_token_base_fee,omitempty"` MintTokenFeeRatio string `protobuf:"bytes,3,opt,name=mint_token_fee_ratio,json=mintTokenFeeRatio,proto3" json:"mint_token_fee_ratio,omitempty"` + EnableErc20 bool `protobuf:"varint,4,opt,name=enable_erc20,json=enableErc20,proto3" json:"enable_erc20,omitempty"` } func (x *Params) Reset() { @@ -1616,6 +1671,13 @@ func (x *Params) GetMintTokenFeeRatio() string { return "" } +func (x *Params) GetEnableErc20() bool { + if x != nil { + return x.EnableErc20 + } + return false +} + var File_irismod_token_v1_token_proto protoreflect.FileDescriptor var file_irismod_token_v1_token_proto_rawDesc = []byte{ @@ -1641,7 +1703,7 @@ var file_irismod_token_v1_token_proto_rawDesc = []byte{ 0x14, 0x0a, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, - 0x74, 0x3a, 0x04, 0x88, 0xa0, 0x1f, 0x00, 0x22, 0x97, 0x02, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, + 0x74, 0x3a, 0x04, 0x88, 0xa0, 0x1f, 0x00, 0x22, 0xba, 0x02, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x54, 0x0a, 0x0e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x74, 0x61, 0x78, 0x5f, 0x72, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x2e, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x26, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, @@ -1658,20 +1720,22 @@ var file_irismod_token_v1_token_proto_rawDesc = []byte{ 0x1f, 0x26, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, 0x11, 0x6d, 0x69, 0x6e, 0x74, 0x54, 0x6f, - 0x6b, 0x65, 0x6e, 0x46, 0x65, 0x65, 0x52, 0x61, 0x74, 0x69, 0x6f, 0x3a, 0x04, 0xe8, 0xa0, 0x1f, - 0x01, 0x42, 0xc1, 0x01, 0xc8, 0xe1, 0x1e, 0x00, 0x0a, 0x14, 0x63, 0x6f, 0x6d, 0x2e, 0x69, 0x72, - 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x76, 0x31, 0x42, 0x0a, - 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x37, 0x67, 0x69, - 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6e, 0x65, 0x74, - 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x69, 0x72, 0x69, - 0x73, 0x6d, 0x6f, 0x64, 0x2f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x2f, 0x76, 0x31, 0x3b, 0x74, 0x6f, - 0x6b, 0x65, 0x6e, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x49, 0x54, 0x58, 0xaa, 0x02, 0x10, 0x49, 0x72, - 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x56, 0x31, 0xca, 0x02, - 0x10, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x5c, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x5c, 0x56, - 0x31, 0xe2, 0x02, 0x1c, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x5c, 0x54, 0x6f, 0x6b, 0x65, - 0x6e, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, - 0xea, 0x02, 0x12, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x3a, 0x3a, 0x54, 0x6f, 0x6b, 0x65, - 0x6e, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6b, 0x65, 0x6e, 0x46, 0x65, 0x65, 0x52, 0x61, 0x74, 0x69, 0x6f, 0x12, 0x21, 0x0a, 0x0c, 0x65, + 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x65, 0x72, 0x63, 0x32, 0x30, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x08, 0x52, 0x0b, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x45, 0x72, 0x63, 0x32, 0x30, 0x3a, 0x04, + 0xe8, 0xa0, 0x1f, 0x01, 0x42, 0xc1, 0x01, 0xc8, 0xe1, 0x1e, 0x00, 0x0a, 0x14, 0x63, 0x6f, 0x6d, + 0x2e, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x76, + 0x31, 0x42, 0x0a, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, + 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x69, 0x72, 0x69, 0x73, + 0x6e, 0x65, 0x74, 0x2f, 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, + 0x69, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x2f, 0x76, 0x31, + 0x3b, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x49, 0x54, 0x58, 0xaa, 0x02, + 0x10, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x56, + 0x31, 0xca, 0x02, 0x10, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x5c, 0x54, 0x6f, 0x6b, 0x65, + 0x6e, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1c, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x5c, 0x54, + 0x6f, 0x6b, 0x65, 0x6e, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, + 0x61, 0x74, 0x61, 0xea, 0x02, 0x12, 0x49, 0x72, 0x69, 0x73, 0x6d, 0x6f, 0x64, 0x3a, 0x3a, 0x54, + 0x6f, 0x6b, 0x65, 0x6e, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/modules/token/keeper/erc20.go b/modules/token/keeper/erc20.go index 99184532..8e06cb22 100644 --- a/modules/token/keeper/erc20.go +++ b/modules/token/keeper/erc20.go @@ -99,6 +99,10 @@ func (k Keeper) SwapFromERC20( receiver sdk.AccAddress, wantedAmount sdk.Coin, ) error { + if !k.ERC20Enabled(ctx) { + return types.ErrERC20Disabled + } + token, err := k.getTokenByMinUnit(ctx, wantedAmount.Denom) if err != nil { return err @@ -146,6 +150,10 @@ func (k Keeper) SwapToERC20( receiver common.Address, amount sdk.Coin, ) error { + if !k.ERC20Enabled(ctx) { + return types.ErrERC20Disabled + } + receiverAcc := k.accountKeeper.GetAccount(ctx, sdk.AccAddress(receiver.Bytes())) if receiverAcc != nil { if !k.evmKeeper.SupportedKey(receiverAcc.GetPubKey()) { diff --git a/modules/token/keeper/evm_hook.go b/modules/token/keeper/evm_hook.go index 0a6cd39c..2d52a01c 100644 --- a/modules/token/keeper/evm_hook.go +++ b/modules/token/keeper/evm_hook.go @@ -28,6 +28,7 @@ type erc20Hook struct { // // Return type: error func (hook erc20Hook) PostTxProcessing(ctx sdk.Context, msg core.Message, receipt *ethtypes.Receipt) error { + disable := !hook.k.ERC20Enabled(ctx) erc20 := contracts.ERC20TokenContract.ABI for _, log := range receipt.Logs { // Note: the `SwapToNative` event contains 1 topics @@ -54,6 +55,10 @@ func (hook erc20Hook) PostTxProcessing(ctx sdk.Context, msg core.Message, receip continue } + if disable { + return types.ErrERC20Disabled + } + eventArgs, err := erc20.Unpack(event.Name, log.Data) if err != nil { return errorsmod.Wrap(types.ErrInvalidContract, "failed to unpack SwapToNative event") diff --git a/modules/token/keeper/params.go b/modules/token/keeper/params.go index 5979d5bc..bfdf6d36 100644 --- a/modules/token/keeper/params.go +++ b/modules/token/keeper/params.go @@ -34,3 +34,9 @@ func (k Keeper) SetParams(ctx sdk.Context, params v1.Params) error { return nil } + +// ERC20Enabled returns true if ERC20 is enabled +func (k Keeper) ERC20Enabled(ctx sdk.Context) bool { + params := k.GetParams(ctx) + return params.EnableErc20 +} diff --git a/modules/token/types/errors.go b/modules/token/types/errors.go index f112177b..f4183615 100644 --- a/modules/token/types/errors.go +++ b/modules/token/types/errors.go @@ -31,4 +31,5 @@ var ( ErrERC20NotDeployed = errorsmod.Register(ModuleName, 23, "erc20 contract not deployed") ErrUnsupportedKey = errorsmod.Register(ModuleName, 24, "evm not supported public key") ErrInvalidContract = errorsmod.Register(ModuleName, 25, "invalid contract") + ErrERC20Disabled = errorsmod.Register(ModuleName, 26, "erc20 swap is disabled") ) diff --git a/modules/token/types/v1/params.go b/modules/token/types/v1/params.go index 8d6a1002..30df9236 100644 --- a/modules/token/types/v1/params.go +++ b/modules/token/types/v1/params.go @@ -24,10 +24,11 @@ func DefaultParams() Params { TokenTaxRate: sdk.NewDecWithPrec(4, 1), // 0.4 (40%) IssueTokenBaseFee: sdk.NewCoin(defaultToken.Symbol, sdk.NewInt(60000)), MintTokenFeeRatio: sdk.NewDecWithPrec(1, 1), // 0.1 (10%) + EnableErc20: true, } } -// ValidateParams validates the given params +// Validate validates the given params func (p Params) Validate() error { if err := validateTaxRate(p.TokenTaxRate); err != nil { return err diff --git a/modules/token/types/v1/token.pb.go b/modules/token/types/v1/token.pb.go index 6c5ada58..ecdab375 100644 --- a/modules/token/types/v1/token.pb.go +++ b/modules/token/types/v1/token.pb.go @@ -76,6 +76,7 @@ type Params struct { TokenTaxRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,1,opt,name=token_tax_rate,json=tokenTaxRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"token_tax_rate"` IssueTokenBaseFee types.Coin `protobuf:"bytes,2,opt,name=issue_token_base_fee,json=issueTokenBaseFee,proto3" json:"issue_token_base_fee"` MintTokenFeeRatio github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=mint_token_fee_ratio,json=mintTokenFeeRatio,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"mint_token_fee_ratio"` + EnableErc20 bool `protobuf:"varint,4,opt,name=enable_erc20,json=enableErc20,proto3" json:"enable_erc20,omitempty"` } func (m *Params) Reset() { *m = Params{} } @@ -119,37 +120,39 @@ func init() { func init() { proto.RegisterFile("irismod/token/v1/token.proto", fileDescriptor_c5b3436d30fd508a) } var fileDescriptor_c5b3436d30fd508a = []byte{ - // 479 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x52, 0x4d, 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, 0xed, 0x89, 0x26, 0x54, 0xc1, 0x39, 0x00, - 0x29, 0x70, 0xdf, 0xfc, 0xb6, 0x17, 0xbc, 0x04, 0x30, 0xc3, 0x32, 0x69, 0x8f, 0xf1, 0xff, 0xd3, - 0x1e, 0x1b, 0x2d, 0xab, 0x7f, 0x0e, 0x90, 0x1b, 0xa1, 0xb3, 0xf0, 0xf7, 0xf5, 0x10, 0x4d, 0xde, - 0x6d, 0x7e, 0xc5, 0xc1, 0x66, 0x1b, 0xa3, 0x9b, 0x6d, 0x8c, 0x7e, 0x6e, 0x63, 0xf4, 0x75, 0x17, - 0x07, 0x37, 0xbb, 0x38, 0xf8, 0xbe, 0x8b, 0x83, 0x8f, 0xd9, 0x3f, 0xf2, 0xc6, 0x8b, 0x02, 0x74, - 0x7a, 0xe7, 0x58, 0x2e, 0x67, 0x6d, 0x0d, 0xca, 0x3b, 0xd7, 0xb6, 0x32, 0x8e, 0xec, 0x58, 0xcb, - 0xbd, 0xfe, 0x1b, 0x00, 0x00, 0xff, 0xff, 0x1f, 0x8d, 0xfc, 0xc1, 0xda, 0x02, 0x00, 0x00, + // 502 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x52, 0xcd, 0x6e, 0xd3, 0x40, + 0x10, 0xf6, 0x16, 0x27, 0x4d, 0xb6, 0x3f, 0xa2, 0xab, 0x08, 0xb9, 0x11, 0x38, 0xa1, 0x12, 0x28, + 0x17, 0x6c, 0x5c, 0x6e, 0x3d, 0x06, 0xe8, 0x95, 0xca, 0x84, 0x0b, 0x17, 0x6b, 0xed, 0x4c, 0xc3, + 0xaa, 0xde, 0xdd, 0xc8, 0xbb, 0x0e, 0xc9, 0x1b, 0x70, 0xe4, 0x11, 0xfa, 0x1c, 0x3c, 0x41, 0x8e, + 0x3d, 0x22, 0x0e, 0x15, 0x24, 0x17, 0x9e, 0x02, 0xa1, 0xdd, 0x75, 0x2b, 0xae, 0x9c, 0x3c, 0xf3, + 0xed, 0xcc, 0x37, 0xe3, 0xf9, 0x3e, 0xfc, 0x98, 0x55, 0x4c, 0x71, 0x39, 0x8d, 0xb5, 0xbc, 0x02, + 0x11, 0x2f, 0x12, 0x17, 0x44, 0xf3, 0x4a, 0x6a, 0x49, 0x1e, 0x36, 0xaf, 0x91, 0x03, 0x17, 0x49, + 0x3f, 0x2c, 0xa4, 0xe2, 0x52, 0xc5, 0x39, 0x55, 0x10, 0x2f, 0x92, 0x1c, 0x34, 0x4d, 0xe2, 0x42, + 0xb2, 0xa6, 0xa3, 0xdf, 0x9b, 0xc9, 0x99, 0xb4, 0x61, 0x6c, 0x22, 0x87, 0x9e, 0xfc, 0x41, 0xb8, + 0x35, 0x31, 0x14, 0xe4, 0x11, 0x6e, 0xab, 0x15, 0xcf, 0x65, 0x19, 0xa0, 0x21, 0x1a, 0x75, 0xd3, + 0x26, 0x23, 0x04, 0xfb, 0x82, 0x72, 0x08, 0x76, 0x2c, 0x6a, 0x63, 0xd2, 0xc3, 0x2d, 0x55, 0xd0, + 0x12, 0x82, 0x07, 0x43, 0x34, 0x3a, 0x48, 0x5d, 0x42, 0x8e, 0x71, 0x87, 0x33, 0x91, 0xd5, 0x82, + 0xe9, 0xc0, 0xb7, 0xd5, 0xbb, 0x9c, 0x89, 0x0f, 0x82, 0x69, 0xf2, 0x0c, 0x1f, 0x32, 0xc1, 0x34, + 0xa3, 0x65, 0xa6, 0xea, 0xf9, 0xbc, 0x5c, 0x05, 0xad, 0x21, 0x1a, 0xf9, 0xe9, 0x41, 0x83, 0xbe, + 0xb7, 0x20, 0x79, 0x82, 0x31, 0xa7, 0xcb, 0xbb, 0x92, 0xb6, 0x2d, 0xe9, 0x72, 0xba, 0x6c, 0x9e, + 0xfb, 0x76, 0x80, 0xa6, 0x79, 0x09, 0xc1, 0xee, 0x10, 0x8d, 0x3a, 0xe9, 0x7d, 0x6e, 0x56, 0x92, + 0x9f, 0x05, 0x54, 0x41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xa1, 0xb7, 0xde, 0x84, 0xe8, 0x66, 0x13, 0xa2, + 0x9f, 0x9b, 0x10, 0x7d, 0xdd, 0x86, 0xde, 0xcd, 0x36, 0xf4, 0xbe, 0x6f, 0x43, 0xef, 0x63, 0xf2, + 0xcf, 0x06, 0xc6, 0xae, 0x02, 0x74, 0x7c, 0x67, 0x6a, 0x2e, 0xa7, 0x75, 0x09, 0xaa, 0x31, 0xb7, + 0xdd, 0xc6, 0x98, 0xb6, 0x6d, 0x5d, 0xf9, 0xea, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x51, 0xd3, + 0x24, 0x09, 0xfd, 0x02, 0x00, 0x00, } func (this *Params) Equal(that interface{}) bool { @@ -180,6 +183,9 @@ func (this *Params) Equal(that interface{}) bool { if !this.MintTokenFeeRatio.Equal(that1.MintTokenFeeRatio) { return false } + if this.EnableErc20 != that1.EnableErc20 { + return false + } return true } func (m *Token) Marshal() (dAtA []byte, err error) { @@ -285,6 +291,16 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.EnableErc20 { + i-- + if m.EnableErc20 { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x20 + } { size := m.MintTokenFeeRatio.Size() i -= size @@ -382,6 +398,9 @@ func (m *Params) Size() (n int) { n += 1 + l + sovToken(uint64(l)) l = m.MintTokenFeeRatio.Size() n += 1 + l + sovToken(uint64(l)) + if m.EnableErc20 { + n += 2 + } return n } @@ -808,6 +827,26 @@ func (m *Params) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field EnableErc20", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowToken + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.EnableErc20 = bool(v != 0) default: iNdEx = preIndex skippy, err := skipToken(dAtA[iNdEx:]) diff --git a/proto/irismod/token/v1/token.proto b/proto/irismod/token/v1/token.proto index 7f3abb08..7087e684 100644 --- a/proto/irismod/token/v1/token.proto +++ b/proto/irismod/token/v1/token.proto @@ -38,4 +38,6 @@ message Params { (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false ]; + + bool enable_erc20 = 4; } \ No newline at end of file