rename denoms

This commit is contained in:
Solovyov1796 2024-05-10 14:31:49 +08:00 committed by 0g-wh
parent 85059d734e
commit 56d337df16
38 changed files with 202 additions and 202 deletions

View File

@ -78,7 +78,7 @@ print-machine-info:
BUILD_DIR := build# build files BUILD_DIR := build# build files
BIN_DIR := $(BUILD_DIR)/bin# for binary dev dependencies BIN_DIR := $(BUILD_DIR)/bin# for binary dev dependencies
BUILD_CACHE_DIR := $(BUILD_DIR)/.cache# caching for non-artifact outputs BUILD_CACHE_DIR := $(BUILD_DIR)/.cache# caching for non-artifact outputs
OUT_DIR := out# for artifact intermediates and outputs OUT_DIR := ./.build# for artifact intermediates and outputs
ROOT_DIR := $(patsubst %/,%,$(dir $(abspath $(lastword $(MAKEFILE_LIST)))))# absolute path to root ROOT_DIR := $(patsubst %/,%,$(dir $(abspath $(lastword $(MAKEFILE_LIST)))))# absolute path to root
export PATH := $(ROOT_DIR)/$(BIN_DIR):$(PATH)# add local bin first in path export PATH := $(ROOT_DIR)/$(BIN_DIR):$(PATH)# add local bin first in path

View File

@ -62,11 +62,11 @@ func (suite *SimulateRequestTestSuite) TestSimulateRequest() {
bank.MsgSend{ bank.MsgSend{
FromAddress: fromAddr, FromAddress: fromAddr,
ToAddress: toAddr, ToAddress: toAddr,
Amount: sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(1e6)), Amount: sdk.NewCoins(chaincfg.MakeCoinForGasDenom(1e6)),
}, },
}, },
Fee: auth.StdFee{ Fee: auth.StdFee{
Amount: sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(5e4)), Amount: sdk.NewCoins(chaincfg.MakeCoinForGasDenom(5e4)),
Gas: 1e6, Gas: 1e6,
}, },
Memo: "test memo", Memo: "test memo",

View File

@ -68,7 +68,7 @@ func TestAppAnteHandler_AuthorizedMempool(t *testing.T) {
chainID, chainID,
app.NewFundedGenStateWithSameCoins( app.NewFundedGenStateWithSameCoins(
tApp.AppCodec(), tApp.AppCodec(),
sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(1e9)), sdk.NewCoins(chaincfg.MakeCoinForGasDenom(1e9)),
testAddresses, testAddresses,
), ),
newBep3GenStateMulti(tApp.AppCodec(), deputy), newBep3GenStateMulti(tApp.AppCodec(), deputy),
@ -116,7 +116,7 @@ func TestAppAnteHandler_AuthorizedMempool(t *testing.T) {
banktypes.NewMsgSend( banktypes.NewMsgSend(
tc.address, tc.address,
testAddresses[0], testAddresses[0],
sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(1_000_000)), sdk.NewCoins(chaincfg.MakeCoinForGasDenom(1_000_000)),
), ),
}, },
sdk.NewCoins(), // no fee sdk.NewCoins(), // no fee

View File

@ -46,7 +46,7 @@ func TestAuthenticatedMempoolDecorator_AnteHandle_NotCheckTx(t *testing.T) {
banktypes.NewMsgSend( banktypes.NewMsgSend(
testAddresses[0], testAddresses[0],
testAddresses[1], testAddresses[1],
sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(100_000_000)), sdk.NewCoins(chaincfg.MakeCoinForGasDenom(100_000_000)),
), ),
}, },
sdk.NewCoins(), // no fee sdk.NewCoins(), // no fee
@ -81,12 +81,12 @@ func TestAuthenticatedMempoolDecorator_AnteHandle_Pass(t *testing.T) {
banktypes.NewMsgSend( banktypes.NewMsgSend(
testAddresses[0], testAddresses[0],
testAddresses[1], testAddresses[1],
sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(100)), sdk.NewCoins(chaincfg.MakeCoinForGasDenom(100)),
), ),
banktypes.NewMsgSend( banktypes.NewMsgSend(
testAddresses[2], testAddresses[2],
testAddresses[1], testAddresses[1],
sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(100)), sdk.NewCoins(chaincfg.MakeCoinForGasDenom(100)),
), ),
}, },
sdk.NewCoins(), // no fee sdk.NewCoins(), // no fee
@ -122,7 +122,7 @@ func TestAuthenticatedMempoolDecorator_AnteHandle_Reject(t *testing.T) {
banktypes.NewMsgSend( banktypes.NewMsgSend(
testAddresses[0], testAddresses[0],
testAddresses[1], testAddresses[1],
sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(100)), sdk.NewCoins(chaincfg.MakeCoinForGasDenom(100)),
), ),
}, },
sdk.NewCoins(), // no fee sdk.NewCoins(), // no fee

View File

@ -59,7 +59,7 @@ func TestAuthzLimiterDecorator(t *testing.T) {
banktypes.NewMsgSend( banktypes.NewMsgSend(
testAddresses[0], testAddresses[0],
testAddresses[1], testAddresses[1],
sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(100e6)), sdk.NewCoins(chaincfg.MakeCoinForGasDenom(100e6)),
), ),
}, },
checkTx: false, checkTx: false,
@ -129,7 +129,7 @@ func TestAuthzLimiterDecorator(t *testing.T) {
[]sdk.Msg{banktypes.NewMsgSend( []sdk.Msg{banktypes.NewMsgSend(
testAddresses[0], testAddresses[0],
testAddresses[3], testAddresses[3],
sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(100e6)), sdk.NewCoins(chaincfg.MakeCoinForGasDenom(100e6)),
)}), )}),
}, },
checkTx: false, checkTx: false,
@ -162,7 +162,7 @@ func TestAuthzLimiterDecorator(t *testing.T) {
banktypes.NewMsgSend( banktypes.NewMsgSend(
testAddresses[0], testAddresses[0],
testAddresses[3], testAddresses[3],
sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(100e6)), sdk.NewCoins(chaincfg.MakeCoinForGasDenom(100e6)),
), ),
&evmtypes.MsgEthereumTx{}, &evmtypes.MsgEthereumTx{},
}, },

View File

