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.

36 changes: 0 additions & 36 deletions contracts/solidity/precompiles/werc20/IWERC20.sol

This file was deleted.

This file was deleted.

26 changes: 25 additions & 1 deletion docs/migrations/v0.5.0_to_v0.6.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ go mod tidy

<!-- TODO: Other changes required for the upgrade -->

## 3) App wiring in `app.go`
## 2) App wiring in `app.go`

### Default Precompiles

Expand Down Expand Up @@ -53,3 +53,27 @@ We added a new default precompile, ICS-02 Client Router. As such, the function s
),
)
```

## 3) Remove werc20 precompile

The WERC20 precompile (or native precompile) has been removed together with the `erc20` module in this release.
If you've enabled it before, that address will become a normal address after upgrade, if you want to prevent user to
interact with it, you can deploy a revert contract to that address:

```solidity
// SPDX-License-Identifier: LGPL-3.0-only

pragma solidity >=0.8.0;

contract Revert {
fallback() external {
revert("WERC20 placeholder");
}
}
```

BTW, the above contract compiles to the following runtime bytecode using solc 0.8.30:

```
0x6080604052348015600e575f5ffd5b506040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401603f90609e565b60405180910390fd5b5f82825260208201905092915050565b7f57455243323020706c616365686f6c64657200000000000000000000000000005f82015250565b5f608a6012836048565b91506093826058565b602082019050919050565b5f6020820190508181035f83015260b3816080565b905091905056fea26469706673582212204bb324dcc23d885a4e58390874b9c85aaca9245ce096c5aec8eefdfc2f12299a64736f6c634300081e0033
```
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
4 changes: 0 additions & 4 deletions evmd/tests/ibc/ics20_recursive_precompile_calls_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,10 +237,6 @@ func (suite *ICS20RecursivePrecompileCallsTestSuite) SetupTest() {
suite.Require().NoError(err)

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(
Expand Down

This file was deleted.

6 changes: 0 additions & 6 deletions interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,12 +218,6 @@ type (
BankKeeperProvider
StakingKeeperProvider
}
WERC20PrecompileApp interface {
TestApp
BankKeeperProvider
Erc20KeeperProvider
TransferKeeperProvider
}

// Base interface required by the integration network helpers. Any app used by
// evm/testutil/integration must satisfy these keeper providers so the shared
Expand Down
3 changes: 0 additions & 3 deletions local_node.sh
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,6 @@ if [[ $overwrite == "y" || $overwrite == "Y" ]]; then

jq '.app_state["evm"]["params"]["evm_denom"]="atest"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS"

jq '.app_state.erc20.native_precompiles=["0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE"]' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS"
jq '.app_state.erc20.token_pairs=[{contract_owner:1,erc20_address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",denom:"atest",enabled:true}]' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS"

jq '.consensus.params.block.max_gas="10000000"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS"

# Change proposal periods
Expand Down
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.

Loading
Loading