mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-12-24 15:25:18 +00:00
fix some lint bugs
This commit is contained in:
parent
363c4f61aa
commit
1a04ffe396
@ -126,21 +126,23 @@ func (k Keeper) ClaimAtomicSwap(ctx sdk.Context, from sdk.AccAddress, swapID []b
|
|||||||
case types.Incoming:
|
case types.Incoming:
|
||||||
err := k.DecrementIncomingAssetSupply(ctx, atomicSwap.Amount[0])
|
err := k.DecrementIncomingAssetSupply(ctx, atomicSwap.Amount[0])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
break
|
return err
|
||||||
}
|
}
|
||||||
err = k.IncrementCurrentAssetSupply(ctx, atomicSwap.Amount[0])
|
err = k.IncrementCurrentAssetSupply(ctx, atomicSwap.Amount[0])
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
case types.Outgoing:
|
case types.Outgoing:
|
||||||
err = k.DecrementOutgoingAssetSupply(ctx, atomicSwap.Amount[0])
|
err = k.DecrementOutgoingAssetSupply(ctx, atomicSwap.Amount[0])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
break
|
return err
|
||||||
}
|
}
|
||||||
err = k.DecrementCurrentAssetSupply(ctx, atomicSwap.Amount[0])
|
err = k.DecrementCurrentAssetSupply(ctx, atomicSwap.Amount[0])
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
err = fmt.Errorf("invalid swap direction: %s", atomicSwap.Direction.String())
|
return fmt.Errorf("invalid swap direction: %s", atomicSwap.Direction.String())
|
||||||
}
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send intended recipient coins
|
// Send intended recipient coins
|
||||||
@ -216,7 +218,7 @@ func (k Keeper) RefundAtomicSwap(ctx sdk.Context, from sdk.AccAddress, swapID []
|
|||||||
ctx.EventManager().EmitEvent(
|
ctx.EventManager().EmitEvent(
|
||||||
sdk.NewEvent(
|
sdk.NewEvent(
|
||||||
types.EventTypeRefundAtomicSwap,
|
types.EventTypeRefundAtomicSwap,
|
||||||
sdk.NewAttribute(types.AttributeKeyRefundSender, fmt.Sprintf("%s", from)),
|
sdk.NewAttribute(types.AttributeKeyRefundSender, from),
|
||||||
sdk.NewAttribute(types.AttributeKeySender, fmt.Sprintf("%s", atomicSwap.Sender)),
|
sdk.NewAttribute(types.AttributeKeySender, fmt.Sprintf("%s", atomicSwap.Sender)),
|
||||||
sdk.NewAttribute(types.AttributeKeyAtomicSwapID, fmt.Sprintf("%s", hex.EncodeToString(atomicSwap.GetSwapID()))),
|
sdk.NewAttribute(types.AttributeKeyAtomicSwapID, fmt.Sprintf("%s", hex.EncodeToString(atomicSwap.GetSwapID()))),
|
||||||
sdk.NewAttribute(types.AttributeKeyRandomNumberHash, fmt.Sprintf("%s", hex.EncodeToString(atomicSwap.RandomNumberHash))),
|
sdk.NewAttribute(types.AttributeKeyRandomNumberHash, fmt.Sprintf("%s", hex.EncodeToString(atomicSwap.RandomNumberHash))),
|
||||||
|
@ -210,7 +210,9 @@ func (k Keeper) GetTotalDebt(ctx sdk.Context, accountName string) sdk.Int {
|
|||||||
|
|
||||||
// RunSurplusAndDebtAuctions nets the surplus and debt balances and then creates surplus or debt auctions if the remaining balance is above the auction threshold parameter
|
// RunSurplusAndDebtAuctions nets the surplus and debt balances and then creates surplus or debt auctions if the remaining balance is above the auction threshold parameter
|
||||||
func (k Keeper) RunSurplusAndDebtAuctions(ctx sdk.Context) error {
|
func (k Keeper) RunSurplusAndDebtAuctions(ctx sdk.Context) error {
|
||||||
k.NetSurplusAndDebt(ctx)
|
if err := k.NetSurplusAndDebt(ctx); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
remainingDebt := k.GetTotalDebt(ctx, types.LiquidatorMacc)
|
remainingDebt := k.GetTotalDebt(ctx, types.LiquidatorMacc)
|
||||||
params := k.GetParams(ctx)
|
params := k.GetParams(ctx)
|
||||||
if remainingDebt.GTE(params.DebtAuctionThreshold) {
|
if remainingDebt.GTE(params.DebtAuctionThreshold) {
|
||||||
|
@ -199,7 +199,7 @@ func (k Keeper) SetCDP(ctx sdk.Context, cdp types.CDP) error {
|
|||||||
store := prefix.NewStore(ctx.KVStore(k.key), types.CdpKeyPrefix)
|
store := prefix.NewStore(ctx.KVStore(k.key), types.CdpKeyPrefix)
|
||||||
db, found := k.GetDenomPrefix(ctx, cdp.Collateral.Denom)
|
db, found := k.GetDenomPrefix(ctx, cdp.Collateral.Denom)
|
||||||
if !found {
|
if !found {
|
||||||
sdkerrors.Wrapf(types.ErrDenomPrefixNotFound, "%s", cdp.Collateral.Denom)
|
return sdkerrors.Wrapf(types.ErrDenomPrefixNotFound, "%s", cdp.Collateral.Denom)
|
||||||
}
|
}
|
||||||
bz := k.cdc.MustMarshalBinaryLengthPrefixed(cdp)
|
bz := k.cdc.MustMarshalBinaryLengthPrefixed(cdp)
|
||||||
store.Set(types.CdpKey(db, cdp.ID), bz)
|
store.Set(types.CdpKey(db, cdp.ID), bz)
|
||||||
@ -211,7 +211,7 @@ func (k Keeper) DeleteCDP(ctx sdk.Context, cdp types.CDP) error {
|
|||||||
store := prefix.NewStore(ctx.KVStore(k.key), types.CdpKeyPrefix)
|
store := prefix.NewStore(ctx.KVStore(k.key), types.CdpKeyPrefix)
|
||||||
db, found := k.GetDenomPrefix(ctx, cdp.Collateral.Denom)
|
db, found := k.GetDenomPrefix(ctx, cdp.Collateral.Denom)
|
||||||
if !found {
|
if !found {
|
||||||
sdkerrors.Wrapf(types.ErrDenomPrefixNotFound, "%s", cdp.Collateral.Denom)
|
return sdkerrors.Wrapf(types.ErrDenomPrefixNotFound, "%s", cdp.Collateral.Denom)
|
||||||
}
|
}
|
||||||
store.Delete(types.CdpKey(db, cdp.ID))
|
store.Delete(types.CdpKey(db, cdp.ID))
|
||||||
return nil
|
return nil
|
||||||
|
@ -142,7 +142,10 @@ func (k Keeper) RepayPrincipal(ctx sdk.Context, owner sdk.AccAddress, denom stri
|
|||||||
// and remove the cdp and indexes from the store
|
// and remove the cdp and indexes from the store
|
||||||
if cdp.Principal.IsZero() && cdp.AccumulatedFees.IsZero() {
|
if cdp.Principal.IsZero() && cdp.AccumulatedFees.IsZero() {
|
||||||
k.ReturnCollateral(ctx, cdp)
|
k.ReturnCollateral(ctx, cdp)
|
||||||
k.DeleteCDP(ctx, cdp)
|
if err := k.DeleteCDP(ctx, cdp); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
k.RemoveCdpOwnerIndex(ctx, cdp)
|
k.RemoveCdpOwnerIndex(ctx, cdp)
|
||||||
|
|
||||||
// emit cdp close event
|
// emit cdp close event
|
||||||
|
@ -56,14 +56,27 @@ func (k Keeper) UpdateFeesForAllCdps(ctx sdk.Context, collateralDenom string) er
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
// mint debt coins to the cdp account
|
// mint debt coins to the cdp account
|
||||||
k.MintDebtCoins(ctx, types.ModuleName, k.GetDebtDenom(ctx), newFees)
|
err := k.MintDebtCoins(ctx, types.ModuleName, k.GetDebtDenom(ctx), newFees)
|
||||||
|
if err != nil {
|
||||||
|
iterationErr = err
|
||||||
|
return true
|
||||||
|
}
|
||||||
previousDebt := k.GetTotalPrincipal(ctx, collateralDenom, dp.Denom)
|
previousDebt := k.GetTotalPrincipal(ctx, collateralDenom, dp.Denom)
|
||||||
newDebt := previousDebt.Add(newFees.Amount)
|
newDebt := previousDebt.Add(newFees.Amount)
|
||||||
k.SetTotalPrincipal(ctx, collateralDenom, dp.Denom, newDebt)
|
k.SetTotalPrincipal(ctx, collateralDenom, dp.Denom, newDebt)
|
||||||
|
|
||||||
// mint surplus coins divided between the liquidator and savings module accounts.
|
// mint surplus coins divided between the liquidator and savings module accounts.
|
||||||
k.supplyKeeper.MintCoins(ctx, types.LiquidatorMacc, sdk.NewCoins(sdk.NewCoin(dp.Denom, newFeesSurplus)))
|
err = k.supplyKeeper.MintCoins(ctx, types.LiquidatorMacc, sdk.NewCoins(sdk.NewCoin(dp.Denom, newFeesSurplus)))
|
||||||
k.supplyKeeper.MintCoins(ctx, types.SavingsRateMacc, sdk.NewCoins(sdk.NewCoin(dp.Denom, newFeesSavings)))
|
if err != nil {
|
||||||
|
iterationErr = err
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
err = k.supplyKeeper.MintCoins(ctx, types.SavingsRateMacc, sdk.NewCoins(sdk.NewCoin(dp.Denom, newFeesSavings)))
|
||||||
|
if err != nil {
|
||||||
|
iterationErr = err
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
// now add the new fees fees to the accumulated fees for the cdp
|
// now add the new fees fees to the accumulated fees for the cdp
|
||||||
cdp.AccumulatedFees = cdp.AccumulatedFees.Add(newFees)
|
cdp.AccumulatedFees = cdp.AccumulatedFees.Add(newFees)
|
||||||
@ -72,7 +85,7 @@ func (k Keeper) UpdateFeesForAllCdps(ctx sdk.Context, collateralDenom string) er
|
|||||||
cdp.FeesUpdated = ctx.BlockTime()
|
cdp.FeesUpdated = ctx.BlockTime()
|
||||||
collateralToDebtRatio := k.CalculateCollateralToDebtRatio(ctx, cdp.Collateral, cdp.Principal.Add(cdp.AccumulatedFees))
|
collateralToDebtRatio := k.CalculateCollateralToDebtRatio(ctx, cdp.Collateral, cdp.Principal.Add(cdp.AccumulatedFees))
|
||||||
k.RemoveCdpCollateralRatioIndex(ctx, cdp.Collateral.Denom, cdp.ID, oldCollateralToDebtRatio)
|
k.RemoveCdpCollateralRatioIndex(ctx, cdp.Collateral.Denom, cdp.ID, oldCollateralToDebtRatio)
|
||||||
err := k.SetCdpAndCollateralRatioIndex(ctx, cdp, collateralToDebtRatio)
|
err = k.SetCdpAndCollateralRatioIndex(ctx, cdp, collateralToDebtRatio)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
iterationErr = err
|
iterationErr = err
|
||||||
return true
|
return true
|
||||||
|
@ -61,8 +61,7 @@ func (k Keeper) SeizeCollateral(ctx sdk.Context, cdp types.CDP) error {
|
|||||||
// Delete CDP from state
|
// Delete CDP from state
|
||||||
k.RemoveCdpOwnerIndex(ctx, cdp)
|
k.RemoveCdpOwnerIndex(ctx, cdp)
|
||||||
k.RemoveCdpCollateralRatioIndex(ctx, cdp.Collateral.Denom, cdp.ID, oldCollateralToDebtRatio)
|
k.RemoveCdpCollateralRatioIndex(ctx, cdp.Collateral.Denom, cdp.ID, oldCollateralToDebtRatio)
|
||||||
k.DeleteCDP(ctx, cdp)
|
return k.DeleteCDP(ctx, cdp)
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// LiquidateCdps seizes collateral from all CDPs below the input liquidation ratio
|
// LiquidateCdps seizes collateral from all CDPs below the input liquidation ratio
|
||||||
|
@ -162,7 +162,7 @@ func (suite *TypesTestSuite) TestCommittee_HasPermissionsFor() {
|
|||||||
},
|
},
|
||||||
}},
|
}},
|
||||||
},
|
},
|
||||||
pubProposal: UnregisteredPubProposal{govtypes.TextProposal{"A Title", "A description."}},
|
pubProposal: UnregisteredPubProposal{govtypes.TextProposal{Title: "A Title", Description: "A description."}},
|
||||||
expectHasPermissions: false,
|
expectHasPermissions: false,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,6 @@ import (
|
|||||||
"github.com/cosmos/cosmos-sdk/codec"
|
"github.com/cosmos/cosmos-sdk/codec"
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
"github.com/cosmos/cosmos-sdk/types/module"
|
"github.com/cosmos/cosmos-sdk/types/module"
|
||||||
authexported "github.com/cosmos/cosmos-sdk/x/auth/exported"
|
|
||||||
"github.com/cosmos/cosmos-sdk/x/simulation"
|
"github.com/cosmos/cosmos-sdk/x/simulation"
|
||||||
|
|
||||||
"github.com/kava-labs/kava/x/incentive/types"
|
"github.com/kava-labs/kava/x/incentive/types"
|
||||||
@ -126,15 +125,3 @@ func genNextClaimPeriodIds(cps types.ClaimPeriods) types.GenesisClaimPeriodIDs {
|
|||||||
}
|
}
|
||||||
return claimPeriodIDs
|
return claimPeriodIDs
|
||||||
}
|
}
|
||||||
|
|
||||||
// In a list of accounts, replace the first account found with the same address. If not found, append the account.
|
|
||||||
func replaceOrAppendAccount(accounts []authexported.GenesisAccount, acc authexported.GenesisAccount) []authexported.GenesisAccount {
|
|
||||||
newAccounts := accounts
|
|
||||||
for i, a := range accounts {
|
|
||||||
if a.GetAddress().Equals(acc.GetAddress()) {
|
|
||||||
newAccounts[i] = acc
|
|
||||||
return newAccounts
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return append(newAccounts, acc)
|
|
||||||
}
|
|
||||||
|
@ -9,7 +9,6 @@ import (
|
|||||||
"github.com/cosmos/cosmos-sdk/simapp/helpers"
|
"github.com/cosmos/cosmos-sdk/simapp/helpers"
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
"github.com/cosmos/cosmos-sdk/x/auth"
|
"github.com/cosmos/cosmos-sdk/x/auth"
|
||||||
authexported "github.com/cosmos/cosmos-sdk/x/auth/exported"
|
|
||||||
"github.com/cosmos/cosmos-sdk/x/auth/vesting"
|
"github.com/cosmos/cosmos-sdk/x/auth/vesting"
|
||||||
"github.com/cosmos/cosmos-sdk/x/simulation"
|
"github.com/cosmos/cosmos-sdk/x/simulation"
|
||||||
|
|
||||||
@ -51,15 +50,12 @@ func SimulateMsgClaimReward(ak auth.AccountKeeper, sk types.SupplyKeeper, k keep
|
|||||||
) (simulation.OperationMsg, []simulation.FutureOperation, error) {
|
) (simulation.OperationMsg, []simulation.FutureOperation, error) {
|
||||||
|
|
||||||
// Load only account types that can claim rewards
|
// Load only account types that can claim rewards
|
||||||
var accounts []authexported.Account
|
|
||||||
validAccounts := make(map[string]bool)
|
validAccounts := make(map[string]bool)
|
||||||
for _, acc := range accs {
|
for _, acc := range accs {
|
||||||
account := ak.GetAccount(ctx, acc.Address)
|
account := ak.GetAccount(ctx, acc.Address)
|
||||||
switch account.(type) {
|
switch account.(type) {
|
||||||
case *vesting.PeriodicVestingAccount, *auth.BaseAccount: // Valid: BaseAccount, PeriodicVestingAccount
|
case *vesting.PeriodicVestingAccount, *auth.BaseAccount: // Valid: BaseAccount, PeriodicVestingAccount
|
||||||
accounts = append(accounts, account)
|
|
||||||
validAccounts[account.GetAddress().String()] = true
|
validAccounts[account.GetAddress().String()] = true
|
||||||
break
|
|
||||||
default: // Invalid: ValidatorVestingAccount, DelayedVestingAccount, ContinuousVestingAccount
|
default: // Invalid: ValidatorVestingAccount, DelayedVestingAccount, ContinuousVestingAccount
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
@ -18,10 +18,7 @@ const (
|
|||||||
func genActive(r *rand.Rand) bool {
|
func genActive(r *rand.Rand) bool {
|
||||||
threshold := 80
|
threshold := 80
|
||||||
value := simulation.RandIntBetween(r, 1, 100)
|
value := simulation.RandIntBetween(r, 1, 100)
|
||||||
if value > threshold {
|
return value <= threshold
|
||||||
return false
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ParamChanges defines the parameters that can be modified by param change proposals
|
// ParamChanges defines the parameters that can be modified by param change proposals
|
||||||
|
@ -157,34 +157,38 @@ func (k Keeper) ResetCurrentPeriodProgress(ctx sdk.Context, addr sdk.AccAddress)
|
|||||||
func (k Keeper) HandleVestingDebt(ctx sdk.Context, addr sdk.AccAddress, blockTime time.Time) {
|
func (k Keeper) HandleVestingDebt(ctx sdk.Context, addr sdk.AccAddress, blockTime time.Time) {
|
||||||
vv := k.GetAccountFromAuthKeeper(ctx, addr)
|
vv := k.GetAccountFromAuthKeeper(ctx, addr)
|
||||||
|
|
||||||
if !vv.DebtAfterFailedVesting.IsZero() {
|
if vv.DebtAfterFailedVesting.IsZero() {
|
||||||
spendableCoins := vv.SpendableCoins(blockTime)
|
return
|
||||||
if spendableCoins.IsAllGTE(vv.DebtAfterFailedVesting) {
|
}
|
||||||
if vv.ReturnAddress != nil {
|
spendableCoins := vv.SpendableCoins(blockTime)
|
||||||
err := k.bk.SendCoins(ctx, addr, vv.ReturnAddress, vv.DebtAfterFailedVesting)
|
if spendableCoins.IsAllGTE(vv.DebtAfterFailedVesting) {
|
||||||
if err != nil {
|
if vv.ReturnAddress != nil {
|
||||||
panic(err)
|
err := k.bk.SendCoins(ctx, addr, vv.ReturnAddress, vv.DebtAfterFailedVesting)
|
||||||
}
|
if err != nil {
|
||||||
} else {
|
panic(err)
|
||||||
err := k.supplyKeeper.SendCoinsFromAccountToModule(ctx, addr, types.ModuleName, vv.DebtAfterFailedVesting)
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
err = k.supplyKeeper.BurnCoins(ctx, types.ModuleName, vv.DebtAfterFailedVesting)
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
k.ResetDebt(ctx, addr)
|
|
||||||
} else {
|
} else {
|
||||||
// iterate over all delegations made from the validator vesting account and undelegate
|
err := k.supplyKeeper.SendCoinsFromAccountToModule(ctx, addr, types.ModuleName, vv.DebtAfterFailedVesting)
|
||||||
// note that we cannot safely undelegate only an amount of shares that covers the debt,
|
if err != nil {
|
||||||
// because the value of those shares could change if a validator gets slashed.
|
panic(err)
|
||||||
k.stakingKeeper.IterateDelegations(ctx, vv.Address, func(index int64, d stakingexported.DelegationI) (stop bool) {
|
}
|
||||||
k.stakingKeeper.Undelegate(ctx, d.GetDelegatorAddr(), d.GetValidatorAddr(), d.GetShares())
|
err = k.supplyKeeper.BurnCoins(ctx, types.ModuleName, vv.DebtAfterFailedVesting)
|
||||||
return false
|
if err != nil {
|
||||||
})
|
panic(err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
k.ResetDebt(ctx, addr)
|
||||||
|
} else {
|
||||||
|
// iterate over all delegations made from the validator vesting account and undelegate
|
||||||
|
// note that we cannot safely undelegate only an amount of shares that covers the debt,
|
||||||
|
// because the value of those shares could change if a validator gets slashed.
|
||||||
|
k.stakingKeeper.IterateDelegations(ctx, vv.Address, func(index int64, d stakingexported.DelegationI) (stop bool) {
|
||||||
|
_, err := k.stakingKeeper.Undelegate(ctx, d.GetDelegatorAddr(), d.GetValidatorAddr(), d.GetShares())
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,9 +172,12 @@ func ValidatorVestingTestAccount() *types.ValidatorVestingAccount {
|
|||||||
testConsAddr := sdk.ConsAddress(testPk.Address())
|
testConsAddr := sdk.ConsAddress(testPk.Address())
|
||||||
origCoins := sdk.Coins{sdk.NewInt64Coin(feeDenom, 1000), sdk.NewInt64Coin(stakeDenom, 100)}
|
origCoins := sdk.Coins{sdk.NewInt64Coin(feeDenom, 1000), sdk.NewInt64Coin(stakeDenom, 100)}
|
||||||
bacc := auth.NewBaseAccountWithAddress(testAddr)
|
bacc := auth.NewBaseAccountWithAddress(testAddr)
|
||||||
bacc.SetCoins(origCoins)
|
err := bacc.SetCoins(origCoins)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
vva := types.NewValidatorVestingAccount(&bacc, now.Unix(), periods, testConsAddr, nil, 90)
|
vva := types.NewValidatorVestingAccount(&bacc, now.Unix(), periods, testConsAddr, nil, 90)
|
||||||
err := vva.Validate()
|
err = vva.Validate()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
@ -196,9 +199,12 @@ func ValidatorVestingTestAccounts(numAccounts int) []*types.ValidatorVestingAcco
|
|||||||
testConsAddr := sdk.ConsAddress(testPk[i].Address())
|
testConsAddr := sdk.ConsAddress(testPk[i].Address())
|
||||||
origCoins := sdk.Coins{sdk.NewInt64Coin(feeDenom, 1000), sdk.NewInt64Coin(stakeDenom, 100)}
|
origCoins := sdk.Coins{sdk.NewInt64Coin(feeDenom, 1000), sdk.NewInt64Coin(stakeDenom, 100)}
|
||||||
bacc := auth.NewBaseAccountWithAddress(testAddr[i])
|
bacc := auth.NewBaseAccountWithAddress(testAddr[i])
|
||||||
bacc.SetCoins(origCoins)
|
err := bacc.SetCoins(origCoins)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
vva := types.NewValidatorVestingAccount(&bacc, now.Unix(), periods, testConsAddr, nil, 90)
|
vva := types.NewValidatorVestingAccount(&bacc, now.Unix(), periods, testConsAddr, nil, 90)
|
||||||
err := vva.Validate()
|
err = vva.Validate()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
@ -218,9 +224,12 @@ func ValidatorVestingDelegatorTestAccount(startTime time.Time) *types.ValidatorV
|
|||||||
testConsAddr := sdk.ConsAddress(testPk.Address())
|
testConsAddr := sdk.ConsAddress(testPk.Address())
|
||||||
origCoins := sdk.Coins{sdk.NewInt64Coin(stakeDenom, 60000000)}
|
origCoins := sdk.Coins{sdk.NewInt64Coin(stakeDenom, 60000000)}
|
||||||
bacc := auth.NewBaseAccountWithAddress(testAddr)
|
bacc := auth.NewBaseAccountWithAddress(testAddr)
|
||||||
bacc.SetCoins(origCoins)
|
err := bacc.SetCoins(origCoins)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
vva := types.NewValidatorVestingAccount(&bacc, startTime.Unix(), periods, testConsAddr, nil, 90)
|
vva := types.NewValidatorVestingAccount(&bacc, startTime.Unix(), periods, testConsAddr, nil, 90)
|
||||||
err := vva.Validate()
|
err = vva.Validate()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user