Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

### DEPENDENCIES

### API-BREAKING

- [\#808](https://github.com/cosmos/evm/pull/808) Remove werc20 precompile.

### IMPROVEMENTS

- [\#758](https://github.com/cosmos/evm/pull/758) Cleanup precompiles abi.json.
Expand Down
189 changes: 26 additions & 163 deletions api/cosmos/evm/erc20/v1/genesis.pulsar.go

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion evmd/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ func NewEVMGenesisState() *evmtypes.GenesisState {
func NewErc20GenesisState() *erc20types.GenesisState {
erc20GenState := erc20types.DefaultGenesisState()
erc20GenState.TokenPairs = testconstants.ExampleTokenPairs
erc20GenState.NativePrecompiles = []string{testconstants.WEVMOSContractMainnet}

return erc20GenState
}
Expand Down
3 changes: 0 additions & 3 deletions evmd/tests/ibc/ics20_recursive_precompile_calls_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,6 @@ func (suite *ICS20RecursivePrecompileCallsTestSuite) SetupTest() {
evmAppA.Erc20Keeper.GetTokenPair(suite.chainA.GetContext(), evmAppA.Erc20Keeper.GetTokenPairID(suite.chainA.GetContext(), bondDenom))
// evmAppA.Erc20Keeper.SetNativePrecompile(suite.chainA.GetContext(), werc20.Address())

avail := evmAppA.Erc20Keeper.IsNativePrecompileAvailable(suite.chainA.GetContext(), common.HexToAddress("0xD4949664cD82660AaE99bEdc034a0deA8A0bd517"))
suite.Require().True(avail)

evmAppB := suite.chainB.App.(*evmd.EVMD)
suite.chainBPrecompile = ics20.NewPrecompile(
evmAppB.BankKeeper,
Expand Down

This file was deleted.

24 changes: 18 additions & 6 deletions precompiles/bank/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ import (
"math/big"

"github.com/ethereum/go-ethereum/accounts/abi"
"github.com/ethereum/go-ethereum/common"

evmtypes "github.com/cosmos/evm/x/vm/types"

sdk "github.com/cosmos/cosmos-sdk/types"
)
Expand Down Expand Up @@ -35,6 +38,7 @@ func (p Precompile) Balances(
if err != nil {
return nil, fmt.Errorf("error calling account balances in bank precompile: %s", err)
}
fmt.Println("Bank Precompile Balances for account:", account.String())

i := 0
balances := make([]Balance, 0)
Expand All @@ -48,9 +52,13 @@ func (p Precompile) Balances(
ctx.GasMeter().ConsumeGas(GasBalances, "ERC-20 extension balances method")
}

contractAddress, err := p.erc20Keeper.GetCoinAddress(ctx, coin.Denom)
if err != nil {
return false
// if denom is the evm native denom, use zero address
var contractAddress common.Address
if coin.Denom != evmtypes.GetEVMCoinDenom() {
contractAddress, err = p.erc20Keeper.GetCoinAddress(ctx, coin.Denom)
if err != nil {
return false
}
}

balances = append(balances, Balance{
Expand All @@ -77,6 +85,7 @@ func (p Precompile) TotalSupply(
i := 0
totalSupply := make([]Balance, 0)

var err error
p.bankKeeper.IterateTotalSupply(ctx, func(coin sdk.Coin) bool {
defer func() { i++ }()

Expand All @@ -86,9 +95,12 @@ func (p Precompile) TotalSupply(
ctx.GasMeter().ConsumeGas(GasTotalSupply, "ERC-20 extension totalSupply method")
}

contractAddress, err := p.erc20Keeper.GetCoinAddress(ctx, coin.Denom)
if err != nil {
return false
var contractAddress common.Address
if coin.Denom != evmtypes.GetEVMCoinDenom() {
contractAddress, err = p.erc20Keeper.GetCoinAddress(ctx, coin.Denom)
if err != nil {
return false
}
}

totalSupply = append(totalSupply, Balance{
Expand Down
36 changes: 0 additions & 36 deletions precompiles/werc20/IWERC20.sol

This file was deleted.

175 changes: 0 additions & 175 deletions precompiles/werc20/README.md

This file was deleted.

Loading
Loading