diff --git a/x/cronos/keeper/precompiles/bank.go b/x/cronos/keeper/precompiles/bank.go index 11138155cb..57ea2223ea 100644 --- a/x/cronos/keeper/precompiles/bank.go +++ b/x/cronos/keeper/precompiles/bank.go @@ -18,11 +18,11 @@ import ( ) const ( - EVMDenomPrefix = "evm/" - MintName = "mint" - BurnName = "burn" - BalanceOfName = "balanceOf" - TransferName = "transfer" + EVMDenomPrefix = "evm/" + MintMethodName = "mint" + BurnMethodName = "burn" + BalanceOfMethodName = "balanceOf" + TransferMethodName = "transfer" ) var ( @@ -62,12 +62,12 @@ func (bc *BankContract) RequiredGas(input []byte) uint64 { return 0 } switch method.Name { - case MintName, BurnName: + case MintMethodName, BurnMethodName: return 1000 - case BalanceOfName: - return 1000 - case TransferName: + case BalanceOfMethodName: return 1000 + case TransferMethodName: + return 150000 default: return 0 } @@ -98,7 +98,7 @@ func (bc *BankContract) Run(evm *vm.EVM, contract *vm.Contract, readonly bool) ( stateDB := evm.StateDB.(ExtStateDB) precompileAddr := bc.Address() switch method.Name { - case MintName, BurnName: + case MintMethodName, BurnMethodName: if readonly { return nil, errors.New("the method is not readonly") } @@ -142,7 +142,7 @@ func (bc *BankContract) Run(evm *vm.EVM, contract *vm.Contract, readonly bool) ( return nil, err } return method.Outputs.Pack(true) - case BalanceOfName: + case BalanceOfMethodName: args, err := method.Inputs.Unpack(contract.Input[4:]) if err != nil { return nil, errors.New("fail to unpack input arguments") @@ -152,7 +152,7 @@ func (bc *BankContract) Run(evm *vm.EVM, contract *vm.Contract, readonly bool) ( // query from storage balance := bc.bankKeeper.GetBalance(stateDB.CacheContext(), sdk.AccAddress(addr.Bytes()), EVMDenom(token)).Amount.BigInt() return method.Outputs.Pack(balance) - case TransferName: + case TransferMethodName: if readonly { return nil, errors.New("the method is not readonly") } diff --git a/x/cronos/keeper/precompiles/ica.go b/x/cronos/keeper/precompiles/ica.go index 625d9a79fa..a53a48ce75 100644 --- a/x/cronos/keeper/precompiles/ica.go +++ b/x/cronos/keeper/precompiles/ica.go @@ -20,9 +20,9 @@ import ( ) const ( - RegisterAccountName = "registerAccount" - QueryAccountName = "queryAccount" - SubmitMsgsName = "submitMsgs" + RegisterAccountMethodName = "registerAccount" + QueryAccountMethodName = "queryAccount" + SubmitMsgsMethodName = "submitMsgs" ) var ( @@ -63,11 +63,11 @@ func (ic *IcaContract) RequiredGas(input []byte) uint64 { return 0 } switch method.Name { - case RegisterAccountName: + case RegisterAccountMethodName: return 1000 - case QueryAccountName: + case QueryAccountMethodName: return 1000 - case SubmitMsgsName: + case SubmitMsgsMethodName: return 1000 default: return 0 @@ -93,7 +93,7 @@ func (ic *IcaContract) Run(evm *vm.EVM, contract *vm.Contract, readonly bool) ([ converter := cronosevents.IcaConvertEvent var execErr error switch method.Name { - case RegisterAccountName: + case RegisterAccountMethodName: if readonly { return nil, errors.New("the method is not readonly") } @@ -115,7 +115,7 @@ func (ic *IcaContract) Run(evm *vm.EVM, contract *vm.Contract, readonly bool) ([ return nil, execErr } return method.Outputs.Pack(true) - case QueryAccountName: + case QueryAccountMethodName: args, err := method.Inputs.Unpack(contract.Input[4:]) if err != nil { return nil, errors.New("fail to unpack input arguments") @@ -137,7 +137,7 @@ func (ic *IcaContract) Run(evm *vm.EVM, contract *vm.Contract, readonly bool) ([ icaAddress = response.InterchainAccountAddress } return method.Outputs.Pack(icaAddress) - case SubmitMsgsName: + case SubmitMsgsMethodName: if readonly { return nil, errors.New("the method is not readonly") }