This commit is contained in:
0xsatoshi 2024-05-04 14:26:54 +08:00 committed by 0g-wh
parent 69a4a6298e
commit e952a4a705
14 changed files with 80 additions and 117 deletions

View File

@ -10,7 +10,6 @@ import (
sdkmath "cosmossdk.io/math"
"github.com/0glabs/0g-chain/app"
"github.com/0glabs/0g-chain/chaincfg"
abci "github.com/cometbft/cometbft/abci/types"
tmbytes "github.com/cometbft/cometbft/libs/bytes"
@ -63,11 +62,11 @@ func (suite *SimulateRequestTestSuite) TestSimulateRequest() {
bank.MsgSend{
FromAddress: fromAddr,
ToAddress: toAddr,
Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.DisplayDenom, sdkmath.NewInt(1e6))),
Amount: sdk.NewCoins(sdk.NewCoin("ua0gi", sdkmath.NewInt(1e6))),
},
},
Fee: auth.StdFee{
Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.DisplayDenom, sdkmath.NewInt(5e4))),
Amount: sdk.NewCoins(sdk.NewCoin("ua0gi", sdkmath.NewInt(5e4))),
Gas: 1e6,
},
Memo: "test memo",

View File

@ -16,7 +16,6 @@ import (
"github.com/0glabs/0g-chain/app"
"github.com/0glabs/0g-chain/app/ante"
"github.com/0glabs/0g-chain/chaincfg"
)
func newMsgGrant(granter sdk.AccAddress, grantee sdk.AccAddress, a authz.Authorization, expiration time.Time) *authz.MsgGrant {
@ -59,7 +58,7 @@ func TestAuthzLimiterDecorator(t *testing.T) {
banktypes.NewMsgSend(
testAddresses[0],
testAddresses[1],
sdk.NewCoins(sdk.NewInt64Coin(chaincfg.DisplayDenom, 100)),
sdk.NewCoins(sdk.NewInt64Coin("ua0gi", 100e6)),
),
},
checkTx: false,
@ -129,7 +128,7 @@ func TestAuthzLimiterDecorator(t *testing.T) {
[]sdk.Msg{banktypes.NewMsgSend(
testAddresses[0],
testAddresses[3],
sdk.NewCoins(sdk.NewInt64Coin(chaincfg.DisplayDenom, 100)),
sdk.NewCoins(sdk.NewInt64Coin("ua0gi", 100e6)),
)}),
},
checkTx: false,
@ -162,7 +161,7 @@ func TestAuthzLimiterDecorator(t *testing.T) {
banktypes.NewMsgSend(
testAddresses[0],
testAddresses[3],
sdk.NewCoins(sdk.NewInt64Coin(chaincfg.DisplayDenom, 100)),
sdk.NewCoins(sdk.NewInt64Coin("ua0gi", 100e6)),
),
&evmtypes.MsgEthereumTx{},
},

View File

@ -34,7 +34,6 @@ import (
"github.com/stretchr/testify/suite"
"github.com/0glabs/0g-chain/app"
"github.com/0glabs/0g-chain/chaincfg"
evmutilkeeper "github.com/0glabs/0g-chain/x/evmutil/keeper"
evmutiltestutil "github.com/0glabs/0g-chain/x/evmutil/testutil"
evmutiltypes "github.com/0glabs/0g-chain/x/evmutil/types"
@ -157,7 +156,7 @@ func (suite *EIP712TestSuite) SetupTest() {
// Genesis states
evmGs := evmtypes.NewGenesisState(
evmtypes.NewParams(
chaincfg.BaseDenom, // evmDenom
"neuron", // evmDenom
false, // allowedUnprotectedTxs
true, // enableCreate
true, // enableCall
@ -224,10 +223,10 @@ func (suite *EIP712TestSuite) SetupTest() {
pricefeedtypes.ModuleName: cdc.MustMarshalJSON(&pricefeedGenState),
}
// funds our test accounts with some a0gi
// funds our test accounts with some ua0gi
coinsGenState := app.NewFundedGenStateWithSameCoins(
tApp.AppCodec(),
sdk.NewCoins(sdk.NewInt64Coin(chaincfg.DisplayDenom, 1e3)),
sdk.NewCoins(sdk.NewInt64Coin("ua0gi", 1e9)),
[]sdk.AccAddress{suite.testAddr, suite.testAddr2},
)
@ -377,7 +376,7 @@ func (suite *EIP712TestSuite) deployUSDCERC20(app app.TestApp, ctx sdk.Context)
suite.tApp.FundModuleAccount(
suite.ctx,
evmutiltypes.ModuleName,
sdk.NewCoins(sdk.NewCoin(chaincfg.DisplayDenom, sdkmath.NewInt(0))),
sdk.NewCoins(sdk.NewCoin("ua0gi", sdkmath.NewInt(0))),
)
contractAddr, err := suite.evmutilKeeper.DeployTestMintableERC20Contract(suite.ctx, "USDC", "USDC", uint8(18))
@ -477,7 +476,7 @@ func (suite *EIP712TestSuite) TestEIP712Tx() {
errMsg: "insufficient funds",
updateTx: func(txBuilder client.TxBuilder, msgs []sdk.Msg) client.TxBuilder {
bk := suite.tApp.GetBankKeeper()
gasCoins := bk.GetBalance(suite.ctx, suite.testAddr, chaincfg.DisplayDenom)
gasCoins := bk.GetBalance(suite.ctx, suite.testAddr, "ua0gi")
suite.tApp.GetBankKeeper().SendCoins(suite.ctx, suite.testAddr, suite.testAddr2, sdk.NewCoins(gasCoins))
return txBuilder
},
@ -489,7 +488,7 @@ func (suite *EIP712TestSuite) TestEIP712Tx() {
failCheckTx: true,
errMsg: "invalid chain-id",
updateTx: func(txBuilder client.TxBuilder, msgs []sdk.Msg) client.TxBuilder {
gasAmt := sdk.NewCoins(sdk.NewCoin(chaincfg.DisplayDenom, sdkmath.NewInt(20)))
gasAmt := sdk.NewCoins(sdk.NewCoin("ua0gi", sdkmath.NewInt(20)))
return suite.createTestEIP712CosmosTxBuilder(
suite.testAddr, suite.testPrivKey, "kavatest_12-1", uint64(sims.DefaultGenTxGas*10), gasAmt, msgs,
)
@ -502,7 +501,7 @@ func (suite *EIP712TestSuite) TestEIP712Tx() {
failCheckTx: true,
errMsg: "invalid pubkey",
updateTx: func(txBuilder client.TxBuilder, msgs []sdk.Msg) client.TxBuilder {
gasAmt := sdk.NewCoins(sdk.NewCoin(chaincfg.DisplayDenom, sdkmath.NewInt(20)))
gasAmt := sdk.NewCoins(sdk.NewCoin("ua0gi", sdkmath.NewInt(20)))
return suite.createTestEIP712CosmosTxBuilder(
suite.testAddr2, suite.testPrivKey2, ChainID, uint64(sims.DefaultGenTxGas*10), gasAmt, msgs,
)
@ -530,7 +529,7 @@ func (suite *EIP712TestSuite) TestEIP712Tx() {
msgs = tc.updateMsgs(msgs)
}
gasAmt := sdk.NewCoins(sdk.NewCoin(chaincfg.DisplayDenom, sdkmath.NewInt(20)))
gasAmt := sdk.NewCoins(sdk.NewCoin("ua0gi", sdkmath.NewInt(20)))
txBuilder := suite.createTestEIP712CosmosTxBuilder(
suite.testAddr, suite.testPrivKey, ChainID, uint64(sims.DefaultGenTxGas*10), gasAmt, msgs,
)
@ -604,7 +603,7 @@ func (suite *EIP712TestSuite) TestEIP712Tx_DepositAndWithdraw() {
}
// deliver deposit msg
gasAmt := sdk.NewCoins(sdk.NewCoin(chaincfg.DisplayDenom, sdkmath.NewInt(20)))
gasAmt := sdk.NewCoins(sdk.NewCoin("ua0gi", sdkmath.NewInt(20)))
txBuilder := suite.createTestEIP712CosmosTxBuilder(
suite.testAddr, suite.testPrivKey, ChainID, uint64(sims.DefaultGenTxGas*10), gasAmt, depositMsgs,
)

View File

@ -13,7 +13,6 @@ import (
"github.com/0glabs/0g-chain/app"
"github.com/0glabs/0g-chain/app/ante"
"github.com/0glabs/0g-chain/chaincfg"
)
func mustParseDecCoins(value string) sdk.DecCoins {
@ -31,7 +30,7 @@ func TestEvmMinGasFilter(t *testing.T) {
ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()})
tApp.GetEvmKeeper().SetParams(ctx, evmtypes.Params{
EvmDenom: chaincfg.BaseDenom,
EvmDenom: "neuron",
})
testCases := []struct {
@ -45,29 +44,29 @@ func TestEvmMinGasFilter(t *testing.T) {
mustParseDecCoins(""),
},
{
"zero a0gi gas price",
mustParseDecCoins("0a0gi"),
mustParseDecCoins("0a0gi"),
"zero ua0gi gas price",
mustParseDecCoins("0ua0gi"),
mustParseDecCoins("0ua0gi"),
},
{
"non-zero a0gi gas price",
mustParseDecCoins("0.001a0gi"),
mustParseDecCoins("0.001a0gi"),
"non-zero ua0gi gas price",
mustParseDecCoins("0.001ua0gi"),
mustParseDecCoins("0.001ua0gi"),
},
{
"zero a0gi gas price, min neuron price",
mustParseDecCoins("0a0gi;100000neuron"),
mustParseDecCoins("0a0gi"), // neuron is removed
"zero ua0gi gas price, min neuron price",
mustParseDecCoins("0ua0gi;100000neuron"),
mustParseDecCoins("0ua0gi"), // neuron is removed
},
{
"zero a0gi gas price, min neuron price, other token",
mustParseDecCoins("0a0gi;100000neuron;0.001other"),
mustParseDecCoins("0a0gi;0.001other"), // neuron is removed
"zero ua0gi gas price, min neuron price, other token",
mustParseDecCoins("0ua0gi;100000neuron;0.001other"),
mustParseDecCoins("0ua0gi;0.001other"), // neuron is removed
},
{
"non-zero a0gi gas price, min neuron price",
mustParseDecCoins("0.25a0gi;100000neuron;0.001other"),
mustParseDecCoins("0.25a0gi;0.001other"), // neuron is removed
"non-zero ua0gi gas price, min neuron price",
mustParseDecCoins("0.25ua0gi;100000neuron;0.001other"),
mustParseDecCoins("0.25ua0gi;0.001other"), // neuron is removed
},
}

View File

@ -14,7 +14,6 @@ import (
"github.com/0glabs/0g-chain/app"
"github.com/0glabs/0g-chain/app/ante"
"github.com/0glabs/0g-chain/chaincfg"
)
func TestVestingMempoolDecorator_MsgCreateVestingAccount_Unauthorized(t *testing.T) {
@ -34,7 +33,7 @@ func TestVestingMempoolDecorator_MsgCreateVestingAccount_Unauthorized(t *testing
"MsgCreateVestingAccount",
vesting.NewMsgCreateVestingAccount(
testAddresses[0], testAddresses[1],
sdk.NewCoins(sdk.NewInt64Coin(chaincfg.DisplayDenom, 100)),
sdk.NewCoins(sdk.NewInt64Coin("ua0gi", 100)),
time.Date(1998, 1, 1, 0, 0, 0, 0, time.UTC).Unix(),
false,
),
@ -45,7 +44,7 @@ func TestVestingMempoolDecorator_MsgCreateVestingAccount_Unauthorized(t *testing
"MsgCreateVestingAccount",
vesting.NewMsgCreatePermanentLockedAccount(
testAddresses[0], testAddresses[1],
sdk.NewCoins(sdk.NewInt64Coin(chaincfg.DisplayDenom, 100)),
sdk.NewCoins(sdk.NewInt64Coin("ua0gi", 100)),
),
true,
"MsgTypeURL /cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount not supported",
@ -64,7 +63,7 @@ func TestVestingMempoolDecorator_MsgCreateVestingAccount_Unauthorized(t *testing
"other messages not affected",
banktypes.NewMsgSend(
testAddresses[0], testAddresses[1],
sdk.NewCoins(sdk.NewInt64Coin(chaincfg.DisplayDenom, 100)),
sdk.NewCoins(sdk.NewInt64Coin("ua0gi", 100)),
),
false,
"",

View File

@ -294,9 +294,6 @@ type App struct {
}
func init() {
// 1stake = 1 ukava = 1_000_000_000_000 akava = 1_000_000_000_000 neuron
conversionMultiplier := sdkmath.NewIntFromUint64(1_000_000_000_000)
sdk.DefaultPowerReduction = sdk.DefaultPowerReduction.Mul(conversionMultiplier)
}
// NewApp returns a reference to an initialized App.

View File

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

View File

@ -1,27 +0,0 @@
package chaincfg
import (
sdk "github.com/cosmos/cosmos-sdk/types"
)
const (
// DisplayDenom defines the denomination displayed to users in client applications.
DisplayDenom = "a0gi"
// BaseDenom defines to the default denomination used in 0g-chain
BaseDenom = "neuron"
BaseDenomUnit = 18
ConversionMultiplier = 1e18
)
// RegisterDenoms registers the base and display denominations to the SDK.
func RegisterDenoms() {
if err := sdk.RegisterDenom(DisplayDenom, sdk.OneDec()); err != nil {
panic(err)
}
if err := sdk.RegisterDenom(BaseDenom, sdk.NewDecWithPrec(1, BaseDenomUnit)); err != nil {
panic(err)
}
}

View File

@ -11,7 +11,6 @@ import (
func main() {
chaincfg.SetSDKConfig().Seal()
chaincfg.RegisterDenoms()
rootCmd := NewRootCmd()

View File

@ -76,7 +76,7 @@ func NewRootCmd() *cobra.Command {
return err
}
customAppTemplate, customAppConfig := servercfg.AppConfig(chaincfg.BaseDenom)
customAppTemplate, customAppConfig := servercfg.AppConfig("ua0gi")
return server.InterceptConfigsPreRunHandler(
cmd,

View File

@ -5,7 +5,6 @@ import (
"time"
sdkmath "cosmossdk.io/math"
"github.com/0glabs/0g-chain/chaincfg"
"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
sdk "github.com/cosmos/cosmos-sdk/types"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
@ -42,7 +41,7 @@ func TestResetPeriodVestingAccount_NoVestingPeriods(t *testing.T) {
}
func TestResetPeriodVestingAccount_SingleVestingPeriod_Vested(t *testing.T) {
balance := sdk.NewCoins(sdk.NewCoin(chaincfg.DisplayDenom, sdkmath.NewInt(1)))
balance := sdk.NewCoins(sdk.NewCoin("ua0gi", sdkmath.NewInt(1e6)))
vestingStartTime := time.Now().Add(-30 * 24 * time.Hour) // 30 days in past
periods := vestingtypes.Periods{
@ -65,7 +64,7 @@ func TestResetPeriodVestingAccount_SingleVestingPeriod_Vested(t *testing.T) {
}
func TestResetPeriodVestingAccount_SingleVestingPeriod_Vesting(t *testing.T) {
balance := sdk.NewCoins(sdk.NewCoin(chaincfg.DisplayDenom, sdkmath.NewInt(1)))
balance := sdk.NewCoins(sdk.NewCoin("ua0gi", sdkmath.NewInt(1e6)))
vestingStartTime := time.Now().Add(-30 * 24 * time.Hour) // 30 days in past
periods := vestingtypes.Periods{
@ -98,7 +97,7 @@ func TestResetPeriodVestingAccount_SingleVestingPeriod_Vesting(t *testing.T) {
}
func TestResetPeriodVestingAccount_SingleVestingPeriod_ExactStartTime(t *testing.T) {
balance := sdk.NewCoins(sdk.NewCoin(chaincfg.DisplayDenom, sdkmath.NewInt(1)))
balance := sdk.NewCoins(sdk.NewCoin("ua0gi", sdkmath.NewInt(1e6)))
vestingStartTime := time.Now().Add(-30 * 24 * time.Hour) // 30 days in past
periods := vestingtypes.Periods{
@ -126,25 +125,25 @@ func TestResetPeriodVestingAccount_SingleVestingPeriod_ExactStartTime(t *testing
}
func TestResetPeriodVestingAccount_MultiplePeriods(t *testing.T) {
balance := sdk.NewCoins(sdk.NewCoin(chaincfg.DisplayDenom, sdkmath.NewInt(4)))
balance := sdk.NewCoins(sdk.NewCoin("ua0gi", sdkmath.NewInt(4e6)))
vestingStartTime := time.Now().Add(-30 * 24 * time.Hour) // 30 days in past
periods := vestingtypes.Periods{
vestingtypes.Period{
Length: 15 * 24 * 60 * 60, // -15 days - vested
Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.DisplayDenom, sdkmath.NewInt(1))),
Amount: sdk.NewCoins(sdk.NewCoin("ua0gi", sdkmath.NewInt(1e6))),
},
vestingtypes.Period{
Length: 15 * 24 * 60 * 60, // 0 days - exact on the start time
Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.DisplayDenom, sdkmath.NewInt(1))),
Amount: sdk.NewCoins(sdk.NewCoin("ua0gi", sdkmath.NewInt(1e6))),
},
vestingtypes.Period{
Length: 15 * 24 * 60 * 60, // +15 days - vesting
Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.DisplayDenom, sdkmath.NewInt(1))),
Amount: sdk.NewCoins(sdk.NewCoin("ua0gi", sdkmath.NewInt(1e6))),
},
vestingtypes.Period{
Length: 15 * 24 * 60 * 60, // +30 days - vesting
Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.DisplayDenom, sdkmath.NewInt(1))),
Amount: sdk.NewCoins(sdk.NewCoin("ua0gi", sdkmath.NewInt(1e6))),
},
}
@ -160,36 +159,36 @@ func TestResetPeriodVestingAccount_MultiplePeriods(t *testing.T) {
expectedPeriods := []vestingtypes.Period{
{
Length: 15 * 24 * 60 * 60, // 15 days
Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.DisplayDenom, sdkmath.NewInt(1))),
Amount: sdk.NewCoins(sdk.NewCoin("ua0gi", sdkmath.NewInt(1e6))),
},
{
Length: 15 * 24 * 60 * 60, // 15 days
Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.DisplayDenom, sdkmath.NewInt(1))),
Amount: sdk.NewCoins(sdk.NewCoin("ua0gi", sdkmath.NewInt(1e6))),
},
}
assert.Equal(t, sdk.NewCoins(sdk.NewCoin(chaincfg.DisplayDenom, sdkmath.NewInt(2))), vacc.OriginalVesting, "expected original vesting to be updated")
assert.Equal(t, sdk.NewCoins(sdk.NewCoin("ua0gi", 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, expectedEndtime, vacc.EndTime, "expected vesting end time end at last period")
assert.Equal(t, expectedPeriods, vacc.VestingPeriods, "expected vesting periods to be updated")
}
func TestResetPeriodVestingAccount_DelegatedVesting_GreaterThanVesting(t *testing.T) {
balance := sdk.NewCoins(sdk.NewCoin(chaincfg.DisplayDenom, sdkmath.NewInt(3)))
balance := sdk.NewCoins(sdk.NewCoin("ua0gi", sdkmath.NewInt(3e6)))
vestingStartTime := time.Now().Add(-30 * 24 * time.Hour) // 30 days in past
periods := vestingtypes.Periods{
vestingtypes.Period{
Length: 15 * 24 * 60 * 60, // -15 days - vested
Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.DisplayDenom, sdkmath.NewInt(1))),
Amount: sdk.NewCoins(sdk.NewCoin("ua0gi", sdkmath.NewInt(1e6))),
},
vestingtypes.Period{
Length: 15 * 24 * 60 * 60, // 0 days - exact on the start time
Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.DisplayDenom, sdkmath.NewInt(1))),
Amount: sdk.NewCoins(sdk.NewCoin("ua0gi", sdkmath.NewInt(1e6))),
},
vestingtypes.Period{
Length: 15 * 24 * 60 * 60, // +15 days - vesting
Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.DisplayDenom, sdkmath.NewInt(1))),
Amount: sdk.NewCoins(sdk.NewCoin("ua0gi", sdkmath.NewInt(1e6))),
},
}
@ -199,35 +198,35 @@ func TestResetPeriodVestingAccount_DelegatedVesting_GreaterThanVesting(t *testin
newVestingStartTime := vestingStartTime.Add(30 * 24 * time.Hour)
ResetPeriodicVestingAccount(vacc, newVestingStartTime)
assert.Equal(t, sdk.NewCoins(sdk.NewCoin(chaincfg.DisplayDenom, sdkmath.NewInt(2))), vacc.DelegatedFree, "expected delegated free to be updated")
assert.Equal(t, sdk.NewCoins(sdk.NewCoin(chaincfg.DisplayDenom, sdkmath.NewInt(1))), vacc.DelegatedVesting, "expected delegated vesting to be updated")
assert.Equal(t, sdk.NewCoins(sdk.NewCoin("ua0gi", sdkmath.NewInt(2e6))), vacc.DelegatedFree, "expected delegated free to be updated")
assert.Equal(t, sdk.NewCoins(sdk.NewCoin("ua0gi", sdkmath.NewInt(1e6))), vacc.DelegatedVesting, "expected delegated vesting to be updated")
}
func TestResetPeriodVestingAccount_DelegatedVesting_LessThanVested(t *testing.T) {
balance := sdk.NewCoins(sdk.NewCoin(chaincfg.DisplayDenom, sdkmath.NewInt(3)))
balance := sdk.NewCoins(sdk.NewCoin("ua0gi", sdkmath.NewInt(3e6)))
vestingStartTime := time.Now().Add(-30 * 24 * time.Hour) // 30 days in past
periods := vestingtypes.Periods{
vestingtypes.Period{
Length: 15 * 24 * 60 * 60, // -15 days - vested
Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.DisplayDenom, sdkmath.NewInt(1))),
Amount: sdk.NewCoins(sdk.NewCoin("ua0gi", sdkmath.NewInt(1e6))),
},
vestingtypes.Period{
Length: 15 * 24 * 60 * 60, // 0 days - exact on the start time
Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.DisplayDenom, sdkmath.NewInt(1))),
Amount: sdk.NewCoins(sdk.NewCoin("ua0gi", sdkmath.NewInt(1e6))),
},
vestingtypes.Period{
Length: 15 * 24 * 60 * 60, // +15 days - vesting
Amount: sdk.NewCoins(sdk.NewCoin(chaincfg.DisplayDenom, sdkmath.NewInt(1))),
Amount: sdk.NewCoins(sdk.NewCoin("ua0gi", sdkmath.NewInt(1e6))),
},
}
vacc := createVestingAccount(balance, vestingStartTime, periods)
vacc.TrackDelegation(vestingStartTime, balance, sdk.NewCoins(sdk.NewCoin(chaincfg.DisplayDenom, sdkmath.NewInt(1))))
vacc.TrackDelegation(vestingStartTime, balance, sdk.NewCoins(sdk.NewCoin("ua0gi", sdkmath.NewInt(1e6))))
newVestingStartTime := vestingStartTime.Add(30 * 24 * time.Hour)
ResetPeriodicVestingAccount(vacc, newVestingStartTime)
assert.Equal(t, sdk.Coins(nil), vacc.DelegatedFree, "expected delegrated free to be unmodified")
assert.Equal(t, sdk.NewCoins(sdk.NewCoin(chaincfg.DisplayDenom, sdkmath.NewInt(1))), vacc.DelegatedVesting, "expected delegated vesting to be unmodified")
assert.Equal(t, sdk.NewCoins(sdk.NewCoin("ua0gi", sdkmath.NewInt(1e6))), vacc.DelegatedVesting, "expected delegated vesting to be unmodified")
}

View File

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

View File

@ -80,14 +80,14 @@ func (suite *Suite) SetupTest() {
suite.Addrs = addrs
evmGenesis := evmtypes.DefaultGenesisState()
evmGenesis.Params.EvmDenom = chaincfg.BaseDenom
evmGenesis.Params.EvmDenom = chaincfg.EvmDenom
feemarketGenesis := feemarkettypes.DefaultGenesisState()
feemarketGenesis.Params.EnableHeight = 1
feemarketGenesis.Params.NoBaseFee = false
cdc := suite.App.AppCodec()
coins := sdk.NewCoins(sdk.NewInt64Coin(chaincfg.DisplayDenom, 1000_000_000_000))
coins := sdk.NewCoins(sdk.NewInt64Coin("ua0gi", 1000_000_000_000))
authGS := app.NewFundedGenStateWithSameCoins(cdc, coins, []sdk.AccAddress{
sdk.AccAddress(suite.Key1.PubKey().Address()),
sdk.AccAddress(suite.Key2.PubKey().Address()),
@ -184,12 +184,12 @@ func (suite *Suite) ModuleBalance(denom string) sdk.Int {
}
func (suite *Suite) FundAccountWithZgChain(addr sdk.AccAddress, coins sdk.Coins) {
a0gi := coins.AmountOf(chaincfg.DisplayDenom)
if a0gi.IsPositive() {
err := suite.App.FundAccount(suite.Ctx, addr, sdk.NewCoins(sdk.NewCoin(chaincfg.DisplayDenom, a0gi)))
ua0gi := coins.AmountOf("ua0gi")
if ua0gi.IsPositive() {
err := suite.App.FundAccount(suite.Ctx, addr, sdk.NewCoins(sdk.NewCoin("ua0gi", ua0gi)))
suite.Require().NoError(err)
}
neuron := coins.AmountOf(chaincfg.BaseDenom)
neuron := coins.AmountOf("neuron")
if neuron.IsPositive() {
err := suite.Keeper.SetBalance(suite.Ctx, addr, neuron)
suite.Require().NoError(err)
@ -197,12 +197,12 @@ func (suite *Suite) FundAccountWithZgChain(addr sdk.AccAddress, coins sdk.Coins)
}
func (suite *Suite) FundModuleAccountWithZgChain(moduleName string, coins sdk.Coins) {
a0gi := coins.AmountOf(chaincfg.DisplayDenom)
if a0gi.IsPositive() {
err := suite.App.FundModuleAccount(suite.Ctx, moduleName, sdk.NewCoins(sdk.NewCoin(chaincfg.DisplayDenom, a0gi)))
ua0gi := coins.AmountOf("ua0gi")
if ua0gi.IsPositive() {
err := suite.App.FundModuleAccount(suite.Ctx, moduleName, sdk.NewCoins(sdk.NewCoin("ua0gi", ua0gi)))
suite.Require().NoError(err)
}
neuron := coins.AmountOf(chaincfg.BaseDenom)
neuron := coins.AmountOf("neuron")
if neuron.IsPositive() {
addr := suite.AccountKeeper.GetModuleAddress(moduleName)
err := suite.Keeper.SetBalance(suite.Ctx, addr, neuron)
@ -216,7 +216,7 @@ func (suite *Suite) DeployERC20() types.InternalEVMAddress {
suite.App.FundModuleAccount(
suite.Ctx,
types.ModuleName,
sdk.NewCoins(sdk.NewCoin(chaincfg.DisplayDenom, sdkmath.NewInt(0))),
sdk.NewCoins(sdk.NewCoin("ua0gi", sdkmath.NewInt(0))),
)
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
suite.MintFeeCollector(sdk.NewCoins(
sdk.NewCoin(
chaincfg.DisplayDenom,
"ua0gi",
sdkmath.NewInt(baseFee.Int64()*int64(gasRes.Gas*2)),
)))

View File

@ -63,7 +63,7 @@ func (s *migrateTestSuite) TestMigrate_JSON() {
},
"supplies": [
{
"current_supply": { "denom": "neuron", "amount": "100000000000000" },
"current_supply": { "denom": "ua0gi", "amount": "100" },
"time_elapsed": "3600000000000"
},
{
@ -96,7 +96,7 @@ func (s *migrateTestSuite) TestMigrate_JSON() {
},
"supplies": [
{
"current_supply": { "denom": "neuron", "amount": "100000000000000" },
"current_supply": { "denom": "ua0gi", "amount": "100" },
"time_elapsed": "3600s"
},
{
@ -115,7 +115,7 @@ func (s *migrateTestSuite) TestMigrate_Params() {
Assets: v015issuance.Assets{
{
Owner: s.addresses[0],
Denom: "neuron",
Denom: "ua0gi",
BlockedAddresses: s.addresses[1:2],
Paused: true,
Blockable: true,
@ -131,7 +131,7 @@ func (s *migrateTestSuite) TestMigrate_Params() {
Assets: []v016issuance.Asset{
{
Owner: s.addresses[0].String(),
Denom: "neuron",
Denom: "ua0gi",
BlockedAddresses: []string{s.addresses[1].String()},
Paused: true,
Blockable: true,
@ -150,7 +150,7 @@ func (s *migrateTestSuite) TestMigrate_Params() {
func (s *migrateTestSuite) TestMigrate_Supplies() {
s.v15genstate.Supplies = v015issuance.AssetSupplies{
{
CurrentSupply: sdk.NewCoin("neuron", sdkmath.NewInt(100000000000000)),
CurrentSupply: sdk.NewCoin("ua0gi", sdkmath.NewInt(100)),
TimeElapsed: time.Duration(1 * time.Hour),
},
{
@ -160,7 +160,7 @@ func (s *migrateTestSuite) TestMigrate_Supplies() {
}
expected := []v016issuance.AssetSupply{
{
CurrentSupply: sdk.NewCoin("neuron", sdkmath.NewInt(100000000000000)),
CurrentSupply: sdk.NewCoin("ua0gi", sdkmath.NewInt(100)),
TimeElapsed: time.Duration(1 * time.Hour),
},
{