@ -157,7 +157,7 @@ func (suite *EIP712TestSuite) SetupTest() {
// Genesis states // Genesis states
evmGs := evmtypes.NewGenesisState( evmGs := evmtypes.NewGenesisState(
evmtypes.NewParams( evmtypes.NewParams(
chaincfg.BaseDenom, // evmDenom chaincfg.EvmDenom, // evmDenom
false, // allowedUnprotectedTxs false, // allowedUnprotectedTxs
true, // enableCreate true, // enableCreate
true, // enableCall true, // enableCall
@ -224,10 +224,10 @@ func (suite *EIP712TestSuite) SetupTest() {
pricefeedtypes.ModuleName: cdc.MustMarshalJSON(&pricefeedGenState), pricefeedtypes.ModuleName: cdc.MustMarshalJSON(&pricefeedGenState),
} }
// funds our test accounts with some auxiliary denom // funds our test accounts with some gas denom
coinsGenState := app.NewFundedGenStateWithSameCoins( coinsGenState := app.NewFundedGenStateWithSameCoins(
tApp.AppCodec(), tApp.AppCodec(),
sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(1e9)), sdk.NewCoins(chaincfg.MakeCoinForGasDenom(1e9)),
[]sdk.AccAddress{suite.testAddr, suite.testAddr2}, []sdk.AccAddress{suite.testAddr, suite.testAddr2},
) )
@ -377,7 +377,7 @@ func (suite *EIP712TestSuite) deployUSDCERC20(app app.TestApp, ctx sdk.Context)
suite.tApp.FundModuleAccount( suite.tApp.FundModuleAccount(
suite.ctx, suite.ctx,
evmutiltypes.ModuleName, evmutiltypes.ModuleName,
sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(0)), sdk.NewCoins(chaincfg.MakeCoinForGasDenom(0)),
) )
contractAddr, err := suite.evmutilKeeper.DeployTestMintableERC20Contract(suite.ctx, "USDC", "USDC", uint8(18)) contractAddr, err := suite.evmutilKeeper.DeployTestMintableERC20Contract(suite.ctx, "USDC", "USDC", uint8(18))
@ -477,7 +477,7 @@ func (suite *EIP712TestSuite) TestEIP712Tx() {
errMsg: "insufficient funds", errMsg: "insufficient funds",
updateTx: func(txBuilder client.TxBuilder, msgs []sdk.Msg) client.TxBuilder { updateTx: func(txBuilder client.TxBuilder, msgs []sdk.Msg) client.TxBuilder {
bk := suite.tApp.GetBankKeeper() bk := suite.tApp.GetBankKeeper()
gasCoins := bk.GetBalance(suite.ctx, suite.testAddr, chaincfg.AuxiliaryDenom) gasCoins := bk.GetBalance(suite.ctx, suite.testAddr, chaincfg.GasDenom)
suite.tApp.GetBankKeeper().SendCoins(suite.ctx, suite.testAddr, suite.testAddr2, sdk.NewCoins(gasCoins)) suite.tApp.GetBankKeeper().SendCoins(suite.ctx, suite.testAddr, suite.testAddr2, sdk.NewCoins(gasCoins))
return txBuilder return txBuilder
}, },
@ -489,7 +489,7 @@ func (suite *EIP712TestSuite) TestEIP712Tx() {
failCheckTx: true, failCheckTx: true,
errMsg: "invalid chain-id", errMsg: "invalid chain-id",
updateTx: func(txBuilder client.TxBuilder, msgs []sdk.Msg) client.TxBuilder { updateTx: func(txBuilder client.TxBuilder, msgs []sdk.Msg) client.TxBuilder {
gasAmt := sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(20)) gasAmt := sdk.NewCoins(chaincfg.MakeCoinForGasDenom(20))
return suite.createTestEIP712CosmosTxBuilder( return suite.createTestEIP712CosmosTxBuilder(
suite.testAddr, suite.testPrivKey, "kavatest_12-1", uint64(sims.DefaultGenTxGas*10), gasAmt, msgs, suite.testAddr, suite.testPrivKey, "kavatest_12-1", uint64(sims.DefaultGenTxGas*10), gasAmt, msgs,
) )
@ -502,7 +502,7 @@ func (suite *EIP712TestSuite) TestEIP712Tx() {
failCheckTx: true, failCheckTx: true,
errMsg: "invalid pubkey", errMsg: "invalid pubkey",
updateTx: func(txBuilder client.TxBuilder, msgs []sdk.Msg) client.TxBuilder { updateTx: func(txBuilder client.TxBuilder, msgs []sdk.Msg) client.TxBuilder {
gasAmt := sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(20)) gasAmt := sdk.NewCoins(chaincfg.MakeCoinForGasDenom(20))
return suite.createTestEIP712CosmosTxBuilder( return suite.createTestEIP712CosmosTxBuilder(
suite.testAddr2, suite.testPrivKey2, ChainID, uint64(sims.DefaultGenTxGas*10), gasAmt, msgs, suite.testAddr2, suite.testPrivKey2, ChainID, uint64(sims.DefaultGenTxGas*10), gasAmt, msgs,
) )
@ -530,7 +530,7 @@ func (suite *EIP712TestSuite) TestEIP712Tx() {
msgs = tc.updateMsgs(msgs) msgs = tc.updateMsgs(msgs)
} }
gasAmt := sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(20)) gasAmt := sdk.NewCoins(chaincfg.MakeCoinForGasDenom(20))
txBuilder := suite.createTestEIP712CosmosTxBuilder( txBuilder := suite.createTestEIP712CosmosTxBuilder(
suite.testAddr, suite.testPrivKey, ChainID, uint64(sims.DefaultGenTxGas*10), gasAmt, msgs, suite.testAddr, suite.testPrivKey, ChainID, uint64(sims.DefaultGenTxGas*10), gasAmt, msgs,
) )
@ -604,7 +604,7 @@ func (suite *EIP712TestSuite) TestEIP712Tx_DepositAndWithdraw() {
} }
// deliver deposit msg // deliver deposit msg
gasAmt := sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(20)) gasAmt := sdk.NewCoins(chaincfg.MakeCoinForGasDenom(20))
txBuilder := suite.createTestEIP712CosmosTxBuilder( txBuilder := suite.createTestEIP712CosmosTxBuilder(
suite.testAddr, suite.testPrivKey, ChainID, uint64(sims.DefaultGenTxGas*10), gasAmt, depositMsgs, suite.testAddr, suite.testPrivKey, ChainID, uint64(sims.DefaultGenTxGas*10), gasAmt, depositMsgs,
) )

View File

@ -31,7 +31,7 @@ func TestEvmMinGasFilter(t *testing.T) {
ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()})
tApp.GetEvmKeeper().SetParams(ctx, evmtypes.Params{ tApp.GetEvmKeeper().SetParams(ctx, evmtypes.Params{
EvmDenom: chaincfg.BaseDenom, EvmDenom: chaincfg.EvmDenom,
}) })
testCases := []struct { testCases := []struct {

View File

@ -34,7 +34,7 @@ func TestVestingMempoolDecorator_MsgCreateVestingAccount_Unauthorized(t *testing
"MsgCreateVestingAccount", "MsgCreateVestingAccount",
vesting.NewMsgCreateVestingAccount( vesting.NewMsgCreateVestingAccount(
testAddresses[0], testAddresses[1], testAddresses[0], testAddresses[1],
sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(100)), sdk.NewCoins(chaincfg.MakeCoinForGasDenom(100)),
time.Date(1998, 1, 1, 0, 0, 0, 0, time.UTC).Unix(), time.Date(1998, 1, 1, 0, 0, 0, 0, time.UTC).Unix(),
false, false,
), ),
@ -45,7 +45,7 @@ func TestVestingMempoolDecorator_MsgCreateVestingAccount_Unauthorized(t *testing
"MsgCreateVestingAccount", "MsgCreateVestingAccount",
vesting.NewMsgCreatePermanentLockedAccount( vesting.NewMsgCreatePermanentLockedAccount(
testAddresses[0], testAddresses[1], testAddresses[0], testAddresses[1],
sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(100)), sdk.NewCoins(chaincfg.MakeCoinForGasDenom(100)),
), ),
true, true,
"MsgTypeURL /cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount not supported", "MsgTypeURL /cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount not supported",
@ -64,7 +64,7 @@ func TestVestingMempoolDecorator_MsgCreateVestingAccount_Unauthorized(t *testing
"other messages not affected", "other messages not affected",
banktypes.NewMsgSend( banktypes.NewMsgSend(
testAddresses[0], testAddresses[1], testAddresses[0], testAddresses[1],
sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(100)), sdk.NewCoins(chaincfg.MakeCoinForGasDenom(100)),
), ),
false, false,
"", "",

View File

@ -159,7 +159,7 @@ func GenesisStateWithSingleValidator(
balances := []banktypes.Balance{ balances := []banktypes.Balance{
{ {
Address: acc.GetAddress().String(), Address: acc.GetAddress().String(),
Coins: sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(100000000000000)), Coins: sdk.NewCoins(chaincfg.MakeCoinForGasDenom(100000000000000)),
}, },
} }
@ -222,7 +222,7 @@ func genesisStateWithValSet(
} }
// set validators and delegations // set validators and delegations
currentStakingGenesis := stakingtypes.GetGenesisStateFromAppState(app.appCodec, genesisState) currentStakingGenesis := stakingtypes.GetGenesisStateFromAppState(app.appCodec, genesisState)
currentStakingGenesis.Params.BondDenom = chaincfg.AuxiliaryDenom // TODO: currentStakingGenesis.Params.BondDenom = chaincfg.GasDenom // TODO:
stakingGenesis := stakingtypes.NewGenesisState( stakingGenesis := stakingtypes.NewGenesisState(
currentStakingGenesis.Params, currentStakingGenesis.Params,
@ -242,13 +242,13 @@ func genesisStateWithValSet(
for range delegations { for range delegations {
// add delegated tokens to total supply // add delegated tokens to total supply
totalSupply = totalSupply.Add(chaincfg.MakeCoinForAuxiliaryDenom(bondAmt)) totalSupply = totalSupply.Add(chaincfg.MakeCoinForGasDenom(bondAmt))
} }
// add bonded amount to bonded pool module account // add bonded amount to bonded pool module account
balances = append(balances, banktypes.Balance{ balances = append(balances, banktypes.Balance{
Address: authtypes.NewModuleAddress(stakingtypes.BondedPoolName).String(), Address: authtypes.NewModuleAddress(stakingtypes.BondedPoolName).String(),
Coins: sdk.Coins{chaincfg.MakeCoinForAuxiliaryDenom(bondAmt)}, Coins: sdk.Coins{chaincfg.MakeCoinForGasDenom(bondAmt)},
}) })
bankGenesis := banktypes.NewGenesisState( bankGenesis := banktypes.NewGenesisState(

View File

@ -44,12 +44,12 @@ func MakeCoinForStandardDenom(amount any) sdk.Coin {
return makeCoin(StandardDenom, toBigInt(amount)) return makeCoin(StandardDenom, toBigInt(amount))
} }
func MakeCoinForAuxiliaryDenom(amount any) sdk.Coin { func MakeCoinForGasDenom(amount any) sdk.Coin {
return makeCoin(AuxiliaryDenom, toBigInt(amount)) return makeCoin(GasDenom, toBigInt(amount))
} }
func MakeCoinForBaseDenom(amount any) sdk.Coin { func MakeCoinForEvmDenom(amount any) sdk.Coin {
return makeCoin(BaseDenom, toBigInt(amount)) return makeCoin(EvmDenom, toBigInt(amount))
} }
func makeCoin(denom string, amount *big.Int) sdk.Coin { func makeCoin(denom string, amount *big.Int) sdk.Coin {

View File

@ -7,31 +7,31 @@ import (
const ( const (
StandardDenom = "a0gi" StandardDenom = "a0gi"
AuxiliaryDenom = "ua0gi" GasDenom = "ua0gi"
BaseDenom = "neuron" EvmDenom = "neuron"
BondDenom = BaseDenom BondDenom = EvmDenom
AuxiliaryDenomUnit = 6 GasDenomUnit = 6
BaseDenomUnit = 18 EvmDenomUnit = 18
AuxiliaryDenomConversionMultiplier = 1e12 GasDenomConversionMultiplier = 1e12
BaseDenomConversionMultiplier = 1e18 EvmDenomConversionMultiplier = 1e18
) )
// RegisterDenoms registers the base and auxiliary denominations to the SDK. // RegisterDenoms registers the base and gas denominations to the SDK.
func RegisterDenoms() { func RegisterDenoms() {
if err := sdk.RegisterDenom(StandardDenom, sdk.OneDec()); err != nil { if err := sdk.RegisterDenom(StandardDenom, sdk.OneDec()); err != nil {
panic(err) panic(err)
} }
if err := sdk.RegisterDenom(AuxiliaryDenom, sdk.NewDecWithPrec(1, AuxiliaryDenomUnit)); err != nil { if err := sdk.RegisterDenom(GasDenom, sdk.NewDecWithPrec(1, GasDenomUnit)); err != nil {
panic(err) panic(err)
} }
if err := sdk.RegisterDenom(BaseDenom, sdk.NewDecWithPrec(1, BaseDenomUnit)); err != nil { if err := sdk.RegisterDenom(EvmDenom, sdk.NewDecWithPrec(1, EvmDenomUnit)); err != nil {
panic(err) panic(err)
} }
} }

View File

@ -17,15 +17,15 @@ func TestRegisterDenoms(t *testing.T) {
expErr error expErr error
}{ }{
{ {
"standard to auxiliary", "standard to gas",
MakeCoinForStandardDenom(99), MakeCoinForStandardDenom(99),
AuxiliaryDenom, GasDenom,
MakeCoinForAuxiliaryDenom(99 * (BaseDenomConversionMultiplier / AuxiliaryDenomConversionMultiplier)), MakeCoinForGasDenom(99 * (EvmDenomConversionMultiplier / GasDenomConversionMultiplier)),
nil, nil,
}, },
{ {
"auxiliary to standard", "gas to standard",
MakeCoinForAuxiliaryDenom(5e7), MakeCoinForGasDenom(5e7),
StandardDenom, StandardDenom,
MakeCoinForStandardDenom(50), MakeCoinForStandardDenom(50),
nil, nil,
@ -33,29 +33,29 @@ func TestRegisterDenoms(t *testing.T) {
{ {
"standard to base", "standard to base",
MakeCoinForStandardDenom(22), MakeCoinForStandardDenom(22),
BaseDenom, EvmDenom,
MakeCoinForBaseDenom(22 * BaseDenomConversionMultiplier), MakeCoinForEvmDenom(22 * EvmDenomConversionMultiplier),
nil, nil,
}, },
{ {
"base to standard", "base to standard",
MakeCoinForBaseDenom("97000000000000000000"), MakeCoinForEvmDenom("97000000000000000000"),
StandardDenom, StandardDenom,
MakeCoinForStandardDenom(97), MakeCoinForStandardDenom(97),
nil, nil,
}, },
{ {
"auxiliary to base", "gas to base",
MakeCoinForAuxiliaryDenom(33), MakeCoinForGasDenom(33),
BaseDenom, EvmDenom,
MakeCoinForBaseDenom(33 * AuxiliaryDenomConversionMultiplier), MakeCoinForEvmDenom(33 * GasDenomConversionMultiplier),
nil, nil,
}, },
{ {
"base to auxiliary", "base to gas",
MakeCoinForBaseDenom("770000000000000"), MakeCoinForEvmDenom("770000000000000"),
AuxiliaryDenom, GasDenom,
MakeCoinForAuxiliaryDenom(770000000000000 / AuxiliaryDenomConversionMultiplier), MakeCoinForGasDenom(770000000000000 / GasDenomConversionMultiplier),
nil, nil,
}, },
} }

View File

@ -3580,7 +3580,7 @@ paths:
base: base:
type: string type: string
description: >- description: >-
base represents the base denom (should be the DenomUnit base represents the evm denom (should be the DenomUnit
with exponent = 0). with exponent = 0).
display: display:
type: string type: string
@ -3787,7 +3787,7 @@ paths:
base: base:
type: string type: string
description: >- description: >-
base represents the base denom (should be the DenomUnit base represents the evm denom (should be the DenomUnit
with exponent = 0). with exponent = 0).
display: display:
type: string type: string
@ -38218,7 +38218,7 @@ definitions:
base: base:
type: string type: string
description: >- description: >-
base represents the base denom (should be the DenomUnit with exponent base represents the evm denom (should be the DenomUnit with exponent
= 0). = 0).
display: display:
type: string type: string
@ -38397,7 +38397,7 @@ definitions:
base: base:
type: string type: string
description: >- description: >-
base represents the base denom (should be the DenomUnit with base represents the evm denom (should be the DenomUnit with
exponent = 0). exponent = 0).
display: display:
type: string type: string
@ -38553,7 +38553,7 @@ definitions:
base: base:
type: string type: string
description: >- description: >-
base represents the base denom (should be the DenomUnit with base represents the evm denom (should be the DenomUnit with
exponent = 0). exponent = 0).
display: display:
type: string type: string

View File

@ -129,9 +129,9 @@ paths:
source of the fungible token. source of the fungible token.
base_denom: base_denom:
type: string type: string
description: base denomination of the relayed fungible token. description: evm denomination of the relayed fungible token.
description: >- description: >-
DenomTrace contains the base denomination for ICS20 fungible DenomTrace contains the evm denomination for ICS20 fungible
tokens and the tokens and the
source tracing information path. source tracing information path.
@ -263,9 +263,9 @@ paths:
source of the fungible token. source of the fungible token.
base_denom: base_denom:
type: string type: string
description: base denomination of the relayed fungible token. description: evm denomination of the relayed fungible token.
description: >- description: >-
DenomTrace contains the base denomination for ICS20 fungible DenomTrace contains the evm denomination for ICS20 fungible
tokens and the tokens and the
source tracing information path. source tracing information path.
@ -13640,9 +13640,9 @@ definitions:
source of the fungible token. source of the fungible token.
base_denom: base_denom:
type: string type: string
description: base denomination of the relayed fungible token. description: evm denomination of the relayed fungible token.
description: >- description: >-
DenomTrace contains the base denomination for ICS20 fungible tokens and DenomTrace contains the evm denomination for ICS20 fungible tokens and
the the
source tracing information path. source tracing information path.
@ -13696,9 +13696,9 @@ definitions:
source of the fungible token. source of the fungible token.
base_denom: base_denom:
type: string type: string
description: base denomination of the relayed fungible token. description: evm denomination of the relayed fungible token.
description: >- description: >-
DenomTrace contains the base denomination for ICS20 fungible tokens DenomTrace contains the evm denomination for ICS20 fungible tokens
and the and the
source tracing information path. source tracing information path.
@ -13722,9 +13722,9 @@ definitions:
source of the fungible token. source of the fungible token.
base_denom: base_denom:
type: string type: string
description: base denomination of the relayed fungible token. description: evm denomination of the relayed fungible token.
description: >- description: >-
DenomTrace contains the base denomination for ICS20 fungible tokens DenomTrace contains the evm denomination for ICS20 fungible tokens
and the and the
source tracing information path. source tracing information path.

View File

@ -16950,7 +16950,7 @@ paths:
base: base:
type: string type: string
description: >- description: >-
base represents the base denom (should be the DenomUnit base represents the evm denom (should be the DenomUnit
with exponent = 0). with exponent = 0).
display: display:
type: string type: string
@ -17157,7 +17157,7 @@ paths:
base: base:
type: string type: string
description: >- description: >-
base represents the base denom (should be the DenomUnit base represents the evm denom (should be the DenomUnit
with exponent = 0). with exponent = 0).
display: display:
type: string type: string
@ -41557,9 +41557,9 @@ paths:
source of the fungible token. source of the fungible token.
base_denom: base_denom:
type: string type: string
description: base denomination of the relayed fungible token. description: evm denomination of the relayed fungible token.
description: >- description: >-
DenomTrace contains the base denomination for ICS20 fungible DenomTrace contains the evm denomination for ICS20 fungible
tokens and the tokens and the
source tracing information path. source tracing information path.
@ -41691,9 +41691,9 @@ paths:
source of the fungible token. source of the fungible token.
base_denom: base_denom:
type: string type: string
description: base denomination of the relayed fungible token. description: evm denomination of the relayed fungible token.
description: >- description: >-
DenomTrace contains the base denomination for ICS20 fungible DenomTrace contains the evm denomination for ICS20 fungible
tokens and the tokens and the
source tracing information path. source tracing information path.
@ -64035,7 +64035,7 @@ definitions:
base: base:
type: string type: string
description: >- description: >-
base represents the base denom (should be the DenomUnit with exponent base represents the evm denom (should be the DenomUnit with exponent
= 0). = 0).
display: display:
type: string type: string
@ -64214,7 +64214,7 @@ definitions:
base: base:
type: string type: string
description: >- description: >-
base represents the base denom (should be the DenomUnit with base represents the evm denom (should be the DenomUnit with
exponent = 0). exponent = 0).
display: display:
type: string type: string
@ -64370,7 +64370,7 @@ definitions:
base: base:
type: string type: string
description: >- description: >-
base represents the base denom (should be the DenomUnit with base represents the evm denom (should be the DenomUnit with
exponent = 0). exponent = 0).
display: display:
type: string type: string
@ -87953,9 +87953,9 @@ definitions:
source of the fungible token. source of the fungible token.
base_denom: base_denom:
type: string type: string
description: base denomination of the relayed fungible token. description: evm denomination of the relayed fungible token.
description: >- description: >-
DenomTrace contains the base denomination for ICS20 fungible tokens and DenomTrace contains the evm denomination for ICS20 fungible tokens and
the the
source tracing information path. source tracing information path.
@ -88009,9 +88009,9 @@ definitions:
source of the fungible token. source of the fungible token.
base_denom: base_denom:
type: string type: string
description: base denomination of the relayed fungible token. description: evm denomination of the relayed fungible token.
description: >- description: >-
DenomTrace contains the base denomination for ICS20 fungible tokens DenomTrace contains the evm denomination for ICS20 fungible tokens
and the and the
source tracing information path. source tracing information path.
@ -88035,9 +88035,9 @@ definitions:
source of the fungible token. source of the fungible token.
base_denom: base_denom:
type: string type: string
description: base denomination of the relayed fungible token. description: evm denomination of the relayed fungible token.
description: >- description: >-
DenomTrace contains the base denomination for ICS20 fungible tokens DenomTrace contains the evm denomination for ICS20 fungible tokens
and the and the
source tracing information path. source tracing information path.

View File

@ -76,7 +76,7 @@ func NewRootCmd() *cobra.Command {
return err return err
} }
customAppTemplate, customAppConfig := servercfg.AppConfig(chaincfg.AuxiliaryDenom) customAppTemplate, customAppConfig := servercfg.AppConfig(chaincfg.GasDenom)
return server.InterceptConfigsPreRunHandler( return server.InterceptConfigsPreRunHandler(
cmd, cmd,
@ -139,7 +139,7 @@ func addSubCmds(rootCmd *cobra.Command, encodingConfig params.EncodingConfig, de
ac.addStartCmdFlags, ac.addStartCmdFlags,
) )
// add keybase, auxiliary RPC, query, and tx child commands // add keybase, gas RPC, query, and tx child commands
rootCmd.AddCommand( rootCmd.AddCommand(
newQueryCmd(), newQueryCmd(),
newTxCmd(), newTxCmd(),

View File

@ -24,7 +24,7 @@ DATA=~/.0gchain
# remove any old state and config # remove any old state and config
rm -rf $DATA rm -rf $DATA
BINARY=0gchaind BINARY=./.build/0gchaind
# Create new data directory, overwriting any that alread existed # Create new data directory, overwriting any that alread existed
chainID="zgchain_8888-1" chainID="zgchain_8888-1"

View File

@ -42,7 +42,7 @@ func TestResetPeriodVestingAccount_NoVestingPeriods(t *testing.T) {
} }
func TestResetPeriodVestingAccount_SingleVestingPeriod_Vested(t *testing.T) { func TestResetPeriodVestingAccount_SingleVestingPeriod_Vested(t *testing.T) {
balance := sdk.NewCoins(sdk.NewCoin(chaincfg.AuxiliaryDenom, sdkmath.NewInt(1e6))) balance := sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6)))
vestingStartTime := time.Now().Add(-30 * 24 * time.Hour) // 30 days in past vestingStartTime := time.Now().Add(-30 * 24 * time.Hour) // 30 days in past
periods := vestingtypes.Periods{ periods := vestingtypes.Periods{
@ -65,7 +65,7 @@ func TestResetPeriodVestingAccount_SingleVestingPeriod_Vested(t *testing.T) {
} }
func TestResetPeriodVestingAccount_SingleVestingPeriod_Vesting(t *testing.T) { func TestResetPeriodVestingAccount_SingleVestingPeriod_Vesting(t *testing.T) {
balance := sdk.NewCoins(sdk.NewCoin(chaincfg.AuxiliaryDenom, sdkmath.NewInt(1e6))) balance := sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6)))
vestingStartTime := time.Now().Add(-30 * 24 * time.Hour) // 30 days in past vestingStartTime := time.Now().Add(-30 * 24 * time.Hour) // 30 days in past
periods := vestingtypes.Periods{ periods := vestingtypes.Periods{
@ -98,7 +98,7 @@ func TestResetPeriodVestingAccount_SingleVestingPeriod_Vesting(t *testing.T) {
} }
func TestResetPeriodVestingAccount_SingleVestingPeriod_ExactStartTime(t *testing.T) { func TestResetPeriodVestingAccount_SingleVestingPeriod_ExactStartTime(t *testing.T) {
balance := sdk.NewCoins(sdk.NewCoin(chaincfg.AuxiliaryDenom, sdkmath.NewInt(1e6))) balance := sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6)))
vestingStartTime := time.Now().Add(-30 * 24 * time.Hour) // 30 days in past vestingStartTime := time.Now().Add(-30 * 24 * time.Hour) // 30 days in past
periods := vestingtypes.Periods{ periods := vestingtypes.Periods{
@ -126,25 +126,25 @@ func TestResetPeriodVestingAccount_SingleVestingPeriod_ExactStartTime(t *testing
} }
func TestResetPeriodVestingAccount_MultiplePeriods(t *testing.T) { func TestResetPeriodVestingAccount_MultiplePeriods(t *testing.T) {
balance := sdk.NewCoins(sdk.NewCoin(chaincfg.AuxiliaryDenom, sdkmath.NewInt(4e6))) balance := sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(4e6)))
vestingStartTime := time.Now().Add(-30 * 24 * time.Hour) // 30 days in past vestingStartTime := time.Now().Add(-30 * 24 * time.Hour) // 30 days in past
periods := vestingtypes.Periods{ periods := vestingtypes.Periods{
vestingtypes.Period{ vestingtypes.Period{
Length: 15 * 24 * 60 * 60, // -15 days - vested Length: 15 * 24 * 60 * 60, // -15 days - vested
Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.AuxiliaryDenom, sdkmath.NewInt(1e6))), Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6))),
}, },
vestingtypes.Period{ vestingtypes.Period{
Length: 15 * 24 * 60 * 60, // 0 days - exact on the start time Length: 15 * 24 * 60 * 60, // 0 days - exact on the start time
Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.AuxiliaryDenom, sdkmath.NewInt(1e6))), Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6))),
}, },
vestingtypes.Period{ vestingtypes.Period{
Length: 15 * 24 * 60 * 60, // +15 days - vesting Length: 15 * 24 * 60 * 60, // +15 days - vesting
Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.AuxiliaryDenom, sdkmath.NewInt(1e6))), Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6))),
}, },
vestingtypes.Period{ vestingtypes.Period{
Length: 15 * 24 * 60 * 60, // +30 days - vesting Length: 15 * 24 * 60 * 60, // +30 days - vesting
Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.AuxiliaryDenom, sdkmath.NewInt(1e6))), Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6))),
}, },
} }
@ -160,36 +160,36 @@ func TestResetPeriodVestingAccount_MultiplePeriods(t *testing.T) {
expectedPeriods := []vestingtypes.Period{ expectedPeriods := []vestingtypes.Period{
{ {
Length: 15 * 24 * 60 * 60, // 15 days Length: 15 * 24 * 60 * 60, // 15 days
Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.AuxiliaryDenom, sdkmath.NewInt(1e6))), Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6))),
}, },
{ {
Length: 15 * 24 * 60 * 60, // 15 days Length: 15 * 24 * 60 * 60, // 15 days
Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.AuxiliaryDenom, sdkmath.NewInt(1e6))), Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6))),
}, },
} }
assert.Equal(t, sdk.NewCoins(sdk.NewCoin(chaincfg.AuxiliaryDenom, sdkmath.NewInt(2e6))), vacc.OriginalVesting, "expected original vesting to be updated") assert.Equal(t, sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(2e6))), vacc.OriginalVesting, "expected original vesting to be updated")
assert.Equal(t, newVestingStartTime.Unix(), vacc.StartTime, "expected vesting start time to be updated") assert.Equal(t, newVestingStartTime.Unix(), vacc.StartTime, "expected vesting start time to be updated")
assert.Equal(t, expectedEndtime, vacc.EndTime, "expected vesting end time end at last period") assert.Equal(t, expectedEndtime, vacc.EndTime, "expected vesting end time end at last period")
assert.Equal(t, expectedPeriods, vacc.VestingPeriods, "expected vesting periods to be updated") assert.Equal(t, expectedPeriods, vacc.VestingPeriods, "expected vesting periods to be updated")
} }
func TestResetPeriodVestingAccount_DelegatedVesting_GreaterThanVesting(t *testing.T) { func TestResetPeriodVestingAccount_DelegatedVesting_GreaterThanVesting(t *testing.T) {
balance := sdk.NewCoins(sdk.NewCoin(chaincfg.AuxiliaryDenom, sdkmath.NewInt(3e6))) balance := sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(3e6)))
vestingStartTime := time.Now().Add(-30 * 24 * time.Hour) // 30 days in past vestingStartTime := time.Now().Add(-30 * 24 * time.Hour) // 30 days in past
periods := vestingtypes.Periods{ periods := vestingtypes.Periods{
vestingtypes.Period{ vestingtypes.Period{
Length: 15 * 24 * 60 * 60, // -15 days - vested Length: 15 * 24 * 60 * 60, // -15 days - vested
Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.AuxiliaryDenom, sdkmath.NewInt(1e6))), Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6))),
}, },
vestingtypes.Period{ vestingtypes.Period{
Length: 15 * 24 * 60 * 60, // 0 days - exact on the start time Length: 15 * 24 * 60 * 60, // 0 days - exact on the start time
Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.AuxiliaryDenom, sdkmath.NewInt(1e6))), Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6))),
}, },
vestingtypes.Period{ vestingtypes.Period{
Length: 15 * 24 * 60 * 60, // +15 days - vesting Length: 15 * 24 * 60 * 60, // +15 days - vesting
Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.AuxiliaryDenom, sdkmath.NewInt(1e6))), Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6))),
}, },
} }
@ -199,35 +199,35 @@ func TestResetPeriodVestingAccount_DelegatedVesting_GreaterThanVesting(t *testin
newVestingStartTime := vestingStartTime.Add(30 * 24 * time.Hour) newVestingStartTime := vestingStartTime.Add(30 * 24 * time.Hour)
ResetPeriodicVestingAccount(vacc, newVestingStartTime) ResetPeriodicVestingAccount(vacc, newVestingStartTime)
assert.Equal(t, sdk.NewCoins(sdk.NewCoin(chaincfg.AuxiliaryDenom, sdkmath.NewInt(2e6))), vacc.DelegatedFree, "expected delegated free to be updated") assert.Equal(t, sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(2e6))), vacc.DelegatedFree, "expected delegated free to be updated")
assert.Equal(t, sdk.NewCoins(sdk.NewCoin(chaincfg.AuxiliaryDenom, sdkmath.NewInt(1e6))), vacc.DelegatedVesting, "expected delegated vesting to be updated") assert.Equal(t, sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6))), vacc.DelegatedVesting, "expected delegated vesting to be updated")
} }
func TestResetPeriodVestingAccount_DelegatedVesting_LessThanVested(t *testing.T) { func TestResetPeriodVestingAccount_DelegatedVesting_LessThanVested(t *testing.T) {
balance := sdk.NewCoins(sdk.NewCoin(chaincfg.AuxiliaryDenom, sdkmath.NewInt(3e6))) balance := sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(3e6)))
vestingStartTime := time.Now().Add(-30 * 24 * time.Hour) // 30 days in past vestingStartTime := time.Now().Add(-30 * 24 * time.Hour) // 30 days in past
periods := vestingtypes.Periods{ periods := vestingtypes.Periods{
vestingtypes.Period{ vestingtypes.Period{
Length: 15 * 24 * 60 * 60, // -15 days - vested Length: 15 * 24 * 60 * 60, // -15 days - vested
Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.AuxiliaryDenom, sdkmath.NewInt(1e6))), Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6))),
}, },
vestingtypes.Period{ vestingtypes.Period{
Length: 15 * 24 * 60 * 60, // 0 days - exact on the start time Length: 15 * 24 * 60 * 60, // 0 days - exact on the start time
Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.AuxiliaryDenom, sdkmath.NewInt(1e6))), Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6))),
}, },
vestingtypes.Period{ vestingtypes.Period{
Length: 15 * 24 * 60 * 60, // +15 days - vesting Length: 15 * 24 * 60 * 60, // +15 days - vesting
Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.AuxiliaryDenom, sdkmath.NewInt(1e6))), Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6))),
}, },
} }
vacc := createVestingAccount(balance, vestingStartTime, periods) vacc := createVestingAccount(balance, vestingStartTime, periods)
vacc.TrackDelegation(vestingStartTime, balance, sdk.NewCoins(sdk.NewCoin(chaincfg.AuxiliaryDenom, sdkmath.NewInt(1e6)))) vacc.TrackDelegation(vestingStartTime, balance, sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6))))
newVestingStartTime := vestingStartTime.Add(30 * 24 * time.Hour) newVestingStartTime := vestingStartTime.Add(30 * 24 * time.Hour)
ResetPeriodicVestingAccount(vacc, newVestingStartTime) ResetPeriodicVestingAccount(vacc, newVestingStartTime)
assert.Equal(t, sdk.Coins(nil), vacc.DelegatedFree, "expected delegrated free to be unmodified") assert.Equal(t, sdk.Coins(nil), vacc.DelegatedFree, "expected delegrated free to be unmodified")
assert.Equal(t, sdk.NewCoins(sdk.NewCoin(chaincfg.AuxiliaryDenom, sdkmath.NewInt(1e6))), vacc.DelegatedVesting, "expected delegated vesting to be unmodified") assert.Equal(t, sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(1e6))), vacc.DelegatedVesting, "expected delegated vesting to be unmodified")
} }

View File

@ -64,7 +64,7 @@ func (suite *IntegrationTestSuite) setupAccountWithCosmosCoinERC20Balance(
tx := util.ZgChainMsgRequest{ tx := util.ZgChainMsgRequest{
Msgs: []sdk.Msg{&msg}, Msgs: []sdk.Msg{&msg},
GasLimit: 4e5, GasLimit: 4e5,
FeeAmount: sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(400)), FeeAmount: sdk.NewCoins(chaincfg.MakeCoinForGasDenom(400)),
Data: "converting sdk coin to erc20", Data: "converting sdk coin to erc20",
} }
res := user.SignAndBroadcastZgChainTx(tx) res := user.SignAndBroadcastZgChainTx(tx)
@ -103,7 +103,7 @@ func (suite *IntegrationTestSuite) TestConvertCosmosCoinsToFromERC20() {
tx := util.ZgChainMsgRequest{ tx := util.ZgChainMsgRequest{
Msgs: []sdk.Msg{&convertToErc20Msg}, Msgs: []sdk.Msg{&convertToErc20Msg},
GasLimit: 2e6, GasLimit: 2e6,
FeeAmount: sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(2000)), FeeAmount: sdk.NewCoins(chaincfg.MakeCoinForGasDenom(2000)),
Data: "converting sdk coin to erc20", Data: "converting sdk coin to erc20",
} }
res := user.SignAndBroadcastZgChainTx(tx) res := user.SignAndBroadcastZgChainTx(tx)
@ -145,7 +145,7 @@ func (suite *IntegrationTestSuite) TestConvertCosmosCoinsToFromERC20() {
tx = util.ZgChainMsgRequest{ tx = util.ZgChainMsgRequest{
Msgs: []sdk.Msg{&convertFromErc20Msg}, Msgs: []sdk.Msg{&convertFromErc20Msg},
GasLimit: 2e5, GasLimit: 2e5,
FeeAmount: sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(200)), FeeAmount: sdk.NewCoins(chaincfg.MakeCoinForGasDenom(200)),
Data: "converting erc20 to cosmos coin", Data: "converting erc20 to cosmos coin",
} }
res = user.SignAndBroadcastZgChainTx(tx) res = user.SignAndBroadcastZgChainTx(tx)
@ -184,7 +184,7 @@ func (suite *IntegrationTestSuite) TestEIP712ConvertCosmosCoinsToFromERC20() {
user, user,
suite.ZgChain, suite.ZgChain,
2e6, 2e6,
sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(1e4)), sdk.NewCoins(chaincfg.MakeCoinForGasDenom(1e4)),
[]sdk.Msg{&convertToErc20Msg}, []sdk.Msg{&convertToErc20Msg},
"this is a memo", "this is a memo",
).GetTx() ).GetTx()
@ -238,7 +238,7 @@ func (suite *IntegrationTestSuite) TestEIP712ConvertCosmosCoinsToFromERC20() {
user, user,
suite.ZgChain, suite.ZgChain,
2e5, 2e5,
sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(200)), sdk.NewCoins(chaincfg.MakeCoinForGasDenom(200)),
[]sdk.Msg{&convertFromErc20Msg}, []sdk.Msg{&convertFromErc20Msg},
"", "",
).GetTx() ).GetTx()
@ -332,7 +332,7 @@ func (suite *IntegrationTestSuite) TestConvertCosmosCoins_ERC20Magic() {
"cosmo-coin-converter-complex-alice", initialAliceAmount, "cosmo-coin-converter-complex-alice", initialAliceAmount,
) )
gasMoney := sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(1e5)) gasMoney := sdk.NewCoins(chaincfg.MakeCoinForGasDenom(1e5))
bob := suite.ZgChain.NewFundedAccount("cosmo-coin-converter-complex-bob", gasMoney) bob := suite.ZgChain.NewFundedAccount("cosmo-coin-converter-complex-bob", gasMoney)
amount := big.NewInt(1e3) // test assumes this is half of alice's balance. amount := big.NewInt(1e3) // test assumes this is half of alice's balance.
@ -413,7 +413,7 @@ func (suite *IntegrationTestSuite) TestConvertCosmosCoins_ERC20Magic() {
convertTx := util.ZgChainMsgRequest{ convertTx := util.ZgChainMsgRequest{
Msgs: []sdk.Msg{&convertMsg}, Msgs: []sdk.Msg{&convertMsg},
GasLimit: 2e5, GasLimit: 2e5,
FeeAmount: sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(200)), FeeAmount: sdk.NewCoins(chaincfg.MakeCoinForGasDenom(200)),
Data: "bob converts his new erc20 to an sdk.Coin", Data: "bob converts his new erc20 to an sdk.Coin",
} }
convertRes := bob.SignAndBroadcastZgChainTx(convertTx) convertRes := bob.SignAndBroadcastZgChainTx(convertTx)

