Optional _memo: stringOptional _funds: Coin[]Returns a user's positions for all vAMMs.
Optional limit?: numberOptional orderOptional startEnables a user to close a position they have for a specific vAMM including slippage limits.

If partial_liquidation_ratio == 1 then close the whole position

await engineClient.closePosition({
vamm: vammClient.contractAddress,
quoteAssetLimit: '0'
});
Optional _memo: stringOptional _funds: Coin[]Returns the contracts configuration.
Users can deposit additional margin to their positions to prevent them from becoming under-collateralised.

await engineClient.depositMargin({
amount: '500000000',
vamm: vammClient.contractAddress
});
Optional _memo: stringOptional _funds: Coin[]Returns the pauser of the contract.
Returns whitelist that can by pass some trader's restrictions.
Allows third parties to liquidate users positions when they are no longer sufficiently collateralised.

If partial_liquidation_ratio == 0 then liquidate the whole position.

await engineClient.liquidate({
vamm: vammClient.contractAddress,
trader: "orai...",
quoteAssetLimit: '0'
});
Optional _memo: stringOptional _funds: Coin[]Enables a user to open a position for a specific vAMM with leverage. Also allows order to be placed with slippage limits.
If side is buy (direction is 'add_to_amm') then open position (increase)

If old position is larger then reduce position (decrease)

Otherwise close position then swap out the entire position (reverse)

await engineClient.openPosition({
vamm: vammClient.contractAddress,
side: 'buy',
marginAmount: '10000000',
leverage: '8000000',
baseAssetLimit: '4000000'
})
Optional stopOptional _memo: stringOptional _funds: Coin[]Allows third parties to trigger funding payments to be processed for a specific vAMM.
The funding rate helps keep the perp price in line with the underlying asset's spot price. When the perp trades at a premium, longs pay shorts. Conversely, at a discount, shorts pay longs. Although the funding rate can take place at any cadence, it is generally set to one hour. If a perp trades at a 0.1% discount for 24 hours, purchasers of that perp will receive 0.1% as the summation of the 24 funding period.

await engineContract.payFunding({
vamm: vammContract.contractAddress
});
Optional _memo: stringOptional _funds: Coin[]Optional limit?: numberOptional orderOptional side?: SideOptional startOptional _memo: stringOptional _funds: Coin[]Enables owner to pause contracts in emergency situations
await engineClient.setPause({
pause: true
});
``
Optional _memo: stringOptional _funds: Coin[]Returns the state variables of the contract.
Optional _memo: stringOptional _funds: Coin[]Returns the unrealized PnL (profit and loss) of a user for a specific vAMM using a specific calculation method.
Enables owner to update key contract parameters.
await engineClient.updateConfig({
tollRatio: '5000',
spreadRatio: '5000'
})
Optional feeOptional initialOptional insuranceOptional liquidationOptional maintenanceOptional owner?: stringOptional partialOptional tpOptional _memo: stringOptional _funds: Coin[]Optional _memo: stringOptional _funds: Coin[]Optional stopOptional takeOptional _memo: stringOptional _funds: Coin[]Users can withdraw excess collateral from their positions if they are over-collateralised

await engineClient.withdrawMargin({
amount: '500000000',
vamm: vammClient.contractAddress
});
Optional _memo: stringOptional _funds: Coin[]©2020 - 2023 Oraichain Foundation
The margin engine is responsible for managing user positions and collateral. Allows users to take positions in all registered vAMMs.