The vAMM is the contract that enables user's to take perpetual positions through its "virtual" automated market maker.
The vAMM also integrates with the price feed contracts for access to market data.
The instantiation message takes the decimals to be used by the contract, the addresses of the pricefeed and margin engine contracts. It also takes the definition of the product pair to be traded on the vAMM including the initial liquidity.
{
"decimals": 6,
"pricefeed": "juno...",
"margin_engine": "juno...",
"quote_asset": "USDT",
"base_asset": "BTC",
"quote_asset_reserve": "12000",
"base_asset_reserve": "10",
"funding_period": "3600",
"toll_ratio": "5000",
"spread_ratio": "5000" ,
"fluctuation_limit_ratio": "5000",
}
Enables owner to update key contract parameters.
{
"update_config" {
"owner": "juno...",
"base_asset_holding_cap": "10000000",
"open_interest_notional_cap": "10000000",
"toll_ratio": "10000",
"spread_ratio": "10000",
"fluctuation_limit_ratio": "10000",
"margin_engine": "juno...",
"pricefeed": "juno...",
"spot_price_twap_interval": 6,
}
}
Allows the margin engine to swap quote asset into the vAMM.
{
"swap_input" {
"direction": "add_to_amm",
"quote_asset_amount": "10000000",
"base_asset_limit": "10000000",
"can_go_over_fluctuation": false,
}
}
Allows the margin engine to swap base asset into the vAMM.
{
"swap_output" {
"direction": "remove_from_amm",
"quote_asset_amount": "10000000",
"base_asset_limit": "10000000",
}
}
Calculates the funding payments due.
{
"settle_funding" {}
}
Allows owner to open the vAMM enable positions to be taken.
{
"set_open" {
"open": true
}
}
Returns contract configuration.
{
"config": {}
}
Returns contract state, including liquidity etc.
{
"state": {}
}
Returns the average price for a trade of a given size.
{
"input_price": {
"direction": "add_to_amm",
"amount": "10000000",
}
}
Returns the average price for a trade of a given size.
{
"output_price": {
"direction": "add_to_amm",
"amount": "10000000",
}
}
Returns the amount for a trade of input with a given size.
{
"input_amount": {
"direction": "add_to_amm",
"amount": "10000000",
}
}
Returns the amount for a trade of output with a given size.
{
"output_amount": {
"direction": "add_to_amm",
"amount": "10000000",
}
}
{
"input_twap": {
"direction": "add_to_amm",
"amount": "10000000",
}
}
{
"output_twap": {
"direction": "add_to_amm",
"amount": "10000000",
}
}
{
"spot_price": {}
}
{
"twap_price": {
"interval": 900,
}
}
{
"calc_fee": {
"quote_asset_amount": "10000000",
}
}
{
"is_over_spread_limit": {}
}