View File

@ -20,7 +20,7 @@ func (suite *IntegrationTestSuite) TestEthCallToGreeterContract() {
// this test manipulates state of the Greeter contract which means other tests shouldn't use it. // this test manipulates state of the Greeter contract which means other tests shouldn't use it.
// setup funded account to interact with contract // setup funded account to interact with contract
user := suite.ZgChain.NewFundedAccount("greeter-contract-user", sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(1e6))) user := suite.ZgChain.NewFundedAccount("greeter-contract-user", sdk.NewCoins(chaincfg.MakeCoinForGasDenom(1e6)))
greeterAddr := suite.ZgChain.ContractAddrs["greeter"] greeterAddr := suite.ZgChain.ContractAddrs["greeter"]
contract, err := greeter.NewGreeter(greeterAddr, suite.ZgChain.EvmClient) contract, err := greeter.NewGreeter(greeterAddr, suite.ZgChain.EvmClient)
@ -63,12 +63,12 @@ func (suite *IntegrationTestSuite) TestEthCallToErc20() {
func (suite *IntegrationTestSuite) TestEip712BasicMessageAuthorization() { func (suite *IntegrationTestSuite) TestEip712BasicMessageAuthorization() {
// create new funded account // create new funded account
sender := suite.ZgChain.NewFundedAccount("eip712-msgSend", sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(2e4))) sender := suite.ZgChain.NewFundedAccount("eip712-msgSend", sdk.NewCoins(chaincfg.MakeCoinForGasDenom(2e4)))
receiver := app.RandomAddress() receiver := app.RandomAddress()
// setup message for sending some auxiliary denom to random receiver // setup message for sending some gas denom to random receiver
msgs := []sdk.Msg{ msgs := []sdk.Msg{
banktypes.NewMsgSend(sender.SdkAddress, receiver, sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(1e3))), banktypes.NewMsgSend(sender.SdkAddress, receiver, sdk.NewCoins(chaincfg.MakeCoinForGasDenom(1e3))),
} }
// create tx // create tx
@ -76,7 +76,7 @@ func (suite *IntegrationTestSuite) TestEip712BasicMessageAuthorization() {
sender, sender,
suite.ZgChain, suite.ZgChain,
1e6, 1e6,
sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(1e4)), sdk.NewCoins(chaincfg.MakeCoinForGasDenom(1e4)),
msgs, msgs,
"this is a memo", "this is a memo",
).GetTx() ).GetTx()
@ -95,10 +95,10 @@ func (suite *IntegrationTestSuite) TestEip712BasicMessageAuthorization() {
_, err = util.WaitForSdkTxCommit(suite.ZgChain.Tx, res.TxResponse.TxHash, 6*time.Second) _, err = util.WaitForSdkTxCommit(suite.ZgChain.Tx, res.TxResponse.TxHash, 6*time.Second)
suite.NoError(err) suite.NoError(err)
// check that the message was processed & the auxiliary denom is transferred. // check that the message was processed & the gas denom is transferred.
balRes, err := suite.ZgChain.Bank.Balance(context.Background(), &banktypes.QueryBalanceRequest{ balRes, err := suite.ZgChain.Bank.Balance(context.Background(), &banktypes.QueryBalanceRequest{
Address: receiver.String(), Address: receiver.String(),
Denom: chaincfg.AuxiliaryDenom, Denom: chaincfg.GasDenom,
}) })
suite.NoError(err) suite.NoError(err)
suite.Equal(sdk.NewInt(1e3), balRes.Balance.Amount) suite.Equal(sdk.NewInt(1e3), balRes.Balance.Amount)
@ -113,7 +113,7 @@ func (suite *IntegrationTestSuite) TestEip712BasicMessageAuthorization() {
// sdkDenom := suite.DeployedErc20.CosmosDenom // sdkDenom := suite.DeployedErc20.CosmosDenom
// // create new funded account // // create new funded account
// depositor := suite.ZgChain.NewFundedAccount("eip712-lend-depositor", sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(1e5))) // depositor := suite.ZgChain.NewFundedAccount("eip712-lend-depositor", sdk.NewCoins(chaincfg.MakeCoinForGasDenom(1e5)))
// // give them erc20 balance to deposit // // give them erc20 balance to deposit
// fundRes := suite.FundZgChainErc20Balance(depositor.EvmAddress, amount.BigInt()) // fundRes := suite.FundZgChainErc20Balance(depositor.EvmAddress, amount.BigInt())
// suite.NoError(fundRes.Err) // suite.NoError(fundRes.Err)
@ -143,7 +143,7 @@ func (suite *IntegrationTestSuite) TestEip712BasicMessageAuthorization() {
// depositor, // depositor,
// suite.ZgChain, // suite.ZgChain,
// 1e6, // 1e6,
// sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(1e4)), // sdk.NewCoins(chaincfg.MakeCoinForGasDenom(1e4)),
// msgs, // msgs,
// "doing the USDT Earn workflow! erc20 -> sdk.Coin -> USDX hard deposit", // "doing the USDT Earn workflow! erc20 -> sdk.Coin -> USDX hard deposit",
// ).GetTx() // ).GetTx()
@ -189,7 +189,7 @@ func (suite *IntegrationTestSuite) TestEip712BasicMessageAuthorization() {
// withdrawAndConvertBack := util.ZgChainMsgRequest{ // withdrawAndConvertBack := util.ZgChainMsgRequest{
// Msgs: []sdk.Msg{&withdraw, &convertBack}, // Msgs: []sdk.Msg{&withdraw, &convertBack},
// GasLimit: 1e6, // GasLimit: 1e6,
// FeeAmount: sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(1000)), // FeeAmount: sdk.NewCoins(chaincfg.MakeCoinForGasDenom(1000)),
// Data: "withdrawing from mint & converting back to erc20", // Data: "withdrawing from mint & converting back to erc20",
// } // }
// lastRes := depositor.SignAndBroadcastZgChainTx(withdrawAndConvertBack) // lastRes := depositor.SignAndBroadcastZgChainTx(withdrawAndConvertBack)

View File

@ -24,10 +24,10 @@ func (suite *IntegrationTestSuite) TestEthGasPriceReturnsMinFee() {
minGasPrices, err := getMinFeeFromAppToml(util.ZgChainHomePath()) minGasPrices, err := getMinFeeFromAppToml(util.ZgChainHomePath())
suite.NoError(err) suite.NoError(err)
// evm uses base denom, get base denom min fee // evm uses evm denom, get evm denom min fee
evmMinGas := minGasPrices.AmountOf(chaincfg.BaseDenom).TruncateInt().BigInt() evmMinGas := minGasPrices.AmountOf(chaincfg.EvmDenom).TruncateInt().BigInt()
// returns eth_gasPrice, units in auxiliary denom // returns eth_gasPrice, units in gas denom
gasPrice, err := suite.ZgChain.EvmClient.SuggestGasPrice(context.Background()) gasPrice, err := suite.ZgChain.EvmClient.SuggestGasPrice(context.Background())
suite.NoError(err) suite.NoError(err)
@ -38,13 +38,13 @@ func (suite *IntegrationTestSuite) TestEvmRespectsMinFee() {
suite.SkipIfKvtoolDisabled() suite.SkipIfKvtoolDisabled()
// setup sender & receiver // setup sender & receiver
sender := suite.ZgChain.NewFundedAccount("evm-min-fee-test-sender", sdk.NewCoins(chaincfg.MakeCoinForAuxiliaryDenom(1e3))) sender := suite.ZgChain.NewFundedAccount("evm-min-fee-test-sender", sdk.NewCoins(chaincfg.MakeCoinForGasDenom(1e3)))
randoReceiver := util.SdkToEvmAddress(app.RandomAddress()) randoReceiver := util.SdkToEvmAddress(app.RandomAddress())
// get min gas price for evm (from app.toml) // get min gas price for evm (from app.toml)
minFees, err := getMinFeeFromAppToml(util.ZgChainHomePath()) minFees, err := getMinFeeFromAppToml(util.ZgChainHomePath())
suite.NoError(err) suite.NoError(err)
minGasPrice := minFees.AmountOf(chaincfg.BaseDenom).TruncateInt() minGasPrice := minFees.AmountOf(chaincfg.EvmDenom).TruncateInt()
// attempt tx with less than min gas price (min fee - 1) // attempt tx with less than min gas price (min fee - 1)
tooLowGasPrice := minGasPrice.Sub(sdk.OneInt()).BigInt() tooLowGasPrice := minGasPrice.Sub(sdk.OneInt()).BigInt()

View File

@ -25,7 +25,7 @@ import (
) )
var ( var (
minEvmGasPrice = big.NewInt(1e10) // base denom minEvmGasPrice = big.NewInt(1e10) // evm denom
) )
type IntegrationTestSuite struct { type IntegrationTestSuite struct {
@ -54,7 +54,7 @@ func (suite *IntegrationTestSuite) TestChainID() {
// example test that funds a new account & queries its balance // example test that funds a new account & queries its balance
func (suite *IntegrationTestSuite) TestFundedAccount() { func (suite *IntegrationTestSuite) TestFundedAccount() {
funds := chaincfg.MakeCoinForAuxiliaryDenom(1e3) funds := chaincfg.MakeCoinForGasDenom(1e3)
acc := suite.ZgChain.NewFundedAccount("example-acc", sdk.NewCoins(funds)) acc := suite.ZgChain.NewFundedAccount("example-acc", sdk.NewCoins(funds))
// check that the sdk & evm signers are for the same account // check that the sdk & evm signers are for the same account
@ -63,21 +63,21 @@ func (suite *IntegrationTestSuite) TestFundedAccount() {
// check balance via SDK query // check balance via SDK query
res, err := suite.ZgChain.Bank.Balance(context.Background(), banktypes.NewQueryBalanceRequest( res, err := suite.ZgChain.Bank.Balance(context.Background(), banktypes.NewQueryBalanceRequest(
acc.SdkAddress, chaincfg.AuxiliaryDenom, acc.SdkAddress, chaincfg.GasDenom,
)) ))
suite.NoError(err) suite.NoError(err)
suite.Equal(funds, *res.Balance) suite.Equal(funds, *res.Balance)
// check balance via EVM query // check balance via EVM query
baseDenomBal, err := suite.ZgChain.EvmClient.BalanceAt(context.Background(), acc.EvmAddress, nil) evmDenomBal, err := suite.ZgChain.EvmClient.BalanceAt(context.Background(), acc.EvmAddress, nil)
suite.NoError(err) suite.NoError(err)
suite.Equal(funds.Amount.MulRaw(1e12).BigInt(), baseDenomBal) suite.Equal(funds.Amount.MulRaw(1e12).BigInt(), evmDenomBal)
} }
// example test that signs & broadcasts an EVM tx // example test that signs & broadcasts an EVM tx
func (suite *IntegrationTestSuite) TestTransferOverEVM() { func (suite *IntegrationTestSuite) TestTransferOverEVM() {
// fund an account that can perform the transfer // fund an account that can perform the transfer
initialFunds := chaincfg.MakeCoinForAuxiliaryDenom(1e6) // 1 (auxiliary denom) initialFunds := chaincfg.MakeCoinForGasDenom(1e6) // 1 (gas denom)
acc := suite.ZgChain.NewFundedAccount("evm-test-transfer", sdk.NewCoins(initialFunds)) acc := suite.ZgChain.NewFundedAccount("evm-test-transfer", sdk.NewCoins(initialFunds))
// get a rando account to send 0gchain to // get a rando account to send 0gchain to
@ -89,10 +89,10 @@ func (suite *IntegrationTestSuite) TestTransferOverEVM() {
suite.NoError(err) suite.NoError(err)
suite.Equal(uint64(0), nonce) // sanity check. the account should have no prior txs suite.Equal(uint64(0), nonce) // sanity check. the account should have no prior txs
// transfer auxiliary denom over EVM // transfer gas denom over EVM
AuxiliaryDenomToTransfer := big.NewInt(1e17) // .1 (auxiliary denom); base denom has 18 decimals. GasDenomToTransfer := big.NewInt(1e17) // .1 (gas denom); evm denom has 18 decimals.
req := util.EvmTxRequest{ req := util.EvmTxRequest{
Tx: ethtypes.NewTransaction(nonce, to, AuxiliaryDenomToTransfer, 1e5, minEvmGasPrice, nil), Tx: ethtypes.NewTransaction(nonce, to, GasDenomToTransfer, 1e5, minEvmGasPrice, nil),
Data: "any ol' data to track this through the system", Data: "any ol' data to track this through the system",
} }
res := acc.SignAndBroadcastEvmTx(req) res := acc.SignAndBroadcastEvmTx(req)
@ -100,31 +100,31 @@ func (suite *IntegrationTestSuite) TestTransferOverEVM() {
suite.Equal(ethtypes.ReceiptStatusSuccessful, res.Receipt.Status) suite.Equal(ethtypes.ReceiptStatusSuccessful, res.Receipt.Status)
// evm txs refund unused gas. so to know the expected balance we need to know how much gas was used. // evm txs refund unused gas. so to know the expected balance we need to know how much gas was used.
AuxiliaryDenomUsedForGas := sdkmath.NewIntFromBigInt(minEvmGasPrice). GasDenomUsedForGas := sdkmath.NewIntFromBigInt(minEvmGasPrice).
Mul(sdkmath.NewIntFromUint64(res.Receipt.GasUsed)). Mul(sdkmath.NewIntFromUint64(res.Receipt.GasUsed)).
QuoRaw(1e12) // convert base denom to auxiliary denom QuoRaw(1e12) // convert evm denom to gas denom
// expect (9 - gas used) (auxiliary denom) remaining in account. // expect (9 - gas used) (gas denom) remaining in account.
balance := suite.ZgChain.QuerySdkForBalances(acc.SdkAddress) balance := suite.ZgChain.QuerySdkForBalances(acc.SdkAddress)
suite.Equal(sdkmath.NewInt(9e5).Sub(AuxiliaryDenomUsedForGas), balance.AmountOf(chaincfg.AuxiliaryDenom)) suite.Equal(sdkmath.NewInt(9e5).Sub(GasDenomUsedForGas), balance.AmountOf(chaincfg.GasDenom))
} }
// TestIbcTransfer transfers (auxiliary denom) from the primary 0g-chain (suite.ZgChain) to the ibc chain (suite.Ibc). // TestIbcTransfer transfers (gas denom) from the primary 0g-chain (suite.ZgChain) to the ibc chain (suite.Ibc).
// Note that because the IBC chain also runs 0g-chain's binary, this tests both the sending & receiving. // Note that because the IBC chain also runs 0g-chain's binary, this tests both the sending & receiving.
func (suite *IntegrationTestSuite) TestIbcTransfer() { func (suite *IntegrationTestSuite) TestIbcTransfer() {
suite.SkipIfIbcDisabled() suite.SkipIfIbcDisabled()
// ARRANGE // ARRANGE
// setup 0g-chain account // setup 0g-chain account
funds := chaincfg.MakeCoinForAuxiliaryDenom(1e5) // .1 (auxiliary denom) funds := chaincfg.MakeCoinForGasDenom(1e5) // .1 (gas denom)
zgChainAcc := suite.ZgChain.NewFundedAccount("ibc-transfer-0g-side", sdk.NewCoins(funds)) zgChainAcc := suite.ZgChain.NewFundedAccount("ibc-transfer-0g-side", sdk.NewCoins(funds))
// setup ibc account // setup ibc account
ibcAcc := suite.Ibc.NewFundedAccount("ibc-transfer-ibc-side", sdk.NewCoins()) ibcAcc := suite.Ibc.NewFundedAccount("ibc-transfer-ibc-side", sdk.NewCoins())
gasLimit := int64(2e5) gasLimit := int64(2e5)
fee := chaincfg.MakeCoinForAuxiliaryDenom(200) fee := chaincfg.MakeCoinForGasDenom(200)
fundsToSend := chaincfg.MakeCoinForAuxiliaryDenom(5e4) // .005 (auxiliary denom) fundsToSend := chaincfg.MakeCoinForGasDenom(5e4) // .005 (gas denom)
transferMsg := ibctypes.NewMsgTransfer( transferMsg := ibctypes.NewMsgTransfer(
testutil.IbcPort, testutil.IbcPort,
testutil.IbcChannel, testutil.IbcChannel,
@ -154,7 +154,7 @@ func (suite *IntegrationTestSuite) TestIbcTransfer() {
// the balance should be deducted from 0g-chain account // the balance should be deducted from 0g-chain account
suite.Eventually(func() bool { suite.Eventually(func() bool {
balance := suite.ZgChain.QuerySdkForBalances(zgChainAcc.SdkAddress) balance := suite.ZgChain.QuerySdkForBalances(zgChainAcc.SdkAddress)
return balance.AmountOf(chaincfg.AuxiliaryDenom).Equal(expectedSrcBalance.Amount) return balance.AmountOf(chaincfg.GasDenom).Equal(expectedSrcBalance.Amount)
}, 10*time.Second, 1*time.Second) }, 10*time.Second, 1*time.Second)
// expect the balance to be transferred to the ibc chain! // expect the balance to be transferred to the ibc chain!

View File

@ -74,7 +74,7 @@ var (
EvmRpcUrl: "http://localhost:8545", EvmRpcUrl: "http://localhost:8545",
ChainId: "0gchainlocalnet_8888-1", ChainId: "0gchainlocalnet_8888-1",
StakingDenom: chaincfg.AuxiliaryDenom, StakingDenom: chaincfg.GasDenom,
} }
kvtoolIbcChain = ChainDetails{ kvtoolIbcChain = ChainDetails{
RpcUrl: "http://localhost:26658", RpcUrl: "http://localhost:26658",

View File

@ -258,7 +258,7 @@ func (a *SigningAccount) BankSend(to sdk.AccAddress, amount sdk.Coins) util.ZgCh
util.ZgChainMsgRequest{ util.ZgChainMsgRequest{
Msgs: []sdk.Msg{banktypes.NewMsgSend(a.SdkAddress, to, amount)}, Msgs: []sdk.Msg{banktypes.NewMsgSend(a.SdkAddress, to, amount)},
GasLimit: 2e5, // 200,000 gas GasLimit: 2e5, // 200,000 gas
FeeAmount: sdk.NewCoins(sdk.NewCoin(a.gasDenom, sdkmath.NewInt(200))), // assume min gas price of .001 auxiliary denom FeeAmount: sdk.NewCoins(sdk.NewCoin(a.gasDenom, sdkmath.NewInt(200))), // assume min gas price of .001 gas denom
Data: fmt.Sprintf("sending %s to %s", amount, to), Data: fmt.Sprintf("sending %s to %s", amount, to),
}, },
) )

View File

@ -98,7 +98,7 @@ message Metadata {
string description = 1; string description = 1;
// denom_units represents the list of DenomUnit's for a given coin // denom_units represents the list of DenomUnit's for a given coin
repeated DenomUnit denom_units = 2; repeated DenomUnit denom_units = 2;
// base represents the base denom (should be the DenomUnit with exponent = 0). // base represents the evm denom (should be the DenomUnit with exponent = 0).
string base = 3; string base = 3;
// display indicates the suggested denom that should be // display indicates the suggested denom that should be
// displayed in clients. // displayed in clients.

View File

@ -234,18 +234,18 @@ message Tip {
string tipper = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; string tipper = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
} }
// AuxSignerData is the intermediary format that an auxiliary signer (e.g. a // AuxSignerData is the intermediary format that an gas signer (e.g. a
// tipper) builds and sends to the fee payer (who will build and broadcast the // tipper) builds and sends to the fee payer (who will build and broadcast the
// actual tx). AuxSignerData is not a valid tx in itself, and will be rejected // actual tx). AuxSignerData is not a valid tx in itself, and will be rejected
// by the node if sent directly as-is. // by the node if sent directly as-is.
// //
// Since: cosmos-sdk 0.46 // Since: cosmos-sdk 0.46
message AuxSignerData { message AuxSignerData {
// address is the bech32-encoded address of the auxiliary signer. If using // address is the bech32-encoded address of the gas signer. If using
// AuxSignerData across different chains, the bech32 prefix of the target // AuxSignerData across different chains, the bech32 prefix of the target
// chain (where the final transaction is broadcasted) should be used. // chain (where the final transaction is broadcasted) should be used.
string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// sign_doc is the SIGN_MODE_DIRECT_AUX sign doc that the auxiliary signer // sign_doc is the SIGN_MODE_DIRECT_AUX sign doc that the gas signer
// signs. Note: we use the same sign doc even if we're signing with // signs. Note: we use the same sign doc even if we're signing with
// LEGACY_AMINO_JSON. // LEGACY_AMINO_JSON.
SignDocDirectAux sign_doc = 2; SignDocDirectAux sign_doc = 2;

View File

@ -6,13 +6,13 @@ option go_package = "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types";
import "gogoproto/gogo.proto"; import "gogoproto/gogo.proto";
// DenomTrace contains the base denomination for ICS20 fungible tokens and the // DenomTrace contains the evm denomination for ICS20 fungible tokens and the
// source tracing information path. // source tracing information path.
message DenomTrace { message DenomTrace {
// path defines the chain of port/channel identifiers used for tracing the // path defines the chain of port/channel identifiers used for tracing the
// source of the fungible token. // source of the fungible token.
string path = 1; string path = 1;
// base denomination of the relayed fungible token. // evm denomination of the relayed fungible token.
string base_denom = 2; string base_denom = 2;
} }

View File

@ -36,7 +36,7 @@ func (suite *MsgServerTestSuite) SetupTest() {
// Set up genesis state and initialize // Set up genesis state and initialize
_, addrs := app.GeneratePrivKeyAddressPairs(3) _, addrs := app.GeneratePrivKeyAddressPairs(3)
coins := sdk.NewCoins(c("bnb", 10000000000), c(chaincfg.AuxiliaryDenom, 10000)) coins := sdk.NewCoins(c("bnb", 10000000000), c(chaincfg.GasDenom, 10000))
authGS := app.NewFundedGenStateWithSameCoins(tApp.AppCodec(), coins, addrs) authGS := app.NewFundedGenStateWithSameCoins(tApp.AppCodec(), coins, addrs)
tApp.InitializeFromGenesisStates(authGS, NewBep3GenStateMulti(cdc, addrs[0])) tApp.InitializeFromGenesisStates(authGS, NewBep3GenStateMulti(cdc, addrs[0]))

View File

@ -20,7 +20,7 @@ type GenesisTestSuite struct {
} }
func (suite *GenesisTestSuite) SetupTest() { func (suite *GenesisTestSuite) SetupTest() {
coin := chaincfg.MakeCoinForAuxiliaryDenom(1) coin := chaincfg.MakeCoinForGasDenom(1)
suite.swaps = atomicSwaps(10) suite.swaps = atomicSwaps(10)
supply := types.NewAssetSupply(coin, coin, coin, coin, time.Duration(0)) supply := types.NewAssetSupply(coin, coin, coin, coin, time.Duration(0))

View File

@ -11,7 +11,7 @@ import (
) )
func TestAssetSupplyValidate(t *testing.T) { func TestAssetSupplyValidate(t *testing.T) {
coin := chaincfg.MakeCoinForAuxiliaryDenom(1) coin := chaincfg.MakeCoinForGasDenom(1)
invalidCoin := sdk.Coin{Denom: "Invalid Denom", Amount: sdkmath.NewInt(-1)} invalidCoin := sdk.Coin{Denom: "Invalid Denom", Amount: sdkmath.NewInt(-1)}
testCases := []struct { testCases := []struct {
msg string msg string

View File

@ -61,7 +61,7 @@ func (suite *MsgServerTestSuite) SetupTest() {
[]types.Proposal{}, []types.Proposal{},
[]types.Vote{}, []types.Vote{},
) )
suite.communityPoolAmt = sdk.NewCoins(chaincfg.MakeCoinForBaseDenom(1000000000000000)) suite.communityPoolAmt = sdk.NewCoins(chaincfg.MakeCoinForEvmDenom(1000000000000000))
suite.app.InitializeFromGenesisStates( suite.app.InitializeFromGenesisStates(
app.GenesisState{types.ModuleName: cdc.MustMarshalJSON(testGenesis)}, app.GenesisState{types.ModuleName: cdc.MustMarshalJSON(testGenesis)},
// TODO: not used? // TODO: not used?

View File

@ -171,7 +171,7 @@ func NewVoteCmd() *cobra.Command {
tokens = val.GetTokens() tokens = val.GetTokens()
} }
} }
// the denom of token is base denom, need to convert to A0GI // the denom of token is evm denom, need to convert to A0GI
a0giTokenCnt := tokens.Quo(sdk.NewInt(1_000_000_000_000_000_000)) a0giTokenCnt := tokens.Quo(sdk.NewInt(1_000_000_000_000_000_000))
// 1_000 0AGI token / vote // 1_000 0AGI token / vote
numBallots := a0giTokenCnt.Quo(sdk.NewInt(1_000)).Uint64() numBallots := a0giTokenCnt.Quo(sdk.NewInt(1_000)).Uint64()

View File

@ -50,7 +50,7 @@ func (suite *invariantTestSuite) SetupValidState() {
suite.FundModuleAccountWithZgChain( suite.FundModuleAccountWithZgChain(
types.ModuleName, types.ModuleName,
sdk.NewCoins( sdk.NewCoins(
sdk.NewCoin(chaincfg.AuxiliaryDenom, sdkmath.NewInt(2)), // ( sum of all minor balances ) / conversion multiplier sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(2)), // ( sum of all minor balances ) / conversion multiplier
), ),
) )

View File

@ -115,7 +115,7 @@ func (k Keeper) SetAccount(ctx sdk.Context, account types.Account) error {
return nil return nil
} }
// GetBalance returns the total balance of base denom for a given account by address. // GetBalance returns the total balance of evm denom for a given account by address.
func (k Keeper) GetBalance(ctx sdk.Context, addr sdk.AccAddress) sdkmath.Int { func (k Keeper) GetBalance(ctx sdk.Context, addr sdk.AccAddress) sdkmath.Int {
account := k.GetAccount(ctx, addr) account := k.GetAccount(ctx, addr)
if account == nil { if account == nil {
@ -124,7 +124,7 @@ func (k Keeper) GetBalance(ctx sdk.Context, addr sdk.AccAddress) sdkmath.Int {
return account.Balance return account.Balance
} }
// SetBalance sets the total balance of base denom for a given account by address. // SetBalance sets the total balance of evm denom for a given account by address.
func (k Keeper) SetBalance(ctx sdk.Context, addr sdk.AccAddress, bal sdkmath.Int) error { func (k Keeper) SetBalance(ctx sdk.Context, addr sdk.AccAddress, bal sdkmath.Int) error {
account := k.GetAccount(ctx, addr) account := k.GetAccount(ctx, addr)
if account == nil { if account == nil {
@ -140,10 +140,10 @@ func (k Keeper) SetBalance(ctx sdk.Context, addr sdk.AccAddress, bal sdkmath.Int
return k.SetAccount(ctx, *account) return k.SetAccount(ctx, *account)
} }
// SendBalance transfers the base denom balance from sender addr to recipient addr. // SendBalance transfers the evm denom balance from sender addr to recipient addr.
func (k Keeper) SendBalance(ctx sdk.Context, senderAddr sdk.AccAddress, recipientAddr sdk.AccAddress, amt sdkmath.Int) error { func (k Keeper) SendBalance(ctx sdk.Context, senderAddr sdk.AccAddress, recipientAddr sdk.AccAddress, amt sdkmath.Int) error {
if amt.IsNegative() { if amt.IsNegative() {
return fmt.Errorf("cannot send a negative amount of base denom: %d", amt) return fmt.Errorf("cannot send a negative amount of evm denom: %d", amt)
} }
if amt.IsZero() { if amt.IsZero() {
@ -162,13 +162,13 @@ func (k Keeper) SendBalance(ctx sdk.Context, senderAddr sdk.AccAddress, recipien
return k.SetBalance(ctx, recipientAddr, receiverBal) return k.SetBalance(ctx, recipientAddr, receiverBal)
} }
// AddBalance increments the base denom balance of an address. // AddBalance increments the evm denom balance of an address.
func (k Keeper) AddBalance(ctx sdk.Context, addr sdk.AccAddress, amt sdkmath.Int) error { func (k Keeper) AddBalance(ctx sdk.Context, addr sdk.AccAddress, amt sdkmath.Int) error {
bal := k.GetBalance(ctx, addr) bal := k.GetBalance(ctx, addr)
return k.SetBalance(ctx, addr, amt.Add(bal)) return k.SetBalance(ctx, addr, amt.Add(bal))
} }
// RemoveBalance decrements the base denom balance of an address. // RemoveBalance decrements the evm denom balance of an address.
func (k Keeper) RemoveBalance(ctx sdk.Context, addr sdk.AccAddress, amt sdkmath.Int) error { func (k Keeper) RemoveBalance(ctx sdk.Context, addr sdk.AccAddress, amt sdkmath.Int) error {
if amt.IsNegative() { if amt.IsNegative() {
return fmt.Errorf("cannot remove a negative amount from balance: %d", amt) return fmt.Errorf("cannot remove a negative amount from balance: %d", amt)

View File

@ -80,14 +80,14 @@ func (suite *Suite) SetupTest() {
suite.Addrs = addrs suite.Addrs = addrs
evmGenesis := evmtypes.DefaultGenesisState() evmGenesis := evmtypes.DefaultGenesisState()
evmGenesis.Params.EvmDenom = chaincfg.BaseDenom evmGenesis.Params.EvmDenom = chaincfg.EvmDenom
feemarketGenesis := feemarkettypes.DefaultGenesisState() feemarketGenesis := feemarkettypes.DefaultGenesisState()
feemarketGenesis.Params.EnableHeight = 1 feemarketGenesis.Params.EnableHeight = 1
feemarketGenesis.Params.NoBaseFee = false feemarketGenesis.Params.NoBaseFee = false
cdc := suite.App.AppCodec() cdc := suite.App.AppCodec()
coins := sdk.NewCoins(sdk.NewInt64Coin(chaincfg.AuxiliaryDenom, 1000_000_000_000_000_000)) coins := sdk.NewCoins(sdk.NewInt64Coin(chaincfg.GasDenom, 1000_000_000_000_000_000))
authGS := app.NewFundedGenStateWithSameCoins(cdc, coins, []sdk.AccAddress{ authGS := app.NewFundedGenStateWithSameCoins(cdc, coins, []sdk.AccAddress{
sdk.AccAddress(suite.Key1.PubKey().Address()), sdk.AccAddress(suite.Key1.PubKey().Address()),
sdk.AccAddress(suite.Key2.PubKey().Address()), sdk.AccAddress(suite.Key2.PubKey().Address()),
@ -184,28 +184,28 @@ func (suite *Suite) ModuleBalance(denom string) sdk.Int {
} }
func (suite *Suite) FundAccountWithZgChain(addr sdk.AccAddress, coins sdk.Coins) { func (suite *Suite) FundAccountWithZgChain(addr sdk.AccAddress, coins sdk.Coins) {
AuxiliaryDenomAmt := coins.AmountOf(chaincfg.AuxiliaryDenom) GasDenomAmt := coins.AmountOf(chaincfg.GasDenom)
if AuxiliaryDenomAmt.IsPositive() { if GasDenomAmt.IsPositive() {
err := suite.App.FundAccount(suite.Ctx, addr, sdk.NewCoins(sdk.NewCoin(chaincfg.AuxiliaryDenom, AuxiliaryDenomAmt))) err := suite.App.FundAccount(suite.Ctx, addr, sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, GasDenomAmt)))
suite.Require().NoError(err) suite.Require().NoError(err)
} }
baseDenomAmt := coins.AmountOf(chaincfg.BaseDenom) evmDenomAmt := coins.AmountOf(chaincfg.EvmDenom)
if baseDenomAmt.IsPositive() { if evmDenomAmt.IsPositive() {
err := suite.Keeper.SetBalance(suite.Ctx, addr, baseDenomAmt) err := suite.Keeper.SetBalance(suite.Ctx, addr, evmDenomAmt)
suite.Require().NoError(err) suite.Require().NoError(err)
} }
} }
func (suite *Suite) FundModuleAccountWithZgChain(moduleName string, coins sdk.Coins) { func (suite *Suite) FundModuleAccountWithZgChain(moduleName string, coins sdk.Coins) {
AuxiliaryDenomAmt := coins.AmountOf(chaincfg.AuxiliaryDenom) GasDenomAmt := coins.AmountOf(chaincfg.GasDenom)
if AuxiliaryDenomAmt.IsPositive() { if GasDenomAmt.IsPositive() {
err := suite.App.FundModuleAccount(suite.Ctx, moduleName, sdk.NewCoins(sdk.NewCoin(chaincfg.AuxiliaryDenom, AuxiliaryDenomAmt))) err := suite.App.FundModuleAccount(suite.Ctx, moduleName, sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, GasDenomAmt)))
suite.Require().NoError(err) suite.Require().NoError(err)
} }
baseDenomAmt := coins.AmountOf(chaincfg.BaseDenom) evmDenomAmt := coins.AmountOf(chaincfg.EvmDenom)
if baseDenomAmt.IsPositive() { if evmDenomAmt.IsPositive() {
addr := suite.AccountKeeper.GetModuleAddress(moduleName) addr := suite.AccountKeeper.GetModuleAddress(moduleName)
err := suite.Keeper.SetBalance(suite.Ctx, addr, baseDenomAmt) err := suite.Keeper.SetBalance(suite.Ctx, addr, evmDenomAmt)
suite.Require().NoError(err) suite.Require().NoError(err)
} }
} }
@ -216,7 +216,7 @@ func (suite *Suite) DeployERC20() types.InternalEVMAddress {
suite.App.FundModuleAccount( suite.App.FundModuleAccount(
suite.Ctx, suite.Ctx,
types.ModuleName, types.ModuleName,
sdk.NewCoins(sdk.NewCoin(chaincfg.AuxiliaryDenom, sdkmath.NewInt(0))), sdk.NewCoins(sdk.NewCoin(chaincfg.GasDenom, sdkmath.NewInt(0))),
) )
contractAddr, err := suite.Keeper.DeployTestMintableERC20Contract(suite.Ctx, "USDC", "USDC", uint8(18)) contractAddr, err := suite.Keeper.DeployTestMintableERC20Contract(suite.Ctx, "USDC", "USDC", uint8(18))
@ -317,7 +317,7 @@ func (suite *Suite) SendTx(
// Mint the max gas to the FeeCollector to ensure balance in case of refund // Mint the max gas to the FeeCollector to ensure balance in case of refund
suite.MintFeeCollector(sdk.NewCoins( suite.MintFeeCollector(sdk.NewCoins(
sdk.NewCoin( sdk.NewCoin(
chaincfg.AuxiliaryDenom, chaincfg.GasDenom,
sdkmath.NewInt(baseFee.Int64()*int64(gasRes.Gas*2)), sdkmath.NewInt(baseFee.Int64()*int64(gasRes.Gas*2)),
))) )))

View File

@ -143,7 +143,7 @@ func TestConversionPairs_Validate(t *testing.T) {
), ),
types.NewConversionPair( types.NewConversionPair(
testutil.MustNewInternalEVMAddressFromString("0x000000000000000000000000000000000000000A"), testutil.MustNewInternalEVMAddressFromString("0x000000000000000000000000000000000000000A"),
chaincfg.AuxiliaryDenom, chaincfg.GasDenom,
), ),
types.NewConversionPair( types.NewConversionPair(
testutil.MustNewInternalEVMAddressFromString("0x000000000000000000000000000000000000000B"), testutil.MustNewInternalEVMAddressFromString("0x000000000000000000000000000000000000000B"),
@ -163,7 +163,7 @@ func TestConversionPairs_Validate(t *testing.T) {
), ),
types.NewConversionPair( types.NewConversionPair(
testutil.MustNewInternalEVMAddressFromString("0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"), testutil.MustNewInternalEVMAddressFromString("0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"),
chaincfg.AuxiliaryDenom, chaincfg.GasDenom,
), ),
types.NewConversionPair( types.NewConversionPair(
testutil.MustNewInternalEVMAddressFromString("0x000000000000000000000000000000000000000B"), testutil.MustNewInternalEVMAddressFromString("0x000000000000000000000000000000000000000B"),
@ -184,16 +184,16 @@ func TestConversionPairs_Validate(t *testing.T) {
), ),
types.NewConversionPair( types.NewConversionPair(
testutil.MustNewInternalEVMAddressFromString("0x000000000000000000000000000000000000000A"), testutil.MustNewInternalEVMAddressFromString("0x000000000000000000000000000000000000000A"),
chaincfg.AuxiliaryDenom, chaincfg.GasDenom,
), ),
types.NewConversionPair( types.NewConversionPair(
testutil.MustNewInternalEVMAddressFromString("0x000000000000000000000000000000000000000B"), testutil.MustNewInternalEVMAddressFromString("0x000000000000000000000000000000000000000B"),
chaincfg.AuxiliaryDenom, chaincfg.GasDenom,
), ),
), ),
errArgs{ errArgs{
expectPass: false, expectPass: false,
contains: "found duplicate enabled conversion pair denom " + chaincfg.AuxiliaryDenom, contains: "found duplicate enabled conversion pair denom " + chaincfg.GasDenom,
}, },
}, },
{ {
@ -209,7 +209,7 @@ func TestConversionPairs_Validate(t *testing.T) {
), ),
types.NewConversionPair( types.NewConversionPair(
testutil.MustNewInternalEVMAddressFromString("0x000000000000000000000000000000000000000B"), testutil.MustNewInternalEVMAddressFromString("0x000000000000000000000000000000000000000B"),
chaincfg.AuxiliaryDenom, chaincfg.GasDenom,
), ),
), ),
errArgs{ errArgs{

View File

@ -107,11 +107,11 @@ func (suite *ParamsTestSuite) TestParams_Validate() {
invalidConversionPairs := types.NewConversionPairs( invalidConversionPairs := types.NewConversionPairs(
types.NewConversionPair( types.NewConversionPair(
testutil.MustNewInternalEVMAddressFromString("0x000000000000000000000000000000000000000A"), testutil.MustNewInternalEVMAddressFromString("0x000000000000000000000000000000000000000A"),
chaincfg.AuxiliaryDenom, chaincfg.GasDenom,
), ),
types.NewConversionPair( types.NewConversionPair(
testutil.MustNewInternalEVMAddressFromString("0x000000000000000000000000000000000000000B"), testutil.MustNewInternalEVMAddressFromString("0x000000000000000000000000000000000000000B"),
chaincfg.AuxiliaryDenom, // duplicate denom! chaincfg.GasDenom, // duplicate denom!
), ),
) )
validAllowedCosmosDenoms := types.NewAllowedCosmosCoinERC20Tokens( validAllowedCosmosDenoms := types.NewAllowedCosmosCoinERC20Tokens(

View File

@ -10,7 +10,7 @@ import (
func TestRawPriceKey_Iteration(t *testing.T) { func TestRawPriceKey_Iteration(t *testing.T) {
// An iterator key should only match price keys with the same market // An iterator key should only match price keys with the same market
iteratorKey := RawPriceIteratorKey(chaincfg.AuxiliaryDenom + ":usd") iteratorKey := RawPriceIteratorKey(chaincfg.GasDenom + ":usd")
addr := sdk.AccAddress("test addr") addr := sdk.AccAddress("test addr")
@ -21,12 +21,12 @@ func TestRawPriceKey_Iteration(t *testing.T) {
}{ }{
{ {
name: "equal marketID is included in iteration", name: "equal marketID is included in iteration",
priceKey: RawPriceKey(chaincfg.AuxiliaryDenom+":usd", addr), priceKey: RawPriceKey(chaincfg.GasDenom+":usd", addr),
expectErr: false, expectErr: false,
}, },
{ {
name: "prefix overlapping marketID excluded from iteration", name: "prefix overlapping marketID excluded from iteration",
priceKey: RawPriceKey(chaincfg.AuxiliaryDenom+":usd:30", addr), priceKey: RawPriceKey(chaincfg.GasDenom+":usd:30", addr),
expectErr: true, expectErr: true,
}, },
} }