Merge PR #5449: Add New constructor for the DecCoin
This commit is contained in:
parent
fe9e50dd34
commit
066dd1114f
|
@ -50,6 +50,8 @@ logic has been implemented for v0.38 target version. Applications can migrate vi
|
|||
|
||||
### API Breaking Changes
|
||||
|
||||
* (types) [\#5430](https://github.com/cosmos/cosmos-sdk/pull/5430) `DecCoins#Add` parameter changed from `DecCoins`
|
||||
to `...DecCoin`, `Coins#Add` parameter changed from `Coins` to `...Coin`
|
||||
* (baseapp/types) [\#5421](https://github.com/cosmos/cosmos-sdk/pull/5421) The `Error` interface (`types/errors.go`)
|
||||
has been removed in favor of the concrete type defined in `types/errors/` which implements the standard `error`
|
||||
interface. As a result, the `Handler` and `Querier` implementations now return a standard `error`.
|
||||
|
|
|
@ -91,7 +91,7 @@ func (app *SimApp) prepForZeroHeightGenesis(ctx sdk.Context, jailWhiteList []str
|
|||
// donate any unwithdrawn outstanding reward fraction tokens to the community pool
|
||||
scraps := app.DistrKeeper.GetValidatorOutstandingRewards(ctx, val.GetOperator())
|
||||
feePool := app.DistrKeeper.GetFeePool(ctx)
|
||||
feePool.CommunityPool = feePool.CommunityPool.Add(scraps)
|
||||
feePool.CommunityPool = feePool.CommunityPool.Add(scraps...)
|
||||
app.DistrKeeper.SetFeePool(ctx, feePool)
|
||||
|
||||
app.DistrKeeper.Hooks().AfterValidatorCreated(ctx, val.GetOperator())
|
||||
|
|
|
@ -82,7 +82,7 @@ func TestSimGenesisAccountValidate(t *testing.T) {
|
|||
"valid basic account with invalid original vesting coins",
|
||||
simapp.SimGenesisAccount{
|
||||
BaseAccount: baseAcc,
|
||||
OriginalVesting: coins.Add(coins),
|
||||
OriginalVesting: coins.Add(coins...),
|
||||
StartTime: vestingStart.Unix(),
|
||||
EndTime: vestingStart.Add(1 * time.Hour).Unix(),
|
||||
},
|
||||
|
|
|
@ -88,7 +88,7 @@ func AddTestAddrs(app *SimApp, ctx sdk.Context, accNum int, accAmt sdk.Int) []sd
|
|||
initCoins := sdk.NewCoins(sdk.NewCoin(app.StakingKeeper.BondDenom(ctx), accAmt))
|
||||
totalSupply := sdk.NewCoins(sdk.NewCoin(app.StakingKeeper.BondDenom(ctx), accAmt.MulRaw(int64(len(testAddrs)))))
|
||||
prevSupply := app.SupplyKeeper.GetSupply(ctx)
|
||||
app.SupplyKeeper.SetSupply(ctx, supply.NewSupply(prevSupply.GetTotal().Add(totalSupply)))
|
||||
app.SupplyKeeper.SetSupply(ctx, supply.NewSupply(prevSupply.GetTotal().Add(totalSupply...)))
|
||||
|
||||
// fill all the addresses with some coins, set the loose pool tokens simultaneously
|
||||
for _, addr := range testAddrs {
|
||||
|
|
|
@ -244,7 +244,7 @@ func (coins Coins) IsValid() bool {
|
|||
//
|
||||
// CONTRACT: Add will never return Coins where one Coin has a non-positive
|
||||
// amount. In otherwords, IsValid will always return true.
|
||||
func (coins Coins) Add(coinsB Coins) Coins {
|
||||
func (coins Coins) Add(coinsB ...Coin) Coins {
|
||||
return coins.safeAdd(coinsB)
|
||||
}
|
||||
|
||||
|
@ -506,6 +506,11 @@ func (coins Coins) AmountOf(denom string) Int {
|
|||
}
|
||||
}
|
||||
|
||||
// GetDenomByIndex returns the Denom of the certain coin to make the findDup generic
|
||||
func (coins Coins) GetDenomByIndex(i int) string {
|
||||
return coins[i].Denom
|
||||
}
|
||||
|
||||
// IsAllPositive returns true if there is at least one coin and all currencies
|
||||
// have a positive value.
|
||||
func (coins Coins) IsAllPositive() bool {
|
||||
|
@ -669,18 +674,23 @@ func ParseCoins(coinsStr string) (Coins, error) {
|
|||
return coins, nil
|
||||
}
|
||||
|
||||
type findDupDescriptor interface {
|
||||
GetDenomByIndex(int) string
|
||||
Len() int
|
||||
}
|
||||
|
||||
// findDup works on the assumption that coins is sorted
|
||||
func findDup(coins Coins) int {
|
||||
if len(coins) <= 1 {
|
||||
func findDup(coins findDupDescriptor) int {
|
||||
if coins.Len() <= 1 {
|
||||
return -1
|
||||
}
|
||||
|
||||
prevDenom := coins[0].Denom
|
||||
for i := 1; i < len(coins); i++ {
|
||||
if coins[i].Denom == prevDenom {
|
||||
prevDenom := coins.GetDenomByIndex(0)
|
||||
for i := 1; i < coins.Len(); i++ {
|
||||
if coins.GetDenomByIndex(i) == prevDenom {
|
||||
return i
|
||||
}
|
||||
prevDenom = coins[i].Denom
|
||||
prevDenom = coins.GetDenomByIndex(i)
|
||||
}
|
||||
|
||||
return -1
|
||||
|
|
|
@ -21,7 +21,7 @@ func BenchmarkCoinsAdditionIntersect(b *testing.B) {
|
|||
b.ResetTimer()
|
||||
|
||||
for i := 0; i < b.N; i++ {
|
||||
coinsA.Add(coinsB)
|
||||
coinsA.Add(coinsB...)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ func BenchmarkCoinsAdditionNoIntersect(b *testing.B) {
|
|||
b.ResetTimer()
|
||||
|
||||
for i := 0; i < b.N; i++ {
|
||||
coinsA.Add(coinsB)
|
||||
coinsA.Add(coinsB...)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -251,7 +251,7 @@ func TestAddCoins(t *testing.T) {
|
|||
}
|
||||
|
||||
for tcIndex, tc := range cases {
|
||||
res := tc.inputOne.Add(tc.inputTwo)
|
||||
res := tc.inputOne.Add(tc.inputTwo...)
|
||||
assert.True(t, res.IsValid())
|
||||
require.Equal(t, tc.expected, res, "sum of coins is incorrect, tc #%d", tcIndex)
|
||||
}
|
||||
|
|
|
@ -157,9 +157,32 @@ func (coin DecCoin) IsValid() bool {
|
|||
// DecCoins defines a slice of coins with decimal values
|
||||
type DecCoins []DecCoin
|
||||
|
||||
// NewDecCoins constructs a new coin set with decimal values
|
||||
// NewDecCoins constructs a new coin set with with decimal values
|
||||
// from DecCoins.
|
||||
func NewDecCoins(decCoins ...DecCoin) DecCoins {
|
||||
// remove zeroes
|
||||
newDecCoins := removeZeroDecCoins(DecCoins(decCoins))
|
||||
if len(newDecCoins) == 0 {
|
||||
return DecCoins{}
|
||||
}
|
||||
|
||||
newDecCoins.Sort()
|
||||
|
||||
// detect duplicate Denoms
|
||||
if dupIndex := findDup(newDecCoins); dupIndex != -1 {
|
||||
panic(fmt.Errorf("find duplicate denom: %s", newDecCoins[dupIndex]))
|
||||
}
|
||||
|
||||
if !newDecCoins.IsValid() {
|
||||
panic(fmt.Errorf("invalid coin set: %s", newDecCoins))
|
||||
}
|
||||
|
||||
return newDecCoins
|
||||
}
|
||||
|
||||
// NewDecCoinsFromCoin constructs a new coin set with decimal values
|
||||
// from regular Coins.
|
||||
func NewDecCoins(coins Coins) DecCoins {
|
||||
func NewDecCoinsFromCoins(coins ...Coin) DecCoins {
|
||||
decCoins := make(DecCoins, len(coins))
|
||||
newCoins := NewCoins(coins...)
|
||||
for i, coin := range newCoins {
|
||||
|
@ -191,10 +214,10 @@ func (coins DecCoins) TruncateDecimal() (truncatedCoins Coins, changeCoins DecCo
|
|||
for _, coin := range coins {
|
||||
truncated, change := coin.TruncateDecimal()
|
||||
if !truncated.IsZero() {
|
||||
truncatedCoins = truncatedCoins.Add(NewCoins(truncated))
|
||||
truncatedCoins = truncatedCoins.Add(truncated)
|
||||
}
|
||||
if !change.IsZero() {
|
||||
changeCoins = changeCoins.Add(DecCoins{change})
|
||||
changeCoins = changeCoins.Add(change)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -208,7 +231,7 @@ func (coins DecCoins) TruncateDecimal() (truncatedCoins Coins, changeCoins DecCo
|
|||
//
|
||||
// CONTRACT: Add will never return Coins where one Coin has a non-positive
|
||||
// amount. In otherwords, IsValid will always return true.
|
||||
func (coins DecCoins) Add(coinsB DecCoins) DecCoins {
|
||||
func (coins DecCoins) Add(coinsB ...DecCoin) DecCoins {
|
||||
return coins.safeAdd(coinsB)
|
||||
}
|
||||
|
||||
|
@ -311,6 +334,11 @@ func (coins DecCoins) Intersect(coinsB DecCoins) DecCoins {
|
|||
return removeZeroDecCoins(res)
|
||||
}
|
||||
|
||||
// GetDenomByIndex returns the Denom to make the findDup generic
|
||||
func (coins DecCoins) GetDenomByIndex(i int) string {
|
||||
return coins[i].Denom
|
||||
}
|
||||
|
||||
// IsAnyNegative returns true if there is at least one coin whose amount
|
||||
// is negative; returns false otherwise. It returns false if the DecCoins set
|
||||
// is empty too.
|
||||
|
@ -338,7 +366,7 @@ func (coins DecCoins) MulDec(d Dec) DecCoins {
|
|||
}
|
||||
|
||||
if !product.IsZero() {
|
||||
res = res.Add(DecCoins{product})
|
||||
res = res.Add(product)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -359,7 +387,7 @@ func (coins DecCoins) MulDecTruncate(d Dec) DecCoins {
|
|||
}
|
||||
|
||||
if !product.IsZero() {
|
||||
res = res.Add(DecCoins{product})
|
||||
res = res.Add(product)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -382,7 +410,7 @@ func (coins DecCoins) QuoDec(d Dec) DecCoins {
|
|||
}
|
||||
|
||||
if !quotient.IsZero() {
|
||||
res = res.Add(DecCoins{quotient})
|
||||
res = res.Add(quotient)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -406,7 +434,7 @@ func (coins DecCoins) QuoDecTruncate(d Dec) DecCoins {
|
|||
}
|
||||
|
||||
if !quotient.IsZero() {
|
||||
res = res.Add(DecCoins{quotient})
|
||||
res = res.Add(quotient)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ func TestAddDecCoins(t *testing.T) {
|
|||
}
|
||||
|
||||
for tcIndex, tc := range cases {
|
||||
res := tc.inputOne.Add(tc.inputTwo)
|
||||
res := tc.inputOne.Add(tc.inputTwo...)
|
||||
require.Equal(t, tc.expected, res, "sum of coins is incorrect, tc #%d", tcIndex)
|
||||
}
|
||||
}
|
||||
|
@ -172,7 +172,7 @@ func TestSubDecCoins(t *testing.T) {
|
|||
msg string
|
||||
}{
|
||||
{
|
||||
NewDecCoins(Coins{NewCoin("mytoken", NewInt(10)), NewCoin("btc", NewInt(20)), NewCoin("eth", NewInt(30))}),
|
||||
NewDecCoinsFromCoins(NewCoin("mytoken", NewInt(10)), NewCoin("btc", NewInt(20)), NewCoin("eth", NewInt(30))),
|
||||
true,
|
||||
"sorted coins should have passed",
|
||||
},
|
||||
|
@ -188,7 +188,7 @@ func TestSubDecCoins(t *testing.T) {
|
|||
},
|
||||
}
|
||||
|
||||
decCoins := NewDecCoins(Coins{NewCoin("btc", NewInt(10)), NewCoin("eth", NewInt(15)), NewCoin("mytoken", NewInt(5))})
|
||||
decCoins := NewDecCoinsFromCoins(NewCoin("btc", NewInt(10)), NewCoin("eth", NewInt(15)), NewCoin("mytoken", NewInt(5)))
|
||||
|
||||
for _, tc := range tests {
|
||||
tc := tc
|
||||
|
@ -421,3 +421,75 @@ func TestDecCoinsQuoDecTruncate(t *testing.T) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestNewDecCoinsWithIsValid(t *testing.T) {
|
||||
fake1 := append(NewDecCoins(NewDecCoin("mytoken", NewInt(10))), DecCoin{Denom: "BTC", Amount: NewDec(10)})
|
||||
fake2 := append(NewDecCoins(NewDecCoin("mytoken", NewInt(10))), DecCoin{Denom: "BTC", Amount: NewDec(-10)})
|
||||
|
||||
tests := []struct {
|
||||
coin DecCoins
|
||||
expectPass bool
|
||||
msg string
|
||||
}{
|
||||
{
|
||||
NewDecCoins(NewDecCoin("mytoken", NewInt(10))),
|
||||
true,
|
||||
"valid coins should have passed",
|
||||
},
|
||||
{
|
||||
fake1,
|
||||
false,
|
||||
"invalid denoms",
|
||||
},
|
||||
{
|
||||
fake2,
|
||||
false,
|
||||
"negative amount",
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range tests {
|
||||
tc := tc
|
||||
if tc.expectPass {
|
||||
require.True(t, tc.coin.IsValid(), tc.msg)
|
||||
} else {
|
||||
require.False(t, tc.coin.IsValid(), tc.msg)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestDecCoins_AddDecCoinWithIsValid(t *testing.T) {
|
||||
lengthTestDecCoins := NewDecCoins().Add(NewDecCoin("mytoken", NewInt(10))).Add(DecCoin{Denom: "BTC", Amount: NewDec(10)})
|
||||
require.Equal(t, 2, len(lengthTestDecCoins), "should be 2")
|
||||
|
||||
tests := []struct {
|
||||
coin DecCoins
|
||||
expectPass bool
|
||||
msg string
|
||||
}{
|
||||
{
|
||||
NewDecCoins().Add(NewDecCoin("mytoken", NewInt(10))),
|
||||
true,
|
||||
"valid coins should have passed",
|
||||
},
|
||||
{
|
||||
NewDecCoins().Add(NewDecCoin("mytoken", NewInt(10))).Add(DecCoin{Denom: "BTC", Amount: NewDec(10)}),
|
||||
false,
|
||||
"invalid denoms",
|
||||
},
|
||||
{
|
||||
NewDecCoins().Add(NewDecCoin("mytoken", NewInt(10))).Add(DecCoin{Denom: "BTC", Amount: NewDec(-10)}),
|
||||
false,
|
||||
"negative amount",
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range tests {
|
||||
tc := tc
|
||||
if tc.expectPass {
|
||||
require.True(t, tc.coin.IsValid(), tc.msg)
|
||||
} else {
|
||||
require.False(t, tc.coin.IsValid(), tc.msg)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -203,7 +203,7 @@ func (fee StdFee) Bytes() []byte {
|
|||
// originally part of the submitted transaction because the fee is computed
|
||||
// as fee = ceil(gasWanted * gasPrices).
|
||||
func (fee StdFee) GasPrices() sdk.DecCoins {
|
||||
return sdk.NewDecCoins(fee.Amount).QuoDec(sdk.NewDec(int64(fee.Gas)))
|
||||
return sdk.NewDecCoinsFromCoins(fee.Amount...).QuoDec(sdk.NewDec(int64(fee.Gas)))
|
||||
}
|
||||
|
||||
//__________________________________________________________
|
||||
|
|
|
@ -25,7 +25,7 @@ func TestValidateGenesisInvalidAccounts(t *testing.T) {
|
|||
baseVestingAcc, err := NewBaseVestingAccount(&acc1, acc1.Coins, 1548775410)
|
||||
require.NoError(t, err)
|
||||
// invalid delegated vesting
|
||||
baseVestingAcc.DelegatedVesting = acc1.Coins.Add(acc1.Coins)
|
||||
baseVestingAcc.DelegatedVesting = acc1.Coins.Add(acc1.Coins...)
|
||||
|
||||
acc2 := authtypes.NewBaseAccountWithAddress(sdk.AccAddress(addr2))
|
||||
acc2.Coins = sdk.NewCoins(sdk.NewInt64Coin(sdk.DefaultBondDenom, 150))
|
||||
|
|
|
@ -74,7 +74,7 @@ func (bva BaseVestingAccount) SpendableCoinsVestingAccount(vestingCoins sdk.Coin
|
|||
spendableCoin := sdk.NewCoin(coin.Denom, min)
|
||||
|
||||
if !spendableCoin.IsZero() {
|
||||
spendableCoins = spendableCoins.Add(sdk.Coins{spendableCoin})
|
||||
spendableCoins = spendableCoins.Add(spendableCoin)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -108,12 +108,12 @@ func (bva *BaseVestingAccount) TrackDelegation(vestingCoins, amount sdk.Coins) {
|
|||
|
||||
if !x.IsZero() {
|
||||
xCoin := sdk.NewCoin(coin.Denom, x)
|
||||
bva.DelegatedVesting = bva.DelegatedVesting.Add(sdk.Coins{xCoin})
|
||||
bva.DelegatedVesting = bva.DelegatedVesting.Add(xCoin)
|
||||
}
|
||||
|
||||
if !y.IsZero() {
|
||||
yCoin := sdk.NewCoin(coin.Denom, y)
|
||||
bva.DelegatedFree = bva.DelegatedFree.Add(sdk.Coins{yCoin})
|
||||
bva.DelegatedFree = bva.DelegatedFree.Add(yCoin)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -543,7 +543,7 @@ func (pva PeriodicVestingAccount) GetVestedCoins(blockTime time.Time) sdk.Coins
|
|||
if x < period.Length {
|
||||
break
|
||||
}
|
||||
vestedCoins = vestedCoins.Add(period.Amount)
|
||||
vestedCoins = vestedCoins.Add(period.Amount...)
|
||||
// Update the start time of the next period
|
||||
currentPeriodStartTime += period.Length
|
||||
}
|
||||
|
@ -589,7 +589,7 @@ func (pva PeriodicVestingAccount) Validate() error {
|
|||
originalVesting := sdk.NewCoins()
|
||||
for _, p := range pva.VestingPeriods {
|
||||
endTime += p.Length
|
||||
originalVesting = originalVesting.Add(p.Amount)
|
||||
originalVesting = originalVesting.Add(p.Amount...)
|
||||
}
|
||||
if endTime != pva.EndTime {
|
||||
return errors.New("vesting end time does not match length of all vesting periods")
|
||||
|
|
|
@ -96,7 +96,7 @@ func TestSpendableCoinsContVestingAcc(t *testing.T) {
|
|||
|
||||
// receive some coins
|
||||
recvAmt := sdk.Coins{sdk.NewInt64Coin(stakeDenom, 50)}
|
||||
cva.SetCoins(cva.GetCoins().Add(recvAmt))
|
||||
cva.SetCoins(cva.GetCoins().Add(recvAmt...))
|
||||
|
||||
// require that all vested coins (50%) are spendable plus any received
|
||||
spendableCoins = cva.SpendableCoins(now.Add(12 * time.Hour))
|
||||
|
@ -268,7 +268,7 @@ func TestSpendableCoinsDelVestingAcc(t *testing.T) {
|
|||
|
||||
// receive some coins
|
||||
recvAmt := sdk.Coins{sdk.NewInt64Coin(stakeDenom, 50)}
|
||||
dva.SetCoins(dva.GetCoins().Add(recvAmt))
|
||||
dva.SetCoins(dva.GetCoins().Add(recvAmt...))
|
||||
|
||||
// require that only received coins are spendable since the account is still
|
||||
// vesting
|
||||
|
@ -497,7 +497,7 @@ func TestSpendableCoinsPeriodicVestingAcc(t *testing.T) {
|
|||
|
||||
// receive some coins
|
||||
recvAmt := sdk.Coins{sdk.NewInt64Coin(stakeDenom, 50)}
|
||||
pva.SetCoins(pva.GetCoins().Add(recvAmt))
|
||||
pva.SetCoins(pva.GetCoins().Add(recvAmt...))
|
||||
|
||||
// require that all vested coins (50%) are spendable plus any received
|
||||
spendableCoins = pva.SpendableCoins(now.Add(12 * time.Hour))
|
||||
|
@ -549,7 +549,7 @@ func TestTrackDelegationPeriodicVestingAcc(t *testing.T) {
|
|||
// delegate 75% of coins, split between vested and vesting
|
||||
bacc.SetCoins(origCoins)
|
||||
pva = NewPeriodicVestingAccount(&bacc, now.Unix(), periods)
|
||||
pva.TrackDelegation(now.Add(12*time.Hour), periods[0].Amount.Add(periods[1].Amount))
|
||||
pva.TrackDelegation(now.Add(12*time.Hour), periods[0].Amount.Add(periods[1].Amount...))
|
||||
// require that the maximum possible amount of vesting coins are chosen for delegation.
|
||||
require.Equal(t, pva.DelegatedFree, periods[1].Amount)
|
||||
require.Equal(t, pva.DelegatedVesting, periods[0].Amount)
|
||||
|
|
|
@ -280,7 +280,7 @@ func (keeper BaseSendKeeper) AddCoins(ctx sdk.Context, addr sdk.AccAddress, amt
|
|||
}
|
||||
|
||||
oldCoins := keeper.GetCoins(ctx, addr)
|
||||
newCoins := oldCoins.Add(amt)
|
||||
newCoins := oldCoins.Add(amt...)
|
||||
|
||||
if newCoins.IsAnyNegative() {
|
||||
return amt, sdkerrors.Wrapf(
|
||||
|
@ -387,5 +387,5 @@ func trackUndelegation(acc authexported.Account, amt sdk.Coins) error {
|
|||
vacc.TrackUndelegation(amt)
|
||||
}
|
||||
|
||||
return acc.SetCoins(acc.GetCoins().Add(amt))
|
||||
return acc.SetCoins(acc.GetCoins().Add(amt...))
|
||||
}
|
||||
|
|
|
@ -240,7 +240,7 @@ func TestVestingAccountSend(t *testing.T) {
|
|||
require.Error(t, err)
|
||||
|
||||
// receive some coins
|
||||
vacc.SetCoins(origCoins.Add(sendCoins))
|
||||
vacc.SetCoins(origCoins.Add(sendCoins...))
|
||||
app.AccountKeeper.SetAccount(ctx, vacc)
|
||||
|
||||
// require that all vested coins are spendable plus any received
|
||||
|
@ -275,7 +275,7 @@ func TestPeriodicVestingAccountSend(t *testing.T) {
|
|||
require.Error(t, err)
|
||||
|
||||
// receive some coins
|
||||
vacc.SetCoins(origCoins.Add(sendCoins))
|
||||
vacc.SetCoins(origCoins.Add(sendCoins...))
|
||||
app.AccountKeeper.SetAccount(ctx, vacc)
|
||||
|
||||
// require that all vested coins are spendable plus any received
|
||||
|
@ -311,7 +311,7 @@ func TestVestingAccountReceive(t *testing.T) {
|
|||
|
||||
// require the coins are spendable
|
||||
vacc = app.AccountKeeper.GetAccount(ctx, addr1).(*vesting.ContinuousVestingAccount)
|
||||
require.Equal(t, origCoins.Add(sendCoins), vacc.GetCoins())
|
||||
require.Equal(t, origCoins.Add(sendCoins...), vacc.GetCoins())
|
||||
require.Equal(t, vacc.SpendableCoins(now), sendCoins)
|
||||
|
||||
// require coins are spendable plus any that have vested
|
||||
|
@ -347,7 +347,7 @@ func TestPeriodicVestingAccountReceive(t *testing.T) {
|
|||
|
||||
// require the coins are spendable
|
||||
vacc = app.AccountKeeper.GetAccount(ctx, addr1).(*vesting.PeriodicVestingAccount)
|
||||
require.Equal(t, origCoins.Add(sendCoins), vacc.GetCoins())
|
||||
require.Equal(t, origCoins.Add(sendCoins...), vacc.GetCoins())
|
||||
require.Equal(t, vacc.SpendableCoins(now), sendCoins)
|
||||
|
||||
// require coins are spendable plus any that have vested
|
||||
|
|
|
@ -168,7 +168,7 @@ func ValidateInputsOutputs(inputs []Input, outputs []Output) error {
|
|||
return err
|
||||
}
|
||||
|
||||
totalIn = totalIn.Add(in.Coins)
|
||||
totalIn = totalIn.Add(in.Coins...)
|
||||
}
|
||||
|
||||
for _, out := range outputs {
|
||||
|
@ -176,7 +176,7 @@ func ValidateInputsOutputs(inputs []Input, outputs []Output) error {
|
|||
return err
|
||||
}
|
||||
|
||||
totalOut = totalOut.Add(out.Coins)
|
||||
totalOut = totalOut.Add(out.Coins...)
|
||||
}
|
||||
|
||||
// make sure inputs and outputs match
|
||||
|
|
|
@ -170,7 +170,7 @@ func SimulateMsgMultiSend(ak types.AccountKeeper, bk keeper.Keeper) simulation.O
|
|||
|
||||
// set next input and accumulate total sent coins
|
||||
inputs[i] = types.NewInput(simAccount.Address, coins)
|
||||
totalSentCoins = totalSentCoins.Add(coins)
|
||||
totalSentCoins = totalSentCoins.Add(coins...)
|
||||
}
|
||||
|
||||
for o := range outputs {
|
||||
|
|
|
@ -36,7 +36,7 @@ func createTestApp() (*simapp.SimApp, sdk.Context, []sdk.AccAddress) {
|
|||
app.CrisisKeeper.RegisterRoute(testModuleName, dummyRouteWhichFails.Route, dummyRouteWhichFails.Invar)
|
||||
|
||||
feePool := distr.InitialFeePool()
|
||||
feePool.CommunityPool = sdk.NewDecCoins(sdk.NewCoins(constantFee))
|
||||
feePool.CommunityPool = sdk.NewDecCoinsFromCoins(sdk.NewCoins(constantFee)...)
|
||||
app.DistrKeeper.SetFeePool(ctx, feePool)
|
||||
app.SupplyKeeper.SetSupply(ctx, supply.NewSupply(sdk.Coins{}))
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ func InitGenesis(ctx sdk.Context, keeper Keeper, supplyKeeper types.SupplyKeeper
|
|||
keeper.SetPreviousProposerConsAddr(ctx, data.PreviousProposer)
|
||||
for _, rew := range data.OutstandingRewards {
|
||||
keeper.SetValidatorOutstandingRewards(ctx, rew.ValidatorAddress, rew.OutstandingRewards)
|
||||
moduleHoldings = moduleHoldings.Add(rew.OutstandingRewards)
|
||||
moduleHoldings = moduleHoldings.Add(rew.OutstandingRewards...)
|
||||
}
|
||||
for _, acc := range data.ValidatorAccumulatedCommissions {
|
||||
keeper.SetValidatorAccumulatedCommission(ctx, acc.ValidatorAddress, acc.Accumulated)
|
||||
|
@ -41,7 +41,7 @@ func InitGenesis(ctx sdk.Context, keeper Keeper, supplyKeeper types.SupplyKeeper
|
|||
keeper.SetValidatorSlashEvent(ctx, evt.ValidatorAddress, evt.Height, evt.Period, evt.Event)
|
||||
}
|
||||
|
||||
moduleHoldings = moduleHoldings.Add(data.FeePool.CommunityPool)
|
||||
moduleHoldings = moduleHoldings.Add(data.FeePool.CommunityPool...)
|
||||
moduleHoldingsInt, _ := moduleHoldings.TruncateDecimal()
|
||||
|
||||
// check if the module account exists
|
||||
|
|
|
@ -23,7 +23,7 @@ func (k Keeper) AllocateTokens(
|
|||
// (and distributed to the previous proposer)
|
||||
feeCollector := k.supplyKeeper.GetModuleAccount(ctx, k.feeCollectorName)
|
||||
feesCollectedInt := feeCollector.GetCoins()
|
||||
feesCollected := sdk.NewDecCoins(feesCollectedInt)
|
||||
feesCollected := sdk.NewDecCoinsFromCoins(feesCollectedInt...)
|
||||
|
||||
// transfer collected fees to the distribution module account
|
||||
err := k.supplyKeeper.SendCoinsFromModuleToModule(ctx, k.feeCollectorName, types.ModuleName, feesCollectedInt)
|
||||
|
@ -35,7 +35,7 @@ func (k Keeper) AllocateTokens(
|
|||
// general discussions here: https://github.com/cosmos/cosmos-sdk/issues/2906#issuecomment-441867634
|
||||
feePool := k.GetFeePool(ctx)
|
||||
if totalPreviousPower == 0 {
|
||||
feePool.CommunityPool = feePool.CommunityPool.Add(feesCollected)
|
||||
feePool.CommunityPool = feePool.CommunityPool.Add(feesCollected...)
|
||||
k.SetFeePool(ctx, feePool)
|
||||
return
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ func (k Keeper) AllocateTokens(
|
|||
}
|
||||
|
||||
// allocate community funding
|
||||
feePool.CommunityPool = feePool.CommunityPool.Add(remaining)
|
||||
feePool.CommunityPool = feePool.CommunityPool.Add(remaining...)
|
||||
k.SetFeePool(ctx, feePool)
|
||||
}
|
||||
|
||||
|
@ -114,12 +114,12 @@ func (k Keeper) AllocateTokensToValidator(ctx sdk.Context, val exported.Validato
|
|||
),
|
||||
)
|
||||
currentCommission := k.GetValidatorAccumulatedCommission(ctx, val.GetOperator())
|
||||
currentCommission = currentCommission.Add(commission)
|
||||
currentCommission = currentCommission.Add(commission...)
|
||||
k.SetValidatorAccumulatedCommission(ctx, val.GetOperator(), currentCommission)
|
||||
|
||||
// update current rewards
|
||||
currentRewards := k.GetValidatorCurrentRewards(ctx, val.GetOperator())
|
||||
currentRewards.Rewards = currentRewards.Rewards.Add(shared)
|
||||
currentRewards.Rewards = currentRewards.Rewards.Add(shared...)
|
||||
k.SetValidatorCurrentRewards(ctx, val.GetOperator(), currentRewards)
|
||||
|
||||
// update outstanding rewards
|
||||
|
@ -131,6 +131,6 @@ func (k Keeper) AllocateTokensToValidator(ctx sdk.Context, val exported.Validato
|
|||
),
|
||||
)
|
||||
outstanding := k.GetValidatorOutstandingRewards(ctx, val.GetOperator())
|
||||
outstanding = outstanding.Add(tokens)
|
||||
outstanding = outstanding.Add(tokens...)
|
||||
k.SetValidatorOutstandingRewards(ctx, val.GetOperator(), outstanding)
|
||||
}
|
||||
|
|
|
@ -81,7 +81,7 @@ func (k Keeper) calculateDelegationRewards(ctx sdk.Context, val exported.Validat
|
|||
func(height uint64, event types.ValidatorSlashEvent) (stop bool) {
|
||||
endingPeriod := event.ValidatorPeriod
|
||||
if endingPeriod > startingPeriod {
|
||||
rewards = rewards.Add(k.calculateDelegationRewardsBetween(ctx, val, startingPeriod, endingPeriod, stake))
|
||||
rewards = rewards.Add(k.calculateDelegationRewardsBetween(ctx, val, startingPeriod, endingPeriod, stake)...)
|
||||
|
||||
// Note: It is necessary to truncate so we don't allow withdrawing
|
||||
// more rewards than owed.
|
||||
|
@ -132,7 +132,7 @@ func (k Keeper) calculateDelegationRewards(ctx sdk.Context, val exported.Validat
|
|||
}
|
||||
|
||||
// calculate rewards for final period
|
||||
rewards = rewards.Add(k.calculateDelegationRewardsBetween(ctx, val, startingPeriod, endingPeriod, stake))
|
||||
rewards = rewards.Add(k.calculateDelegationRewardsBetween(ctx, val, startingPeriod, endingPeriod, stake)...)
|
||||
return rewards
|
||||
}
|
||||
|
||||
|
@ -173,7 +173,7 @@ func (k Keeper) withdrawDelegationRewards(ctx sdk.Context, val exported.Validato
|
|||
// transaction was successful
|
||||
k.SetValidatorOutstandingRewards(ctx, del.GetValidatorAddr(), outstanding.Sub(rewards))
|
||||
feePool := k.GetFeePool(ctx)
|
||||
feePool.CommunityPool = feePool.CommunityPool.Add(remainder)
|
||||
feePool.CommunityPool = feePool.CommunityPool.Add(remainder...)
|
||||
k.SetFeePool(ctx, feePool)
|
||||
|
||||
// decrement reference count of starting period
|
||||
|
|
|
@ -13,7 +13,7 @@ func (k Keeper) DistributeFromFeePool(ctx sdk.Context, amount sdk.Coins, receive
|
|||
// NOTE the community pool isn't a module account, however its coins
|
||||
// are held in the distribution module account. Thus the community pool
|
||||
// must be reduced separately from the SendCoinsFromModuleToAccount call
|
||||
newPool, negative := feePool.CommunityPool.SafeSub(sdk.NewDecCoins(amount))
|
||||
newPool, negative := feePool.CommunityPool.SafeSub(sdk.NewDecCoinsFromCoins(amount...))
|
||||
if negative {
|
||||
return types.ErrBadDistribution
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ func (h Hooks) AfterValidatorRemoved(ctx sdk.Context, _ sdk.ConsAddress, valAddr
|
|||
|
||||
// remainder to community pool
|
||||
feePool := h.k.GetFeePool(ctx)
|
||||
feePool.CommunityPool = feePool.CommunityPool.Add(remainder)
|
||||
feePool.CommunityPool = feePool.CommunityPool.Add(remainder...)
|
||||
h.k.SetFeePool(ctx, feePool)
|
||||
|
||||
// add to validator account
|
||||
|
@ -56,7 +56,7 @@ func (h Hooks) AfterValidatorRemoved(ctx sdk.Context, _ sdk.ConsAddress, valAddr
|
|||
|
||||
// add outstanding to community pool
|
||||
feePool := h.k.GetFeePool(ctx)
|
||||
feePool.CommunityPool = feePool.CommunityPool.Add(outstanding)
|
||||
feePool.CommunityPool = feePool.CommunityPool.Add(outstanding...)
|
||||
h.k.SetFeePool(ctx, feePool)
|
||||
|
||||
// delete outstanding
|
||||
|
|
|
@ -140,12 +140,12 @@ func ModuleAccountInvariant(k Keeper) sdk.Invariant {
|
|||
|
||||
var expectedCoins sdk.DecCoins
|
||||
k.IterateValidatorOutstandingRewards(ctx, func(_ sdk.ValAddress, rewards types.ValidatorOutstandingRewards) (stop bool) {
|
||||
expectedCoins = expectedCoins.Add(rewards)
|
||||
expectedCoins = expectedCoins.Add(rewards...)
|
||||
return false
|
||||
})
|
||||
|
||||
communityPool := k.GetFeePoolCommunityCoins(ctx)
|
||||
expectedInt, _ := expectedCoins.Add(communityPool).TruncateDecimal()
|
||||
expectedInt, _ := expectedCoins.Add(communityPool...).TruncateDecimal()
|
||||
|
||||
macc := k.GetDistributionAccount(ctx)
|
||||
|
||||
|
|
|
@ -118,7 +118,7 @@ func (k Keeper) WithdrawValidatorCommission(ctx sdk.Context, valAddr sdk.ValAddr
|
|||
|
||||
// update outstanding
|
||||
outstanding := k.GetValidatorOutstandingRewards(ctx, valAddr)
|
||||
k.SetValidatorOutstandingRewards(ctx, valAddr, outstanding.Sub(sdk.NewDecCoins(commission)))
|
||||
k.SetValidatorOutstandingRewards(ctx, valAddr, outstanding.Sub(sdk.NewDecCoinsFromCoins(commission...)))
|
||||
|
||||
if !commission.IsZero() {
|
||||
accAddr := sdk.AccAddress(valAddr)
|
||||
|
@ -143,7 +143,7 @@ func (k Keeper) WithdrawValidatorCommission(ctx sdk.Context, valAddr sdk.ValAddr
|
|||
func (k Keeper) GetTotalRewards(ctx sdk.Context) (totalRewards sdk.DecCoins) {
|
||||
k.IterateValidatorOutstandingRewards(ctx,
|
||||
func(_ sdk.ValAddress, rewards types.ValidatorOutstandingRewards) (stop bool) {
|
||||
totalRewards = totalRewards.Add(rewards)
|
||||
totalRewards = totalRewards.Add(rewards...)
|
||||
return false
|
||||
},
|
||||
)
|
||||
|
@ -161,7 +161,7 @@ func (k Keeper) FundCommunityPool(ctx sdk.Context, amount sdk.Coins, sender sdk.
|
|||
}
|
||||
|
||||
feePool := k.GetFeePool(ctx)
|
||||
feePool.CommunityPool = feePool.CommunityPool.Add(sdk.NewDecCoins(amount))
|
||||
feePool.CommunityPool = feePool.CommunityPool.Add(sdk.NewDecCoinsFromCoins(amount...)...)
|
||||
k.SetFeePool(ctx, feePool)
|
||||
|
||||
return nil
|
||||
|
|
|
@ -105,6 +105,6 @@ func TestFundCommunityPool(t *testing.T) {
|
|||
err := keeper.FundCommunityPool(ctx, amount, delAddr1)
|
||||
assert.Nil(t, err)
|
||||
|
||||
assert.Equal(t, initPool.CommunityPool.Add(sdk.NewDecCoins(amount)), keeper.GetFeePool(ctx).CommunityPool)
|
||||
assert.Equal(t, initPool.CommunityPool.Add(sdk.NewDecCoinsFromCoins(amount...)...), keeper.GetFeePool(ctx).CommunityPool)
|
||||
assert.Empty(t, bk.GetCoins(ctx, delAddr1))
|
||||
}
|
||||
|
|
|
@ -202,8 +202,7 @@ func queryDelegatorTotalRewards(ctx sdk.Context, _ []string, req abci.RequestQue
|
|||
delReward := k.calculateDelegationRewards(ctx, val, del, endingPeriod)
|
||||
|
||||
delRewards = append(delRewards, types.NewDelegationDelegatorReward(valAddr, delReward))
|
||||
total = total.Add(delReward)
|
||||
|
||||
total = total.Add(delReward...)
|
||||
return false
|
||||
},
|
||||
)
|
||||
|
|
|
@ -37,7 +37,7 @@ func (k Keeper) incrementValidatorPeriod(ctx sdk.Context, val exported.Validator
|
|||
// ergo we instead add to the community pool
|
||||
feePool := k.GetFeePool(ctx)
|
||||
outstanding := k.GetValidatorOutstandingRewards(ctx, val.GetOperator())
|
||||
feePool.CommunityPool = feePool.CommunityPool.Add(rewards.Rewards)
|
||||
feePool.CommunityPool = feePool.CommunityPool.Add(rewards.Rewards...)
|
||||
outstanding = outstanding.Sub(rewards.Rewards)
|
||||
k.SetFeePool(ctx, feePool)
|
||||
k.SetValidatorOutstandingRewards(ctx, val.GetOperator(), outstanding)
|
||||
|
@ -55,7 +55,7 @@ func (k Keeper) incrementValidatorPeriod(ctx sdk.Context, val exported.Validator
|
|||
k.decrementReferenceCount(ctx, val.GetOperator(), rewards.Period-1)
|
||||
|
||||
// set new historical rewards with reference count of 1
|
||||
k.SetValidatorHistoricalRewards(ctx, val.GetOperator(), rewards.Period, types.NewValidatorHistoricalRewards(historical.Add(current), 1))
|
||||
k.SetValidatorHistoricalRewards(ctx, val.GetOperator(), rewards.Period, types.NewValidatorHistoricalRewards(historical.Add(current...), 1))
|
||||
|
||||
// set current rewards, incrementing period by 1
|
||||
k.SetValidatorCurrentRewards(ctx, val.GetOperator(), types.NewValidatorCurrentRewards(sdk.DecCoins{}, rewards.Period+1))
|
||||
|
|
|
@ -33,7 +33,7 @@ func TestProposalHandlerPassed(t *testing.T) {
|
|||
|
||||
// add coins to the module account
|
||||
macc := keeper.GetDistributionAccount(ctx)
|
||||
err := macc.SetCoins(macc.GetCoins().Add(amount))
|
||||
err := macc.SetCoins(macc.GetCoins().Add(amount...))
|
||||
require.NoError(t, err)
|
||||
|
||||
supplyKeeper.SetModuleAccount(ctx, macc)
|
||||
|
@ -43,7 +43,7 @@ func TestProposalHandlerPassed(t *testing.T) {
|
|||
accountKeeper.SetAccount(ctx, account)
|
||||
|
||||
feePool := keeper.GetFeePool(ctx)
|
||||
feePool.CommunityPool = sdk.NewDecCoins(amount)
|
||||
feePool.CommunityPool = sdk.NewDecCoinsFromCoins(amount...)
|
||||
keeper.SetFeePool(ctx, feePool)
|
||||
|
||||
tp := testProposal(recipient, amount)
|
||||
|
|
|
@ -75,7 +75,7 @@ func Migrate(
|
|||
|
||||
var expDeposits sdk.Coins
|
||||
for _, deposit := range deposits {
|
||||
expDeposits = expDeposits.Add(deposit.Deposit.Amount)
|
||||
expDeposits = expDeposits.Add(deposit.Deposit.Amount...)
|
||||
}
|
||||
|
||||
if !expDeposits.IsEqual(govCoins) {
|
||||
|
@ -113,10 +113,10 @@ func Migrate(
|
|||
// get distr module account coins
|
||||
var distrDecCoins sdk.DecCoins
|
||||
for _, reward := range valOutRewards {
|
||||
distrDecCoins = distrDecCoins.Add(reward.OutstandingRewards)
|
||||
distrDecCoins = distrDecCoins.Add(reward.OutstandingRewards...)
|
||||
}
|
||||
|
||||
distrCoins, _ := distrDecCoins.Add(communityPool).TruncateDecimal()
|
||||
distrCoins, _ := distrDecCoins.Add(communityPool...).TruncateDecimal()
|
||||
|
||||
// get module account addresses
|
||||
feeCollectorAddr := sdk.AccAddress(crypto.AddressHash([]byte(feeCollectorName)))
|
||||
|
|
|
@ -279,7 +279,7 @@ func TestProposalPassedEndblocker(t *testing.T) {
|
|||
require.NotNil(t, macc)
|
||||
moduleAccCoins := macc.GetCoins()
|
||||
|
||||
deposits := initialModuleAccCoins.Add(proposal.TotalDeposit).Add(proposalCoins)
|
||||
deposits := initialModuleAccCoins.Add(proposal.TotalDeposit...).Add(proposalCoins...)
|
||||
require.True(t, moduleAccCoins.IsEqual(deposits))
|
||||
|
||||
err = input.keeper.AddVote(ctx, proposal.ProposalID, input.addrs[0], OptionYes)
|
||||
|
|
|
@ -24,7 +24,7 @@ func InitGenesis(ctx sdk.Context, k Keeper, supplyKeeper types.SupplyKeeper, dat
|
|||
var totalDeposits sdk.Coins
|
||||
for _, deposit := range data.Deposits {
|
||||
k.SetDeposit(ctx, deposit)
|
||||
totalDeposits = totalDeposits.Add(deposit.Amount)
|
||||
totalDeposits = totalDeposits.Add(deposit.Amount...)
|
||||
}
|
||||
|
||||
for _, vote := range data.Votes {
|
||||
|
|
|
@ -113,7 +113,7 @@ func (keeper Keeper) AddDeposit(ctx sdk.Context, proposalID uint64, depositorAdd
|
|||
}
|
||||
|
||||
// Update proposal
|
||||
proposal.TotalDeposit = proposal.TotalDeposit.Add(depositAmount)
|
||||
proposal.TotalDeposit = proposal.TotalDeposit.Add(depositAmount...)
|
||||
keeper.SetProposal(ctx, proposal)
|
||||
|
||||
// Check if deposit has provided sufficient total funds to transition the proposal into the voting period
|
||||
|
@ -126,7 +126,7 @@ func (keeper Keeper) AddDeposit(ctx sdk.Context, proposalID uint64, depositorAdd
|
|||
// Add or update deposit object
|
||||
deposit, found := keeper.GetDeposit(ctx, proposalID, depositorAddr)
|
||||
if found {
|
||||
deposit.Amount = deposit.Amount.Add(depositAmount)
|
||||
deposit.Amount = deposit.Amount.Add(depositAmount...)
|
||||
} else {
|
||||
deposit = types.NewDeposit(proposalID, depositorAddr, depositAmount)
|
||||
}
|
||||
|
|
|
@ -51,11 +51,11 @@ func TestDeposits(t *testing.T) {
|
|||
require.False(t, votingStarted)
|
||||
deposit, found = keeper.GetDeposit(ctx, proposalID, TestAddrs[0])
|
||||
require.True(t, found)
|
||||
require.Equal(t, fourStake.Add(fiveStake), deposit.Amount)
|
||||
require.Equal(t, fourStake.Add(fiveStake...), deposit.Amount)
|
||||
require.Equal(t, TestAddrs[0], deposit.Depositor)
|
||||
proposal, ok = keeper.GetProposal(ctx, proposalID)
|
||||
require.True(t, ok)
|
||||
require.Equal(t, fourStake.Add(fiveStake), proposal.TotalDeposit)
|
||||
require.Equal(t, fourStake.Add(fiveStake...), proposal.TotalDeposit)
|
||||
require.Equal(t, addr0Initial.Sub(fourStake).Sub(fiveStake), ak.GetAccount(ctx, TestAddrs[0]).GetCoins())
|
||||
|
||||
// Check third deposit from a new address
|
||||
|
@ -68,7 +68,7 @@ func TestDeposits(t *testing.T) {
|
|||
require.Equal(t, fourStake, deposit.Amount)
|
||||
proposal, ok = keeper.GetProposal(ctx, proposalID)
|
||||
require.True(t, ok)
|
||||
require.Equal(t, fourStake.Add(fiveStake).Add(fourStake), proposal.TotalDeposit)
|
||||
require.Equal(t, fourStake.Add(fiveStake...).Add(fourStake...), proposal.TotalDeposit)
|
||||
require.Equal(t, addr1Initial.Sub(fourStake), ak.GetAccount(ctx, TestAddrs[1]).GetCoins())
|
||||
|
||||
// Check that proposal moved to voting period
|
||||
|
@ -82,7 +82,7 @@ func TestDeposits(t *testing.T) {
|
|||
require.Len(t, deposits, 2)
|
||||
require.Equal(t, deposits, keeper.GetDeposits(ctx, proposalID))
|
||||
require.Equal(t, TestAddrs[0], deposits[0].Depositor)
|
||||
require.Equal(t, fourStake.Add(fiveStake), deposits[0].Amount)
|
||||
require.Equal(t, fourStake.Add(fiveStake...), deposits[0].Amount)
|
||||
require.Equal(t, TestAddrs[1], deposits[1].Depositor)
|
||||
require.Equal(t, fourStake, deposits[1].Amount)
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ func ModuleAccountInvariant(keeper Keeper) sdk.Invariant {
|
|||
var expectedDeposits sdk.Coins
|
||||
|
||||
keeper.IterateAllDeposits(ctx, func(deposit types.Deposit) bool {
|
||||
expectedDeposits = expectedDeposits.Add(deposit.Amount)
|
||||
expectedDeposits = expectedDeposits.Add(deposit.Amount...)
|
||||
return false
|
||||
})
|
||||
|
||||
|
|
|
@ -159,7 +159,7 @@ func TestQueries(t *testing.T) {
|
|||
_, err = keeper.AddDeposit(ctx, deposit1.ProposalID, deposit1.Depositor, deposit1.Amount)
|
||||
require.NoError(t, err)
|
||||
|
||||
proposal1.TotalDeposit = proposal1.TotalDeposit.Add(deposit1.Amount)
|
||||
proposal1.TotalDeposit = proposal1.TotalDeposit.Add(deposit1.Amount...)
|
||||
|
||||
proposal2, err := keeper.SubmitProposal(ctx, tp)
|
||||
require.NoError(t, err)
|
||||
|
@ -167,7 +167,7 @@ func TestQueries(t *testing.T) {
|
|||
_, err = keeper.AddDeposit(ctx, deposit2.ProposalID, deposit2.Depositor, deposit2.Amount)
|
||||
require.NoError(t, err)
|
||||
|
||||
proposal2.TotalDeposit = proposal2.TotalDeposit.Add(deposit2.Amount)
|
||||
proposal2.TotalDeposit = proposal2.TotalDeposit.Add(deposit2.Amount...)
|
||||
|
||||
// TestAddrs[1] proposes (and deposits) on proposal #3
|
||||
proposal3, err := keeper.SubmitProposal(ctx, tp)
|
||||
|
@ -176,14 +176,14 @@ func TestQueries(t *testing.T) {
|
|||
_, err = keeper.AddDeposit(ctx, deposit3.ProposalID, deposit3.Depositor, deposit3.Amount)
|
||||
require.NoError(t, err)
|
||||
|
||||
proposal3.TotalDeposit = proposal3.TotalDeposit.Add(deposit3.Amount)
|
||||
proposal3.TotalDeposit = proposal3.TotalDeposit.Add(deposit3.Amount...)
|
||||
|
||||
// TestAddrs[1] deposits on proposals #2 & #3
|
||||
deposit4 := types.NewDeposit(proposal2.ProposalID, TestAddrs[1], depositParams.MinDeposit)
|
||||
_, err = keeper.AddDeposit(ctx, deposit4.ProposalID, deposit4.Depositor, deposit4.Amount)
|
||||
require.NoError(t, err)
|
||||
|
||||
proposal2.TotalDeposit = proposal2.TotalDeposit.Add(deposit4.Amount)
|
||||
proposal2.TotalDeposit = proposal2.TotalDeposit.Add(deposit4.Amount...)
|
||||
proposal2.Status = types.StatusVotingPeriod
|
||||
proposal2.VotingEndTime = proposal2.VotingEndTime.Add(types.DefaultPeriod)
|
||||
|
||||
|
@ -191,11 +191,11 @@ func TestQueries(t *testing.T) {
|
|||
_, err = keeper.AddDeposit(ctx, deposit5.ProposalID, deposit5.Depositor, deposit5.Amount)
|
||||
require.NoError(t, err)
|
||||
|
||||
proposal3.TotalDeposit = proposal3.TotalDeposit.Add(deposit5.Amount)
|
||||
proposal3.TotalDeposit = proposal3.TotalDeposit.Add(deposit5.Amount...)
|
||||
proposal3.Status = types.StatusVotingPeriod
|
||||
proposal3.VotingEndTime = proposal3.VotingEndTime.Add(types.DefaultPeriod)
|
||||
// total deposit of TestAddrs[1] on proposal #3 is worth the proposal deposit + individual deposit
|
||||
deposit5.Amount = deposit5.Amount.Add(deposit3.Amount)
|
||||
deposit5.Amount = deposit5.Amount.Add(deposit3.Amount...)
|
||||
|
||||
// check deposits on proposal1 match individual deposits
|
||||
deposits := getQueriedDeposits(t, ctx, keeper.cdc, querier, proposal1.ProposalID)
|
||||
|
|
|
@ -299,7 +299,7 @@ func RandomSetGenesis(r *rand.Rand, app *App, addrs []sdk.AccAddress, denoms []s
|
|||
}
|
||||
}
|
||||
|
||||
app.TotalCoinsSupply = app.TotalCoinsSupply.Add(coins)
|
||||
app.TotalCoinsSupply = app.TotalCoinsSupply.Add(coins...)
|
||||
baseAcc := auth.NewBaseAccountWithAddress(addrs[i])
|
||||
|
||||
(&baseAcc).SetCoins(coins)
|
||||
|
|
|
@ -31,7 +31,7 @@ func (sk DummySupplyKeeper) SendCoinsFromAccountToModule(ctx sdk.Context, fromAd
|
|||
return sdkerrors.Wrap(sdkerrors.ErrInsufficientFunds, fromAcc.GetCoins().String())
|
||||
}
|
||||
|
||||
newToCoins := moduleAcc.GetCoins().Add(amt)
|
||||
newToCoins := moduleAcc.GetCoins().Add(amt...)
|
||||
|
||||
if err := fromAcc.SetCoins(newFromCoins); err != nil {
|
||||
return err
|
||||
|
|
|
@ -296,7 +296,7 @@ func TestUndelegateSelfDelegationBelowMinSelfDelegation(t *testing.T) {
|
|||
|
||||
// add bonded tokens to pool for delegations
|
||||
notBondedPool := keeper.GetNotBondedPool(ctx)
|
||||
err := notBondedPool.SetCoins(notBondedPool.GetCoins().Add(delCoins))
|
||||
err := notBondedPool.SetCoins(notBondedPool.GetCoins().Add(delCoins...))
|
||||
require.NoError(t, err)
|
||||
keeper.supplyKeeper.SetModuleAccount(ctx, notBondedPool)
|
||||
|
||||
|
@ -308,7 +308,7 @@ func TestUndelegateSelfDelegationBelowMinSelfDelegation(t *testing.T) {
|
|||
|
||||
// add bonded tokens to pool for delegations
|
||||
bondedPool := keeper.GetBondedPool(ctx)
|
||||
err = bondedPool.SetCoins(bondedPool.GetCoins().Add(delCoins))
|
||||
err = bondedPool.SetCoins(bondedPool.GetCoins().Add(delCoins...))
|
||||
require.NoError(t, err)
|
||||
keeper.supplyKeeper.SetModuleAccount(ctx, bondedPool)
|
||||
|
||||
|
@ -320,7 +320,7 @@ func TestUndelegateSelfDelegationBelowMinSelfDelegation(t *testing.T) {
|
|||
|
||||
// add bonded tokens to pool for delegations
|
||||
bondedPool = keeper.GetBondedPool(ctx)
|
||||
err = bondedPool.SetCoins(bondedPool.GetCoins().Add(delCoins))
|
||||
err = bondedPool.SetCoins(bondedPool.GetCoins().Add(delCoins...))
|
||||
require.NoError(t, err)
|
||||
keeper.supplyKeeper.SetModuleAccount(ctx, bondedPool)
|
||||
|
||||
|
@ -356,7 +356,7 @@ func TestUndelegateFromUnbondingValidator(t *testing.T) {
|
|||
|
||||
// add bonded tokens to pool for delegations
|
||||
notBondedPool := keeper.GetNotBondedPool(ctx)
|
||||
err := notBondedPool.SetCoins(notBondedPool.GetCoins().Add(delCoins))
|
||||
err := notBondedPool.SetCoins(notBondedPool.GetCoins().Add(delCoins...))
|
||||
require.NoError(t, err)
|
||||
keeper.supplyKeeper.SetModuleAccount(ctx, notBondedPool)
|
||||
|
||||
|
@ -367,7 +367,7 @@ func TestUndelegateFromUnbondingValidator(t *testing.T) {
|
|||
keeper.SetDelegation(ctx, selfDelegation)
|
||||
|
||||
bondedPool := keeper.GetBondedPool(ctx)
|
||||
err = bondedPool.SetCoins(bondedPool.GetCoins().Add(delCoins))
|
||||
err = bondedPool.SetCoins(bondedPool.GetCoins().Add(delCoins...))
|
||||
require.NoError(t, err)
|
||||
keeper.supplyKeeper.SetModuleAccount(ctx, bondedPool)
|
||||
|
||||
|
@ -378,7 +378,7 @@ func TestUndelegateFromUnbondingValidator(t *testing.T) {
|
|||
require.Equal(t, delTokens, issuedShares.RoundInt())
|
||||
|
||||
bondedPool = keeper.GetBondedPool(ctx)
|
||||
err = bondedPool.SetCoins(bondedPool.GetCoins().Add(delCoins))
|
||||
err = bondedPool.SetCoins(bondedPool.GetCoins().Add(delCoins...))
|
||||
require.NoError(t, err)
|
||||
keeper.supplyKeeper.SetModuleAccount(ctx, bondedPool)
|
||||
|
||||
|
@ -387,7 +387,7 @@ func TestUndelegateFromUnbondingValidator(t *testing.T) {
|
|||
keeper.SetDelegation(ctx, delegation)
|
||||
|
||||
bondedPool = keeper.GetBondedPool(ctx)
|
||||
err = bondedPool.SetCoins(bondedPool.GetCoins().Add(delCoins))
|
||||
err = bondedPool.SetCoins(bondedPool.GetCoins().Add(delCoins...))
|
||||
require.NoError(t, err)
|
||||
keeper.supplyKeeper.SetModuleAccount(ctx, bondedPool)
|
||||
|
||||
|
@ -438,7 +438,7 @@ func TestUndelegateFromUnbondedValidator(t *testing.T) {
|
|||
|
||||
// add bonded tokens to pool for delegations
|
||||
notBondedPool := keeper.GetNotBondedPool(ctx)
|
||||
err := notBondedPool.SetCoins(notBondedPool.GetCoins().Add(delCoins))
|
||||
err := notBondedPool.SetCoins(notBondedPool.GetCoins().Add(delCoins...))
|
||||
require.NoError(t, err)
|
||||
keeper.supplyKeeper.SetModuleAccount(ctx, notBondedPool)
|
||||
|
||||
|
@ -456,7 +456,7 @@ func TestUndelegateFromUnbondedValidator(t *testing.T) {
|
|||
keeper.SetDelegation(ctx, selfDelegation)
|
||||
|
||||
bondedPool := keeper.GetBondedPool(ctx)
|
||||
err = bondedPool.SetCoins(bondedPool.GetCoins().Add(delCoins))
|
||||
err = bondedPool.SetCoins(bondedPool.GetCoins().Add(delCoins...))
|
||||
require.NoError(t, err)
|
||||
keeper.supplyKeeper.SetModuleAccount(ctx, bondedPool)
|
||||
|
||||
|
@ -517,7 +517,7 @@ func TestUnbondingAllDelegationFromValidator(t *testing.T) {
|
|||
|
||||
// add bonded tokens to pool for delegations
|
||||
notBondedPool := keeper.GetNotBondedPool(ctx)
|
||||
err := notBondedPool.SetCoins(notBondedPool.GetCoins().Add(delCoins))
|
||||
err := notBondedPool.SetCoins(notBondedPool.GetCoins().Add(delCoins...))
|
||||
require.NoError(t, err)
|
||||
keeper.supplyKeeper.SetModuleAccount(ctx, notBondedPool)
|
||||
|
||||
|
@ -541,7 +541,7 @@ func TestUnbondingAllDelegationFromValidator(t *testing.T) {
|
|||
require.Equal(t, delTokens, issuedShares.RoundInt())
|
||||
|
||||
bondedPool := keeper.GetBondedPool(ctx)
|
||||
err = bondedPool.SetCoins(bondedPool.GetCoins().Add(delCoins))
|
||||
err = bondedPool.SetCoins(bondedPool.GetCoins().Add(delCoins...))
|
||||
require.NoError(t, err)
|
||||
keeper.supplyKeeper.SetModuleAccount(ctx, bondedPool)
|
||||
|
||||
|
@ -672,7 +672,7 @@ func TestRedelegateToSameValidator(t *testing.T) {
|
|||
|
||||
// add bonded tokens to pool for delegations
|
||||
notBondedPool := keeper.GetNotBondedPool(ctx)
|
||||
err := notBondedPool.SetCoins(notBondedPool.GetCoins().Add(startCoins))
|
||||
err := notBondedPool.SetCoins(notBondedPool.GetCoins().Add(startCoins...))
|
||||
require.NoError(t, err)
|
||||
keeper.supplyKeeper.SetModuleAccount(ctx, notBondedPool)
|
||||
|
||||
|
@ -699,7 +699,7 @@ func TestRedelegationMaxEntries(t *testing.T) {
|
|||
|
||||
// add bonded tokens to pool for delegations
|
||||
notBondedPool := keeper.GetNotBondedPool(ctx)
|
||||
err := notBondedPool.SetCoins(notBondedPool.GetCoins().Add(startCoins))
|
||||
err := notBondedPool.SetCoins(notBondedPool.GetCoins().Add(startCoins...))
|
||||
require.NoError(t, err)
|
||||
keeper.supplyKeeper.SetModuleAccount(ctx, notBondedPool)
|
||||
|
||||
|
@ -752,7 +752,7 @@ func TestRedelegateSelfDelegation(t *testing.T) {
|
|||
|
||||
// add bonded tokens to pool for delegations
|
||||
notBondedPool := keeper.GetNotBondedPool(ctx)
|
||||
err := notBondedPool.SetCoins(notBondedPool.GetCoins().Add(startCoins))
|
||||
err := notBondedPool.SetCoins(notBondedPool.GetCoins().Add(startCoins...))
|
||||
require.NoError(t, err)
|
||||
keeper.supplyKeeper.SetModuleAccount(ctx, notBondedPool)
|
||||
|
||||
|
@ -804,7 +804,7 @@ func TestRedelegateFromUnbondingValidator(t *testing.T) {
|
|||
|
||||
// add bonded tokens to pool for delegations
|
||||
notBondedPool := keeper.GetNotBondedPool(ctx)
|
||||
err := notBondedPool.SetCoins(notBondedPool.GetCoins().Add(startCoins))
|
||||
err := notBondedPool.SetCoins(notBondedPool.GetCoins().Add(startCoins...))
|
||||
require.NoError(t, err)
|
||||
keeper.supplyKeeper.SetModuleAccount(ctx, notBondedPool)
|
||||
|
||||
|
@ -883,7 +883,7 @@ func TestRedelegateFromUnbondedValidator(t *testing.T) {
|
|||
|
||||
// add bonded tokens to pool for delegations
|
||||
notBondedPool := keeper.GetNotBondedPool(ctx)
|
||||
err := notBondedPool.SetCoins(notBondedPool.GetCoins().Add(startCoins))
|
||||
err := notBondedPool.SetCoins(notBondedPool.GetCoins().Add(startCoins...))
|
||||
require.NoError(t, err)
|
||||
keeper.supplyKeeper.SetModuleAccount(ctx, notBondedPool)
|
||||
|
||||
|
|
|
@ -117,7 +117,7 @@ func TestSlashRedelegation(t *testing.T) {
|
|||
// add bonded tokens to pool for (re)delegations
|
||||
startCoins := sdk.NewCoins(sdk.NewInt64Coin(keeper.BondDenom(ctx), 15))
|
||||
bondedPool := keeper.GetBondedPool(ctx)
|
||||
err := bondedPool.SetCoins(bondedPool.GetCoins().Add(startCoins))
|
||||
err := bondedPool.SetCoins(bondedPool.GetCoins().Add(startCoins...))
|
||||
require.NoError(t, err)
|
||||
keeper.supplyKeeper.SetModuleAccount(ctx, bondedPool)
|
||||
|
||||
|
@ -371,7 +371,7 @@ func TestSlashWithRedelegation(t *testing.T) {
|
|||
bondedPool := keeper.GetBondedPool(ctx)
|
||||
notBondedPool := keeper.GetNotBondedPool(ctx)
|
||||
rdCoins := sdk.NewCoins(sdk.NewCoin(bondDenom, rdTokens.MulRaw(2)))
|
||||
err := bondedPool.SetCoins(bondedPool.GetCoins().Add(rdCoins))
|
||||
err := bondedPool.SetCoins(bondedPool.GetCoins().Add(rdCoins...))
|
||||
require.NoError(t, err)
|
||||
keeper.supplyKeeper.SetModuleAccount(ctx, bondedPool)
|
||||
|
||||
|
@ -515,8 +515,8 @@ func TestSlashBoth(t *testing.T) {
|
|||
// update bonded tokens
|
||||
bondedPool := keeper.GetBondedPool(ctx)
|
||||
notBondedPool := keeper.GetNotBondedPool(ctx)
|
||||
require.NoError(t, bondedPool.SetCoins(bondedPool.GetCoins().Add(bondedCoins)))
|
||||
require.NoError(t, bondedPool.SetCoins(notBondedPool.GetCoins().Add(notBondedCoins)))
|
||||
require.NoError(t, bondedPool.SetCoins(bondedPool.GetCoins().Add(bondedCoins...)))
|
||||
require.NoError(t, bondedPool.SetCoins(notBondedPool.GetCoins().Add(notBondedCoins...)))
|
||||
keeper.supplyKeeper.SetModuleAccount(ctx, bondedPool)
|
||||
keeper.supplyKeeper.SetModuleAccount(ctx, notBondedPool)
|
||||
|
||||
|
|
|
@ -449,7 +449,7 @@ func TestGetValidatorsEdgeCases(t *testing.T) {
|
|||
tokens := sdk.TokensFromConsensusPower(power)
|
||||
validators[i], _ = validators[i].AddTokensFromDel(tokens)
|
||||
notBondedPool := keeper.GetNotBondedPool(ctx)
|
||||
require.NoError(t, notBondedPool.SetCoins(notBondedPool.GetCoins().Add(sdk.NewCoins(sdk.NewCoin(params.BondDenom, tokens)))))
|
||||
require.NoError(t, notBondedPool.SetCoins(notBondedPool.GetCoins().Add(sdk.NewCoin(params.BondDenom, tokens))))
|
||||
keeper.supplyKeeper.SetModuleAccount(ctx, notBondedPool)
|
||||
validators[i] = TestingUpdateValidator(keeper, ctx, validators[i], true)
|
||||
}
|
||||
|
@ -465,8 +465,8 @@ func TestGetValidatorsEdgeCases(t *testing.T) {
|
|||
delTokens := sdk.TokensFromConsensusPower(500)
|
||||
validators[0], _ = validators[0].AddTokensFromDel(delTokens)
|
||||
notBondedPool := keeper.GetNotBondedPool(ctx)
|
||||
newTokens := sdk.NewCoins(sdk.NewCoin(params.BondDenom, delTokens))
|
||||
require.NoError(t, notBondedPool.SetCoins(notBondedPool.GetCoins().Add(newTokens)))
|
||||
newTokens := sdk.NewCoins()
|
||||
require.NoError(t, notBondedPool.SetCoins(notBondedPool.GetCoins().Add(newTokens...)))
|
||||
keeper.supplyKeeper.SetModuleAccount(ctx, notBondedPool)
|
||||
|
||||
// test that the two largest validators are
|
||||
|
@ -496,7 +496,7 @@ func TestGetValidatorsEdgeCases(t *testing.T) {
|
|||
|
||||
notBondedPool = keeper.GetNotBondedPool(ctx)
|
||||
newTokens = sdk.NewCoins(sdk.NewCoin(params.BondDenom, sdk.TokensFromConsensusPower(1)))
|
||||
require.NoError(t, notBondedPool.SetCoins(notBondedPool.GetCoins().Add(newTokens)))
|
||||
require.NoError(t, notBondedPool.SetCoins(notBondedPool.GetCoins().Add(newTokens...)))
|
||||
keeper.supplyKeeper.SetModuleAccount(ctx, notBondedPool)
|
||||
|
||||
validators[3] = TestingUpdateValidator(keeper, ctx, validators[3], true)
|
||||
|
@ -511,7 +511,7 @@ func TestGetValidatorsEdgeCases(t *testing.T) {
|
|||
validators[3], _ = validators[3].RemoveDelShares(sdk.NewDec(201))
|
||||
|
||||
bondedPool := keeper.GetBondedPool(ctx)
|
||||
require.NoError(t, bondedPool.SetCoins(bondedPool.GetCoins().Add(sdk.NewCoins(sdk.NewCoin(params.BondDenom, rmTokens)))))
|
||||
require.NoError(t, bondedPool.SetCoins(bondedPool.GetCoins().Add(sdk.NewCoin(params.BondDenom, rmTokens))))
|
||||
keeper.supplyKeeper.SetModuleAccount(ctx, bondedPool)
|
||||
|
||||
validators[3] = TestingUpdateValidator(keeper, ctx, validators[3], true)
|
||||
|
@ -525,7 +525,7 @@ func TestGetValidatorsEdgeCases(t *testing.T) {
|
|||
validators[3], _ = validators[3].AddTokensFromDel(sdk.NewInt(200))
|
||||
|
||||
notBondedPool = keeper.GetNotBondedPool(ctx)
|
||||
require.NoError(t, notBondedPool.SetCoins(notBondedPool.GetCoins().Add(sdk.NewCoins(sdk.NewCoin(params.BondDenom, sdk.NewInt(200))))))
|
||||
require.NoError(t, notBondedPool.SetCoins(notBondedPool.GetCoins().Add(sdk.NewCoin(params.BondDenom, sdk.NewInt(200)))))
|
||||
keeper.supplyKeeper.SetModuleAccount(ctx, notBondedPool)
|
||||
|
||||
validators[3] = TestingUpdateValidator(keeper, ctx, validators[3], true)
|
||||
|
|
|
@ -15,7 +15,7 @@ func InitGenesis(ctx sdk.Context, keeper Keeper, ak types.AccountKeeper, data Ge
|
|||
var totalSupply sdk.Coins
|
||||
ak.IterateAccounts(ctx,
|
||||
func(acc authexported.Account) (stop bool) {
|
||||
totalSupply = totalSupply.Add(acc.GetCoins())
|
||||
totalSupply = totalSupply.Add(acc.GetCoins()...)
|
||||
return false
|
||||
},
|
||||
)
|
||||
|
|
|
@ -60,7 +60,7 @@ func TestSendCoins(t *testing.T) {
|
|||
keeper.SendCoinsFromModuleToAccount(ctx, "", baseAcc.GetAddress(), initCoins)
|
||||
})
|
||||
|
||||
err = keeper.SendCoinsFromModuleToAccount(ctx, holderAcc.GetName(), baseAcc.GetAddress(), initCoins.Add(initCoins))
|
||||
err = keeper.SendCoinsFromModuleToAccount(ctx, holderAcc.GetName(), baseAcc.GetAddress(), initCoins.Add(initCoins...))
|
||||
require.Error(t, err)
|
||||
|
||||
err = keeper.SendCoinsFromModuleToModule(ctx, holderAcc.GetName(), types.Burner, initCoins)
|
||||
|
@ -102,7 +102,7 @@ func TestMintCoins(t *testing.T) {
|
|||
err = keeper.MintCoins(ctx, types.Minter, initCoins)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, initCoins, getCoinsByName(ctx, keeper, ak, types.Minter))
|
||||
require.Equal(t, initialSupply.GetTotal().Add(initCoins), keeper.GetSupply(ctx).GetTotal())
|
||||
require.Equal(t, initialSupply.GetTotal().Add(initCoins...), keeper.GetSupply(ctx).GetTotal())
|
||||
|
||||
// test same functionality on module account with multiple permissions
|
||||
initialSupply = keeper.GetSupply(ctx)
|
||||
|
@ -110,7 +110,7 @@ func TestMintCoins(t *testing.T) {
|
|||
err = keeper.MintCoins(ctx, multiPermAcc.GetName(), initCoins)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, initCoins, getCoinsByName(ctx, keeper, ak, multiPermAcc.GetName()))
|
||||
require.Equal(t, initialSupply.GetTotal().Add(initCoins), keeper.GetSupply(ctx).GetTotal())
|
||||
require.Equal(t, initialSupply.GetTotal().Add(initCoins...), keeper.GetSupply(ctx).GetTotal())
|
||||
|
||||
require.Panics(t, func() { keeper.MintCoins(ctx, types.Burner, initCoins) })
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ func TotalSupply(k Keeper) sdk.Invariant {
|
|||
supply := k.GetSupply(ctx)
|
||||
|
||||
k.ak.IterateAccounts(ctx, func(acc exported.Account) bool {
|
||||
expectedTotal = expectedTotal.Add(acc.GetCoins())
|
||||
expectedTotal = expectedTotal.Add(acc.GetCoins()...)
|
||||
return false
|
||||
})
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ func DefaultSupply() exported.SupplyI {
|
|||
|
||||
// Inflate adds coins to the total supply
|
||||
func (supply Supply) Inflate(amount sdk.Coins) exported.SupplyI {
|
||||
supply.Total = supply.Total.Add(amount)
|
||||
supply.Total = supply.Total.Add(amount...)
|
||||
return supply
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue