diff --git a/.gitleaks.toml b/.gitleaks.toml index 0ac1001945..f7acacf49c 100644 --- a/.gitleaks.toml +++ b/.gitleaks.toml @@ -1709,7 +1709,7 @@ stopwords= [ "phalcon", "input", "custom", - "atom", + "edgens", "oracle", "phonegap", "ubuntu", diff --git a/ante/cosmos/min_gas_price.go b/ante/cosmos/min_gas_price.go index 8303fdfcff..75b8fc2a90 100644 --- a/ante/cosmos/min_gas_price.go +++ b/ante/cosmos/min_gas_price.go @@ -42,7 +42,7 @@ func (mpd MinGasPriceDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate feeCoins := feeTx.GetFee() evmDenom := evmtypes.GetEVMCoinDenom() - // only allow user to pass in aatom and stake native token as transaction fees + // only allow user to pass in aedgens and stake native token as transaction fees // allow use stake native tokens for fees is just for unit tests to pass // // TODO: is the handling of stake necessary here? Why not adjust the tests to contain the correct denom? diff --git a/ante/evm/04_validate.go b/ante/evm/04_validate.go index 6d2e10186d..e5a85287fa 100644 --- a/ante/evm/04_validate.go +++ b/ante/evm/04_validate.go @@ -111,9 +111,9 @@ func CheckTxFee(txFeeInfo *tx.Fee, txFee *big.Int, txGasLimit uint64) error { } // NOTE: When an evm tx comes in, it goes through the process of converting it - // to MsgEthereumTx, which is a sdk tx. Here, the denom will be a uatom, not aatom. - // BuildTx then converts uatom to aatom meaning that logic that interacts with the user - // will use uatom and internal processing such as the ante handler will operate based on aatom. + // to MsgEthereumTx, which is a sdk tx. Here, the denom will be a uedgens, not aedgens. + // BuildTx then converts uedgens to aedgens meaning that logic that interacts with the user + // will use uedgens and internal processing such as the ante handler will operate based on aedgens. evmExtendedDenom := evmtypes.GetEVMCoinExtendedDenom() if !txFeeInfo.Amount.AmountOf(evmExtendedDenom).Equal(sdkmath.NewIntFromBigInt(txFee)) { return errorsmod.Wrapf(errortypes.ErrInvalidRequest, "invalid AuthInfo Fee Amount (%s != %s)", txFeeInfo.Amount, txFee) diff --git a/ante/evm/ante_test.go b/ante/evm/ante_test.go index 2c4d256744..e8cd565d24 100644 --- a/ante/evm/ante_test.go +++ b/ante/evm/ante_test.go @@ -662,7 +662,7 @@ func (suite *AnteTestSuite) TestAnteHandler() { addr[:], sdk.NewCoins( sdk.NewCoin( - "uatomz", + "uedgensz", sdkmath.NewInt(1), ), ), @@ -692,7 +692,7 @@ func (suite *AnteTestSuite) TestAnteHandler() { addr[:], sdk.NewCoins( sdk.NewCoin( - "uatomz", + "uedgensz", sdkmath.NewInt(1), ), ), @@ -747,7 +747,7 @@ func (suite *AnteTestSuite) TestAnteHandler() { addr[:], sdk.NewCoins( sdk.NewCoin( - "uatomz", + "uedgensz", sdkmath.NewInt(1), ), ), @@ -777,7 +777,7 @@ func (suite *AnteTestSuite) TestAnteHandler() { addr[:], sdk.NewCoins( sdk.NewCoin( - "uatomz", + "uedgensz", sdkmath.NewInt(1), ), ), @@ -807,7 +807,7 @@ func (suite *AnteTestSuite) TestAnteHandler() { addr[:], sdk.NewCoins( sdk.NewCoin( - "uatomz", + "uedgensz", sdkmath.NewInt(1), ), ), @@ -837,7 +837,7 @@ func (suite *AnteTestSuite) TestAnteHandler() { addr[:], sdk.NewCoins( sdk.NewCoin( - "uatomz", + "uedgensz", sdkmath.NewInt(1), ), ), @@ -871,7 +871,7 @@ func (suite *AnteTestSuite) TestAnteHandler() { addr[:], sdk.NewCoins( sdk.NewCoin( - "uatomz", + "uedgensz", sdkmath.NewInt(1), ), ), @@ -901,7 +901,7 @@ func (suite *AnteTestSuite) TestAnteHandler() { addr[:], sdk.NewCoins( sdk.NewCoin( - "uatomz", + "uedgensz", sdkmath.NewInt(1), ), ), diff --git a/ante/evm/fee_checker_test.go b/ante/evm/fee_checker_test.go index a9bfdcd142..826d50b45d 100644 --- a/ante/evm/fee_checker_test.go +++ b/ante/evm/fee_checker_test.go @@ -110,7 +110,7 @@ func TestSDKTxFeeChecker(t *testing.T) { return txBuilder.GetTx() }, false, - "10aatom", + "10aedgens", 0, true, }, @@ -155,7 +155,7 @@ func TestSDKTxFeeChecker(t *testing.T) { return txBuilder.GetTx() }, true, - "10aatom", + "10aedgens", 0, true, }, @@ -172,7 +172,7 @@ func TestSDKTxFeeChecker(t *testing.T) { return txBuilder.GetTx() }, true, - "10000010aatom", + "10000010aedgens", 10, true, }, @@ -193,7 +193,7 @@ func TestSDKTxFeeChecker(t *testing.T) { return txBuilder.GetTx() }, true, - "10aatom", + "10aedgens", 0, true, }, @@ -216,7 +216,7 @@ func TestSDKTxFeeChecker(t *testing.T) { return txBuilder.GetTx() }, true, - "5000010aatom", + "5000010aedgens", 5, true, }, diff --git a/api/cosmos/evm/precisebank/v1/genesis.pulsar.go b/api/cosmos/evm/precisebank/v1/genesis.pulsar.go index ac1d34c5e3..feb7100e77 100644 --- a/api/cosmos/evm/precisebank/v1/genesis.pulsar.go +++ b/api/cosmos/evm/precisebank/v1/genesis.pulsar.go @@ -1126,7 +1126,7 @@ type FractionalBalance struct { Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` // amount indicates amount of only the fractional balance owned by the // address. FractionalBalance currently only supports tracking 1 single asset, - // e.g. fractional balances of uatom. + // e.g. fractional balances of uedgens. Amount string `protobuf:"bytes,2,opt,name=amount,proto3" json:"amount,omitempty"` } diff --git a/cmd/evmd/config/config.go b/cmd/evmd/config/config.go index 4c9caf65ad..057737876d 100644 --- a/cmd/evmd/config/config.go +++ b/cmd/evmd/config/config.go @@ -18,9 +18,9 @@ var ChainsCoinInfo = map[uint64]evmtypes.EvmCoinInfo{ Decimals: evmtypes.EighteenDecimals, }, CosmosChainID: { - Denom: "atest", - ExtendedDenom: "atest", - DisplayDenom: "test", + Denom: "aedgen", + ExtendedDenom: "aedgen", + DisplayDenom: "edgen", Decimals: evmtypes.EighteenDecimals, }, } @@ -41,13 +41,13 @@ const ( // Bech32PrefixConsPub defines the Bech32 prefix of a consensus node public key. Bech32PrefixConsPub = Bech32Prefix + sdk.PrefixValidator + sdk.PrefixConsensus + sdk.PrefixPublic // DisplayDenom defines the denomination displayed to users in client applications. - DisplayDenom = "atom" + DisplayDenom = "edgens" // BaseDenom defines to the default denomination used in the Cosmos EVM example chain. - BaseDenom = "aatom" + BaseDenom = "aedgens" // BaseDenomUnit defines the precision of the base denomination. BaseDenomUnit = 18 // EVMChainID defines the EIP-155 replay-protection chain id for the current ethereum chain config. - EVMChainID = 262144 + EVMChainID = 4207 ) // SetBech32Prefixes sets the global prefixes to be used when serializing addresses and public keys to Bech32 strings. diff --git a/cmd/evmd/config/constants.go b/cmd/evmd/config/constants.go index fb9bdbe4bb..62c4454686 100644 --- a/cmd/evmd/config/constants.go +++ b/cmd/evmd/config/constants.go @@ -2,10 +2,10 @@ package config const ( // ExampleChainDenom is the denomination of the Cosmos EVM example chain's base coin. - ExampleChainDenom = "aatom" + ExampleChainDenom = "aedgens" // ExampleDisplayDenom is the display denomination of the Cosmos EVM example chain's base coin. - ExampleDisplayDenom = "atom" + ExampleDisplayDenom = "edgens" // EighteenDecimalsChainID is the chain ID for the 18 decimals chain. EighteenDecimalsChainID = 9001 @@ -19,7 +19,7 @@ const ( // TwoDecimalsChainID is the chain ID for the 2 decimals chain. TwoDecimalsChainID = 9004 - CosmosChainID = 262144 + CosmosChainID = 4207 // TestChainID1 is test chain IDs for IBC E2E test TestChainID1 = 9005 diff --git a/contracts/solidity/WATOM.json b/contracts/solidity/WEDGENS.json similarity index 99% rename from contracts/solidity/WATOM.json rename to contracts/solidity/WEDGENS.json index d0620b7d96..90e53bfd4b 100644 --- a/contracts/solidity/WATOM.json +++ b/contracts/solidity/WEDGENS.json @@ -1,7 +1,7 @@ { "_format": "hh-sol-artifact-1", - "contractName": "WATOM", - "sourceName": "solidity/WATOM.sol", + "contractName": "WEDGENS", + "sourceName": "solidity/WEDGENS.sol", "abi": [ { "anonymous": false, diff --git a/contracts/solidity/WATOM.sol b/contracts/solidity/WEDGENS.sol similarity index 88% rename from contracts/solidity/WATOM.sol rename to contracts/solidity/WEDGENS.sol index 4a36597892..95016313f4 100644 --- a/contracts/solidity/WATOM.sol +++ b/contracts/solidity/WEDGENS.sol @@ -1,9 +1,9 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; -contract WATOM { - string public name = "Wrapped Atom"; - string public symbol = "WATOM"; +contract WEDGENS { + string public name = "Wrapped Edgens"; + string public symbol = "WEDGENS"; uint8 public decimals = 18; mapping(address => uint256) public balanceOf; @@ -12,7 +12,7 @@ contract WATOM { event Withdrawal(address indexed src, uint256 amount); event Transfer(address indexed src, address indexed dst, uint256 amount); - // Receive ether and wrap it into ATOM + // Receive ether and wrap it into EDGENS receive() external payable { deposit(); } diff --git a/contracts/watom.go b/contracts/watom.go index aeaded5d4c..cc7d363ad0 100644 --- a/contracts/watom.go +++ b/contracts/watom.go @@ -8,19 +8,19 @@ import ( ) var ( - // WATOMJSON are the compiled bytes of the WATOMContract + // WEDGENSJSON are the compiled bytes of the WEDGENSContract // - //go:embed solidity/WATOM.json - WATOMJSON []byte + //go:embed solidity/WEDGENS.json + WEDGENSJSON []byte - // WATOMContract is the compiled watom contract - WATOMContract evmtypes.CompiledContract + // WEDGENSContract is the compiled wedgens contract + WEDGENSContract evmtypes.CompiledContract ) func init() { var err error - if WATOMContract, err = contractutils.ConvertHardhatBytesToCompiledContract( - WATOMJSON, + if WEDGENSContract, err = contractutils.ConvertHardhatBytesToCompiledContract( + WEDGENSJSON, ); err != nil { panic(err) } diff --git a/evmd/README.md b/evmd/README.md index 8a05bb192a..54da293437 100644 --- a/evmd/README.md +++ b/evmd/README.md @@ -6,7 +6,7 @@ repository, which itself is a simplified version of a Cosmos SDK-based blockchain. This chain implementation is used to demonstrate the integration of Cosmos EVM -as well as to provide a chain object for testing purposes within the repository. +as well as to provide a chain object for edgening purposes within the repository. ## Config @@ -18,7 +18,7 @@ By default, this chain has the following configuration: | Chain ID | `cosmos_262144-1` | | Custom Opcodes | - | | Default Token Pairs | 1 for the native token | -| Denomination | `atest` | +| Denomination | `aedgen` | | EVM permissioning | permissionless | | Enabled Precompiles | all | @@ -42,7 +42,7 @@ Available flags are: For the sake of this example, we'll be using Metamask: 1. Use the following seed phrase when adding a new wallet: -`gesture inject test cycle original hollow east ridge hen combine +`gesture inject edgen cycle original hollow east ridge hen combine junk child baconzero hope comfort vacuum milk pitch cage oppose unhappy lunar seat` 2. On the top left of the Metamask extension, click the Network button. diff --git a/evmd/ante/integration_test.go b/evmd/ante/integration_test.go index 1397bf2787..10c5344709 100644 --- a/evmd/ante/integration_test.go +++ b/evmd/ante/integration_test.go @@ -128,7 +128,7 @@ var _ = Describe("when sending a Cosmos transaction", Label("AnteHandler"), Orde addr, priv = testutiltx.NewAccAddressAndKey() // this is a new address that does not exist on chain. - // Transfer 1 aatom to this account so it is + // Transfer 1 aedgens to this account so it is // added on chain err := s.factory.FundAccount( s.keyring.GetKey(0), diff --git a/evmd/config_testing.go b/evmd/config_testing.go index 09120fd2d9..acb684bae0 100644 --- a/evmd/config_testing.go +++ b/evmd/config_testing.go @@ -24,9 +24,9 @@ var ChainsCoinInfo = map[uint64]evmtypes.EvmCoinInfo{ Decimals: evmtypes.EighteenDecimals, }, config.SixDecimalsChainID: { - Denom: "utest", - ExtendedDenom: "atest", - DisplayDenom: "test", + Denom: "uedgen", + ExtendedDenom: "aedgen", + DisplayDenom: "edgen", Decimals: evmtypes.SixDecimals, }, config.TwelveDecimalsChainID: { diff --git a/ibc/utils_test.go b/ibc/utils_test.go index bc90727f35..4b0a31faa9 100644 --- a/ibc/utils_test.go +++ b/ibc/utils_test.go @@ -146,11 +146,11 @@ func TestGetTransferAmount(t *testing.T) { &transfertypes.FungibleTokenPacketData{ Sender: "cosmos1qql8ag4cluz6r4dz28p3w00dnc9w8ueulg2gmc", Receiver: "cosmos1x2w87cvt5mqjncav4lxy8yfreynn273x34qlwy", - Amount: "test", + Amount: "edgen", }, ), }, - expAmount: "test", + expAmount: "edgen", expError: true, }, { @@ -220,14 +220,14 @@ func TestGetReceivedCoin(t *testing.T) { dstChannel: chan1, rawDenom: func() string { denom := transfertypes.NewDenom( - "uatom", + "uedgens", transfertypes.NewHop(port, chan0), ) return denom.Path() }, rawAmount: "10", expCoin: func() sdk.Coin { - expectedDenom := transfertypes.NewDenom("uatom").IBCDenom() + expectedDenom := transfertypes.NewDenom("uedgens").IBCDenom() return sdk.NewCoin(expectedDenom, math.NewInt(10)) }, }, @@ -261,7 +261,7 @@ func TestGetReceivedCoin(t *testing.T) { dstPort: port, dstChannel: chan0, rawDenom: func() string { - denom := transfertypes.NewDenom("uatom", + denom := transfertypes.NewDenom("uedgens", transfertypes.NewHop(port, chan1), ) return denom.Path() @@ -269,7 +269,7 @@ func TestGetReceivedCoin(t *testing.T) { rawAmount: "10", expCoin: func() sdk.Coin { expectedDenom := transfertypes.NewDenom( - "uatom", + "uedgens", transfertypes.NewHop(port, chan0), transfertypes.NewHop(port, chan1), ).IBCDenom() @@ -306,14 +306,14 @@ func TestGetSentCoin(t *testing.T) { expCoin sdk.Coin }{ { - "get unwrapped aatom coin", + "get unwrapped aedgens coin", baseDenom, "10", sdk.Coin{Denom: baseDenom, Amount: math.NewInt(10)}, }, { - "get ibc wrapped aatom coin", - "transfer/channel-0/aatom", + "get ibc wrapped aedgens coin", + "transfer/channel-0/aedgens", "10", sdk.Coin{Denom: precompilestestutil.AatomIbcDenom, Amount: math.NewInt(10)}, }, @@ -324,14 +324,14 @@ func TestGetSentCoin(t *testing.T) { sdk.Coin{Denom: precompilestestutil.UosmoIbcDenom, Amount: math.NewInt(10)}, }, { - "get ibc wrapped uatom coin", - "transfer/channel-1/uatom", + "get ibc wrapped uedgens coin", + "transfer/channel-1/uedgens", "10", sdk.Coin{Denom: precompilestestutil.UatomIbcDenom, Amount: math.NewInt(10)}, }, { - "get 2x ibc wrapped uatom coin", - "transfer/channel-0/transfer/channel-1/uatom", + "get 2x ibc wrapped uedgens coin", + "transfer/channel-0/transfer/channel-1/uedgens", "10", sdk.Coin{Denom: precompilestestutil.UatomOsmoIbcDenom, Amount: math.NewInt(10)}, }, @@ -367,14 +367,14 @@ func TestDeriveDecimalsFromDenom(t *testing.T) { }, { name: "success: micro 'u' prefix", - baseDenom: "uatom", + baseDenom: "uedgens", expDec: 6, expFail: false, expErrMsg: "", }, { name: "success: atto 'a' prefix", - baseDenom: "aatom", + baseDenom: "aedgens", expDec: 18, expFail: false, expErrMsg: "", @@ -401,22 +401,22 @@ func TestIsBaseDenomFromSourceChain(t *testing.T) { }{ { name: "one hop", - denom: "transfer/channel-0/uatom", + denom: "transfer/channel-0/uedgens", expected: false, }, { name: "no hop with factory prefix", - denom: "factory/owner/uatom", + denom: "factory/owner/uedgens", expected: false, }, { name: "multi hop", - denom: "transfer/channel-0/transfer/channel-1/uatom", + denom: "transfer/channel-0/transfer/channel-1/uedgens", expected: false, }, { name: "no hop", - denom: "uatom", + denom: "uedgens", expected: true, }, } diff --git a/init_node.sh b/init_node.sh new file mode 100755 index 0000000000..fb79c36b39 --- /dev/null +++ b/init_node.sh @@ -0,0 +1,180 @@ +#!/bin/bash + +CHAINID="${CHAIN_ID:-4207}" +MONIKER="layeredge" +# Remember to change to other types of keyring like 'file' in-case exposing to outside world, +# otherwise your balance will be wiped quickly +# The keyring test does not require private key to steal tokens from you +KEYRING="test" +KEYALGO="eth_secp256k1" + +LOGLEVEL="info" +# Set dedicated home directory for the evmd instance +HOMEDIR="$HOME/.evmd" + +evmd="$HOME/go/bin/evmd" + +BASEFEE=10000000 + +# Path variables +CONFIG=$HOMEDIR/config/config.toml +APP_TOML=$HOMEDIR/config/app.toml +CLIENT_TOML=$HOMEDIR/config/client.toml +GENESIS=$HOMEDIR/config/genesis.json +TMP_GENESIS=$HOMEDIR/config/tmp_genesis.json + +# validate dependencies are installed +command -v jq >/dev/null 2>&1 || { + echo >&2 "jq not installed. More info: https://stedolan.github.io/jq/download/" + exit 1 +} + +# used to exit on first error (any non-zero exit code) +set -e + +# Parse input flags +install=true +overwrite="" +BUILD_FOR_DEBUG=false + +while [[ $# -gt 0 ]]; do + key="$1" + case $key in + -y) + echo "Flag -y passed -> Overwriting the previous chain data." + overwrite="y" + shift # Move past the flag + ;; + -n) + echo "Flag -n passed -> Not overwriting the previous chain data." + overwrite="n" + shift # Move past the argument + ;; + --no-install) + echo "Flag --no-install passed -> Skipping installation of the evmd binary." + install=false + shift # Move past the flag + ;; + --remote-debugging) + echo "Flag --remote-debugging passed -> Building with remote debugging options." + BUILD_FOR_DEBUG=true + shift # Move past the flag + ;; + *) + echo "Unknown flag passed: $key -> Exiting script!" + exit 1 + ;; + esac +done + +if [[ $install == true ]]; then + if [[ $BUILD_FOR_DEBUG == true ]]; then + # for remote debugging the optimization should be disabled and the debug info should not be stripped + make install COSMOS_BUILD_OPTIONS=nooptimization,nostrip + else + make install + fi +fi + +# User prompt if neither -y nor -n was passed as a flag +# and an existing local node configuration is found. +if [[ $overwrite = "" ]]; then + if [ -d "$HOMEDIR" ]; then + printf "\nAn existing folder at '%s' was found. You can choose to delete this folder and start a new local node with new keys from genesis. When declined, the existing local node is started. \n" "$HOMEDIR" + echo "Overwrite the existing configuration and start a new local node? [y/n]" + read -r overwrite + else + overwrite="y" + fi +fi + +# Setup local node if overwrite is set to Yes, otherwise skip setup +if [[ $overwrite == "y" || $overwrite == "Y" ]]; then + # Remove the previous folder + rm -rf "$HOMEDIR" + + # Set client config + $evmd config set client chain-id "$CHAINID" --home "$HOMEDIR" + $evmd config set client keyring-backend "$KEYRING" --home "$HOMEDIR" + + # Set moniker and chain-id for the example chain (Moniker can be anything, chain-id must be an integer) + $evmd init $MONIKER -o --chain-id "$CHAINID" --home "$HOMEDIR" + + # Change parameter token denominations to desired value + jq '.app_state["staking"]["params"]["bond_denom"]="aedgen"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" + jq '.app_state["gov"]["deposit_params"]["min_deposit"][0]["denom"]="aedgen"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" + jq '.app_state["gov"]["params"]["min_deposit"][0]["denom"]="aedgen"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" + jq '.app_state["gov"]["params"]["expedited_min_deposit"][0]["denom"]="aedgen"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" + jq '.app_state["evm"]["params"]["evm_denom"]="aedgen"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" + jq '.app_state["feemarket"]["params"]["min_gas_price"]="500000.000000000000000000"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" + jq '.app_state["mint"]["params"]["mint_denom"]="aedgen"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" + + # Add default token metadata to genesis + jq '.app_state["bank"]["denom_metadata"]=[{"description":"The native staking token for evmd.","denom_units":[{"denom":"aedgen","exponent":0,"aliases":["aedgen"]},{"denom":"edgen","exponent":18,"aliases":[]}],"base":"aedgen","display":"edgen","name":"LayerEdge Testnet Staking Token","symbol":"EDGEN","uri":"","uri_hash":""}]' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" + + # Enable precompiles in EVM params + jq '.app_state["evm"]["params"]["active_static_precompiles"]=["0x0000000000000000000000000000000000000100","0x0000000000000000000000000000000000000400","0x0000000000000000000000000000000000000800","0x0000000000000000000000000000000000000801","0x0000000000000000000000000000000000000802","0x0000000000000000000000000000000000000803","0x0000000000000000000000000000000000000804","0x0000000000000000000000000000000000000805"]' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" + + # Enable native denomination as a token pair for STRv2 + jq '.app_state.erc20.params.native_precompiles=["0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE"]' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" + jq '.app_state.erc20.token_pairs=[{contract_owner:1,erc20_address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",denom:"aedgen",enabled:true}]' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" + + # Set gas limit in genesis + jq '.consensus.params.block.max_gas="30000000"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" + + if [[ $1 == "pending" ]]; then + if [[ "$OSTYPE" == "darwin"* ]]; then + sed -i '' 's/timeout_propose = "3s"/timeout_propose = "30s"/g' "$CONFIG" + sed -i '' 's/timeout_propose_delta = "500ms"/timeout_propose_delta = "5s"/g' "$CONFIG" + sed -i '' 's/timeout_prevote = "1s"/timeout_prevote = "10s"/g' "$CONFIG" + sed -i '' 's/timeout_prevote_delta = "500ms"/timeout_prevote_delta = "5s"/g' "$CONFIG" + sed -i '' 's/timeout_precommit = "1s"/timeout_precommit = "10s"/g' "$CONFIG" + sed -i '' 's/timeout_precommit_delta = "500ms"/timeout_precommit_delta = "5s"/g' "$CONFIG" + sed -i '' 's/timeout_commit = "5s"/timeout_commit = "150s"/g' "$CONFIG" + sed -i '' 's/timeout_broadcast_tx_commit = "10s"/timeout_broadcast_tx_commit = "150s"/g' "$CONFIG" + else + sed -i 's/timeout_propose = "3s"/timeout_propose = "30s"/g' "$CONFIG" + sed -i 's/timeout_propose_delta = "500ms"/timeout_propose_delta = "5s"/g' "$CONFIG" + sed -i 's/timeout_prevote = "1s"/timeout_prevote = "10s"/g' "$CONFIG" + sed -i 's/timeout_prevote_delta = "500ms"/timeout_prevote_delta = "5s"/g' "$CONFIG" + sed -i 's/timeout_precommit = "1s"/timeout_precommit = "10s"/g' "$CONFIG" + sed -i 's/timeout_precommit_delta = "500ms"/timeout_precommit_delta = "5s"/g' "$CONFIG" + sed -i 's/timeout_commit = "5s"/timeout_commit = "150s"/g' "$CONFIG" + sed -i 's/timeout_broadcast_tx_commit = "10s"/timeout_broadcast_tx_commit = "150s"/g' "$CONFIG" + fi + fi + + # enable prometheus metrics and all APIs for dev node + if [[ "$OSTYPE" == "darwin"* ]]; then + sed -i '' 's/prometheus = false/prometheus = true/' "$CONFIG" + sed -i '' 's/prometheus-retention-time = 0/prometheus-retention-time = 1000000000000/g' "$APP_TOML" + sed -i '' 's/enabled = false/enabled = true/g' "$APP_TOML" + sed -i '' 's/enable = false/enable = true/g' "$APP_TOML" + else + sed -i 's/prometheus = false/prometheus = true/' "$CONFIG" + sed -i 's/prometheus-retention-time = "0"/prometheus-retention-time = "1000000000000"/g' "$APP_TOML" + sed -i 's/enabled = false/enabled = true/g' "$APP_TOML" + sed -i 's/enable = false/enable = true/g' "$APP_TOML" + fi + + # Change proposal periods to pass within a reasonable time for local testing + sed -i.bak 's/"max_deposit_period": "172800s"/"max_deposit_period": "30s"/g' "$GENESIS" + sed -i.bak 's/"voting_period": "172800s"/"voting_period": "30s"/g' "$GENESIS" + sed -i.bak 's/"expedited_voting_period": "86400s"/"expedited_voting_period": "15s"/g' "$GENESIS" + + # set custom pruning settings + sed -i.bak 's/node = "tcp:\/\/localhost:26657"/node = "tcp:\/\/0.0.0.0:26657"/g' "$CLIENT_TOML" + sed -i.bak 's/pprof_laddr = "localhost:6060"/pprof_laddr = "0.0.0.0:6060"/' "$CONFIG" + sed -i.bak 's/proxy_app = "tcp:\/\/127.0.0.1:26658"/proxy_app = "tcp:\/\/0.0.0.0:26658"/' "$CONFIG" + sed -i.bak 's/laddr = "tcp:\/\/127.0.0.1:26657"/laddr = "tcp:\/\/0.0.0.0:26657"/' "$CONFIG" + sed -i.bak 's/address = "tcp:\/\/localhost:1317"/address = "tcp:\/\/0.0.0.0:1317"/g' "$APP_TOML" + sed -i.bak 's/address = "localhost:9090"/address = "0.0.0.0:9090"/g' "$APP_TOML" + sed -i.bak 's/address = "127.0.0.1:8545"/address = "0.0.0.0:8545"/g' "$APP_TOML" + sed -i.bak 's/address = "127.0.0.1:8546"/address = "0.0.0.0:8546"/g' "$APP_TOML" + sed -i.bak 's/metrics-address = "127.0.0.1:6065"/metrics-address = "0.0.0.0:6065"/g' "$APP_TOML" + sed -i.bak 's/minimum-gas-prices = "0aedgens"/minimum-gas-prices = "5000000aedgen"/g' "$APP_TOML" + sed -i.bak 's/pruning = "default"/pruning = "custom"/g' "$APP_TOML" + sed -i.bak 's/pruning = "default"/pruning = "custom"/g' "$APP_TOML" + sed -i.bak 's/pruning-keep-recent = "0"/pruning-keep-recent = "2"/g' "$APP_TOML" + sed -i.bak 's/pruning-interval = "0"/pruning-interval = "10"/g' "$APP_TOML" +fi diff --git a/local_node.sh b/local_node.sh index 97e26f46c4..f950015ea9 100755 --- a/local_node.sh +++ b/local_node.sh @@ -12,6 +12,8 @@ LOGLEVEL="info" # Set dedicated home directory for the evmd instance HOMEDIR="$HOME/.evmd" +evmd="$HOME/go/bin/evmd" + BASEFEE=10000000 # Path variables @@ -91,8 +93,8 @@ if [[ $overwrite == "y" || $overwrite == "Y" ]]; then rm -rf "$HOMEDIR" # Set client config - evmd config set client chain-id "$CHAINID" --home "$HOMEDIR" - evmd config set client keyring-backend "$KEYRING" --home "$HOMEDIR" + $evmd config set client chain-id "$CHAINID" --home "$HOMEDIR" + $evmd config set client keyring-backend "$KEYRING" --home "$HOMEDIR" # myKey address 0x7cb61d4117ae31a12e393a1cfa3bac666481d02e | os10jmp6sgh4cc6zt3e8gw05wavvejgr5pwjnpcky VAL_KEY="mykey" @@ -115,35 +117,35 @@ if [[ $overwrite == "y" || $overwrite == "Y" ]]; then USER4_MNEMONIC="doll midnight silk carpet brush boring pluck office gown inquiry duck chief aim exit gain never tennis crime fragile ship cloud surface exotic patch" # Import keys from mnemonics - echo "$VAL_MNEMONIC" | evmd keys add "$VAL_KEY" --recover --keyring-backend "$KEYRING" --algo "$KEYALGO" --home "$HOMEDIR" - echo "$USER1_MNEMONIC" | evmd keys add "$USER1_KEY" --recover --keyring-backend "$KEYRING" --algo "$KEYALGO" --home "$HOMEDIR" - echo "$USER2_MNEMONIC" | evmd keys add "$USER2_KEY" --recover --keyring-backend "$KEYRING" --algo "$KEYALGO" --home "$HOMEDIR" - echo "$USER3_MNEMONIC" | evmd keys add "$USER3_KEY" --recover --keyring-backend "$KEYRING" --algo "$KEYALGO" --home "$HOMEDIR" - echo "$USER4_MNEMONIC" | evmd keys add "$USER4_KEY" --recover --keyring-backend "$KEYRING" --algo "$KEYALGO" --home "$HOMEDIR" + echo "$VAL_MNEMONIC" | $evmd keys add "$VAL_KEY" --recover --keyring-backend "$KEYRING" --algo "$KEYALGO" --home "$HOMEDIR" + echo "$USER1_MNEMONIC" | $evmd keys add "$USER1_KEY" --recover --keyring-backend "$KEYRING" --algo "$KEYALGO" --home "$HOMEDIR" + echo "$USER2_MNEMONIC" | $evmd keys add "$USER2_KEY" --recover --keyring-backend "$KEYRING" --algo "$KEYALGO" --home "$HOMEDIR" + echo "$USER3_MNEMONIC" | $evmd keys add "$USER3_KEY" --recover --keyring-backend "$KEYRING" --algo "$KEYALGO" --home "$HOMEDIR" + echo "$USER4_MNEMONIC" | $evmd keys add "$USER4_KEY" --recover --keyring-backend "$KEYRING" --algo "$KEYALGO" --home "$HOMEDIR" # Set moniker and chain-id for the example chain (Moniker can be anything, chain-id must be an integer) - evmd init $MONIKER -o --chain-id "$CHAINID" --home "$HOMEDIR" + $evmd init $MONIKER -o --chain-id "$CHAINID" --home "$HOMEDIR" # Change parameter token denominations to desired value - jq '.app_state["staking"]["params"]["bond_denom"]="atest"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" - jq '.app_state["gov"]["deposit_params"]["min_deposit"][0]["denom"]="atest"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" - jq '.app_state["gov"]["params"]["min_deposit"][0]["denom"]="atest"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" - jq '.app_state["gov"]["params"]["expedited_min_deposit"][0]["denom"]="atest"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" - jq '.app_state["evm"]["params"]["evm_denom"]="atest"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" - jq '.app_state["mint"]["params"]["mint_denom"]="atest"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" + jq '.app_state["staking"]["params"]["bond_denom"]="aedgen"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" + jq '.app_state["gov"]["deposit_params"]["min_deposit"][0]["denom"]="aedgen"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" + jq '.app_state["gov"]["params"]["min_deposit"][0]["denom"]="aedgen"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" + jq '.app_state["gov"]["params"]["expedited_min_deposit"][0]["denom"]="aedgen"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" + jq '.app_state["evm"]["params"]["evm_denom"]="aedgen"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" + jq '.app_state["mint"]["params"]["mint_denom"]="aedgen"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" # Add default token metadata to genesis - jq '.app_state["bank"]["denom_metadata"]=[{"description":"The native staking token for evmd.","denom_units":[{"denom":"atest","exponent":0,"aliases":["attotest"]},{"denom":"test","exponent":18,"aliases":[]}],"base":"atest","display":"test","name":"Test Token","symbol":"TEST","uri":"","uri_hash":""}]' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" + jq '.app_state["bank"]["denom_metadata"]=[{"description":"The native staking token for evmd.","denom_units":[{"denom":"aedgen","exponent":0,"aliases":["attoedgen"]},{"denom":"edgen","exponent":18,"aliases":[]}],"base":"aedgen","display":"edgen","name":"Edgen Token","symbol":"EDGEN","uri":"","uri_hash":""}]' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" # Enable precompiles in EVM params jq '.app_state["evm"]["params"]["active_static_precompiles"]=["0x0000000000000000000000000000000000000100","0x0000000000000000000000000000000000000400","0x0000000000000000000000000000000000000800","0x0000000000000000000000000000000000000801","0x0000000000000000000000000000000000000802","0x0000000000000000000000000000000000000803","0x0000000000000000000000000000000000000804","0x0000000000000000000000000000000000000805"]' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" # Set EVM config - jq '.app_state["evm"]["params"]["evm_denom"]="atest"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" + jq '.app_state["evm"]["params"]["evm_denom"]="aedgen"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" # Enable native denomination as a token pair for STRv2 jq '.app_state.erc20.params.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 '.app_state.erc20.token_pairs=[{contract_owner:1,erc20_address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",denom:"aedgen",enabled:true}]' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" # Set gas limit in genesis jq '.consensus.params.block.max_gas="10000000"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" @@ -194,14 +196,14 @@ if [[ $overwrite == "y" || $overwrite == "Y" ]]; then sed -i.bak 's/pruning-interval = "0"/pruning-interval = "10"/g' "$APP_TOML" # Allocate genesis accounts (cosmos formatted addresses) - evmd genesis add-genesis-account "$VAL_KEY" 100000000000000000000000000atest --keyring-backend "$KEYRING" --home "$HOMEDIR" - evmd genesis add-genesis-account "$USER1_KEY" 1000000000000000000000atest --keyring-backend "$KEYRING" --home "$HOMEDIR" - evmd genesis add-genesis-account "$USER2_KEY" 1000000000000000000000atest --keyring-backend "$KEYRING" --home "$HOMEDIR" - evmd genesis add-genesis-account "$USER3_KEY" 1000000000000000000000atest --keyring-backend "$KEYRING" --home "$HOMEDIR" - evmd genesis add-genesis-account "$USER4_KEY" 1000000000000000000000atest --keyring-backend "$KEYRING" --home "$HOMEDIR" + $evmd genesis add-genesis-account "$VAL_KEY" 100000000000000000000000000aedgen --keyring-backend "$KEYRING" --home "$HOMEDIR" + $evmd genesis add-genesis-account "$USER1_KEY" 1000000000000000000000aedgen --keyring-backend "$KEYRING" --home "$HOMEDIR" + $evmd genesis add-genesis-account "$USER2_KEY" 1000000000000000000000aedgen --keyring-backend "$KEYRING" --home "$HOMEDIR" + $evmd genesis add-genesis-account "$USER3_KEY" 1000000000000000000000aedgen --keyring-backend "$KEYRING" --home "$HOMEDIR" + $evmd genesis add-genesis-account "$USER4_KEY" 1000000000000000000000aedgen --keyring-backend "$KEYRING" --home "$HOMEDIR" # Sign genesis transaction - evmd genesis gentx "$VAL_KEY" 1000000000000000000000atest --gas-prices ${BASEFEE}atest --keyring-backend "$KEYRING" --chain-id "$CHAINID" --home "$HOMEDIR" + $evmd genesis gentx "$VAL_KEY" 1000000000000000000000aedgen --gas-prices ${BASEFEE}aedgen --keyring-backend "$KEYRING" --chain-id "$CHAINID" --home "$HOMEDIR" ## In case you want to create multiple validators at genesis ## 1. Back to `evmd keys add` step, init more keys ## 2. Back to `evmd add-genesis-account` step, add balance for those @@ -210,10 +212,10 @@ if [[ $overwrite == "y" || $overwrite == "Y" ]]; then ## 5. Copy the `gentx-*` folders under `~/.clonedOsd/config/gentx/` folders into the original `~/.evmd/config/gentx` # Collect genesis tx - evmd genesis collect-gentxs --home "$HOMEDIR" + $evmd genesis collect-gentxs --home "$HOMEDIR" # Run this to ensure everything worked and that the genesis file is setup correctly - evmd genesis validate-genesis --home "$HOMEDIR" + $evmd genesis validate-genesis --home "$HOMEDIR" if [[ $1 == "pending" ]]; then echo "pending mode is on, please wait for the first block committed." @@ -221,9 +223,9 @@ if [[ $overwrite == "y" || $overwrite == "Y" ]]; then fi # Start the node -evmd start "$TRACE" \ +$evmd start "$TRACE" \ --log_level $LOGLEVEL \ - --minimum-gas-prices=0.0001atest \ + --minimum-gas-prices=0.0025aedgen \ --home "$HOMEDIR" \ --json-rpc.api eth,txpool,personal,net,debug,web3 \ --chain-id "$CHAINID" diff --git a/precompiles/bank/query_test.go b/precompiles/bank/query_test.go index eedf18719b..56bad9fa27 100644 --- a/precompiles/bank/query_test.go +++ b/precompiles/bank/query_test.go @@ -83,7 +83,7 @@ func (s *PrecompileTestSuite) TestBalances() { }, }, { - "pass - ATOM and XMPL balances present - mint extra XMPL", + "pass - EDGENS and XMPL balances present - mint extra XMPL", func() []interface{} { ctx = s.mintAndSendXMPLCoin(ctx, s.keyring.GetAccAddr(0), math.NewInt(1e18)) return []interface{}{ @@ -145,7 +145,7 @@ func (s *PrecompileTestSuite) TestTotalSupply() { expSupply func(cosmosEVMAddr, xmplAddr common.Address) []bank.Balance }{ { - "pass - ATOM and XMPL total supply", + "pass - EDGENS and XMPL total supply", func() { ctx = s.mintAndSendXMPLCoin(ctx, s.keyring.GetAccAddr(0), math.NewInt(1e18)) }, @@ -244,7 +244,7 @@ func (s *PrecompileTestSuite) TestSupplyOf() { }, { - "pass - ATOM total supply", + "pass - EDGENS total supply", func() []interface{} { return []interface{}{ s.cosmosEVMAddr, diff --git a/precompiles/distribution/tx_test.go b/precompiles/distribution/tx_test.go index dd0869fed9..1412d3cb37 100644 --- a/precompiles/distribution/tx_test.go +++ b/precompiles/distribution/tx_test.go @@ -530,7 +530,7 @@ func (s *PrecompileTestSuite) TestFundCommunityPool() { "invalid hex address address", }, { - "success - fund the community pool 1 ATOM", + "success - fund the community pool 1 EDGENS", func() []interface{} { return []interface{}{ s.keyring.GetAddr(0), @@ -565,7 +565,7 @@ func (s *PrecompileTestSuite) TestFundCommunityPool() { var contract *vm.Contract contract, ctx = testutil.NewPrecompileContract(s.T(), ctx, s.keyring.GetAddr(0), s.precompile, tc.gas) - // Sanity check to make sure the starting balance is always 100k ATOM + // Sanity check to make sure the starting balance is always 100k EDGENS balance := s.network.App.BankKeeper.GetBalance(ctx, s.keyring.GetAddr(0).Bytes(), testconstants.ExampleAttoDenom) s.Require().Equal(balance.Amount, network.PrefundedAccountInitialBalance) diff --git a/precompiles/erc20/query.go b/precompiles/erc20/query.go index 6e59bac03f..6eb3241f06 100644 --- a/precompiles/erc20/query.go +++ b/precompiles/erc20/query.go @@ -37,7 +37,7 @@ const ( // Name returns the name of the token. If the token metadata is registered in the // bank module, it returns its name. Otherwise, it returns the base denomination of -// the token capitalized (e.g. uatom -> Atom). +// the token capitalized (e.g. uedgens -> Edgens). func (p Precompile) Name( ctx sdk.Context, _ *vm.Contract, @@ -61,7 +61,7 @@ func (p Precompile) Name( // Symbol returns the symbol of the token. If the token metadata is registered in the // bank module, it returns its symbol. Otherwise, it returns the base denomination of -// the token in uppercase (e.g. uatom -> ATOM). +// the token in uppercase (e.g. uedgens -> EDGENS). func (p Precompile) Symbol( ctx sdk.Context, _ *vm.Contract, @@ -85,7 +85,7 @@ func (p Precompile) Symbol( // Decimals returns the decimals places of the token. If the token metadata is registered in the // bank module, it returns the display denomination exponent. Otherwise, it infers the decimal -// value from the first character of the base denomination (e.g. uatom -> 6). +// value from the first character of the base denomination (e.g. uedgens -> 6). func (p Precompile) Decimals( ctx sdk.Context, _ *vm.Contract, diff --git a/precompiles/erc20/query_test.go b/precompiles/erc20/query_test.go index 9925c47388..ab31b55613 100644 --- a/precompiles/erc20/query_test.go +++ b/precompiles/erc20/query_test.go @@ -26,22 +26,22 @@ var ( // validDenom is a denomination with a valid IBC voucher name validDenom = types.NewDenom("uosmo", types.NewHop(types.PortID, "channel-0")) // validAttoDenom is a denomination with a valid IBC voucher name and 18 decimals - validAttoDenom = types.NewDenom("aatom", types.NewHop(types.PortID, "channel-0")) + validAttoDenom = types.NewDenom("aedgens", types.NewHop(types.PortID, "channel-0")) // validDenomNoMicroAtto is a denomination with a valid IBC voucher name but no micro or atto prefix - validDenomNoMicroAtto = types.NewDenom("matom", types.NewHop(types.PortID, "channel-0")) + validDenomNoMicroAtto = types.NewDenom("medgens", types.NewHop(types.PortID, "channel-0")) // -------------------- // Variables for coin with valid metadata // // validMetadataDenom is the base denomination of the coin with valid metadata - validMetadataDenom = "uatom" + validMetadataDenom = "uedgens" // validMetadataDisplay is the denomination displayed of the coin with valid metadata - validMetadataDisplay = "atom" + validMetadataDisplay = "edgens" // validMetadataName is the name of the coin with valid metadata - validMetadataName = "Atom" + validMetadataName = "Edgens" // validMetadataSymbol is the symbol of the coin with valid metadata - validMetadataSymbol = "ATOM" + validMetadataSymbol = "EDGENS" // validMetadata is the metadata of the coin with valid metadata validMetadata = banktypes.Metadata{ @@ -147,8 +147,8 @@ func (s *PrecompileTestSuite) TestNameSymbol() { app.TransferKeeper.SetDenom(ctx, validDenomNoMicroAtto) }, expPass: true, - expName: "Atom", - expSymbol: "ATOM", + expName: "Edgens", + expSymbol: "EDGENS", }, { name: "pass - valid denom with metadata", @@ -162,8 +162,8 @@ func (s *PrecompileTestSuite) TestNameSymbol() { app.BankKeeper.SetDenomMetaData(ctx, validMetadata) }, expPass: true, - expName: "Atom", - expSymbol: "ATOM", + expName: "Edgens", + expSymbol: "EDGENS", }, { name: "pass - valid ibc denom without metadata", diff --git a/precompiles/gov/query_test.go b/precompiles/gov/query_test.go index bad163221e..5d38c729d1 100644 --- a/precompiles/gov/query_test.go +++ b/precompiles/gov/query_test.go @@ -288,7 +288,7 @@ func (s *PrecompileTestSuite) TestGetDeposit() { s.Require().NoError(err) s.Require().Equal(tc.expPropNumber, out.Deposit.ProposalId) s.Require().Equal(common.BytesToAddress(depositor.Bytes()), out.Deposit.Depositor) - s.Require().Equal([]cmn.Coin{{Denom: "aatom", Amount: big.NewInt(100)}}, out.Deposit.Amount) + s.Require().Equal([]cmn.Coin{{Denom: "aedgens", Amount: big.NewInt(100)}}, out.Deposit.Amount) } else { s.Require().Error(err) s.Require().Contains(err.Error(), tc.errContains) diff --git a/precompiles/testutil/contracts/types.go b/precompiles/testutil/contracts/types.go index bb655eba35..5d3bb176e3 100644 --- a/precompiles/testutil/contracts/types.go +++ b/precompiles/testutil/contracts/types.go @@ -82,7 +82,7 @@ func (c CallArgs) WithArgs(args ...interface{}) CallArgs { } // WithAmount populates the CallArgs struct's Amount field with the given amount. -// This is the amount of ATOM that will be sent with the contract call. +// This is the amount of EDGENS that will be sent with the contract call. func (c CallArgs) WithAmount(amount *big.Int) CallArgs { c.Amount = amount return c diff --git a/precompiles/testutil/ibc.go b/precompiles/testutil/ibc.go index 476de91f4d..e897ac5386 100644 --- a/precompiles/testutil/ibc.go +++ b/precompiles/testutil/ibc.go @@ -8,19 +8,19 @@ var ( UosmoDenom = transfertypes.NewDenom("uosmo", transfertypes.NewHop(transfertypes.PortID, "channel-0")) UosmoIbcDenom = UosmoDenom.IBCDenom() - UatomDenom = transfertypes.NewDenom("uatom", transfertypes.NewHop(transfertypes.PortID, "channel-1")) + UatomDenom = transfertypes.NewDenom("uedgens", transfertypes.NewHop(transfertypes.PortID, "channel-1")) UatomIbcDenom = UatomDenom.IBCDenom() - UAtomDenom = transfertypes.NewDenom("aatom", transfertypes.NewHop(transfertypes.PortID, "channel-0")) + UAtomDenom = transfertypes.NewDenom("aedgens", transfertypes.NewHop(transfertypes.PortID, "channel-0")) UAtomIbcDenom = UatomDenom.IBCDenom() UatomOsmoDenom = transfertypes.NewDenom( - "uatom", + "uedgens", transfertypes.NewHop(transfertypes.PortID, "channel-0"), transfertypes.NewHop(transfertypes.PortID, "channel-1"), ) UatomOsmoIbcDenom = UatomOsmoDenom.IBCDenom() - AatomDenom = transfertypes.NewDenom("aatom", transfertypes.NewHop(transfertypes.PortID, "channel-0")) + AatomDenom = transfertypes.NewDenom("aedgens", transfertypes.NewHop(transfertypes.PortID, "channel-0")) AatomIbcDenom = AatomDenom.IBCDenom() ) diff --git a/precompiles/werc20/integration_test.go b/precompiles/werc20/integration_test.go index cdc3db7c86..e81f567196 100644 --- a/precompiles/werc20/integration_test.go +++ b/precompiles/werc20/integration_test.go @@ -580,7 +580,7 @@ var _ = When("a user interact with the WEVMOS precompiled contract", func() { var symbol string err = is.precompile.UnpackIntoInterface(&symbol, erc20.SymbolMethod, ethRes.Ret) Expect(err).ToNot(HaveOccurred(), "failed to unpack result") - Expect(symbol).To(ContainSubstring("ATOM"), "expected different symbol") + Expect(symbol).To(ContainSubstring("EDGENS"), "expected different symbol") }) It("should return the decimals", func() { diff --git a/precompiles/werc20/tx.go b/precompiles/werc20/tx.go index 6ba36c0ab1..5bfa145801 100644 --- a/precompiles/werc20/tx.go +++ b/precompiles/werc20/tx.go @@ -65,7 +65,7 @@ func (p Precompile) Deposit( // Withdraw is a no-op and mock function that provides the same interface as the // WETH contract to support equality between the native coin and its wrapped -// ERC-20 (e.g. ATOM and WEVMOS). +// ERC-20 (e.g. EDGENS and WEVMOS). func (p Precompile) Withdraw(ctx sdk.Context, contract *vm.Contract, stateDB vm.StateDB, args []interface{}) ([]byte, error) { amount, ok := args[0].(*big.Int) if !ok { diff --git a/proto/cosmos/evm/precisebank/v1/genesis.proto b/proto/cosmos/evm/precisebank/v1/genesis.proto index ded2ae9c31..fac1c72c4f 100644 --- a/proto/cosmos/evm/precisebank/v1/genesis.proto +++ b/proto/cosmos/evm/precisebank/v1/genesis.proto @@ -33,7 +33,7 @@ message FractionalBalance { // amount indicates amount of only the fractional balance owned by the // address. FractionalBalance currently only supports tracking 1 single asset, - // e.g. fractional balances of uatom. + // e.g. fractional balances of uedgens. string amount = 2 [ (cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "cosmossdk.io/math.Int", diff --git a/rpc/backend/backend_suite_test.go b/rpc/backend/backend_suite_test.go index f597274804..434f028de9 100644 --- a/rpc/backend/backend_suite_test.go +++ b/rpc/backend/backend_suite_test.go @@ -90,7 +90,7 @@ func (suite *BackendTestSuite) SetupTest() { suite.backend.cfg.JSONRPC.GasCap = 0 suite.backend.cfg.JSONRPC.EVMTimeout = 0 suite.backend.cfg.JSONRPC.AllowInsecureUnlock = true - suite.backend.cfg.EVM.EVMChainID = 262144 + suite.backend.cfg.EVM.EVMChainID = 4207 suite.backend.queryClient.QueryClient = mocks.NewEVMQueryClient(suite.T()) suite.backend.queryClient.FeeMarket = mocks.NewFeeMarketQueryClient(suite.T()) suite.backend.ctx = rpctypes.ContextWithHeight(1) diff --git a/rpc/backend/call_tx_test.go b/rpc/backend/call_tx_test.go index 3c04393988..8199098f67 100644 --- a/rpc/backend/call_tx_test.go +++ b/rpc/backend/call_tx_test.go @@ -341,7 +341,7 @@ func (suite *BackendTestSuite) TestSendRawTransaction() { return bytes }, common.Hash{}, - fmt.Errorf("incorrect chain-id; expected %d, got %d", 262144, big.NewInt(1)).Error(), + fmt.Errorf("incorrect chain-id; expected %d, got %d", 4207, big.NewInt(1)).Error(), false, }, { diff --git a/rpc/backend/chain_info_test.go b/rpc/backend/chain_info_test.go index 3bba11bed4..fa469921be 100644 --- a/rpc/backend/chain_info_test.go +++ b/rpc/backend/chain_info_test.go @@ -154,7 +154,7 @@ func (suite *BackendTestSuite) TestBaseFee() { } func (suite *BackendTestSuite) TestChainId() { - expChainID := (*hexutil.Big)(big.NewInt(262144)) + expChainID := (*hexutil.Big)(big.NewInt(4207)) testCases := []struct { name string registerMock func() diff --git a/rpc/namespaces/ethereum/eth/api.go b/rpc/namespaces/ethereum/eth/api.go index 3c48efd9c1..6828d87189 100644 --- a/rpc/namespaces/ethereum/eth/api.go +++ b/rpc/namespaces/ethereum/eth/api.go @@ -2,6 +2,8 @@ package eth import ( "context" + "fmt" + "math" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" @@ -74,7 +76,7 @@ type EthereumAPI interface { ProtocolVersion() hexutil.Uint GasPrice() (*hexutil.Big, error) EstimateGas(args evmtypes.TransactionArgs, blockNrOptional *rpctypes.BlockNumber) (hexutil.Uint64, error) - FeeHistory(blockCount uint64, lastBlock rpc.BlockNumber, rewardPercentiles []float64) (*rpctypes.FeeHistoryResult, error) + FeeHistory(blockCount interface{}, lastBlock rpc.BlockNumber, rewardPercentiles []float64) (*rpctypes.FeeHistoryResult, error) MaxPriorityFeePerGas() (*hexutil.Big, error) ChainId() (*hexutil.Big, error) @@ -311,12 +313,38 @@ func (e *PublicAPI) EstimateGas(args evmtypes.TransactionArgs, blockNrOptional * return e.backend.EstimateGas(args, blockNrOptional) } -func (e *PublicAPI) FeeHistory(blockCount uint64, +func (e *PublicAPI) FeeHistory(blockCount interface{}, lastBlock rpc.BlockNumber, rewardPercentiles []float64, ) (*rpctypes.FeeHistoryResult, error) { e.logger.Debug("eth_feeHistory") - return e.backend.FeeHistory(blockCount, lastBlock, rewardPercentiles) + + // Convert blockCount to uint64 + var blockCountUint uint64 + switch v := blockCount.(type) { + case string: + // Handle hex string + blockCountBig, err := hexutil.DecodeBig(v) + if err != nil { + return nil, fmt.Errorf("invalid blockCount: %v", err) + } + if !blockCountBig.IsUint64() { + return nil, fmt.Errorf("blockCount too large") + } + blockCountUint = blockCountBig.Uint64() + case float64: + // Handle number + if v < 0 || v > float64(math.MaxUint64) { + return nil, fmt.Errorf("invalid blockCount") + } + blockCountUint = uint64(v) + case uint64: + blockCountUint = v + default: + return nil, fmt.Errorf("invalid blockCount type: %T", blockCount) + } + + return e.backend.FeeHistory(blockCountUint, lastBlock, rewardPercentiles) } // MaxPriorityFeePerGas returns a suggestion for a gas tip cap for dynamic fee transactions. diff --git a/server/config/config.go b/server/config/config.go index 605d8047df..e7991eecdf 100644 --- a/server/config/config.go +++ b/server/config/config.go @@ -63,7 +63,7 @@ const ( // DefaultMaxTxGasWanted is the default gas wanted for each eth tx returned in ante handler in check tx mode DefaultMaxTxGasWanted = 0 - DefaultEVMChainID = 262144 + DefaultEVMChainID = 4207 // DefaultGasCap is the default cap on gas that can be used in eth_call/estimateGas DefaultGasCap uint64 = 25000000 diff --git a/server/config/migration/v0.50-app.toml b/server/config/migration/v0.50-app.toml index bcff87d811..b7022b13b2 100644 --- a/server/config/migration/v0.50-app.toml +++ b/server/config/migration/v0.50-app.toml @@ -8,7 +8,7 @@ # The minimum gas prices a validator is willing to accept for processing a # transaction. A transaction's fees must meet the minimum of any denomination # specified in this config (e.g. 0.25token1,0.0001token2). -minimum-gas-prices = "0aatom" +minimum-gas-prices = "0aedgens" # The maximum gas a query coming over rest/grpc may consume. # If this is set to zero, the query can consume an unbounded amount of gas. @@ -368,8 +368,8 @@ gas-to-suggest = 300000 # DenomToSuggest defines the defult denom for fee suggestion. # Price must be in minimum-gas-prices. -denom-to-suggest = "aatom" +denom-to-suggest = "aedgens" # GasPrices defines the gas prices for fee suggestion -gas-prices = "4000000.000000000000000000aatom" +gas-prices = "4000000.000000000000000000aedgens" diff --git a/server/flags/flags.go b/server/flags/flags.go index 9093182b36..f37cafb3cd 100644 --- a/server/flags/flags.go +++ b/server/flags/flags.go @@ -76,8 +76,8 @@ const ( func AddTxFlags(cmd *cobra.Command) (*cobra.Command, error) { cmd.PersistentFlags().String(flags.FlagChainID, "", "Specify Chain ID for sending Tx") cmd.PersistentFlags().String(flags.FlagFrom, "", "Name or address of private key with which to sign") - cmd.PersistentFlags().String(flags.FlagFees, "", "Fees to pay along with transaction; eg: 10aatom") - cmd.PersistentFlags().String(flags.FlagGasPrices, "", "Gas prices to determine the transaction fee (e.g. 10aatom)") + cmd.PersistentFlags().String(flags.FlagFees, "", "Fees to pay along with transaction; eg: 10aedgens") + cmd.PersistentFlags().String(flags.FlagGasPrices, "", "Gas prices to determine the transaction fee (e.g. 10aedgens)") cmd.PersistentFlags().String(flags.FlagNode, "tcp://localhost:26657", ": to tendermint rpc interface for this chain") //nolint:lll cmd.PersistentFlags().Float64(flags.FlagGasAdjustment, flags.DefaultGasAdjustment, "adjustment factor to be multiplied against the estimate returned by the tx simulation; if the gas limit is set manually this flag is ignored ") //nolint:lll cmd.PersistentFlags().StringP(flags.FlagBroadcastMode, "b", flags.BroadcastSync, "Transaction broadcasting mode (sync|async)") diff --git a/server/start.go b/server/start.go index d885bddb2c..75c7728545 100644 --- a/server/start.go +++ b/server/start.go @@ -159,7 +159,7 @@ which accepts a path for the resulting pprof file. cmd.Flags().String(srvflags.Address, "tcp://0.0.0.0:26658", "Listen address") cmd.Flags().String(srvflags.Transport, "socket", "Transport protocol: socket, grpc") cmd.Flags().String(srvflags.TraceStore, "", "Enable KVStore tracing to an output file") - cmd.Flags().String(server.FlagMinGasPrices, "", "Minimum gas prices to accept for transactions; Any fee in a tx must meet this minimum (e.g. 20000000000aatom)") //nolint:lll + cmd.Flags().String(server.FlagMinGasPrices, "", "Minimum gas prices to accept for transactions; Any fee in a tx must meet this minimum (e.g. 20000000000aedgens)") //nolint:lll cmd.Flags().IntSlice(server.FlagUnsafeSkipUpgrades, []int{}, "Skip a set of upgrade heights to continue the old binary") cmd.Flags().Uint64(server.FlagHaltHeight, 0, "Block height at which to gracefully halt the chain and shutdown the node") cmd.Flags().Uint64(server.FlagHaltTime, 0, "Minimum block time (in Unix seconds) at which to gracefully halt the chain and shutdown the node") @@ -186,7 +186,7 @@ which accepts a path for the resulting pprof file. cmd.Flags().StringSlice(srvflags.JSONRPCAPI, cosmosevmserverconfig.GetDefaultAPINamespaces(), "Defines a list of JSON-RPC namespaces that should be enabled") cmd.Flags().String(srvflags.JSONRPCAddress, cosmosevmserverconfig.DefaultJSONRPCAddress, "the JSON-RPC server address to listen on") cmd.Flags().String(srvflags.JSONWsAddress, cosmosevmserverconfig.DefaultJSONRPCWsAddress, "the JSON-RPC WS server address to listen on") - cmd.Flags().Uint64(srvflags.JSONRPCGasCap, cosmosevmserverconfig.DefaultGasCap, "Sets a cap on gas that can be used in eth_call/estimateGas unit is aatom (0=infinite)") //nolint:lll + cmd.Flags().Uint64(srvflags.JSONRPCGasCap, cosmosevmserverconfig.DefaultGasCap, "Sets a cap on gas that can be used in eth_call/estimateGas unit is aedgens (0=infinite)") //nolint:lll cmd.Flags().Bool(srvflags.JSONRPCAllowInsecureUnlock, cosmosevmserverconfig.DefaultJSONRPCAllowInsecureUnlock, "Allow insecure account unlocking when account-related RPCs are exposed by http") //nolint:lll cmd.Flags().Float64(srvflags.JSONRPCTxFeeCap, cosmosevmserverconfig.DefaultTxFeeCap, "Sets a cap on transaction fee that can be sent via the RPC APIs (1 = default 1 evmos)") //nolint:lll cmd.Flags().Int32(srvflags.JSONRPCFilterCap, cosmosevmserverconfig.DefaultFilterCap, "Sets the global cap for total number of filters that can be created") diff --git a/tests/solidity/init-node.sh b/tests/solidity/init-node.sh index dbac289745..e1c0383368 100755 --- a/tests/solidity/init-node.sh +++ b/tests/solidity/init-node.sh @@ -4,7 +4,7 @@ CHAINID="${CHAIN_ID:-cosmos_262144-1}" MONIKER="localtestnet" -KEYRING="test" # remember to change to other types of keyring like 'file' in-case exposing to outside world, otherwise your balance will be wiped quickly. The keyring test does not require private key to steal tokens from you +KEYRING=edgen # remember to change to other types of keyring like 'file' in-case exposing to outside world, otherwise your balance will be wiped quickly. The keyring test does not require private key to steal tokens from you KEYALGO="eth_secp256k1" #gitleaks:allow LOGLEVEL="info" # to trace evm @@ -68,12 +68,12 @@ echo "$USER4_MNEMONIC" | evmd keys add "$USER4_KEY" --recover --keyring-backend # Set moniker and chain-id for Cosmos EVM (Moniker can be anything, chain-id must be an integer) evmd init "$MONIKER" --chain-id "$CHAINID" --home "$CHAINDIR" -# Change parameter token denominations to atest -jq '.app_state["staking"]["params"]["bond_denom"]="atest"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" -jq '.app_state["gov"]["deposit_params"]["min_deposit"][0]["denom"]="atest"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" -jq '.app_state["gov"]["params"]["min_deposit"][0]["denom"]="atest"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" -jq '.app_state["evm"]["params"]["evm_denom"]="atest"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" -jq '.app_state["mint"]["params"]["mint_denom"]="atest"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" +# Change parameter token denominations to aedgen +jq '.app_state["staking"]["params"]["bond_denom"]="aedgen"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" +jq '.app_state["gov"]["deposit_params"]["min_deposit"][0]["denom"]="aedgen"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" +jq '.app_state["gov"]["params"]["min_deposit"][0]["denom"]="aedgen"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" +jq '.app_state["evm"]["params"]["evm_denom"]="aedgen"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" +jq '.app_state["mint"]["params"]["mint_denom"]="aedgen"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" # Enable precompiles in EVM params jq '.app_state["evm"]["params"]["active_static_precompiles"]=["0x0000000000000000000000000000000000000100","0x0000000000000000000000000000000000000400","0x0000000000000000000000000000000000000800","0x0000000000000000000000000000000000000801","0x0000000000000000000000000000000000000802","0x0000000000000000000000000000000000000803","0x0000000000000000000000000000000000000804"]' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" @@ -93,11 +93,11 @@ jq '.app_state["feemarket"]["params"]["base_fee"]="'${BASEFEE}'"' "$GENESIS" >"$ sed -i.bak 's/create_empty_blocks = true/create_empty_blocks = false/g' "$CONFIG_TOML" # Allocate genesis accounts (cosmos formatted addresses) -evmd genesis add-genesis-account "$(evmd keys show "$VAL_KEY" -a --keyring-backend "$KEYRING" --home "$CHAINDIR")" 100000000000000000000000000atest --keyring-backend "$KEYRING" --home "$CHAINDIR" -evmd genesis add-genesis-account "$(evmd keys show "$USER1_KEY" -a --keyring-backend "$KEYRING" --home "$CHAINDIR")" 1000000000000000000000atest --keyring-backend "$KEYRING" --home "$CHAINDIR" -evmd genesis add-genesis-account "$(evmd keys show "$USER2_KEY" -a --keyring-backend "$KEYRING" --home "$CHAINDIR")" 1000000000000000000000atest --keyring-backend "$KEYRING" --home "$CHAINDIR" -evmd genesis add-genesis-account "$(evmd keys show "$USER3_KEY" -a --keyring-backend "$KEYRING" --home "$CHAINDIR")" 1000000000000000000000atest --keyring-backend "$KEYRING" --home "$CHAINDIR" -evmd genesis add-genesis-account "$(evmd keys show "$USER4_KEY" -a --keyring-backend "$KEYRING" --home "$CHAINDIR")" 1000000000000000000000atest --keyring-backend "$KEYRING" --home "$CHAINDIR" +evmd genesis add-genesis-account "$(evmd keys show "$VAL_KEY" -a --keyring-backend "$KEYRING" --home "$CHAINDIR")" 100000000000000000000000000aedgen --keyring-backend "$KEYRING" --home "$CHAINDIR" +evmd genesis add-genesis-account "$(evmd keys show "$USER1_KEY" -a --keyring-backend "$KEYRING" --home "$CHAINDIR")" 1000000000000000000000aedgen --keyring-backend "$KEYRING" --home "$CHAINDIR" +evmd genesis add-genesis-account "$(evmd keys show "$USER2_KEY" -a --keyring-backend "$KEYRING" --home "$CHAINDIR")" 1000000000000000000000aedgen --keyring-backend "$KEYRING" --home "$CHAINDIR" +evmd genesis add-genesis-account "$(evmd keys show "$USER3_KEY" -a --keyring-backend "$KEYRING" --home "$CHAINDIR")" 1000000000000000000000aedgen --keyring-backend "$KEYRING" --home "$CHAINDIR" +evmd genesis add-genesis-account "$(evmd keys show "$USER4_KEY" -a --keyring-backend "$KEYRING" --home "$CHAINDIR")" 1000000000000000000000aedgen --keyring-backend "$KEYRING" --home "$CHAINDIR" # set custom pruning settings if [ "$PRUNING" = "custom" ]; then @@ -114,7 +114,7 @@ sed -i.bak 's/127.0.0.1/0.0.0.0/g' "$APP_TOML" sed -i.bak 's/timeout_commit = "3s"/timeout_commit = "1s"/g' "$CONFIG_TOML" # Sign genesis transaction -evmd genesis gentx "$VAL_KEY" 1000000000000000000000atest --gas-prices ${BASEFEE}atest --keyring-backend "$KEYRING" --chain-id "$CHAINID" --home "$CHAINDIR" +evmd genesis gentx "$VAL_KEY" 1000000000000000000000aedgen --gas-prices ${BASEFEE}aedgen --keyring-backend "$KEYRING" --chain-id "$CHAINID" --home "$CHAINDIR" ## In case you want to create multiple validators at genesis ## 1. Back to `evmd keys add` step, init more keys ## 2. Back to `evmd add-genesis-account` step, add balance for those @@ -137,7 +137,7 @@ evmd genesis validate-genesis --home "$CHAINDIR" # Start the node evmd start "$TRACE" \ --log_level $LOGLEVEL \ - --minimum-gas-prices=0.0001utest \ + --minimum-gas-prices=0.0001uedgen \ --json-rpc.api eth,txpool,personal,net,debug,web3 \ --chain-id "$CHAINID" \ --home "$CHAINDIR" diff --git a/tests/solidity/suites/precompiles/hardhat.config.js b/tests/solidity/suites/precompiles/hardhat.config.js index 6f99b69480..496cc35d29 100644 --- a/tests/solidity/suites/precompiles/hardhat.config.js +++ b/tests/solidity/suites/precompiles/hardhat.config.js @@ -16,7 +16,7 @@ module.exports = { networks: { cosmos: { url: "http://127.0.0.1:8545", - chainId: 262144, + chainId: 4207, accounts: [ "0x88CBEAD91AEE890D27BF06E003ADE3D4E952427E88F88D31D61D3EF5E5D54305", "0x3B7955D25189C99A7468192FCBC6429205C158834053EBE3F78F4512AB432DB9", diff --git a/tests/solidity/suites/precompiles/test/staking.js b/tests/solidity/suites/precompiles/test/staking.js index 735c692bb2..a1f9850e92 100644 --- a/tests/solidity/suites/precompiles/test/staking.js +++ b/tests/solidity/suites/precompiles/test/staking.js @@ -2,7 +2,7 @@ const { expect } = require('chai') const hre = require('hardhat') describe('Staking', function () { - it('should stake ATOM to a validator', async function () { + it('should stake EDGENS to a validator', async function () { const valAddr = 'cosmosvaloper10jmp6sgh4cc6zt3e8gw05wavvejgr5pw4xyrql' const stakeAmount = hre.ethers.parseEther('0.001') diff --git a/testutil/constants/constants.go b/testutil/constants/constants.go index 1b2cf732a5..2cd1554f27 100644 --- a/testutil/constants/constants.go +++ b/testutil/constants/constants.go @@ -12,13 +12,13 @@ const ( DefaultGasPrice = 20 // ExampleAttoDenom provides an example denom for use in tests - ExampleAttoDenom = "aatom" + ExampleAttoDenom = "aedgens" // ExampleMicroDenom provides an example denom for use in tests - ExampleMicroDenom = "uatom" + ExampleMicroDenom = "uedgens" // ExampleDisplayDenom provides an example display denom for use in tests - ExampleDisplayDenom = "atom" + ExampleDisplayDenom = "edgens" // ExampleBech32Prefix provides an example Bech32 prefix for use in tests ExampleBech32Prefix = "cosmos" @@ -82,9 +82,9 @@ var ( Decimals: evmtypes.EighteenDecimals, }, SixDecimalsChainID: { - Denom: "utest", - ExtendedDenom: "atest", - DisplayDenom: "test", + Denom: "uedgen", + ExtendedDenom: "aedgen", + DisplayDenom: "edgen", Decimals: evmtypes.SixDecimals, }, TwelveDecimalsChainID: { diff --git a/testutil/integration/os/network/chain_id_modifiers.go b/testutil/integration/os/network/chain_id_modifiers.go index eb40b599de..976a9f3081 100644 --- a/testutil/integration/os/network/chain_id_modifiers.go +++ b/testutil/integration/os/network/chain_id_modifiers.go @@ -25,7 +25,7 @@ func updateBankGenesisStateForChainID(bankGenesisState banktypes.GenesisState) b func generateBankGenesisMetadata() banktypes.Metadata { return banktypes.Metadata{ Description: "The native EVM, governance and staking token of the Cosmos EVM example chain", - Base: "aatom", + Base: "aedgens", DenomUnits: []*banktypes.DenomUnit{ { Denom: testconstants.ExampleAttoDenom, @@ -37,7 +37,7 @@ func generateBankGenesisMetadata() banktypes.Metadata { }, }, Name: "Cosmos EVM", - Symbol: "ATOM", + Symbol: "EDGENS", Display: testconstants.ExampleDisplayDenom, } } diff --git a/testutil/integration/os/utils/bank_test.go b/testutil/integration/os/utils/bank_test.go index 011ccffed1..a9cc0c0bc0 100644 --- a/testutil/integration/os/utils/bank_test.go +++ b/testutil/integration/os/utils/bank_test.go @@ -17,7 +17,7 @@ import ( ) func TestCheckBalances(t *testing.T) { - testDenom := "atest" + testDenom := "aedgen" keyring := testkeyring.New(1) address := keyring.GetAccAddr(0).String() diff --git a/testutil/tx/cosmos.go b/testutil/tx/cosmos.go index d4f0376d84..cf4b6d44ba 100644 --- a/testutil/tx/cosmos.go +++ b/testutil/tx/cosmos.go @@ -16,7 +16,7 @@ import ( authsigning "github.com/cosmos/cosmos-sdk/x/auth/signing" ) -var DefaultFee = sdk.NewCoin(constants.ExampleAttoDenom, sdkmath.NewInt(1e16)) // 0.01 AATOM +var DefaultFee = sdk.NewCoin(constants.ExampleAttoDenom, sdkmath.NewInt(1e16)) // 0.01 AEDGENS // CosmosTxArgs contains the params to create a cosmos tx type CosmosTxArgs struct { diff --git a/utils/utils_test.go b/utils/utils_test.go index f4c722c719..d6af6c2f7c 100644 --- a/utils/utils_test.go +++ b/utils/utils_test.go @@ -136,7 +136,7 @@ func TestEvmosCoinDenom(t *testing.T) { }{ { "valid denom - native coin", - "aatom", + "aedgens", false, }, { @@ -261,7 +261,7 @@ func TestGetIBCDenomAddress(t *testing.T) { }{ { "", - "test", + edgen, true, "does not have 'ibc/' prefix", }, diff --git a/wallets/ledger/ledger_suite_test.go b/wallets/ledger/ledger_suite_test.go index 54f75e4fc4..4ed265108d 100644 --- a/wallets/ledger/ledger_suite_test.go +++ b/wallets/ledger/ledger_suite_test.go @@ -77,14 +77,14 @@ func (suite *LedgerTestSuite) getMockTxAmino() []byte { "account_number": "0", "chain_id":"%s", "fee":{ - "amount":[{"amount":"150","denom":"atom"}], + "amount":[{"amount":"150","denom":"edgens"}], "gas":"20000" }, "memo":"memo", "msgs":[{ "type":"cosmos-sdk/MsgSend", "value":{ - "amount":[{"amount":"150","denom":"atom"}], + "amount":[{"amount":"150","denom":"edgens"}], "from_address":"cosmos10jmp6sgh4cc6zt3e8gw05wavvejgr5pwsjskvv", "to_address":"cosmos1fx944mzagwdhx0wz7k9tfztc8g3lkfk6rrgv6l" } @@ -106,7 +106,7 @@ func (suite *LedgerTestSuite) getMockTxProtobuf() []byte { sdk.MustAccAddressFromBech32("cosmos10t8ca2w09ykd6ph0agdz5stvgau47whhaggl9a"), []sdk.Coin{ { - Denom: "atom", + Denom: "edgens", Amount: math.NewIntFromUint64(150), }, }, @@ -141,7 +141,7 @@ func (suite *LedgerTestSuite) getMockTxProtobuf() []byte { Sequence: 6, } - fee := txTypes.Fee{Amount: sdk.NewCoins(sdk.NewInt64Coin("atom", 150)), GasLimit: 20000} + fee := txTypes.Fee{Amount: sdk.NewCoins(sdk.NewInt64Coin("edgens", 150)), GasLimit: 20000} authInfo := &txTypes.AuthInfo{ SignerInfos: []*txTypes.SignerInfo{signerInfo}, diff --git a/x/erc20/client/cli/metadata/coin_metadata_test.json b/x/erc20/client/cli/metadata/coin_metadata_test.json index 1b0896ebe2..a7aa9e9d04 100644 --- a/x/erc20/client/cli/metadata/coin_metadata_test.json +++ b/x/erc20/client/cli/metadata/coin_metadata_test.json @@ -4,18 +4,18 @@ "description": "The native staking and governance token of the Cosmos EVM chain", "denom_units": [ { - "denom": "aatom", + "denom": "aedgens", "exponent": 0 }, { - "denom": "atom", + "denom": "edgens", "exponent": 18 } ], - "base": "aatom", - "display": "aatom", - "name": "aatom", - "symbol": "ATOM" + "base": "aedgens", + "display": "aedgens", + "name": "aedgens", + "symbol": "EDGENS" } ] } \ No newline at end of file diff --git a/x/erc20/client/cli/metadata/coins_metadata_test.json b/x/erc20/client/cli/metadata/coins_metadata_test.json index 8e98ab2026..eb45c25a95 100644 --- a/x/erc20/client/cli/metadata/coins_metadata_test.json +++ b/x/erc20/client/cli/metadata/coins_metadata_test.json @@ -4,18 +4,18 @@ "description": "The native staking and governance token of the Cosmos EVM chain", "denom_units": [ { - "denom": "aatom", + "denom": "aedgens", "exponent": 0 }, { - "denom": "atom", + "denom": "edgens", "exponent": 18 } ], - "base": "aatom", - "display": "aatom", - "name": "aatom", - "symbol": "ATOM" + "base": "aedgens", + "display": "aedgens", + "name": "aedgens", + "symbol": "EDGENS" }, { "description": "The native staking and governance token of the Osmosis chain", diff --git a/x/erc20/client/cli/metadata/invalid_metadata_test.json b/x/erc20/client/cli/metadata/invalid_metadata_test.json index 08c71c4167..363b81cad0 100644 --- a/x/erc20/client/cli/metadata/invalid_metadata_test.json +++ b/x/erc20/client/cli/metadata/invalid_metadata_test.json @@ -4,18 +4,18 @@ "description": 1, "denom_units": [ { - "denom": "aatom", + "denom": "aedgens", "exponent": 0 }, { - "denom": "atom", + "denom": "edgens", "exponent": 18 } ], - "base": "aatom", - "display": "aatom", - "name": "aatom", - "symbol": "ATOM" + "base": "aedgens", + "display": "aedgens", + "name": "aedgens", + "symbol": "EDGENS" } ] } \ No newline at end of file diff --git a/x/erc20/keeper/ibc_callbacks.go b/x/erc20/keeper/ibc_callbacks.go index ec224797f0..a51987a2b0 100644 --- a/x/erc20/keeper/ibc_callbacks.go +++ b/x/erc20/keeper/ibc_callbacks.go @@ -23,7 +23,7 @@ import ( // OnRecvPacket performs the ICS20 middleware receive callback for automatically // converting an IBC Coin to their ERC20 representation. // For the conversion to succeed, the IBC denomination must have previously been -// registered via governance. Note that the native staking denomination (e.g. "aatom"), +// registered via governance. Note that the native staking denomination (e.g. "aedgens"), // is excluded from the conversion. // // CONTRACT: This middleware MUST be executed transfer after the ICS20 OnRecvPacket diff --git a/x/erc20/keeper/ibc_callbacks_test.go b/x/erc20/keeper/ibc_callbacks_test.go index 0a2d97e1ff..3715877f0f 100644 --- a/x/erc20/keeper/ibc_callbacks_test.go +++ b/x/erc20/keeper/ibc_callbacks_test.go @@ -260,7 +260,7 @@ func (suite *KeeperTestSuite) TestOnRecvPacket() { &suite.network.App.TransferKeeper, ) - // Fund receiver account with ATOM, ERC20 coins and IBC vouchers + // Fund receiver account with EDGENS, ERC20 coins and IBC vouchers // We do this since we are interested in the conversion portion w/ OnRecvPacket err = testutil.FundAccount(ctx, suite.network.App.BankKeeper, tc.receiver, coins) suite.Require().NoError(err) @@ -470,7 +470,7 @@ func (suite *KeeperTestSuite) TestOnAcknowledgementPacket() { sender = sdk.AccAddress(senderPk.PubKey().Address()) - // Fund receiver account with ATOM, ERC20 coins and IBC vouchers + // Fund receiver account with EDGENS, ERC20 coins and IBC vouchers // We do this since we are interested in the conversion portion w/ OnRecvPacket err = testutil.FundAccount( ctx, diff --git a/x/erc20/keeper/proposals_test.go b/x/erc20/keeper/proposals_test.go index cc8c6dbcd5..0b560a6fe9 100644 --- a/x/erc20/keeper/proposals_test.go +++ b/x/erc20/keeper/proposals_test.go @@ -39,7 +39,7 @@ const ( ) var metadataIbc = banktypes.Metadata{ - Description: "ATOM IBC voucher (channel 14)", + Description: "EDGENS IBC voucher (channel 14)", Base: ibcBase, // NOTE: Denom units MUST be increasing DenomUnits: []*banktypes.DenomUnit{ @@ -48,7 +48,7 @@ var metadataIbc = banktypes.Metadata{ Exponent: 0, }, }, - Name: "ATOM channel-14", + Name: "EDGENS channel-14", Symbol: "ibcATOM-14", Display: ibcBase, } diff --git a/x/erc20/types/msg_test.go b/x/erc20/types/msg_test.go index 28b9c4ad9f..b745bf1b1f 100644 --- a/x/erc20/types/msg_test.go +++ b/x/erc20/types/msg_test.go @@ -135,7 +135,7 @@ func (suite *MsgsTestSuite) TestMsgConvertCoinGetters() { msgInvalid := types.MsgConvertCoin{} msg := types.NewMsgConvertCoin( sdk.NewCoin( - "atest", + "aedgen", math.NewInt(100), ), utiltx.GenerateAddress(), @@ -157,7 +157,7 @@ func (suite *MsgsTestSuite) TestNewMsgConvertCoin() { }{ { "msg convert coin - pass", - "atest", + "aedgen", math.NewInt(100), utiltx.GenerateAddress().String(), sdk.AccAddress(utiltx.GenerateAddress().Bytes()).String(), @@ -196,7 +196,7 @@ func (suite *MsgsTestSuite) TestMsgConvertCoin() { }, { "cannot mint a non-positive amount", - "atest", + "aedgen", math.NewInt(-100), sdk.AccAddress(utiltx.GenerateAddress().Bytes()).String(), utiltx.GenerateAddress().String(), @@ -204,7 +204,7 @@ func (suite *MsgsTestSuite) TestMsgConvertCoin() { }, { "invalid sender address", - "atest", + "aedgen", math.NewInt(100), utiltx.GenerateAddress().String(), sdk.AccAddress{}.String(), @@ -212,7 +212,7 @@ func (suite *MsgsTestSuite) TestMsgConvertCoin() { }, { "invalid receiver hex address", - "atest", + "aedgen", math.NewInt(100), "not_a_hex_address", sdk.AccAddress(utiltx.GenerateAddress().Bytes()).String(), @@ -220,7 +220,7 @@ func (suite *MsgsTestSuite) TestMsgConvertCoin() { }, { "msg convert coin - pass", - "atest", + "aedgen", math.NewInt(100), utiltx.GenerateAddress().String(), sdk.AccAddress(utiltx.GenerateAddress().Bytes()).String(), diff --git a/x/erc20/types/utils_test.go b/x/erc20/types/utils_test.go index 8578ee1348..b30d2e27c4 100644 --- a/x/erc20/types/utils_test.go +++ b/x/erc20/types/utils_test.go @@ -66,37 +66,37 @@ func TestEqualMetadata(t *testing.T) { { "equal metadata", banktypes.Metadata{ - Base: "aatom", - Display: "atom", + Base: "aedgens", + Display: "edgens", Name: "Cosmos EVM", - Symbol: "ATOM", + Symbol: "EDGENS", Description: "EVM, staking and governance denom of Cosmos EVM", DenomUnits: []*banktypes.DenomUnit{ { - Denom: "aatom", + Denom: "aedgens", Exponent: 0, - Aliases: []string{"atto atom"}, + Aliases: []string{"atto edgens"}, }, { - Denom: "atom", + Denom: "edgens", Exponent: 18, }, }, }, banktypes.Metadata{ - Base: "aatom", - Display: "atom", + Base: "aedgens", + Display: "edgens", Name: "Cosmos EVM", - Symbol: "ATOM", + Symbol: "EDGENS", Description: "EVM, staking and governance denom of Cosmos EVM", DenomUnits: []*banktypes.DenomUnit{ { - Denom: "aatom", + Denom: "aedgens", Exponent: 0, - Aliases: []string{"atto atom"}, + Aliases: []string{"atto edgens"}, }, { - Denom: "atom", + Denom: "edgens", Exponent: 18, }, }, @@ -106,44 +106,44 @@ func TestEqualMetadata(t *testing.T) { { "different base field", banktypes.Metadata{ - Base: "aatom", + Base: "aedgens", }, banktypes.Metadata{ - Base: "taatom", + Base: "taedgens", }, true, }, { "different denom units length", banktypes.Metadata{ - Base: "aatom", - Display: "atom", + Base: "aedgens", + Display: "edgens", Name: "Cosmos EVM", - Symbol: "ATOM", + Symbol: "EDGENS", Description: "EVM, staking and governance denom of Cosmos EVM", DenomUnits: []*banktypes.DenomUnit{ { - Denom: "aatom", + Denom: "aedgens", Exponent: 0, - Aliases: []string{"atto atom"}, + Aliases: []string{"atto edgens"}, }, { - Denom: "atom", + Denom: "edgens", Exponent: 18, }, }, }, banktypes.Metadata{ - Base: "aatom", - Display: "atom", + Base: "aedgens", + Display: "edgens", Name: "Cosmos EVM", - Symbol: "ATOM", + Symbol: "EDGENS", Description: "EVM, staking and governance denom of Cosmos EVM", DenomUnits: []*banktypes.DenomUnit{ { - Denom: "aatom", + Denom: "aedgens", Exponent: 0, - Aliases: []string{"atto atom"}, + Aliases: []string{"atto edgens"}, }, }, }, @@ -152,47 +152,47 @@ func TestEqualMetadata(t *testing.T) { { "different denom units", banktypes.Metadata{ - Base: "aatom", - Display: "atom", + Base: "aedgens", + Display: "edgens", Name: "Cosmos EVM", - Symbol: "ATOM", + Symbol: "EDGENS", Description: "EVM, staking and governance denom of Cosmos EVM", DenomUnits: []*banktypes.DenomUnit{ { - Denom: "aatom", + Denom: "aedgens", Exponent: 0, - Aliases: []string{"atto atom"}, + Aliases: []string{"atto edgens"}, }, { - Denom: "uatom", + Denom: "uedgens", Exponent: 12, Aliases: []string{"micro evmos"}, }, { - Denom: "atom", + Denom: "edgens", Exponent: 18, }, }, }, banktypes.Metadata{ - Base: "aatom", - Display: "atom", + Base: "aedgens", + Display: "edgens", Name: "Cosmos EVM", - Symbol: "ATOM", + Symbol: "EDGENS", Description: "EVM, staking and governance denom of Cosmos EVM", DenomUnits: []*banktypes.DenomUnit{ { - Denom: "aatom", + Denom: "aedgens", Exponent: 0, - Aliases: []string{"atto atom"}, + Aliases: []string{"atto edgens"}, }, { - Denom: "Uatom", + Denom: "Uedgens", Exponent: 12, Aliases: []string{"micro evmos"}, }, { - Denom: "atom", + Denom: "edgens", Exponent: 18, }, }, @@ -227,25 +227,25 @@ func TestEqualAliases(t *testing.T) { { "different lengths", []string{}, - []string{"atto atom"}, + []string{"atto edgens"}, false, }, { "different values", []string{"attoevmos"}, - []string{"atto atom"}, + []string{"atto edgens"}, false, }, { "same values, unsorted", - []string{"atto atom", "aatom"}, - []string{"aatom", "atto atom"}, + []string{"atto edgens", "aedgens"}, + []string{"aedgens", "atto edgens"}, false, }, { "same values, sorted", - []string{"aatom", "atto atom"}, - []string{"aatom", "atto atom"}, + []string{"aedgens", "atto edgens"}, + []string{"aedgens", "atto edgens"}, true, }, } diff --git a/x/feemarket/keeper/integration_test.go b/x/feemarket/keeper/integration_test.go index a0dbf9e084..527fefdbf8 100644 --- a/x/feemarket/keeper/integration_test.go +++ b/x/feemarket/keeper/integration_test.go @@ -76,7 +76,7 @@ var _ = Describe("Feemarket", func() { const minGasPrices int64 = 15 BeforeEach(func() { - // local min-gas-prices is 10aatom + // local min-gas-prices is 10aedgens params := fmkttypes.DefaultParams() params.MinGasPrice = math.LegacyNewDec(minGasPrices) params.BaseFee = math.LegacyNewDec(0) @@ -144,7 +144,7 @@ var _ = Describe("Feemarket", func() { // minGasPrices is the feemarket MinGasPrices const minGasPrices int64 = 10 BeforeEach(func() { - // local min-gas-prices is 10aatom + // local min-gas-prices is 10aedgens params := fmkttypes.DefaultParams() params.MinGasPrice = math.LegacyNewDec(minGasPrices) params.BaseFee = math.LegacyNewDec(0) @@ -215,7 +215,7 @@ var _ = Describe("Feemarket", func() { baseFee := math.LegacyNewDec(15) BeforeEach(func() { - // local min-gas-prices is 10aatom + // local min-gas-prices is 10aedgens params := fmkttypes.DefaultParams() params.MinGasPrice = math.LegacyNewDec(minGasPrices) params.BaseFee = baseFee @@ -522,7 +522,7 @@ var _ = Describe("Feemarket", func() { // 200000`. With the fee calculation `Fee = (baseFee + tip) * gasLimit`, // with `minGasPrices = 40_000_000_000` results in `minGlobalFee = // 8000000000000000` - // local min-gas-prices is 10aatom + // local min-gas-prices is 10aedgens params := fmkttypes.DefaultParams() params.MinGasPrice = math.LegacyNewDec(minGasPrices) params.BaseFee = math.LegacyNewDec(baseFee) @@ -616,7 +616,7 @@ var _ = Describe("Feemarket", func() { // 200000`. With the fee calculation `Fee = (baseFee + tip) * gasLimit`, // with `minGasPrices = 40_000_000_000` results in `minGlobalFee = // 8000000000000000` - // local min-gas-prices is 10aatom + // local min-gas-prices is 10aedgens params := fmkttypes.DefaultParams() params.MinGasPrice = math.LegacyNewDec(minGasPrices) params.BaseFee = math.LegacyNewDec(baseFee) diff --git a/x/feemarket/keeper/setup_test.go b/x/feemarket/keeper/setup_test.go index aa0acf6a19..206f221ecb 100644 --- a/x/feemarket/keeper/setup_test.go +++ b/x/feemarket/keeper/setup_test.go @@ -27,7 +27,7 @@ func (suite *KeeperTestSuite) SetupTest() { keyring := testkeyring.New(2) nw := network.NewUnitTestNetwork( network.WithPreFundedAccounts(keyring.GetAllAccAddrs()...), - network.WithCustomBaseAppOpts(baseapp.SetMinGasPrices("10aatom")), + network.WithCustomBaseAppOpts(baseapp.SetMinGasPrices("10aedgens")), ) grpcHandler := grpc.NewIntegrationHandler(nw) txFactory := factory.New(nw, grpcHandler) diff --git a/x/precisebank/README.md b/x/precisebank/README.md index 671234d7ae..de0f3c3670 100644 --- a/x/precisebank/README.md +++ b/x/precisebank/README.md @@ -7,7 +7,7 @@ This document specifies the precisebank module of Cosmos EVM. The precisebank module is responsible for extending the precision of `x/bank`, intended to be used for the `x/evm`. -It serves as a wrapper of `x/bank` to increase the precision of ATOM from 6 to 18 decimals, +It serves as a wrapper of `x/bank` to increase the precision of EDGENS from 6 to 18 decimals, while preserving the behavior of existing `x/bank` balances. This module is used only by `x/evm` where 18 decimal points are expected. @@ -39,32 +39,32 @@ This module is used only by `x/evm` where 18 decimal points are expected. ## Background -The standard unit of currency on the Cosmos Chain is `ATOM`. This is denominated by the atomic unit `uatom`, -which represents $10^{-6}$ `ATOM` and there are $10^6$ `uatom` per `ATOM`. +The standard unit of currency on the Cosmos Chain is `EDGENS`. This is denominated by the atomic unit `uedgens`, +which represents $10^{-6}$ `EDGENS` and there are $10^6$ `uedgens` per `EDGENS`. -In order to support 18 decimals of precision while maintaining `uatom` as the cosmos-native atomic unit, -we further split each `uatom` unit into $10^{12}$ `aatom` units, the native currency of the Cosmos EVM. +In order to support 18 decimals of precision while maintaining `uedgens` as the cosmos-native atomic unit, +we further split each `uedgens` unit into $10^{12}$ `aedgens` units, the native currency of the Cosmos EVM. -This gives a full $10^{18}$ precision on the EVM. In order to avoid confusion with atomic `uatom` units, -we will refer to `aatom` as "sub-atomic units". +This gives a full $10^{18}$ precision on the EVM. In order to avoid confusion with atomic `uedgens` units, +we will refer to `aedgens` as "sub-atomic units". To review we have: - - `uatom`, the cosmos-native unit and atomic unit of the Cosmos chain - - `aatom`, the evm-native unit and sub-atomic unit of the Cosmos chain + - `uedgens`, the cosmos-native unit and atomic unit of the Cosmos chain + - `aedgens`, the evm-native unit and sub-atomic unit of the Cosmos chain -In order to maintain consistency between the `aatom` supply and the `uatom` supply, -we add the constraint that each sub-atomic `aatom`, may only exist as part of an atomic `uatom`. -Every `aatom` is fully backed by a `uatom` in the `x/bank` module. +In order to maintain consistency between the `aedgens` supply and the `uedgens` supply, +we add the constraint that each sub-atomic `aedgens`, may only exist as part of an atomic `uedgens`. +Every `aedgens` is fully backed by a `uedgens` in the `x/bank` module. -This is a requirement since `uatom` balances in `x/bank` are shared between the cosmos modules and the EVM. +This is a requirement since `uedgens` balances in `x/bank` are shared between the cosmos modules and the EVM. We are wrapping and extending the `x/bank` module with the `x/precisebank` module to add an extra $10^{12}$ units -of precision. If $10^{12}$ `aatom` is transferred in the EVM, the cosmos modules will see a 1 `uatom` transfer -and vice versa. If `aatom` was not fully backed by `uatom`, then balance changes would not be fully consistent +of precision. If $10^{12}$ `aedgens` is transferred in the EVM, the cosmos modules will see a 1 `uedgens` transfer +and vice versa. If `aedgens` was not fully backed by `uedgens`, then balance changes would not be fully consistent across the cosmos and the EVM. -This brings us to how account balances are extended to represent `aatom` balances larger than $10^{12}$. -First, we define $a(n)$, $b(n)$, and $C$ where $a(n)$ is the `aatom` balance of account `n`, $b(n)$ is the -`uatom` balance of account `n` stored in the `x/bank` module, and $C$ is the conversion factor equal to $10^{12}$. +This brings us to how account balances are extended to represent `aedgens` balances larger than $10^{12}$. +First, we define $a(n)$, $b(n)$, and $C$ where $a(n)$ is the `aedgens` balance of account `n`, $b(n)$ is the +`uedgens` balance of account `n` stored in the `x/bank` module, and $C$ is the conversion factor equal to $10^{12}$. Any $a(n)$ divisible by $C$, can be represented by $C$ * $b(n)$. Any remainder not divisible by $C$, we define the "fractional balance" as $f(n)$ and store this in the `x/precisebank` store. @@ -88,13 +88,13 @@ $$f(n) = a(n)\bmod{C}$$ With this definition in mind we will refer to $b(n)$ units as integer units, and $f(n)$ as fractional units. Now since $f(n)$ is stored in the `x/precisebank` and not tracked by the `x/bank` keeper, these are not counted -in the `uatom` supply, so if we define +in the `uedgens` supply, so if we define $$T_a \equiv \sum_{n \in \mathcal{A}}{a(n)}$$ $$T_b \equiv \sum_{n \in \mathcal{A}}{b(n)}$$ -where $\mathcal{A}$ is the set of all accounts, $T_a$ is the total `aatom` supply, and $T_b$ is the total `uatom` supply, +where $\mathcal{A}$ is the set of all accounts, $T_a$ is the total `aedgens` supply, and $T_b$ is the total `uedgens` supply, then a reserve account $R$ is added such that $$a(R) = 0$$ @@ -110,13 +110,13 @@ and $$ 0 <= r < C$$ -We see that $0 \le T_b \cdot C - T_a < C$. If we mint, burn, or transfer `aatom` such that this inequality would be +We see that $0 \le T_b \cdot C - T_a < C$. If we mint, burn, or transfer `aedgens` such that this inequality would be invalid after updates to account balances, we adjust the $T_b$ supply by minting or burning to the reserve account -which holds `uatom` equal to that of all `aatom` balances less than `C` plus the remainder. +which holds `uedgens` equal to that of all `aedgens` balances less than `C` plus the remainder. -If we didn't add these constraints, then the total supply of `uatom` reported by the bank keeper would not account -for the `aatom` units. We would incorrectly increase the supply of `aatom` without increasing the reported -total supply of ATOM. +If we didn't add these constraints, then the total supply of `uedgens` reported by the bank keeper would not account +for the `aedgens` units. We would incorrectly increase the supply of `aedgens` without increasing the reported +total supply of EDGENS. ### Adding @@ -126,7 +126,7 @@ $$a'(n) = a(n) + a$$ $$b'(n) \cdot C + f'(n) = b(n) \cdot C + f(n) + a$$ -where $a'(n)$ is the new `aatom` balance after adding `aatom` amount $a$. These +where $a'(n)$ is the new `aedgens` balance after adding `aedgens` amount $a$. These must hold true for all $a$. We can determine the new $b'(n)$ and $f'(n)$ with the following formula. $$f'(n) = f(n) + a \mod{C}$$ @@ -414,7 +414,7 @@ The `x/precisebank` module keeps state of the following: 2. Remainder amount. This amount represents the fractional amount that is backed by the reserve account but not yet in circulation. This can be non-zero if - a fractional amount less than `1uatom` is minted. + a fractional amount less than `1uedgens` is minted. **Note:** Currently, mint and burns are only used to transfer fractional amounts between accounts via `x/evm`. This means mint and burns on mainnet @@ -451,11 +451,11 @@ by other modules as a replacement of the bank module. The `x/precisebank` module emits the following events, that are meant to be match the events emitted by the `x/bank` module. Events emitted by -`x/precisebank` will only contain `aatom` amounts, as the `x/bank` module will +`x/precisebank` will only contain `aedgens` amounts, as the `x/bank` module will emit events with all other denoms. This means if an account transfers multiple -coins including `aatom`, the `x/precisebank` module will emit an event with the -full `aatom` amount. If `uatom` is included in a transfer, mint, or burn, the -`x/precisebank` module will emit an event with the full equivalent `aatom` +coins including `aedgens`, the `x/precisebank` module will emit an event with the +full `aedgens` amount. If `uedgens` is included in a transfer, mint, or burn, the +`x/precisebank` module will emit an event with the full equivalent `aedgens` amount. #### SendCoins @@ -623,7 +623,7 @@ Example Output: ```json { - "total": "2000000000000aatom" + "total": "2000000000000aedgens" } ``` @@ -647,7 +647,7 @@ Example Output: ```json { - "remainder": "100aatom" + "remainder": "100aedgens" } ``` @@ -673,6 +673,6 @@ Example Output: ```json { - "fractional_balance": "10000aatom" + "fractional_balance": "10000aedgens" } ``` diff --git a/x/precisebank/keeper/burn_integration_test.go b/x/precisebank/keeper/burn_integration_test.go index ba589fd0ab..85e0be23a6 100644 --- a/x/precisebank/keeper/burn_integration_test.go +++ b/x/precisebank/keeper/burn_integration_test.go @@ -150,7 +150,7 @@ func (suite *KeeperIntegrationTestSuite) TestBurnCoins() { cs(ci(types.ExtendedCoinDenom(), types.ConversionFactor())), cs(ci(types.ExtendedCoinDenom(), types.ConversionFactor().MulRaw(2))), cs(), - // Returns correct error with aatom balance (rewrites Bank BurnCoins err) + // Returns correct error with aedgens balance (rewrites Bank BurnCoins err) fmt.Sprintf("spendable balance 1000000000000%s is smaller than 2000000000000%s: insufficient funds", types.ExtendedCoinDenom(), types.ExtendedCoinDenom()), }, @@ -190,7 +190,7 @@ func (suite *KeeperIntegrationTestSuite) TestBurnCoins() { // ------------------------------------------------------------- // Check FULL balances // x/bank balances + x/precisebank balance - // Exclude "uatom" as x/precisebank balance will include it + // Exclude "uedgens" as x/precisebank balance will include it afterBalance := suite.GetAllBalances(recipientAddr) suite.Require().Equal( diff --git a/x/precisebank/keeper/integration_test.go b/x/precisebank/keeper/integration_test.go index d858017073..df29a8a2e9 100644 --- a/x/precisebank/keeper/integration_test.go +++ b/x/precisebank/keeper/integration_test.go @@ -247,7 +247,7 @@ func (suite *KeeperIntegrationTestSuite) TestSendEvmTx_RandomValueMultiDecimals( } } -func (suite *KeeperIntegrationTestSuite) TestWATOMWrapUnwrap_MultiDecimal() { +func (suite *KeeperIntegrationTestSuite) TestWEDGENSWrapUnwrap_MultiDecimal() { tests := []struct { name string chainID testconstants.ChainID @@ -273,12 +273,12 @@ func (suite *KeeperIntegrationTestSuite) TestWATOMWrapUnwrap_MultiDecimal() { sender := suite.keyring.GetKey(0) amount := big.NewInt(1) - // Deploy WATOM contract - watomAddr, err := suite.factory.DeployContract( + // Deploy WEDGENS contract + wedgensAddr, err := suite.factory.DeployContract( sender.Priv, evmtypes.EvmTxArgs{}, factory.ContractDeploymentData{ - Contract: contracts.WATOMContract, + Contract: contracts.WEDGENSContract, }, ) suite.Require().NoError(err) @@ -293,14 +293,14 @@ func (suite *KeeperIntegrationTestSuite) TestWATOMWrapUnwrap_MultiDecimal() { _, err = suite.factory.ExecuteContractCall( sender.Priv, evmtypes.EvmTxArgs{ - To: &watomAddr, + To: &wedgensAddr, Amount: amount, GasLimit: 100_000, GasFeeCap: baseFeeRes.BaseFee.BigInt(), GasTipCap: big.NewInt(1), }, factory.CallArgs{ - ContractABI: contracts.WATOMContract.ABI, + ContractABI: contracts.WEDGENSContract.ABI, MethodName: "deposit", }, ) @@ -308,10 +308,10 @@ func (suite *KeeperIntegrationTestSuite) TestWATOMWrapUnwrap_MultiDecimal() { err = suite.network.NextBlock() suite.Require().NoError(err) - // Check WATOM balance == wrapAmount - bal, err := utils.GetERC20Balance(suite.network, watomAddr, sender.Addr) + // Check WEDGENS balance == wrapAmount + bal, err := utils.GetERC20Balance(suite.network, wedgensAddr, sender.Addr) suite.Require().NoError(err) - suite.Require().Equal(amount.Cmp(bal), 0, "WATOM balance should match deposited amount (expected: %s, actual: %s)", amount, bal) + suite.Require().Equal(amount.Cmp(bal), 0, "WEDGENS balance should match deposited amount (expected: %s, actual: %s)", amount, bal) baseFeeRes, err = suite.network.GetEvmClient().BaseFee(suite.network.GetContext(), &evmtypes.QueryBaseFeeRequest{}) suite.Require().NoError(err) @@ -320,13 +320,13 @@ func (suite *KeeperIntegrationTestSuite) TestWATOMWrapUnwrap_MultiDecimal() { _, err = suite.factory.ExecuteContractCall( sender.Priv, evmtypes.EvmTxArgs{ - To: &watomAddr, + To: &wedgensAddr, GasLimit: 100_000, GasFeeCap: baseFeeRes.BaseFee.BigInt(), GasTipCap: big.NewInt(1), }, factory.CallArgs{ - ContractABI: contracts.WATOMContract.ABI, + ContractABI: contracts.WEDGENSContract.ABI, MethodName: "withdraw", Args: []interface{}{amount}, }, @@ -334,10 +334,10 @@ func (suite *KeeperIntegrationTestSuite) TestWATOMWrapUnwrap_MultiDecimal() { suite.Require().NoError(err) suite.Require().NoError(suite.network.NextBlock()) - // Final WATOM balance should be 0 - bal, err = utils.GetERC20Balance(suite.network, watomAddr, sender.Addr) + // Final WEDGENS balance should be 0 + bal, err = utils.GetERC20Balance(suite.network, wedgensAddr, sender.Addr) suite.Require().NoError(err) - suite.Require().Equal("0", bal.String(), "WATOM balance should be zero after withdraw") + suite.Require().Equal("0", bal.String(), "WEDGENS balance should be zero after withdraw") }) } } diff --git a/x/precisebank/keeper/mint_integration_test.go b/x/precisebank/keeper/mint_integration_test.go index 18663bc991..93b25ad8f4 100644 --- a/x/precisebank/keeper/mint_integration_test.go +++ b/x/precisebank/keeper/mint_integration_test.go @@ -289,10 +289,10 @@ func (suite *KeeperIntegrationTestSuite) TestMintCoins() { // ------------------------------------------------------------- // Check FULL balances // x/bank balances + x/precisebank balance - // Exclude "uatom" as x/precisebank balance will include it + // Exclude "uedgens" as x/precisebank balance will include it bankCoins := suite.network.App.BankKeeper.GetAllBalances(suite.network.GetContext(), recipientAddr) - // Only use x/bank balances for non-uatom denoms + // Only use x/bank balances for non-uedgens denoms var denoms []string for _, coin := range bankCoins { // Ignore integer coins, query the extended denom instead @@ -305,7 +305,7 @@ func (suite *KeeperIntegrationTestSuite) TestMintCoins() { // Add the extended denom to the list of denoms to balance check // Will be included in balance check even if x/bank doesn't have - // uatom. + // uedgens. denoms = append(denoms, types.ExtendedCoinDenom()) // All balance queries through x/precisebank diff --git a/x/precisebank/keeper/send_integration_test.go b/x/precisebank/keeper/send_integration_test.go index d7b8313f33..a2333a55a7 100644 --- a/x/precisebank/keeper/send_integration_test.go +++ b/x/precisebank/keeper/send_integration_test.go @@ -172,7 +172,7 @@ func (suite *KeeperIntegrationTestSuite) TestSendCoinsFromModuleToAccount_Matchi "insufficient balance - extended", senderModuleName, sdk.AccAddress([]byte{2}), - // We can still test insufficient bal errors with "aatom" since + // We can still test insufficient bal errors with "aedgens" since // we also expect it to not exist in x/bank cs(c(types.ExtendedCoinDenom(), 1000)), fmt.Sprintf("spendable balance 0%s is smaller than 1000%s: insufficient funds", @@ -248,7 +248,7 @@ func (suite *KeeperIntegrationTestSuite) TestSendCoins_MatchingErrors() { { "insufficient empty balance - extended", cs(), - // We can still test insufficient bal errors with "aatom" since + // We can still test insufficient bal errors with "aedgens" since // we also expect it to not exist in x/bank cs(c(types.ExtendedCoinDenom(), 1000)), fmt.Sprintf("spendable balance 0%s is smaller than 1000%s: insufficient funds", @@ -261,8 +261,8 @@ func (suite *KeeperIntegrationTestSuite) TestSendCoins_MatchingErrors() { fmt.Sprintf("spendable balance 100%s is smaller than 1000%s: insufficient funds", types.IntegerCoinDenom(), types.IntegerCoinDenom()), }, - // non-empty aatom transfer error is tested in SendCoins, not here since - // x/bank doesn't hold aatom + // non-empty aedgens transfer error is tested in SendCoins, not here since + // x/bank doesn't hold aedgens } for _, tt := range tests { @@ -334,17 +334,17 @@ func (suite *KeeperIntegrationTestSuite) TestSendCoins() { "", }, { - "aatom send - 1aatom to 0 balance", + "aedgens send - 1aedgens to 0 balance", // Starting balances cs(ci(types.ExtendedCoinDenom(), types.ConversionFactor().MulRaw(5))), cs(), // Send amount - cs(c(types.ExtendedCoinDenom(), 1)), // aatom + cs(c(types.ExtendedCoinDenom(), 1)), // aedgens "", }, { "sender borrow from integer", - // 1uatom, 0 fractional + // 1uedgens, 0 fractional cs(ci(types.ExtendedCoinDenom(), types.ConversionFactor())), cs(), // Send 1 with 0 fractional balance @@ -353,7 +353,7 @@ func (suite *KeeperIntegrationTestSuite) TestSendCoins() { }, { "sender borrow from integer - max fractional amount", - // 1uatom, 0 fractional + // 1uedgens, 0 fractional cs(ci(types.ExtendedCoinDenom(), types.ConversionFactor())), cs(), // Max fractional amount @@ -406,7 +406,7 @@ func (suite *KeeperIntegrationTestSuite) TestSendCoins() { recipientBalAfter := suite.GetAllBalances(recipient) // Convert send amount coins to extended coins. i.e. if send coins - // includes uatom, convert it so that its the equivalent aatom + // includes uedgens, convert it so that its the equivalent aedgens // amount so its easier to compare. Compare extended coins only. sendAmountFullExtended := tt.giveAmt sendAmountInteger := tt.giveAmt.AmountOf(types.IntegerCoinDenom()) @@ -432,14 +432,14 @@ func (suite *KeeperIntegrationTestSuite) TestSendCoins() { // Check events - // FULL aatom equivalent, including uatom only/mixed sends + // FULL aedgens equivalent, including uedgens only/mixed sends sendExtendedAmount := sdk.NewCoin( types.ExtendedCoinDenom(), sendAmountFullExtended.AmountOf(types.ExtendedCoinDenom()), ) extCoins := sdk.NewCoins(sendExtendedAmount) - // No extra events if not sending aatom + // No extra events if not sending aedgens if sendExtendedAmount.IsZero() { return } @@ -565,7 +565,7 @@ func (suite *KeeperIntegrationTestSuite) TestSendCoins_Matrix() { recipientBalAfter := suite.GetAllBalances(recipient) // Convert send amount coins to extended coins. i.e. if send coins - // includes uatom, convert it so that its the equivalent aatom + // includes uedgens, convert it so that its the equivalent aedgens // amount so its easier to compare. Compare extended coins only. suite.Require().Equal( diff --git a/x/precisebank/keeper/util_test.go b/x/precisebank/keeper/util_test.go index e9b4e9f739..667a104eb9 100644 --- a/x/precisebank/keeper/util_test.go +++ b/x/precisebank/keeper/util_test.go @@ -8,7 +8,7 @@ import ( ) // MintToAccount mints coins to an account with the x/precisebank methods. This -// must be used when minting extended coins, ie. aatom coins. This depends on +// must be used when minting extended coins, ie. aedgens coins. This depends on // the methods to be properly tested to be implemented correctly. func (suite *KeeperIntegrationTestSuite) MintToAccount(addr sdk.AccAddress, amt sdk.Coins) { accBalancesBefore := suite.GetAllBalances(addr) @@ -29,7 +29,7 @@ func (suite *KeeperIntegrationTestSuite) MintToAccount(addr sdk.AccAddress, amt } // MintToModuleAccount mints coins to an account with the x/precisebank methods. This -// must be used when minting extended coins, ie. aatom coins. This depends on +// must be used when minting extended coins, ie. aedgens coins. This depends on // the methods to be properly tested to be implemented correctly. func (suite *KeeperIntegrationTestSuite) MintToModuleAccount(moduleName string, amt sdk.Coins) { moduleAddr := suite.network.App.AccountKeeper.GetModuleAddress(moduleName) diff --git a/x/precisebank/keeper/view_integration_test.go b/x/precisebank/keeper/view_integration_test.go index 2579f514fc..2cdc47e7ae 100644 --- a/x/precisebank/keeper/view_integration_test.go +++ b/x/precisebank/keeper/view_integration_test.go @@ -24,7 +24,7 @@ func (suite *KeeperIntegrationTestSuite) TestKeeper_SpendableCoin() { { "extended denom, no fractional - locked coins", types.ExtendedCoinDenom(), - // queried bank balance in uatom when querying for aatom + // queried bank balance in uedgens when querying for aedgens sdk.NewCoins(sdk.NewCoin(types.IntegerCoinDenom(), sdkmath.NewInt(1000))), sdkmath.ZeroInt(), sdk.NewCoins(sdk.NewCoin(types.IntegerCoinDenom(), sdkmath.NewInt(10))), @@ -37,7 +37,7 @@ func (suite *KeeperIntegrationTestSuite) TestKeeper_SpendableCoin() { { "extended denom, with fractional - locked coins", types.ExtendedCoinDenom(), - // queried bank balance in uatom when querying for aatom + // queried bank balance in uedgens when querying for aedgens sdk.NewCoins(sdk.NewCoin(types.IntegerCoinDenom(), sdkmath.NewInt(1000))), sdkmath.NewInt(5000), sdk.NewCoins(sdk.NewCoin(types.IntegerCoinDenom(), sdkmath.NewInt(10))), @@ -48,7 +48,7 @@ func (suite *KeeperIntegrationTestSuite) TestKeeper_SpendableCoin() { ), }, { - "non-extended denom - uatom returns uatom", + "non-extended denom - uedgens returns uedgens", types.IntegerCoinDenom(), sdk.NewCoins(sdk.NewCoin(types.IntegerCoinDenom(), sdkmath.NewInt(1000))), sdkmath.ZeroInt(), @@ -56,7 +56,7 @@ func (suite *KeeperIntegrationTestSuite) TestKeeper_SpendableCoin() { sdk.NewCoin(types.IntegerCoinDenom(), sdkmath.NewInt(990)), }, { - "non-extended denom, with fractional - uatom returns uatom", + "non-extended denom, with fractional - uedgens returns uedgens", types.IntegerCoinDenom(), sdk.NewCoins(sdk.NewCoin(types.IntegerCoinDenom(), sdkmath.NewInt(1000))), // does not affect balance diff --git a/x/precisebank/keeper/view_test.go b/x/precisebank/keeper/view_test.go index 6172a80dc2..13251c6c3e 100644 --- a/x/precisebank/keeper/view_test.go +++ b/x/precisebank/keeper/view_test.go @@ -29,7 +29,7 @@ func TestKeeper_GetBalance(t *testing.T) { { "extended denom - no fractional balance", types.ExtendedCoinDenom(), - // queried bank balance in uatom when querying for aatom + // queried bank balance in uedgens when querying for aedgens sdk.NewCoins(sdk.NewCoin(types.IntegerCoinDenom(), sdkmath.NewInt(1000))), sdkmath.ZeroInt(), // integer + fractional @@ -60,7 +60,7 @@ func TestKeeper_GetBalance(t *testing.T) { sdk.NewCoin(types.ExtendedCoinDenom(), sdkmath.NewInt(1000_999_999_999_999)), }, { - "non-extended denom - uatom returns uatom", + "non-extended denom - uedgens returns uedgens", types.IntegerCoinDenom(), sdk.NewCoins(sdk.NewCoin(types.IntegerCoinDenom(), sdkmath.NewInt(1000))), sdkmath.ZeroInt(), @@ -143,7 +143,7 @@ func TestKeeper_SpendableCoin(t *testing.T) { { "extended denom - no fractional balance", types.ExtendedCoinDenom(), - // queried bank balance in uatom when querying for aatom + // queried bank balance in uedgens when querying for aedgens sdk.NewCoins(sdk.NewCoin(types.IntegerCoinDenom(), sdkmath.NewInt(1000))), sdkmath.ZeroInt(), // integer + fractional @@ -174,7 +174,7 @@ func TestKeeper_SpendableCoin(t *testing.T) { sdk.NewCoin(types.ExtendedCoinDenom(), sdkmath.NewInt(1000_999_999_999_999)), }, { - "non-extended denom - uatom returns uatom", + "non-extended denom - uedgens returns uedgens", types.IntegerCoinDenom(), sdk.NewCoins(sdk.NewCoin(types.IntegerCoinDenom(), sdkmath.NewInt(1000))), sdkmath.ZeroInt(), @@ -263,12 +263,12 @@ func TestHiddenReserve(t *testing.T) { expectedBalance sdk.Coin }{ { - "aatom", + "aedgens", types.ExtendedCoinDenom(), sdk.NewCoin(types.ExtendedCoinDenom(), sdkmath.ZeroInt()), }, { - "uatom", + "uedgens", types.IntegerCoinDenom(), sdk.NewCoin(types.IntegerCoinDenom(), sdkmath.NewInt(1)), }, diff --git a/x/precisebank/types/extended_balance.go b/x/precisebank/types/extended_balance.go index 50825f1030..d4625e8010 100644 --- a/x/precisebank/types/extended_balance.go +++ b/x/precisebank/types/extended_balance.go @@ -10,12 +10,12 @@ import ( // amount in extended coins. This is intended to get the full value to emit in // events. func SumExtendedCoin(amt sdk.Coins) sdk.Coin { - // uatom converted to aatom + // uedgens converted to aedgens integerAmount := amt.AmountOf(IntegerCoinDenom()).Mul(ConversionFactor()) - // aatom as is + // aedgens as is extendedAmount := amt.AmountOf(ExtendedCoinDenom()) - // total of uatom and aatom amounts + // total of uedgens and aedgens amounts fullEmissionAmount := integerAmount.Add(extendedAmount) return sdk.NewCoin( diff --git a/x/precisebank/types/genesis.pb.go b/x/precisebank/types/genesis.pb.go index ef2ce69539..187f678704 100644 --- a/x/precisebank/types/genesis.pb.go +++ b/x/precisebank/types/genesis.pb.go @@ -80,7 +80,7 @@ type FractionalBalance struct { Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` // amount indicates amount of only the fractional balance owned by the // address. FractionalBalance currently only supports tracking 1 single asset, - // e.g. fractional balances of uatom. + // e.g. fractional balances of uedgens. Amount cosmossdk_io_math.Int `protobuf:"bytes,2,opt,name=amount,proto3,customtype=cosmossdk.io/math.Int" json:"amount"` } diff --git a/x/vm/genesis_test.go b/x/vm/genesis_test.go index 5d1ddb8d62..7d31562f3b 100644 --- a/x/vm/genesis_test.go +++ b/x/vm/genesis_test.go @@ -237,7 +237,7 @@ func TestExportGenesis(t *testing.T) { require.NoError(t, ts.network.NextBlock(), "failed to advance block") genState := vm.ExportGenesis(ts.network.GetContext(), ts.network.App.EVMKeeper) - require.Len(t, genState.Accounts, 3, "expected 3 smart contracts in the exported genesis") // NOTE: 2 deployed above + 1 for the aatom denomination ERC-20 pair + require.Len(t, genState.Accounts, 3, "expected 3 smart contracts in the exported genesis") // NOTE: 2 deployed above + 1 for the aedgens denomination ERC-20 pair genAddresses := make([]string, 0, len(genState.Accounts)) for _, acc := range genState.Accounts { @@ -245,5 +245,5 @@ func TestExportGenesis(t *testing.T) { } require.Contains(t, genAddresses, contractAddr.Hex(), "expected contract 1 address in exported genesis") require.Contains(t, genAddresses, contractAddr2.Hex(), "expected contract 2 address in exported genesis") - require.Contains(t, genAddresses, testconstants.WEVMOSContractMainnet, "expected mainnet aatom contract address in exported genesis") + require.Contains(t, genAddresses, testconstants.WEVMOSContractMainnet, "expected mainnet aedgens contract address in exported genesis") } diff --git a/x/vm/keeper/integration_test.go b/x/vm/keeper/integration_test.go index d70dd1ad6b..1738184c87 100644 --- a/x/vm/keeper/integration_test.go +++ b/x/vm/keeper/integration_test.go @@ -34,8 +34,8 @@ type IntegrationTestSuite struct { keyring testkeyring.Keyring } -// This test suite is meant to test the EVM module in the context of the ATOM. -// It uses the integration test framework to spin up a local ATOM network and +// This test suite is meant to test the EVM module in the context of the EDGENS. +// It uses the integration test framework to spin up a local EDGENS network and // perform transactions on it. // The test suite focus on testing how the MsgEthereumTx message is handled under the // different params configuration of the module while testing the different Tx types diff --git a/x/vm/keeper/state_transition_test.go b/x/vm/keeper/state_transition_test.go index 0779086d84..beb4affaa9 100644 --- a/x/vm/keeper/state_transition_test.go +++ b/x/vm/keeper/state_transition_test.go @@ -569,9 +569,9 @@ func (suite *KeeperTestSuite) TestApplyTransaction() { suite.SetupTest() // set bounded cosmos block gas limit ctx := suite.network.GetContext().WithBlockGasMeter(storetypes.NewGasMeter(1e6)) - err := suite.network.App.BankKeeper.MintCoins(ctx, "mint", sdk.NewCoins(sdk.NewCoin("aatom", sdkmath.NewInt(3e18)))) + err := suite.network.App.BankKeeper.MintCoins(ctx, "mint", sdk.NewCoins(sdk.NewCoin("aedgens", sdkmath.NewInt(3e18)))) suite.Require().NoError(err) - err = suite.network.App.BankKeeper.SendCoinsFromModuleToModule(ctx, "mint", "fee_collector", sdk.NewCoins(sdk.NewCoin("aatom", sdkmath.NewInt(3e18)))) + err = suite.network.App.BankKeeper.SendCoinsFromModuleToModule(ctx, "mint", "fee_collector", sdk.NewCoins(sdk.NewCoin("aedgens", sdkmath.NewInt(3e18)))) suite.Require().NoError(err) testCases := []struct { name string @@ -593,7 +593,7 @@ func (suite *KeeperTestSuite) TestApplyTransaction() { GasLimit: tc.gasLimit, }) suite.Require().NoError(err) - initialBalance := suite.network.App.BankKeeper.GetBalance(ctx, suite.keyring.GetAccAddr(0), "aatom") + initialBalance := suite.network.App.BankKeeper.GetBalance(ctx, suite.keyring.GetAccAddr(0), "aedgens") ethTx := tx.GetMsgs()[0].(*types.MsgEthereumTx).AsTransaction() res, err := suite.network.App.EVMKeeper.ApplyTransaction(ctx, ethTx) @@ -602,7 +602,7 @@ func (suite *KeeperTestSuite) TestApplyTransaction() { // Half of the gas should be refunded based on the protocol refund cap. // Note that the balance should only increment by the refunded amount // because ApplyTransaction does not consume and take the gas from the user. - balanceAfterRefund := suite.network.App.BankKeeper.GetBalance(ctx, suite.keyring.GetAccAddr(0), "aatom") + balanceAfterRefund := suite.network.App.BankKeeper.GetBalance(ctx, suite.keyring.GetAccAddr(0), "aedgens") expectedRefund := new(big.Int).Mul(new(big.Int).SetUint64(6e6/2), suite.network.App.EVMKeeper.GetBaseFee(ctx)) suite.Require().Equal(balanceAfterRefund.Sub(initialBalance).Amount, sdkmath.NewIntFromBigInt(expectedRefund)) }) diff --git a/x/vm/keeper/statedb_test.go b/x/vm/keeper/statedb_test.go index dbb48e45af..e09bc2e46a 100644 --- a/x/vm/keeper/statedb_test.go +++ b/x/vm/keeper/statedb_test.go @@ -397,7 +397,7 @@ func TestIterateContracts(t *testing.T) { ) network.App.EVMKeeper.IterateContracts(network.GetContext(), func(addr common.Address, codeHash common.Hash) bool { - // NOTE: we only care about the 2 contracts deployed above, not the ERC20 native precompile for the aatom denomination + // NOTE: we only care about the 2 contracts deployed above, not the ERC20 native precompile for the aedgens denomination if bytes.Equal(addr.Bytes(), common.HexToAddress(testconstants.WEVMOSContractMainnet).Bytes()) { return false } diff --git a/x/vm/types/chain_config.go b/x/vm/types/chain_config.go index 5720d80af8..9f683ee319 100644 --- a/x/vm/types/chain_config.go +++ b/x/vm/types/chain_config.go @@ -11,7 +11,7 @@ import ( ) // testChainID represents the ChainID used for the purpose of testing. -const testChainID uint64 = 262144 +const testChainID uint64 = 4207 // chainConfig is the chain configuration used in the EVM to defined which // opcodes are active based on Ethereum upgrades. diff --git a/x/vm/types/opcodes_hooks.go b/x/vm/types/opcodes_hooks.go index ba3add7346..7d79a6d83a 100644 --- a/x/vm/types/opcodes_hooks.go +++ b/x/vm/types/opcodes_hooks.go @@ -13,7 +13,7 @@ type OpCodeHooks interface { AddCreateHooks(hooks ...CreateHook) } -// DefaultOpCodesHooks is the default implementation of OpCodeHooks for ATOM chain +// DefaultOpCodesHooks is the default implementation of OpCodeHooks for EDGENS chain // The hooks are used to enforce access control policies on EVM operations. // They are ran BEFORE the respective opcode execution every time they are called. type DefaultOpCodesHooks struct { diff --git a/x/vm/types/params.go b/x/vm/types/params.go index 8cd10b4a55..dfce4b52f9 100644 --- a/x/vm/types/params.go +++ b/x/vm/types/params.go @@ -18,7 +18,7 @@ import ( var ( // DefaultEVMDenom is the default value for the evm denom - DefaultEVMDenom = "atest" + DefaultEVMDenom = "aedgen" // DefaultEVMChainID is the default value for the evm chain ID DefaultEVMChainID = "cosmos_262144-1" // DefaultEVMDecimals is the default value for the evm denom decimal precision diff --git a/x/vm/types/scaling_test.go b/x/vm/types/scaling_test.go index 421914fe1e..eb334e4967 100644 --- a/x/vm/types/scaling_test.go +++ b/x/vm/types/scaling_test.go @@ -68,7 +68,7 @@ func TestConvertEvmCoinFrom18Decimals(t *testing.T) { { name: "fail - not evm denom", evmCoinInfo: sixDecimalsCoinInfo, - coin: sdk.Coin{Denom: "atom", Amount: math.NewInt(1)}, + coin: sdk.Coin{Denom: "edgens", Amount: math.NewInt(1)}, expErr: true, }, }