Skip to content

Commit

Permalink
fix new vault deposit amount
Browse files Browse the repository at this point in the history
Signed-off-by: Shrenuj Bansal <shrenuj@dydx.exchange>
  • Loading branch information
shrenujb committed Sep 25, 2024
1 parent a2bcb7b commit 68f7397
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 11 deletions.
2 changes: 1 addition & 1 deletion protocol/app/testdata/default_genesis_state.json
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@
"listing": {
"hard_cap_for_markets": 500,
"listing_vault_deposit_params": {
"new_vault_deposit_amount": "10000",
"new_vault_deposit_amount": "10000000000",
"main_vault_deposit_amount": "0",
"num_blocks_to_lock_shares": 2592000
}
Expand Down
2 changes: 1 addition & 1 deletion protocol/scripts/genesis/sample_pregenesis.json
Original file line number Diff line number Diff line change
Expand Up @@ -872,7 +872,7 @@
"hard_cap_for_markets": 500,
"listing_vault_deposit_params": {
"main_vault_deposit_amount": "0",
"new_vault_deposit_amount": "10000",
"new_vault_deposit_amount": "10000000000",
"num_blocks_to_lock_shares": 2592000
}
},
Expand Down
2 changes: 1 addition & 1 deletion protocol/testing/genesis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2262,7 +2262,7 @@ function edit_genesis() {
# Set hard cap for markets
dasel put -t int -f "$GENESIS" ".app_state.listing.hard_cap_for_markets" -v '500'
# Set default listing vault deposit params
dasel put -t string -f "$GENESIS" ".app_state.listing.listing_vault_deposit_params.new_vault_deposit_amount" -v "10000" # 10_000 USDC
dasel put -t string -f "$GENESIS" ".app_state.listing.listing_vault_deposit_params.new_vault_deposit_amount" -v "10000000000" # 10_000 USDC
dasel put -t string -f "$GENESIS" ".app_state.listing.listing_vault_deposit_params.main_vault_deposit_amount" -v "0" # 0 USDC
dasel put -t int -f "$GENESIS" ".app_state.listing.listing_vault_deposit_params.num_blocks_to_lock_shares" -v '2592000' # 30 days

Expand Down
2 changes: 1 addition & 1 deletion protocol/testutil/constants/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -875,7 +875,7 @@ const GenesisState = `{
"listing": {
"hard_cap_for_markets": 500,
"listing_vault_deposit_params": {
"new_vault_deposit_amount": "10000",
"new_vault_deposit_amount": "10000000000",
"main_vault_deposit_amount": "0",
"num_blocks_to_lock_shares": 2592000
}
Expand Down
7 changes: 2 additions & 5 deletions protocol/x/listing/keeper/listing.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import (
"math"
"math/big"

"github.com/dydxprotocol/v4-chain/protocol/dtypes"

vaulttypes "github.com/dydxprotocol/v4-chain/protocol/x/vault/types"

satypes "github.com/dydxprotocol/v4-chain/protocol/x/subaccounts/types"
Expand Down Expand Up @@ -209,8 +207,7 @@ func (k Keeper) DepositToMegavaultforPML(
vaultDepositParams := k.GetListingVaultDepositParams(ctx)

// Deposit to the megavault
totalDepositAmount := big.NewInt(0)
totalDepositAmount.Add(
totalDepositAmount := new(big.Int).Add(
vaultDepositParams.NewVaultDepositAmount.BigInt(),
vaultDepositParams.MainVaultDepositAmount.BigInt(),
)
Expand Down Expand Up @@ -242,7 +239,7 @@ func (k Keeper) DepositToMegavaultforPML(
err = k.VaultKeeper.LockShares(
ctx,
fromSubaccount.Owner,
vaulttypes.NumShares{NumShares: dtypes.NewIntFromBigInt(mintedShares)},
vaulttypes.BigIntToNumShares(mintedShares),
uint32(ctx.BlockHeight())+vaultDepositParams.NumBlocksToLockShares,
)
if err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ func (k msgServer) CreateMarketPermissionless(
return nil, err
}

// TODO: vault deposit for PML
err = k.Keeper.DepositToMegavaultforPML(ctx, *msg.SubaccountId, clobPairId)
if err != nil {
k.Logger(ctx).Error("failed to deposit to megavault for PML market", "error", err)
Expand Down
2 changes: 1 addition & 1 deletion protocol/x/listing/types/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import "github.com/dydxprotocol/v4-chain/protocol/dtypes"
// DefaultParams defines the default parameters for listing vault deposits.
func DefaultParams() ListingVaultDepositParams {
return ListingVaultDepositParams{
NewVaultDepositAmount: dtypes.NewIntFromUint64(10_000),
NewVaultDepositAmount: dtypes.NewIntFromUint64(10_000_000_000), // 10_000 USDC
MainVaultDepositAmount: dtypes.NewIntFromUint64(0),
NumBlocksToLockShares: 30 * 24 * 3600, // 30 days
}
Expand Down

0 comments on commit 68f7397

Please sign in to comment.