mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-12-25 07:45:18 +00:00
[R4R] Bep3 sim changes (#442)
* fix: choose claim amount as percentage * fix: lower asset supply to avoid overwhelming auctions
This commit is contained in:
parent
783247851d
commit
5ae0b76e0c
@ -24,7 +24,7 @@ const (
|
||||
)
|
||||
|
||||
var (
|
||||
MaxSupplyLimit = sdk.NewInt(10000000000000000)
|
||||
MaxSupplyLimit = sdk.NewInt(1000000000000)
|
||||
Accs []simulation.Account
|
||||
ConsistentDenoms = [3]string{"bnb", "xrp", "btc"}
|
||||
)
|
||||
|
@ -50,19 +50,12 @@ func SimulateMsgCreateAtomicSwap(ak auth.AccountKeeper, k keeper.Keeper) simulat
|
||||
|
||||
// Check that the sender has coins of this type
|
||||
availableAmount := ak.GetAccount(ctx, sender).GetCoins().AmountOf(asset.Denom)
|
||||
if !availableAmount.IsPositive() {
|
||||
return noOpMsg, nil, fmt.Errorf("available amount must be positive")
|
||||
// Get an amount of coins between 0.1 and 2% of total coins
|
||||
amount := availableAmount.Quo(sdk.NewInt(int64(simulation.RandIntBetween(r, 50, 1000))))
|
||||
if amount.IsZero() {
|
||||
return simulation.NewOperationMsgBasic(bep3.ModuleName, fmt.Sprintf("no-operation (all funds exhausted for asset %s)", asset.Denom), "", false, nil), nil, nil
|
||||
}
|
||||
|
||||
// Get a random amount of the available coins
|
||||
amount, err := simulation.RandPositiveInt(r, availableAmount)
|
||||
if err != nil {
|
||||
return noOpMsg, nil, err
|
||||
}
|
||||
|
||||
// If we don't adjust the conversion factor, we'll be out of funds soon
|
||||
adjustedAmount := amount.Int64() / int64(math.Pow10(8))
|
||||
coin := sdk.NewInt64Coin(asset.Denom, adjustedAmount)
|
||||
coin := sdk.NewCoin(asset.Denom, amount)
|
||||
coins := sdk.NewCoins(coin)
|
||||
expectedIncome := coin.String()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user