diff --git a/app/ante/ante_test.go b/app/ante/ante_test.go index 125ebf14..d4ce8a61 100644 --- a/app/ante/ante_test.go +++ b/app/ante/ante_test.go @@ -68,7 +68,7 @@ func TestAppAnteHandler_AuthorizedMempool(t *testing.T) { chainID, app.NewFundedGenStateWithSameCoins( tApp.AppCodec(), - sdk.NewCoins(sdk.NewInt64Coin(chaincfg.DisplayDenom, 1e9)), + sdk.NewCoins(sdk.NewInt64Coin("ua0gi", 1e9)), testAddresses, ), newBep3GenStateMulti(tApp.AppCodec(), deputy), @@ -116,7 +116,7 @@ func TestAppAnteHandler_AuthorizedMempool(t *testing.T) { banktypes.NewMsgSend( tc.address, testAddresses[0], - sdk.NewCoins(sdk.NewInt64Coin(chaincfg.DisplayDenom, 1_000_000)), + sdk.NewCoins(sdk.NewInt64Coin("ua0gi", 1_000_000)), ), }, sdk.NewCoins(), // no fee diff --git a/app/ante/authorized_test.go b/app/ante/authorized_test.go index d7506439..e2c4cdf2 100644 --- a/app/ante/authorized_test.go +++ b/app/ante/authorized_test.go @@ -12,7 +12,6 @@ import ( "github.com/0glabs/0g-chain/app" "github.com/0glabs/0g-chain/app/ante" - "github.com/0glabs/0g-chain/chaincfg" ) var _ sdk.AnteHandler = (&MockAnteHandler{}).AnteHandle @@ -46,7 +45,7 @@ func TestAuthenticatedMempoolDecorator_AnteHandle_NotCheckTx(t *testing.T) { banktypes.NewMsgSend( testAddresses[0], testAddresses[1], - sdk.NewCoins(sdk.NewInt64Coin(chaincfg.DisplayDenom, 100_000_000)), + sdk.NewCoins(sdk.NewInt64Coin("ua0gi", 100_000_000)), ), }, sdk.NewCoins(), // no fee @@ -81,12 +80,12 @@ func TestAuthenticatedMempoolDecorator_AnteHandle_Pass(t *testing.T) { banktypes.NewMsgSend( testAddresses[0], testAddresses[1], - sdk.NewCoins(sdk.NewInt64Coin(chaincfg.DisplayDenom, 100)), + sdk.NewCoins(sdk.NewInt64Coin("ua0gi", 100)), ), banktypes.NewMsgSend( testAddresses[2], testAddresses[1], - sdk.NewCoins(sdk.NewInt64Coin(chaincfg.DisplayDenom, 100)), + sdk.NewCoins(sdk.NewInt64Coin("ua0gi", 100)), ), }, sdk.NewCoins(), // no fee @@ -122,7 +121,7 @@ func TestAuthenticatedMempoolDecorator_AnteHandle_Reject(t *testing.T) { banktypes.NewMsgSend( testAddresses[0], testAddresses[1], - sdk.NewCoins(sdk.NewInt64Coin(chaincfg.DisplayDenom, 100)), + sdk.NewCoins(sdk.NewInt64Coin("ua0gi", 100)), ), }, sdk.NewCoins(), // no fee diff --git a/tests/e2e/e2e_evm_contracts_test.go b/tests/e2e/e2e_evm_contracts_test.go index 88c9c292..b6215291 100644 --- a/tests/e2e/e2e_evm_contracts_test.go +++ b/tests/e2e/e2e_evm_contracts_test.go @@ -11,7 +11,6 @@ import ( banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" "github.com/0glabs/0g-chain/app" - "github.com/0glabs/0g-chain/chaincfg" "github.com/0glabs/0g-chain/tests/e2e/contracts/greeter" "github.com/0glabs/0g-chain/tests/util" @@ -99,7 +98,7 @@ func (suite *IntegrationTestSuite) TestEip712BasicMessageAuthorization() { // check that the message was processed & the a0gi is transferred. balRes, err := suite.ZgChain.Bank.Balance(context.Background(), &banktypes.QueryBalanceRequest{ Address: receiver.String(), - Denom: chaincfg.DisplayDenom, + Denom: "ua0gi", }) suite.NoError(err) suite.Equal(sdk.NewInt(1e3), balRes.Balance.Amount) diff --git a/tests/e2e/e2e_min_fees_test.go b/tests/e2e/e2e_min_fees_test.go index 5a024182..8516f2ba 100644 --- a/tests/e2e/e2e_min_fees_test.go +++ b/tests/e2e/e2e_min_fees_test.go @@ -13,7 +13,6 @@ import ( ethtypes "github.com/ethereum/go-ethereum/core/types" "github.com/0glabs/0g-chain/app" - "github.com/0glabs/0g-chain/chaincfg" "github.com/0glabs/0g-chain/tests/util" ) @@ -25,7 +24,7 @@ func (suite *IntegrationTestSuite) TestEthGasPriceReturnsMinFee() { suite.NoError(err) // evm uses neuron, get neuron min fee - evmMinGas := minGasPrices.AmountOf(chaincfg.BaseDenom).TruncateInt().BigInt() + evmMinGas := minGasPrices.AmountOf("neuron").TruncateInt().BigInt() // returns eth_gasPrice, units in a0gi gasPrice, err := suite.ZgChain.EvmClient.SuggestGasPrice(context.Background()) @@ -44,7 +43,7 @@ func (suite *IntegrationTestSuite) TestEvmRespectsMinFee() { // get min gas price for evm (from app.toml) minFees, err := getMinFeeFromAppToml(util.ZgChainHomePath()) suite.NoError(err) - minGasPrice := minFees.AmountOf(chaincfg.BaseDenom).TruncateInt() + minGasPrice := minFees.AmountOf("neuron").TruncateInt() // attempt tx with less than min gas price (min fee - 1) tooLowGasPrice := minGasPrice.Sub(sdk.OneInt()).BigInt() diff --git a/tests/e2e/e2e_test.go b/tests/e2e/e2e_test.go index b4ae0cc9..d6a862be 100644 --- a/tests/e2e/e2e_test.go +++ b/tests/e2e/e2e_test.go @@ -19,7 +19,6 @@ import ( emtypes "github.com/evmos/ethermint/types" "github.com/0glabs/0g-chain/app" - "github.com/0glabs/0g-chain/chaincfg" "github.com/0glabs/0g-chain/tests/e2e/testutil" "github.com/0glabs/0g-chain/tests/util" ) @@ -29,7 +28,7 @@ var ( ) func a0gi(amt *big.Int) sdk.Coin { - return sdk.NewCoin(chaincfg.DisplayDenom, sdkmath.NewIntFromBigInt(amt)) + return sdk.NewCoin("ua0gi", sdkmath.NewIntFromBigInt(amt)) } type IntegrationTestSuite struct { @@ -67,7 +66,7 @@ func (suite *IntegrationTestSuite) TestFundedAccount() { // check balance via SDK query res, err := suite.ZgChain.Bank.Balance(context.Background(), banktypes.NewQueryBalanceRequest( - acc.SdkAddress, chaincfg.DisplayDenom, + acc.SdkAddress, "ua0gi", )) suite.NoError(err) suite.Equal(funds, *res.Balance) @@ -110,7 +109,7 @@ func (suite *IntegrationTestSuite) TestTransferOverEVM() { // expect (9 - gas used) A0GI remaining in account. balance := suite.ZgChain.QuerySdkForBalances(acc.SdkAddress) - suite.Equal(sdkmath.NewInt(9e5).Sub(a0giUsedForGas), balance.AmountOf(chaincfg.DisplayDenom)) + suite.Equal(sdkmath.NewInt(9e5).Sub(a0giUsedForGas), balance.AmountOf("ua0gi")) } // TestIbcTransfer transfers A0GI from the primary 0g-chain (suite.ZgChain) to the ibc chain (suite.Ibc). @@ -158,7 +157,7 @@ func (suite *IntegrationTestSuite) TestIbcTransfer() { // the balance should be deducted from 0g-chain account suite.Eventually(func() bool { balance := suite.ZgChain.QuerySdkForBalances(zgChainAcc.SdkAddress) - return balance.AmountOf(chaincfg.DisplayDenom).Equal(expectedSrcBalance.Amount) + return balance.AmountOf("ua0gi").Equal(expectedSrcBalance.Amount) }, 10*time.Second, 1*time.Second) // expect the balance to be transferred to the ibc chain! diff --git a/tests/e2e/runner/chain.go b/tests/e2e/runner/chain.go index 957636e0..bbedec03 100644 --- a/tests/e2e/runner/chain.go +++ b/tests/e2e/runner/chain.go @@ -4,7 +4,6 @@ import ( "errors" "fmt" - "github.com/0glabs/0g-chain/chaincfg" rpchttpclient "github.com/cometbft/cometbft/rpc/client/http" "github.com/ethereum/go-ethereum/ethclient" ) @@ -74,7 +73,7 @@ var ( EvmRpcUrl: "http://localhost:8545", ChainId: "0gchainlocalnet_8888-1", - StakingDenom: chaincfg.DisplayDenom, + StakingDenom: "ua0gi", } kvtoolIbcChain = ChainDetails{ RpcUrl: "http://localhost:26658", diff --git a/x/evmutil/keeper/invariants_test.go b/x/evmutil/keeper/invariants_test.go index c51cf87b..756c456f 100644 --- a/x/evmutil/keeper/invariants_test.go +++ b/x/evmutil/keeper/invariants_test.go @@ -12,7 +12,6 @@ import ( "github.com/stretchr/testify/suite" "github.com/0glabs/0g-chain/app" - "github.com/0glabs/0g-chain/chaincfg" "github.com/0glabs/0g-chain/x/evmutil/keeper" "github.com/0glabs/0g-chain/x/evmutil/testutil" "github.com/0glabs/0g-chain/x/evmutil/types" diff --git a/x/evmutil/testutil/suite.go b/x/evmutil/testutil/suite.go index 2ce20be8..52dd5e00 100644 --- a/x/evmutil/testutil/suite.go +++ b/x/evmutil/testutil/suite.go @@ -37,7 +37,6 @@ import ( "github.com/stretchr/testify/suite" "github.com/0glabs/0g-chain/app" - "github.com/0glabs/0g-chain/chaincfg" "github.com/0glabs/0g-chain/x/evmutil/keeper" "github.com/0glabs/0g-chain/x/evmutil/types" ) @@ -80,7 +79,7 @@ func (suite *Suite) SetupTest() { suite.Addrs = addrs evmGenesis := evmtypes.DefaultGenesisState() - evmGenesis.Params.EvmDenom = chaincfg.EvmDenom + evmGenesis.Params.EvmDenom = keeper.EvmDenom feemarketGenesis := feemarkettypes.DefaultGenesisState() feemarketGenesis.Params.EnableHeight = 1