From 061b0da3ed3e76cd758dda177a8fea7f60ed4e4c Mon Sep 17 00:00:00 2001 From: WGB5445 <919603023@qq.com> Date: Mon, 13 Apr 2026 19:34:19 +0800 Subject: [PATCH 1/3] Update README and examples to use TESTNET_CONFIG instead of NETNA_CONFIG This commit modifies the README and various example scripts to replace instances of NETNA_CONFIG with TESTNET_CONFIG, ensuring consistency in the configuration used for test network operations. This change enhances clarity and aligns with the intended usage of the Decibel library. --- README.md | 19 +- examples/read/get_account_overview.py | 4 +- examples/read/get_all_market_prices.py | 4 +- examples/read/get_all_markets.py | 4 +- examples/read/get_candlesticks.py | 4 +- examples/read/get_delegations.py | 4 +- examples/read/get_leaderboard.py | 4 +- examples/read/get_market_contexts.py | 4 +- examples/read/get_market_depth.py | 4 +- examples/read/get_market_price.py | 4 +- examples/read/get_market_trades.py | 4 +- examples/read/get_portfolio_chart.py | 4 +- examples/read/get_trading_points.py | 4 +- examples/read/get_user_active_twaps.py | 4 +- examples/read/get_user_bulk_orders.py | 4 +- examples/read/get_user_fund_history.py | 4 +- examples/read/get_user_funding_history.py | 4 +- examples/read/get_user_open_orders.py | 4 +- examples/read/get_user_order_history.py | 4 +- examples/read/get_user_positions.py | 4 +- examples/read/get_user_subaccounts.py | 4 +- examples/read/get_user_trade_history.py | 4 +- examples/read/get_user_twap_history.py | 4 +- examples/read/list_market_addresses.py | 4 +- .../read/ws/subscribe_account_overview.py | 4 +- .../read/ws/subscribe_all_market_prices.py | 4 +- examples/read/ws/subscribe_candlesticks.py | 4 +- examples/read/ws/subscribe_market_depth.py | 4 +- examples/read/ws/subscribe_market_price.py | 4 +- examples/read/ws/subscribe_market_trades.py | 4 +- .../read/ws/subscribe_user_active_twaps.py | 4 +- .../read/ws/subscribe_user_bulk_orders.py | 4 +- .../read/ws/subscribe_user_notifications.py | 4 +- .../read/ws/subscribe_user_open_orders.py | 4 +- .../read/ws/subscribe_user_order_history.py | 4 +- examples/read/ws/subscribe_user_positions.py | 4 +- .../read/ws/subscribe_user_trade_history.py | 4 +- examples/write/activate_vault.py | 6 +- examples/write/approve_builder_fee.py | 6 +- examples/write/cancel_bulk_order.py | 6 +- examples/write/cancel_order.py | 6 +- examples/write/cancel_order_by_client_id.py | 6 +- examples/write/cancel_tp_sl_order.py | 8 +- examples/write/cancel_twap_order.py | 8 +- examples/write/configure_market_settings.py | 12 +- examples/write/create_subaccount.py | 6 +- examples/write/create_vault.py | 6 +- examples/write/deactivate_subaccount.py | 6 +- examples/write/delegate_trading.py | 10 +- examples/write/delegate_vault_actions.py | 6 +- examples/write/deposit.py | 6 +- examples/write/deposit_to_vault.py | 10 +- examples/write/market_maker_bot.py | 487 ++++ examples/write/place_bulk_orders.py | 8 +- examples/write/place_limit_order.py | 8 +- examples/write/place_market_order.py | 8 +- examples/write/place_order_with_tp_sl.py | 8 +- examples/write/place_stop_order.py | 8 +- examples/write/place_tp_sl_for_position.py | 10 +- examples/write/place_twap_order.py | 8 +- examples/write/revoke_builder_fee.py | 6 +- examples/write/revoke_delegation.py | 6 +- examples/write/trigger_matching.py | 8 +- examples/write/update_tp_sl_order.py | 10 +- examples/write/withdraw.py | 6 +- examples/write/withdraw_from_vault.py | 6 +- src/decibel/__init__.py | 2 - src/decibel/_constants.py | 15 - src/decibel/_fee_pay.py | 3 - src/decibel/abi/_registry.py | 9 +- src/decibel/abi/generate.py | 5 +- src/decibel/abi/json/netna.json | 2417 ----------------- tests/abi/test_registry.py | 17 +- 73 files changed, 680 insertions(+), 2646 deletions(-) create mode 100644 examples/write/market_maker_bot.py delete mode 100644 src/decibel/abi/json/netna.json diff --git a/README.md b/README.md index feaf5b7..5d4b0d5 100644 --- a/README.md +++ b/README.md @@ -46,11 +46,11 @@ export APTOS_NODE_API_KEY="your_aptos_node_api_key" ```python import asyncio -from decibel import NETNA_CONFIG +from decibel import TESTNET_CONFIG from decibel.read import DecibelReadDex async def main(): - read = DecibelReadDex(NETNA_CONFIG) + read = DecibelReadDex(TESTNET_CONFIG) # Get all markets markets = await read.markets.get_all() @@ -73,7 +73,7 @@ import os from aptos_sdk.account import Account from aptos_sdk.ed25519 import PrivateKey from decibel import ( - NETNA_CONFIG, + TESTNET_CONFIG, BaseSDKOptions, DecibelWriteDex, GasPriceManager, @@ -87,15 +87,15 @@ async def main(): private_key = PrivateKey.from_hex(os.environ["PRIVATE_KEY"]) account = Account.load_key(private_key.hex()) - gas = GasPriceManager(NETNA_CONFIG) + gas = GasPriceManager(TESTNET_CONFIG) await gas.initialize() - read = DecibelReadDex(NETNA_CONFIG) + read = DecibelReadDex(TESTNET_CONFIG) markets = await read.markets.get_all() btc = next(m for m in markets if m.market_name == "BTC/USD") write = DecibelWriteDex( - NETNA_CONFIG, + TESTNET_CONFIG, account, opts=BaseSDKOptions(gas_price_manager=gas), ) @@ -123,11 +123,11 @@ asyncio.run(main()) ```python import asyncio -from decibel import NETNA_CONFIG +from decibel import TESTNET_CONFIG from decibel.read import DecibelReadDex async def main(): - read = DecibelReadDex(NETNA_CONFIG) + read = DecibelReadDex(TESTNET_CONFIG) def on_price(msg): price = msg.price @@ -155,11 +155,10 @@ See the [examples](examples) directory for complete working examples: ### Network Configs ```python -from decibel import MAINNET_CONFIG, TESTNET_CONFIG, NETNA_CONFIG +from decibel import MAINNET_CONFIG, TESTNET_CONFIG # MAINNET_CONFIG - Production network # TESTNET_CONFIG - Test network -# NETNA_CONFIG - Dev network ``` ### Read Client diff --git a/examples/read/get_account_overview.py b/examples/read/get_account_overview.py index e2011fd..2fd4529 100644 --- a/examples/read/get_account_overview.py +++ b/examples/read/get_account_overview.py @@ -1,14 +1,14 @@ import asyncio import os -from decibel import NETNA_CONFIG +from decibel import TESTNET_CONFIG from decibel.read import DecibelReadDex SUB_ADDR = "0x456..." async def main() -> None: - read = DecibelReadDex(NETNA_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) + read = DecibelReadDex(TESTNET_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) overview = await read.account_overview.get_by_addr(sub_addr=SUB_ADDR) diff --git a/examples/read/get_all_market_prices.py b/examples/read/get_all_market_prices.py index 6f63308..a3745d7 100644 --- a/examples/read/get_all_market_prices.py +++ b/examples/read/get_all_market_prices.py @@ -1,12 +1,12 @@ import asyncio import os -from decibel import NETNA_CONFIG +from decibel import TESTNET_CONFIG from decibel.read import DecibelReadDex async def main() -> None: - read = DecibelReadDex(NETNA_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) + read = DecibelReadDex(TESTNET_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) prices = await read.market_prices.get_all() diff --git a/examples/read/get_all_markets.py b/examples/read/get_all_markets.py index 7e4d647..2d07d4e 100644 --- a/examples/read/get_all_markets.py +++ b/examples/read/get_all_markets.py @@ -1,12 +1,12 @@ import asyncio import os -from decibel import NETNA_CONFIG +from decibel import TESTNET_CONFIG from decibel.read import DecibelReadDex async def main() -> None: - read = DecibelReadDex(NETNA_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) + read = DecibelReadDex(TESTNET_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) markets = await read.markets.get_all() diff --git a/examples/read/get_candlesticks.py b/examples/read/get_candlesticks.py index 2dbaf6c..85d13a0 100644 --- a/examples/read/get_candlesticks.py +++ b/examples/read/get_candlesticks.py @@ -2,12 +2,12 @@ import os from datetime import UTC, datetime -from decibel import NETNA_CONFIG +from decibel import TESTNET_CONFIG from decibel.read import CandlestickInterval, DecibelReadDex async def main() -> None: - read = DecibelReadDex(NETNA_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) + read = DecibelReadDex(TESTNET_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) market_name = "BTC/USD" interval = CandlestickInterval.ONE_HOUR diff --git a/examples/read/get_delegations.py b/examples/read/get_delegations.py index 4949207..c936e28 100644 --- a/examples/read/get_delegations.py +++ b/examples/read/get_delegations.py @@ -1,14 +1,14 @@ import asyncio import os -from decibel import NETNA_CONFIG +from decibel import TESTNET_CONFIG from decibel.read import DecibelReadDex SUB_ADDR = "0x456..." async def main() -> None: - read = DecibelReadDex(NETNA_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) + read = DecibelReadDex(TESTNET_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) delegations = await read.delegations.get_all(sub_addr=SUB_ADDR) diff --git a/examples/read/get_leaderboard.py b/examples/read/get_leaderboard.py index e1e7fb3..6964639 100644 --- a/examples/read/get_leaderboard.py +++ b/examples/read/get_leaderboard.py @@ -1,12 +1,12 @@ import asyncio import os -from decibel import NETNA_CONFIG +from decibel import TESTNET_CONFIG from decibel.read import DecibelReadDex async def main() -> None: - read = DecibelReadDex(NETNA_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) + read = DecibelReadDex(TESTNET_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) response = await read.leaderboard.get_leaderboard(limit=10, sort_key="realized_pnl") diff --git a/examples/read/get_market_contexts.py b/examples/read/get_market_contexts.py index c0e0c2e..199d0f8 100644 --- a/examples/read/get_market_contexts.py +++ b/examples/read/get_market_contexts.py @@ -1,12 +1,12 @@ import asyncio import os -from decibel import NETNA_CONFIG +from decibel import TESTNET_CONFIG from decibel.read import DecibelReadDex async def main() -> None: - read = DecibelReadDex(NETNA_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) + read = DecibelReadDex(TESTNET_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) contexts = await read.market_contexts.get_all() diff --git a/examples/read/get_market_depth.py b/examples/read/get_market_depth.py index 3f3bc6a..8d27891 100644 --- a/examples/read/get_market_depth.py +++ b/examples/read/get_market_depth.py @@ -1,12 +1,12 @@ import asyncio import os -from decibel import NETNA_CONFIG +from decibel import TESTNET_CONFIG from decibel.read import DecibelReadDex async def main() -> None: - read = DecibelReadDex(NETNA_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) + read = DecibelReadDex(TESTNET_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) market_name = "BTC/USD" depth = await read.market_depth.get_by_name(market_name, limit=10) diff --git a/examples/read/get_market_price.py b/examples/read/get_market_price.py index 1bf2ef0..d75fba6 100644 --- a/examples/read/get_market_price.py +++ b/examples/read/get_market_price.py @@ -1,12 +1,12 @@ import asyncio import os -from decibel import NETNA_CONFIG +from decibel import TESTNET_CONFIG from decibel.read import DecibelReadDex async def main() -> None: - read = DecibelReadDex(NETNA_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) + read = DecibelReadDex(TESTNET_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) market_name = "BTC/USD" prices = await read.market_prices.get_by_name(market_name) diff --git a/examples/read/get_market_trades.py b/examples/read/get_market_trades.py index e0314b1..38f0ee5 100644 --- a/examples/read/get_market_trades.py +++ b/examples/read/get_market_trades.py @@ -1,12 +1,12 @@ import asyncio import os -from decibel import NETNA_CONFIG +from decibel import TESTNET_CONFIG from decibel.read import DecibelReadDex async def main() -> None: - read = DecibelReadDex(NETNA_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) + read = DecibelReadDex(TESTNET_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) market_name = "BTC/USD" trades = await read.market_trades.get_by_name(market_name, limit=10) diff --git a/examples/read/get_portfolio_chart.py b/examples/read/get_portfolio_chart.py index 79fceb4..bdbcdd0 100644 --- a/examples/read/get_portfolio_chart.py +++ b/examples/read/get_portfolio_chart.py @@ -1,14 +1,14 @@ import asyncio import os -from decibel import NETNA_CONFIG +from decibel import TESTNET_CONFIG from decibel.read import DecibelReadDex SUB_ADDR = "0x456..." async def main() -> None: - read = DecibelReadDex(NETNA_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) + read = DecibelReadDex(TESTNET_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) chart = await read.portfolio_chart.get_by_addr( sub_addr=SUB_ADDR, diff --git a/examples/read/get_trading_points.py b/examples/read/get_trading_points.py index 889bd47..7de1a19 100644 --- a/examples/read/get_trading_points.py +++ b/examples/read/get_trading_points.py @@ -1,14 +1,14 @@ import asyncio import os -from decibel import NETNA_CONFIG +from decibel import TESTNET_CONFIG from decibel.read import DecibelReadDex OWNER_ADDR = "0x123..." async def main() -> None: - read = DecibelReadDex(NETNA_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) + read = DecibelReadDex(TESTNET_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) points = await read.trading_points.get_by_owner(owner_addr=OWNER_ADDR) diff --git a/examples/read/get_user_active_twaps.py b/examples/read/get_user_active_twaps.py index 347f269..ce9b144 100644 --- a/examples/read/get_user_active_twaps.py +++ b/examples/read/get_user_active_twaps.py @@ -1,14 +1,14 @@ import asyncio import os -from decibel import NETNA_CONFIG +from decibel import TESTNET_CONFIG from decibel.read import DecibelReadDex SUB_ADDR = "0x456..." async def main() -> None: - read = DecibelReadDex(NETNA_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) + read = DecibelReadDex(TESTNET_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) twaps = await read.user_active_twaps.get_by_addr(sub_addr=SUB_ADDR) diff --git a/examples/read/get_user_bulk_orders.py b/examples/read/get_user_bulk_orders.py index 0ba899f..fb12e2c 100644 --- a/examples/read/get_user_bulk_orders.py +++ b/examples/read/get_user_bulk_orders.py @@ -1,14 +1,14 @@ import asyncio import os -from decibel import NETNA_CONFIG +from decibel import TESTNET_CONFIG from decibel.read import DecibelReadDex SUB_ADDR = "0x456..." async def main() -> None: - read = DecibelReadDex(NETNA_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) + read = DecibelReadDex(TESTNET_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) bulk_orders = await read.user_bulk_orders.get_by_addr(sub_addr=SUB_ADDR) diff --git a/examples/read/get_user_fund_history.py b/examples/read/get_user_fund_history.py index 0cb4b59..9407f2d 100644 --- a/examples/read/get_user_fund_history.py +++ b/examples/read/get_user_fund_history.py @@ -1,14 +1,14 @@ import asyncio import os -from decibel import NETNA_CONFIG +from decibel import TESTNET_CONFIG from decibel.read import DecibelReadDex SUB_ADDR = "0x456..." async def main() -> None: - read = DecibelReadDex(NETNA_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) + read = DecibelReadDex(TESTNET_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) response = await read.user_fund_history.get_by_addr(sub_addr=SUB_ADDR, limit=10) diff --git a/examples/read/get_user_funding_history.py b/examples/read/get_user_funding_history.py index 70b0081..348418e 100644 --- a/examples/read/get_user_funding_history.py +++ b/examples/read/get_user_funding_history.py @@ -1,14 +1,14 @@ import asyncio import os -from decibel import NETNA_CONFIG +from decibel import TESTNET_CONFIG from decibel.read import DecibelReadDex SUB_ADDR = "0x456..." async def main() -> None: - read = DecibelReadDex(NETNA_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) + read = DecibelReadDex(TESTNET_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) response = await read.user_funding_history.get_by_addr(sub_addr=SUB_ADDR, limit=10) diff --git a/examples/read/get_user_open_orders.py b/examples/read/get_user_open_orders.py index 5d0f99e..1ea2134 100644 --- a/examples/read/get_user_open_orders.py +++ b/examples/read/get_user_open_orders.py @@ -1,14 +1,14 @@ import asyncio import os -from decibel import NETNA_CONFIG +from decibel import TESTNET_CONFIG from decibel.read import DecibelReadDex SUB_ADDR = "0x456..." async def main() -> None: - read = DecibelReadDex(NETNA_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) + read = DecibelReadDex(TESTNET_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) response = await read.user_open_orders.get_by_addr(sub_addr=SUB_ADDR, limit=10) diff --git a/examples/read/get_user_order_history.py b/examples/read/get_user_order_history.py index 14a1fed..dba209d 100644 --- a/examples/read/get_user_order_history.py +++ b/examples/read/get_user_order_history.py @@ -1,14 +1,14 @@ import asyncio import os -from decibel import NETNA_CONFIG +from decibel import TESTNET_CONFIG from decibel.read import DecibelReadDex SUB_ADDR = "0x456..." async def main() -> None: - read = DecibelReadDex(NETNA_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) + read = DecibelReadDex(TESTNET_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) response = await read.user_order_history.get_by_addr(sub_addr=SUB_ADDR, limit=10) diff --git a/examples/read/get_user_positions.py b/examples/read/get_user_positions.py index 84a0376..3b5f0cb 100644 --- a/examples/read/get_user_positions.py +++ b/examples/read/get_user_positions.py @@ -1,14 +1,14 @@ import asyncio import os -from decibel import NETNA_CONFIG +from decibel import TESTNET_CONFIG from decibel.read import DecibelReadDex SUB_ADDR = "0x456..." async def main() -> None: - read = DecibelReadDex(NETNA_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) + read = DecibelReadDex(TESTNET_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) positions = await read.user_positions.get_by_addr(sub_addr=SUB_ADDR) diff --git a/examples/read/get_user_subaccounts.py b/examples/read/get_user_subaccounts.py index c2a3824..7863a30 100644 --- a/examples/read/get_user_subaccounts.py +++ b/examples/read/get_user_subaccounts.py @@ -1,14 +1,14 @@ import asyncio import os -from decibel import NETNA_CONFIG +from decibel import TESTNET_CONFIG from decibel.read import DecibelReadDex OWNER_ADDR = "0x123..." async def main() -> None: - read = DecibelReadDex(NETNA_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) + read = DecibelReadDex(TESTNET_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) subaccounts = await read.user_subaccounts.get_by_addr(owner_addr=OWNER_ADDR) diff --git a/examples/read/get_user_trade_history.py b/examples/read/get_user_trade_history.py index 3f85eee..c2722cf 100644 --- a/examples/read/get_user_trade_history.py +++ b/examples/read/get_user_trade_history.py @@ -1,14 +1,14 @@ import asyncio import os -from decibel import NETNA_CONFIG +from decibel import TESTNET_CONFIG from decibel.read import DecibelReadDex SUB_ADDR = "0x456..." async def main() -> None: - read = DecibelReadDex(NETNA_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) + read = DecibelReadDex(TESTNET_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) response = await read.user_trade_history.get_by_addr(sub_addr=SUB_ADDR, limit=10) diff --git a/examples/read/get_user_twap_history.py b/examples/read/get_user_twap_history.py index 245a946..9bea2ef 100644 --- a/examples/read/get_user_twap_history.py +++ b/examples/read/get_user_twap_history.py @@ -1,14 +1,14 @@ import asyncio import os -from decibel import NETNA_CONFIG +from decibel import TESTNET_CONFIG from decibel.read import DecibelReadDex SUB_ADDR = "0x456..." async def main() -> None: - read = DecibelReadDex(NETNA_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) + read = DecibelReadDex(TESTNET_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) response = await read.user_twap_history.get_by_addr(sub_addr=SUB_ADDR, limit=10) diff --git a/examples/read/list_market_addresses.py b/examples/read/list_market_addresses.py index 1532e57..e43cde3 100644 --- a/examples/read/list_market_addresses.py +++ b/examples/read/list_market_addresses.py @@ -1,11 +1,11 @@ import asyncio -from decibel import NETNA_CONFIG +from decibel import TESTNET_CONFIG from decibel.read import DecibelReadDex async def main() -> None: - read = DecibelReadDex(NETNA_CONFIG) + read = DecibelReadDex(TESTNET_CONFIG) addresses = await read.markets.list_market_addresses() diff --git a/examples/read/ws/subscribe_account_overview.py b/examples/read/ws/subscribe_account_overview.py index 4792281..d77b0f1 100644 --- a/examples/read/ws/subscribe_account_overview.py +++ b/examples/read/ws/subscribe_account_overview.py @@ -2,14 +2,14 @@ import os from typing import Any -from decibel import NETNA_CONFIG +from decibel import TESTNET_CONFIG from decibel.read import DecibelReadDex SUB_ADDR = "0x123..." async def main() -> None: - read = DecibelReadDex(NETNA_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) + read = DecibelReadDex(TESTNET_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) def on_data(msg: Any) -> None: overview = msg.account_overview diff --git a/examples/read/ws/subscribe_all_market_prices.py b/examples/read/ws/subscribe_all_market_prices.py index 6ad6b3e..9b91050 100644 --- a/examples/read/ws/subscribe_all_market_prices.py +++ b/examples/read/ws/subscribe_all_market_prices.py @@ -2,12 +2,12 @@ import os from typing import Any -from decibel import NETNA_CONFIG +from decibel import TESTNET_CONFIG from decibel.read import DecibelReadDex async def main() -> None: - read = DecibelReadDex(NETNA_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) + read = DecibelReadDex(TESTNET_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) def on_data(msg: Any) -> None: print(f"Received {len(msg.prices)} market prices:\n") diff --git a/examples/read/ws/subscribe_candlesticks.py b/examples/read/ws/subscribe_candlesticks.py index add1cd7..6329e7c 100644 --- a/examples/read/ws/subscribe_candlesticks.py +++ b/examples/read/ws/subscribe_candlesticks.py @@ -2,12 +2,12 @@ import os from typing import Any -from decibel import NETNA_CONFIG +from decibel import TESTNET_CONFIG from decibel.read import CandlestickInterval, DecibelReadDex async def main() -> None: - read = DecibelReadDex(NETNA_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) + read = DecibelReadDex(TESTNET_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) market_name = "BTC/USD" interval = CandlestickInterval.ONE_MINUTE diff --git a/examples/read/ws/subscribe_market_depth.py b/examples/read/ws/subscribe_market_depth.py index cf97f22..55d9632 100644 --- a/examples/read/ws/subscribe_market_depth.py +++ b/examples/read/ws/subscribe_market_depth.py @@ -2,12 +2,12 @@ import os from typing import Any -from decibel import NETNA_CONFIG +from decibel import TESTNET_CONFIG from decibel.read import DecibelReadDex async def main() -> None: - read = DecibelReadDex(NETNA_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) + read = DecibelReadDex(TESTNET_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) market_name = "BTC/USD" aggregation_size = 1 diff --git a/examples/read/ws/subscribe_market_price.py b/examples/read/ws/subscribe_market_price.py index e979e94..091b4c5 100644 --- a/examples/read/ws/subscribe_market_price.py +++ b/examples/read/ws/subscribe_market_price.py @@ -2,12 +2,12 @@ import os from typing import Any -from decibel import NETNA_CONFIG +from decibel import TESTNET_CONFIG from decibel.read import DecibelReadDex async def main() -> None: - read = DecibelReadDex(NETNA_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) + read = DecibelReadDex(TESTNET_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) market_name = "BTC/USD" diff --git a/examples/read/ws/subscribe_market_trades.py b/examples/read/ws/subscribe_market_trades.py index 0d1904f..bd57844 100644 --- a/examples/read/ws/subscribe_market_trades.py +++ b/examples/read/ws/subscribe_market_trades.py @@ -2,12 +2,12 @@ import os from typing import Any -from decibel import NETNA_CONFIG +from decibel import TESTNET_CONFIG from decibel.read import DecibelReadDex async def main() -> None: - read = DecibelReadDex(NETNA_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) + read = DecibelReadDex(TESTNET_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) market_name = "BTC/USD" diff --git a/examples/read/ws/subscribe_user_active_twaps.py b/examples/read/ws/subscribe_user_active_twaps.py index 76e3e79..cc165a7 100644 --- a/examples/read/ws/subscribe_user_active_twaps.py +++ b/examples/read/ws/subscribe_user_active_twaps.py @@ -2,14 +2,14 @@ import os from typing import Any -from decibel import NETNA_CONFIG +from decibel import TESTNET_CONFIG from decibel.read import DecibelReadDex SUB_ADDR = "0x123..." async def main() -> None: - read = DecibelReadDex(NETNA_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) + read = DecibelReadDex(TESTNET_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) def on_data(msg: Any) -> None: if not msg.twaps: diff --git a/examples/read/ws/subscribe_user_bulk_orders.py b/examples/read/ws/subscribe_user_bulk_orders.py index 5eb1bf9..768880f 100644 --- a/examples/read/ws/subscribe_user_bulk_orders.py +++ b/examples/read/ws/subscribe_user_bulk_orders.py @@ -2,14 +2,14 @@ import os from typing import Any -from decibel import NETNA_CONFIG +from decibel import TESTNET_CONFIG from decibel.read import DecibelReadDex SUB_ADDR = "0x123..." async def main() -> None: - read = DecibelReadDex(NETNA_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) + read = DecibelReadDex(TESTNET_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) def on_data(msg: Any) -> None: inner = msg.bulk_order diff --git a/examples/read/ws/subscribe_user_notifications.py b/examples/read/ws/subscribe_user_notifications.py index 42ef8c0..eefed5f 100644 --- a/examples/read/ws/subscribe_user_notifications.py +++ b/examples/read/ws/subscribe_user_notifications.py @@ -2,14 +2,14 @@ import os from typing import Any -from decibel import NETNA_CONFIG +from decibel import TESTNET_CONFIG from decibel.read import DecibelReadDex SUB_ADDR = "0x123..." async def main() -> None: - read = DecibelReadDex(NETNA_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) + read = DecibelReadDex(TESTNET_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) def on_data(msg: Any) -> None: notif = msg.notification diff --git a/examples/read/ws/subscribe_user_open_orders.py b/examples/read/ws/subscribe_user_open_orders.py index 90ba12e..6673c63 100644 --- a/examples/read/ws/subscribe_user_open_orders.py +++ b/examples/read/ws/subscribe_user_open_orders.py @@ -2,14 +2,14 @@ import os from typing import Any -from decibel import NETNA_CONFIG +from decibel import TESTNET_CONFIG from decibel.read import DecibelReadDex SUB_ADDR = "0x123..." async def main() -> None: - read = DecibelReadDex(NETNA_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) + read = DecibelReadDex(TESTNET_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) def on_data(msg: Any) -> None: if not msg.orders: diff --git a/examples/read/ws/subscribe_user_order_history.py b/examples/read/ws/subscribe_user_order_history.py index e9b99ac..49b55fe 100644 --- a/examples/read/ws/subscribe_user_order_history.py +++ b/examples/read/ws/subscribe_user_order_history.py @@ -2,14 +2,14 @@ import os from typing import Any -from decibel import NETNA_CONFIG +from decibel import TESTNET_CONFIG from decibel.read import DecibelReadDex SUB_ADDR = "0x123..." async def main() -> None: - read = DecibelReadDex(NETNA_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) + read = DecibelReadDex(TESTNET_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) def on_data(msg: Any) -> None: inner = msg.order diff --git a/examples/read/ws/subscribe_user_positions.py b/examples/read/ws/subscribe_user_positions.py index 932928c..8493e14 100644 --- a/examples/read/ws/subscribe_user_positions.py +++ b/examples/read/ws/subscribe_user_positions.py @@ -2,14 +2,14 @@ import os from typing import Any -from decibel import NETNA_CONFIG +from decibel import TESTNET_CONFIG from decibel.read import DecibelReadDex SUB_ADDR = "0x123..." async def main() -> None: - read = DecibelReadDex(NETNA_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) + read = DecibelReadDex(TESTNET_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) def on_data(msg: Any) -> None: print(f"Positions for {SUB_ADDR}:\n") diff --git a/examples/read/ws/subscribe_user_trade_history.py b/examples/read/ws/subscribe_user_trade_history.py index 3b9bb33..5c326b1 100644 --- a/examples/read/ws/subscribe_user_trade_history.py +++ b/examples/read/ws/subscribe_user_trade_history.py @@ -2,14 +2,14 @@ import os from typing import Any -from decibel import NETNA_CONFIG +from decibel import TESTNET_CONFIG from decibel.read import DecibelReadDex SUB_ADDR = "0x123..." async def main() -> None: - read = DecibelReadDex(NETNA_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) + read = DecibelReadDex(TESTNET_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) def on_data(msg: Any) -> None: print(f"Trade History for {SUB_ADDR}:\n") diff --git a/examples/write/activate_vault.py b/examples/write/activate_vault.py index eb6ed13..c81dc70 100644 --- a/examples/write/activate_vault.py +++ b/examples/write/activate_vault.py @@ -5,7 +5,7 @@ from aptos_sdk.ed25519 import PrivateKey from decibel import ( - NETNA_CONFIG, + TESTNET_CONFIG, BaseSDKOptions, DecibelWriteDex, GasPriceManager, @@ -16,11 +16,11 @@ async def main() -> None: private_key = PrivateKey.from_hex(os.environ["PRIVATE_KEY"]) account = Account.load_key(private_key.hex()) - gas = GasPriceManager(NETNA_CONFIG) + gas = GasPriceManager(TESTNET_CONFIG) await gas.initialize() write = DecibelWriteDex( - NETNA_CONFIG, + TESTNET_CONFIG, account, opts=BaseSDKOptions( node_api_key=os.environ.get("APTOS_NODE_API_KEY"), diff --git a/examples/write/approve_builder_fee.py b/examples/write/approve_builder_fee.py index 8103af8..39827e2 100644 --- a/examples/write/approve_builder_fee.py +++ b/examples/write/approve_builder_fee.py @@ -5,7 +5,7 @@ from aptos_sdk.ed25519 import PrivateKey from decibel import ( - NETNA_CONFIG, + TESTNET_CONFIG, BaseSDKOptions, DecibelWriteDex, GasPriceManager, @@ -16,11 +16,11 @@ async def main() -> None: private_key = PrivateKey.from_hex(os.environ["PRIVATE_KEY"]) account = Account.load_key(private_key.hex()) - gas = GasPriceManager(NETNA_CONFIG) + gas = GasPriceManager(TESTNET_CONFIG) await gas.initialize() write = DecibelWriteDex( - NETNA_CONFIG, + TESTNET_CONFIG, account, opts=BaseSDKOptions( node_api_key=os.environ.get("APTOS_NODE_API_KEY"), diff --git a/examples/write/cancel_bulk_order.py b/examples/write/cancel_bulk_order.py index 845ec85..9ded308 100644 --- a/examples/write/cancel_bulk_order.py +++ b/examples/write/cancel_bulk_order.py @@ -5,7 +5,7 @@ from aptos_sdk.ed25519 import PrivateKey from decibel import ( - NETNA_CONFIG, + TESTNET_CONFIG, BaseSDKOptions, DecibelWriteDex, GasPriceManager, @@ -16,11 +16,11 @@ async def main() -> None: private_key = PrivateKey.from_hex(os.environ["PRIVATE_KEY"]) account = Account.load_key(private_key.hex()) - gas = GasPriceManager(NETNA_CONFIG) + gas = GasPriceManager(TESTNET_CONFIG) await gas.initialize() write = DecibelWriteDex( - NETNA_CONFIG, + TESTNET_CONFIG, account, opts=BaseSDKOptions( node_api_key=os.environ.get("APTOS_NODE_API_KEY"), diff --git a/examples/write/cancel_order.py b/examples/write/cancel_order.py index 5499fc7..8141ae6 100644 --- a/examples/write/cancel_order.py +++ b/examples/write/cancel_order.py @@ -5,7 +5,7 @@ from aptos_sdk.ed25519 import PrivateKey from decibel import ( - NETNA_CONFIG, + TESTNET_CONFIG, BaseSDKOptions, DecibelWriteDex, GasPriceManager, @@ -16,11 +16,11 @@ async def main() -> None: private_key = PrivateKey.from_hex(os.environ["PRIVATE_KEY"]) account = Account.load_key(private_key.hex()) - gas = GasPriceManager(NETNA_CONFIG) + gas = GasPriceManager(TESTNET_CONFIG) await gas.initialize() write = DecibelWriteDex( - NETNA_CONFIG, + TESTNET_CONFIG, account, opts=BaseSDKOptions( node_api_key=os.environ.get("APTOS_NODE_API_KEY"), diff --git a/examples/write/cancel_order_by_client_id.py b/examples/write/cancel_order_by_client_id.py index 2b8b8ca..f089d05 100644 --- a/examples/write/cancel_order_by_client_id.py +++ b/examples/write/cancel_order_by_client_id.py @@ -5,7 +5,7 @@ from aptos_sdk.ed25519 import PrivateKey from decibel import ( - NETNA_CONFIG, + TESTNET_CONFIG, BaseSDKOptions, DecibelWriteDex, GasPriceManager, @@ -16,11 +16,11 @@ async def main() -> None: private_key = PrivateKey.from_hex(os.environ["PRIVATE_KEY"]) account = Account.load_key(private_key.hex()) - gas = GasPriceManager(NETNA_CONFIG) + gas = GasPriceManager(TESTNET_CONFIG) await gas.initialize() write = DecibelWriteDex( - NETNA_CONFIG, + TESTNET_CONFIG, account, opts=BaseSDKOptions( node_api_key=os.environ.get("APTOS_NODE_API_KEY"), diff --git a/examples/write/cancel_tp_sl_order.py b/examples/write/cancel_tp_sl_order.py index 4ff66e0..510ea43 100644 --- a/examples/write/cancel_tp_sl_order.py +++ b/examples/write/cancel_tp_sl_order.py @@ -5,7 +5,7 @@ from aptos_sdk.ed25519 import PrivateKey from decibel import ( - NETNA_CONFIG, + TESTNET_CONFIG, BaseSDKOptions, DecibelWriteDex, GasPriceManager, @@ -17,11 +17,11 @@ async def main() -> None: private_key = PrivateKey.from_hex(os.environ["PRIVATE_KEY"]) account = Account.load_key(private_key.hex()) - gas = GasPriceManager(NETNA_CONFIG) + gas = GasPriceManager(TESTNET_CONFIG) await gas.initialize() write = DecibelWriteDex( - NETNA_CONFIG, + TESTNET_CONFIG, account, opts=BaseSDKOptions( node_api_key=os.environ.get("APTOS_NODE_API_KEY"), @@ -32,7 +32,7 @@ async def main() -> None: ), ) - market_addr = get_market_addr("BTC/USD", NETNA_CONFIG.deployment.perp_engine_global) + market_addr = get_market_addr("BTC/USD", TESTNET_CONFIG.deployment.perp_engine_global) order_id = 12345 tx_result = await write.cancel_tp_sl_order_for_position( diff --git a/examples/write/cancel_twap_order.py b/examples/write/cancel_twap_order.py index f064d94..5c13c0a 100644 --- a/examples/write/cancel_twap_order.py +++ b/examples/write/cancel_twap_order.py @@ -5,7 +5,7 @@ from aptos_sdk.ed25519 import PrivateKey from decibel import ( - NETNA_CONFIG, + TESTNET_CONFIG, BaseSDKOptions, DecibelWriteDex, GasPriceManager, @@ -17,11 +17,11 @@ async def main() -> None: private_key = PrivateKey.from_hex(os.environ["PRIVATE_KEY"]) account = Account.load_key(private_key.hex()) - gas = GasPriceManager(NETNA_CONFIG) + gas = GasPriceManager(TESTNET_CONFIG) await gas.initialize() write = DecibelWriteDex( - NETNA_CONFIG, + TESTNET_CONFIG, account, opts=BaseSDKOptions( node_api_key=os.environ.get("APTOS_NODE_API_KEY"), @@ -32,7 +32,7 @@ async def main() -> None: ), ) - market_addr = get_market_addr("ETH/USD", NETNA_CONFIG.deployment.perp_engine_global) + market_addr = get_market_addr("ETH/USD", TESTNET_CONFIG.deployment.perp_engine_global) order_id = 1234 tx_result = await write.cancel_twap_order( diff --git a/examples/write/configure_market_settings.py b/examples/write/configure_market_settings.py index 0b6bfc4..b59580f 100644 --- a/examples/write/configure_market_settings.py +++ b/examples/write/configure_market_settings.py @@ -5,7 +5,7 @@ from aptos_sdk.ed25519 import PrivateKey from decibel import ( - NETNA_CONFIG, + TESTNET_CONFIG, BaseSDKOptions, DecibelWriteDex, GasPriceManager, @@ -18,11 +18,11 @@ async def main() -> None: private_key = PrivateKey.from_hex(os.environ["PRIVATE_KEY"]) account = Account.load_key(private_key.hex()) - gas = GasPriceManager(NETNA_CONFIG) + gas = GasPriceManager(TESTNET_CONFIG) await gas.initialize() write = DecibelWriteDex( - NETNA_CONFIG, + TESTNET_CONFIG, account, opts=BaseSDKOptions( node_api_key=os.environ.get("APTOS_NODE_API_KEY"), @@ -33,12 +33,12 @@ async def main() -> None: ), ) - market_addr = get_market_addr("BTC/USD", NETNA_CONFIG.deployment.perp_engine_global) + market_addr = get_market_addr("BTC/USD", TESTNET_CONFIG.deployment.perp_engine_global) subaccount_addr = get_primary_subaccount_addr( account.address(), - NETNA_CONFIG.compat_version, - NETNA_CONFIG.deployment.package, + TESTNET_CONFIG.compat_version, + TESTNET_CONFIG.deployment.package, ) tx_result = await write.configure_user_settings_for_market( diff --git a/examples/write/create_subaccount.py b/examples/write/create_subaccount.py index 2d387bb..959a79b 100644 --- a/examples/write/create_subaccount.py +++ b/examples/write/create_subaccount.py @@ -5,7 +5,7 @@ from aptos_sdk.ed25519 import PrivateKey from decibel import ( - NETNA_CONFIG, + TESTNET_CONFIG, BaseSDKOptions, DecibelWriteDex, GasPriceManager, @@ -16,11 +16,11 @@ async def main() -> None: private_key = PrivateKey.from_hex(os.environ["PRIVATE_KEY"]) account = Account.load_key(private_key.hex()) - gas = GasPriceManager(NETNA_CONFIG) + gas = GasPriceManager(TESTNET_CONFIG) await gas.initialize() write = DecibelWriteDex( - NETNA_CONFIG, + TESTNET_CONFIG, account, opts=BaseSDKOptions( node_api_key=os.environ.get("APTOS_NODE_API_KEY"), diff --git a/examples/write/create_vault.py b/examples/write/create_vault.py index 6b9f88d..2fbd25b 100644 --- a/examples/write/create_vault.py +++ b/examples/write/create_vault.py @@ -5,7 +5,7 @@ from aptos_sdk.ed25519 import PrivateKey from decibel import ( - NETNA_CONFIG, + TESTNET_CONFIG, BaseSDKOptions, DecibelWriteDex, GasPriceManager, @@ -18,11 +18,11 @@ async def main() -> None: private_key = PrivateKey.from_hex(os.environ["PRIVATE_KEY"]) account = Account.load_key(private_key.hex()) - gas = GasPriceManager(NETNA_CONFIG) + gas = GasPriceManager(TESTNET_CONFIG) await gas.initialize() write = DecibelWriteDex( - NETNA_CONFIG, + TESTNET_CONFIG, account, opts=BaseSDKOptions( node_api_key=os.environ.get("APTOS_NODE_API_KEY"), diff --git a/examples/write/deactivate_subaccount.py b/examples/write/deactivate_subaccount.py index c2d8d66..aed2cea 100644 --- a/examples/write/deactivate_subaccount.py +++ b/examples/write/deactivate_subaccount.py @@ -5,7 +5,7 @@ from aptos_sdk.ed25519 import PrivateKey from decibel import ( - NETNA_CONFIG, + TESTNET_CONFIG, BaseSDKOptions, DecibelWriteDex, GasPriceManager, @@ -16,11 +16,11 @@ async def main() -> None: private_key = PrivateKey.from_hex(os.environ["PRIVATE_KEY"]) account = Account.load_key(private_key.hex()) - gas = GasPriceManager(NETNA_CONFIG) + gas = GasPriceManager(TESTNET_CONFIG) await gas.initialize() write = DecibelWriteDex( - NETNA_CONFIG, + TESTNET_CONFIG, account, opts=BaseSDKOptions( node_api_key=os.environ.get("APTOS_NODE_API_KEY"), diff --git a/examples/write/delegate_trading.py b/examples/write/delegate_trading.py index 1a00281..b78fd0c 100644 --- a/examples/write/delegate_trading.py +++ b/examples/write/delegate_trading.py @@ -5,7 +5,7 @@ from aptos_sdk.ed25519 import PrivateKey from decibel import ( - NETNA_CONFIG, + TESTNET_CONFIG, BaseSDKOptions, DecibelWriteDex, GasPriceManager, @@ -17,11 +17,11 @@ async def main() -> None: private_key = PrivateKey.from_hex(os.environ["PRIVATE_KEY"]) account = Account.load_key(private_key.hex()) - gas = GasPriceManager(NETNA_CONFIG) + gas = GasPriceManager(TESTNET_CONFIG) await gas.initialize() write = DecibelWriteDex( - NETNA_CONFIG, + TESTNET_CONFIG, account, opts=BaseSDKOptions( node_api_key=os.environ.get("APTOS_NODE_API_KEY"), @@ -34,8 +34,8 @@ async def main() -> None: subaccount_addr = get_primary_subaccount_addr( account.address(), - NETNA_CONFIG.compat_version, - NETNA_CONFIG.deployment.package, + TESTNET_CONFIG.compat_version, + TESTNET_CONFIG.deployment.package, ) delegate_to = "0x123..." diff --git a/examples/write/delegate_vault_actions.py b/examples/write/delegate_vault_actions.py index 465e0c7..f8101cc 100644 --- a/examples/write/delegate_vault_actions.py +++ b/examples/write/delegate_vault_actions.py @@ -5,7 +5,7 @@ from aptos_sdk.ed25519 import PrivateKey from decibel import ( - NETNA_CONFIG, + TESTNET_CONFIG, BaseSDKOptions, DecibelWriteDex, GasPriceManager, @@ -16,11 +16,11 @@ async def main() -> None: private_key = PrivateKey.from_hex(os.environ["PRIVATE_KEY"]) account = Account.load_key(private_key.hex()) - gas = GasPriceManager(NETNA_CONFIG) + gas = GasPriceManager(TESTNET_CONFIG) await gas.initialize() write = DecibelWriteDex( - NETNA_CONFIG, + TESTNET_CONFIG, account, opts=BaseSDKOptions( node_api_key=os.environ.get("APTOS_NODE_API_KEY"), diff --git a/examples/write/deposit.py b/examples/write/deposit.py index e5001f9..832e4ce 100644 --- a/examples/write/deposit.py +++ b/examples/write/deposit.py @@ -5,7 +5,7 @@ from aptos_sdk.ed25519 import PrivateKey from decibel import ( - NETNA_CONFIG, + TESTNET_CONFIG, BaseSDKOptions, DecibelWriteDex, GasPriceManager, @@ -17,11 +17,11 @@ async def main() -> None: private_key = PrivateKey.from_hex(os.environ["PRIVATE_KEY"]) account = Account.load_key(private_key.hex()) - gas = GasPriceManager(NETNA_CONFIG) + gas = GasPriceManager(TESTNET_CONFIG) await gas.initialize() write = DecibelWriteDex( - NETNA_CONFIG, + TESTNET_CONFIG, account, opts=BaseSDKOptions( node_api_key=os.environ.get("APTOS_NODE_API_KEY"), diff --git a/examples/write/deposit_to_vault.py b/examples/write/deposit_to_vault.py index 253c9e3..680572d 100644 --- a/examples/write/deposit_to_vault.py +++ b/examples/write/deposit_to_vault.py @@ -5,7 +5,7 @@ from aptos_sdk.ed25519 import PrivateKey from decibel import ( - NETNA_CONFIG, + TESTNET_CONFIG, BaseSDKOptions, DecibelWriteDex, GasPriceManager, @@ -18,11 +18,11 @@ async def main() -> None: private_key = PrivateKey.from_hex(os.environ["PRIVATE_KEY"]) account = Account.load_key(private_key.hex()) - gas = GasPriceManager(NETNA_CONFIG) + gas = GasPriceManager(TESTNET_CONFIG) await gas.initialize() write = DecibelWriteDex( - NETNA_CONFIG, + TESTNET_CONFIG, account, opts=BaseSDKOptions( node_api_key=os.environ.get("APTOS_NODE_API_KEY"), @@ -35,8 +35,8 @@ async def main() -> None: subaccount_addr = get_primary_subaccount_addr( account.address(), - NETNA_CONFIG.compat_version, - NETNA_CONFIG.deployment.package, + TESTNET_CONFIG.compat_version, + TESTNET_CONFIG.deployment.package, ) vault_address = "0x123..." diff --git a/examples/write/market_maker_bot.py b/examples/write/market_maker_bot.py new file mode 100644 index 0000000..4fca0fe --- /dev/null +++ b/examples/write/market_maker_bot.py @@ -0,0 +1,487 @@ +from __future__ import annotations + +import argparse +import asyncio +import os +from dataclasses import dataclass + +from aptos_sdk.account import Account +from aptos_sdk.ed25519 import PrivateKey + +from decibel import ( + BaseSDKOptions, + DecibelWriteDex, + GasPriceManager, + NAMED_CONFIGS, + PlaceOrderSuccess, + TimeInForce, + amount_to_chain_units, + round_to_tick_size, + round_to_valid_order_size, +) +from decibel.read import DecibelReadDex, PerpMarket + + +@dataclass(frozen=True) +class MMSettings: + market_name: str = "BTC/USD" + spread: float = 0.001 + order_size: float = 0.001 + max_inventory: float = 0.005 + skew_per_unit: float = 0.0001 + max_margin_usage: float = 0.5 + refresh_interval_s: float = 20.0 + cooldown_s: float = 1.5 + cancel_resync_s: float = 8.0 + max_cycles: int = 0 + dry_run: bool = False + + +def _env_bool(name: str, default: bool = False) -> bool: + raw = os.getenv(name) + if raw is None: + return default + return raw.strip().lower() in {"1", "true", "yes", "y", "on"} + + +def _normalize_market_name(name: str) -> str: + return name.strip().replace("-", "/").upper() + + +def _resolve_market(markets: list[PerpMarket], requested_name: str) -> PerpMarket | None: + requested = _normalize_market_name(requested_name) + for market in markets: + if _normalize_market_name(market.market_name) == requested: + return market + return None + + +def _compute_quotes( + *, + mid: float, + inventory: float, + market: PerpMarket, + settings: MMSettings, +) -> tuple[float, float, float] | None: + tick_size = int(market.tick_size) + lot_size = int(market.lot_size) + min_size = int(market.min_size) + + if mid <= 0: + return None + + tick_human = tick_size / (10**market.px_decimals) + min_spread = tick_human / mid + if settings.spread < min_spread: + raise ValueError( + f"spread {settings.spread} is tighter than one tick ({min_spread:.8f}); " + "increase --spread", + ) + + if abs(inventory) >= settings.max_inventory: + return None + + valid_size = round_to_valid_order_size( + settings.order_size, + lot_size=lot_size, + sz_decimals=market.sz_decimals, + min_size=min_size, + ) + if valid_size <= 0: + return None + + half_spread = settings.spread / 2.0 + skew = inventory * settings.skew_per_unit + + raw_bid = mid * (1.0 - half_spread - skew) + raw_ask = mid * (1.0 + half_spread - skew) + + bid = round_to_tick_size( + raw_bid, + tick_size=tick_size, + px_decimals=market.px_decimals, + round_up=False, + ) + ask = round_to_tick_size( + raw_ask, + tick_size=tick_size, + px_decimals=market.px_decimals, + round_up=True, + ) + + if ask <= bid: + ask = round_to_tick_size( + bid + tick_human, + tick_size=tick_size, + px_decimals=market.px_decimals, + round_up=True, + ) + + return bid, ask, valid_size + + +async def _sync_state( + read: DecibelReadDex, + market: PerpMarket, + subaccount_addr: str, +) -> tuple[float | None, float, float, list[str]]: + overview_task = read.account_overview.get_by_addr(sub_addr=subaccount_addr) + positions_task = read.user_positions.get_by_addr(sub_addr=subaccount_addr, limit=100) + orders_task = read.user_open_orders.get_by_addr(sub_addr=subaccount_addr, limit=200) + prices_task = read.market_prices.get_all() + + overview, positions, open_orders, prices = await asyncio.gather( + overview_task, + positions_task, + orders_task, + prices_task, + ) + + inventory = 0.0 + for pos in positions: + if pos.market == market.market_addr: + inventory = pos.size + break + + market_order_ids = [ + order.order_id for order in open_orders.items if order.market == market.market_addr + ] + + mid: float | None = None + for price in prices: + if price.market == market.market_addr: + mid = price.mid_px or price.mark_px + break + + if mid is None: + try: + depth = await read.market_depth.get_by_name(market.market_name, limit=1) + if depth.bids and depth.asks: + mid = (depth.bids[0].price + depth.asks[0].price) / 2.0 + except Exception as exc: + print(f" warning: failed depth fallback for {market.market_name}: {exc}") + + return mid, inventory, overview.cross_margin_ratio, market_order_ids + + +async def _cancel_market_orders( + write: DecibelWriteDex, + market_name: str, + order_ids: list[str], + subaccount_addr: str, + dry_run: bool, +) -> tuple[int, int]: + cancelled = 0 + failed = 0 + for order_id in order_ids: + if dry_run: + print(f" [dry-run] would cancel {order_id}") + cancelled += 1 + continue + try: + await write.cancel_order( + order_id=order_id, + market_name=market_name, + subaccount_addr=subaccount_addr, + ) + cancelled += 1 + except Exception as exc: + print(f" cancel failed ({order_id}): {exc}") + failed += 1 + return cancelled, failed + + +async def _place_quote( + write: DecibelWriteDex | None, + *, + market: PerpMarket, + subaccount_addr: str, + is_buy: bool, + price: float, + size: float, + dry_run: bool, +) -> None: + side = "bid" if is_buy else "ask" + if dry_run: + print(f" [dry-run] would place {side}: {size} @ {price}") + return + if write is None: + raise RuntimeError("write client is required in live mode") + + result = await write.place_order( + market_name=market.market_name, + price=amount_to_chain_units(price, market.px_decimals), + size=amount_to_chain_units(size, market.sz_decimals), + is_buy=is_buy, + time_in_force=TimeInForce.PostOnly, + is_reduce_only=False, + subaccount_addr=subaccount_addr, + tick_size=market.tick_size, + ) + if isinstance(result, PlaceOrderSuccess): + print(f" {side} placed: {price} x {size} (tx={result.transaction_hash[:16]}...)") + else: + print(f" {side} failed: {result.error}") + + +async def _run_cycle( + cycle: int, + *, + read: DecibelReadDex, + write: DecibelWriteDex | None, + market: PerpMarket, + subaccount_addr: str, + settings: MMSettings, +) -> None: + mid, inventory, margin_usage, open_order_ids = await _sync_state(read, market, subaccount_addr) + print( + f"\n[cycle {cycle}] mid={mid if mid is not None else 'N/A'} " + f"inventory={inventory:+.6f} " + f"margin={margin_usage*100:.2f}% open_orders={len(open_order_ids)}" + ) + + if margin_usage > settings.max_margin_usage: + print( + f" paused: margin {margin_usage*100:.2f}% > {settings.max_margin_usage*100:.2f}%" + ) + return + if mid is None: + print(" paused: no mid price available") + return + + quotes = _compute_quotes( + mid=mid, + inventory=inventory, + market=market, + settings=settings, + ) + if quotes is None: + print( + f" paused: inventory {inventory:+.6f} at/above max {settings.max_inventory}; " + "canceling resting orders only" + ) + if write is not None and open_order_ids: + await _cancel_market_orders( + write, + market_name=market.market_name, + order_ids=open_order_ids, + subaccount_addr=subaccount_addr, + dry_run=settings.dry_run, + ) + return + + bid, ask, size = quotes + print(f" quotes: bid={bid} ask={ask} size={size}") + + failed = 0 + if write is not None and open_order_ids: + cancelled, failed = await _cancel_market_orders( + write, + market_name=market.market_name, + order_ids=open_order_ids, + subaccount_addr=subaccount_addr, + dry_run=settings.dry_run, + ) + print(f" cancelled={cancelled} failed={failed}") + + if failed > 0: + await asyncio.sleep(settings.cancel_resync_s) + still_open = await read.user_open_orders.get_by_addr(sub_addr=subaccount_addr, limit=200) + market_still_open = [o for o in still_open.items if o.market == market.market_addr] + if market_still_open: + print(f" still {len(market_still_open)} open orders, skip this cycle") + return + + await _place_quote( + write, + market=market, + subaccount_addr=subaccount_addr, + is_buy=True, + price=bid, + size=size, + dry_run=settings.dry_run, + ) + await asyncio.sleep(settings.cooldown_s) + await _place_quote( + write, + market=market, + subaccount_addr=subaccount_addr, + is_buy=False, + price=ask, + size=size, + dry_run=settings.dry_run, + ) + + +def _parse_args() -> argparse.Namespace: + parser = argparse.ArgumentParser( + description=( + "Single-file Decibel market maker bot: each cycle cancels existing market " + "orders and places a POST_ONLY bid/ask around mid price with inventory skew." + ), + ) + parser.add_argument( + "--network", + default=os.getenv("NETWORK", "testnet"), + choices=("testnet", "mainnet"), + help="Network profile from decibel.NAMED_CONFIGS", + ) + parser.add_argument( + "--market", + default=os.getenv("MARKET_NAME", "BTC/USD"), + help="Market symbol, e.g. BTC/USD", + ) + parser.add_argument("--spread", type=float, default=float(os.getenv("MM_SPREAD", "0.001"))) + parser.add_argument( + "--order-size", + type=float, + default=float(os.getenv("MM_ORDER_SIZE", "0.001")), + ) + parser.add_argument( + "--max-inventory", + type=float, + default=float(os.getenv("MM_MAX_INVENTORY", "0.005")), + ) + parser.add_argument( + "--skew-per-unit", + type=float, + default=float(os.getenv("MM_SKEW_PER_UNIT", "0.0001")), + ) + parser.add_argument( + "--max-margin-usage", + type=float, + default=float(os.getenv("MM_MAX_MARGIN", "0.5")), + help="Pause quoting when cross_margin_ratio exceeds this value", + ) + parser.add_argument( + "--refresh-interval", + type=float, + default=float(os.getenv("MM_REFRESH_S", "20")), + help="Seconds between cycles", + ) + parser.add_argument( + "--cooldown", + type=float, + default=float(os.getenv("MM_COOLDOWN_S", "1.5")), + help="Seconds between placing bid and ask", + ) + parser.add_argument( + "--cancel-resync", + type=float, + default=float(os.getenv("MM_CANCEL_RESYNC_S", "8")), + help="Sleep before re-checking open orders after cancel failures", + ) + parser.add_argument( + "--max-cycles", + type=int, + default=int(os.getenv("MAX_CYCLES", "0")), + help="Stop after N cycles (0 = run forever)", + ) + parser.add_argument( + "--dry-run", + action=argparse.BooleanOptionalAction, + default=_env_bool("DRY_RUN", False), + help="Simulate cancels/orders without sending transactions", + ) + return parser.parse_args() + + +async def main() -> int: + args = _parse_args() + + subaccount_addr = os.getenv("SUBACCOUNT_ADDRESS", "").strip() + node_api_key = os.getenv("APTOS_NODE_API_KEY", "").strip() or None + private_key_hex = os.getenv("PRIVATE_KEY", "").strip() + + if not subaccount_addr: + print("Error: SUBACCOUNT_ADDRESS is required") + return 1 + + dry_run = args.dry_run + if not private_key_hex: + print("PRIVATE_KEY missing, forcing dry-run mode") + dry_run = True + + settings = MMSettings( + market_name=args.market, + spread=args.spread, + order_size=args.order_size, + max_inventory=args.max_inventory, + skew_per_unit=args.skew_per_unit, + max_margin_usage=args.max_margin_usage, + refresh_interval_s=args.refresh_interval, + cooldown_s=args.cooldown, + cancel_resync_s=args.cancel_resync, + max_cycles=args.max_cycles, + dry_run=dry_run, + ) + + config = NAMED_CONFIGS[args.network] + read = DecibelReadDex(config, api_key=node_api_key) + + gas: GasPriceManager | None = None + write: DecibelWriteDex | None = None + try: + markets = await read.markets.get_all() + market = _resolve_market(markets, settings.market_name) + if market is None: + preview = ", ".join(m.market_name for m in markets[:8]) + print(f"Market '{settings.market_name}' not found. Sample: {preview}") + return 1 + + print(f"Starting MM bot on {market.market_name} ({args.network})") + print( + f" spread={settings.spread} order_size={settings.order_size} " + f"max_inventory={settings.max_inventory} skew_per_unit={settings.skew_per_unit}" + ) + print( + f" max_margin_usage={settings.max_margin_usage} " + f"refresh={settings.refresh_interval_s}s " + f"cooldown={settings.cooldown_s}s dry_run={settings.dry_run}" + ) + + if not settings.dry_run: + private_key = PrivateKey.from_hex(private_key_hex) + account = Account.load_key(private_key.hex()) + gas = GasPriceManager(config) + await gas.initialize() + write = DecibelWriteDex( + config, + account, + opts=BaseSDKOptions( + node_api_key=node_api_key, + gas_price_manager=gas, + skip_simulate=False, + no_fee_payer=True, + time_delta_ms=0, + ), + ) + + cycle = 1 + while True: + try: + await _run_cycle( + cycle, + read=read, + write=write, + market=market, + subaccount_addr=subaccount_addr, + settings=settings, + ) + except Exception as exc: + print(f" [cycle {cycle} error] {exc}") + + if settings.max_cycles > 0 and cycle >= settings.max_cycles: + break + cycle += 1 + await asyncio.sleep(settings.refresh_interval_s) + finally: + await read.ws.close() + if gas is not None: + await gas.destroy() + + return 0 + + +if __name__ == "__main__": + raise SystemExit(asyncio.run(main())) diff --git a/examples/write/place_bulk_orders.py b/examples/write/place_bulk_orders.py index e06022b..1c84b0e 100644 --- a/examples/write/place_bulk_orders.py +++ b/examples/write/place_bulk_orders.py @@ -5,7 +5,7 @@ from aptos_sdk.ed25519 import PrivateKey from decibel import ( - NETNA_CONFIG, + TESTNET_CONFIG, BaseSDKOptions, DecibelWriteDex, GasPriceManager, @@ -19,10 +19,10 @@ async def main() -> None: private_key = PrivateKey.from_hex(os.environ["PRIVATE_KEY"]) account = Account.load_key(private_key.hex()) - gas = GasPriceManager(NETNA_CONFIG) + gas = GasPriceManager(TESTNET_CONFIG) await gas.initialize() - read = DecibelReadDex(NETNA_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) + read = DecibelReadDex(TESTNET_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) markets = await read.markets.get_all() btc_market = next((m for m in markets if m.market_name == "BTC/USD"), None) @@ -52,7 +52,7 @@ async def main() -> None: ] write = DecibelWriteDex( - NETNA_CONFIG, + TESTNET_CONFIG, account, opts=BaseSDKOptions( node_api_key=os.environ.get("APTOS_NODE_API_KEY"), diff --git a/examples/write/place_limit_order.py b/examples/write/place_limit_order.py index f7051bc..b718ae6 100644 --- a/examples/write/place_limit_order.py +++ b/examples/write/place_limit_order.py @@ -5,7 +5,7 @@ from aptos_sdk.ed25519 import PrivateKey from decibel import ( - NETNA_CONFIG, + TESTNET_CONFIG, BaseSDKOptions, DecibelWriteDex, GasPriceManager, @@ -20,10 +20,10 @@ async def main() -> None: private_key = PrivateKey.from_hex(os.environ["PRIVATE_KEY"]) account = Account.load_key(private_key.hex()) - gas = GasPriceManager(NETNA_CONFIG) + gas = GasPriceManager(TESTNET_CONFIG) await gas.initialize() - read = DecibelReadDex(NETNA_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) + read = DecibelReadDex(TESTNET_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) markets = await read.markets.get_all() btc_market = next((m for m in markets if m.market_name == "BTC/USD"), None) @@ -37,7 +37,7 @@ async def main() -> None: tick_size = btc_market.tick_size write = DecibelWriteDex( - NETNA_CONFIG, + TESTNET_CONFIG, account, opts=BaseSDKOptions( node_api_key=os.environ.get("APTOS_NODE_API_KEY"), diff --git a/examples/write/place_market_order.py b/examples/write/place_market_order.py index 4343541..449f741 100644 --- a/examples/write/place_market_order.py +++ b/examples/write/place_market_order.py @@ -5,7 +5,7 @@ from aptos_sdk.ed25519 import PrivateKey from decibel import ( - NETNA_CONFIG, + TESTNET_CONFIG, BaseSDKOptions, DecibelWriteDex, GasPriceManager, @@ -20,10 +20,10 @@ async def main() -> None: private_key = PrivateKey.from_hex(os.environ["PRIVATE_KEY"]) account = Account.load_key(private_key.hex()) - gas = GasPriceManager(NETNA_CONFIG) + gas = GasPriceManager(TESTNET_CONFIG) await gas.initialize() - read = DecibelReadDex(NETNA_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) + read = DecibelReadDex(TESTNET_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) markets = await read.markets.get_all() btc_market = next((m for m in markets if m.market_name == "BTC/USD"), None) @@ -36,7 +36,7 @@ async def main() -> None: size = amount_to_chain_units(0.001, btc_market.sz_decimals) write = DecibelWriteDex( - NETNA_CONFIG, + TESTNET_CONFIG, account, opts=BaseSDKOptions( node_api_key=os.environ.get("APTOS_NODE_API_KEY"), diff --git a/examples/write/place_order_with_tp_sl.py b/examples/write/place_order_with_tp_sl.py index 4a0a034..dc1e481 100644 --- a/examples/write/place_order_with_tp_sl.py +++ b/examples/write/place_order_with_tp_sl.py @@ -5,7 +5,7 @@ from aptos_sdk.ed25519 import PrivateKey from decibel import ( - NETNA_CONFIG, + TESTNET_CONFIG, BaseSDKOptions, DecibelWriteDex, GasPriceManager, @@ -20,10 +20,10 @@ async def main() -> None: private_key = PrivateKey.from_hex(os.environ["PRIVATE_KEY"]) account = Account.load_key(private_key.hex()) - gas = GasPriceManager(NETNA_CONFIG) + gas = GasPriceManager(TESTNET_CONFIG) await gas.initialize() - read = DecibelReadDex(NETNA_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) + read = DecibelReadDex(TESTNET_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) markets = await read.markets.get_all() btc_market = next((m for m in markets if m.market_name == "BTC/USD"), None) @@ -43,7 +43,7 @@ async def main() -> None: sl_limit = amount_to_chain_units(69900.0, btc_market.px_decimals) write = DecibelWriteDex( - NETNA_CONFIG, + TESTNET_CONFIG, account, opts=BaseSDKOptions( node_api_key=os.environ.get("APTOS_NODE_API_KEY"), diff --git a/examples/write/place_stop_order.py b/examples/write/place_stop_order.py index 9084ead..cc62cd1 100644 --- a/examples/write/place_stop_order.py +++ b/examples/write/place_stop_order.py @@ -5,7 +5,7 @@ from aptos_sdk.ed25519 import PrivateKey from decibel import ( - NETNA_CONFIG, + TESTNET_CONFIG, BaseSDKOptions, DecibelWriteDex, GasPriceManager, @@ -20,10 +20,10 @@ async def main() -> None: private_key = PrivateKey.from_hex(os.environ["PRIVATE_KEY"]) account = Account.load_key(private_key.hex()) - gas = GasPriceManager(NETNA_CONFIG) + gas = GasPriceManager(TESTNET_CONFIG) await gas.initialize() - read = DecibelReadDex(NETNA_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) + read = DecibelReadDex(TESTNET_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) markets = await read.markets.get_all() btc_market = next((m for m in markets if m.market_name == "BTC/USD"), None) @@ -38,7 +38,7 @@ async def main() -> None: tick_size = btc_market.tick_size write = DecibelWriteDex( - NETNA_CONFIG, + TESTNET_CONFIG, account, opts=BaseSDKOptions( node_api_key=os.environ.get("APTOS_NODE_API_KEY"), diff --git a/examples/write/place_tp_sl_for_position.py b/examples/write/place_tp_sl_for_position.py index b1fb021..d63ddd5 100644 --- a/examples/write/place_tp_sl_for_position.py +++ b/examples/write/place_tp_sl_for_position.py @@ -5,7 +5,7 @@ from aptos_sdk.ed25519 import PrivateKey from decibel import ( - NETNA_CONFIG, + TESTNET_CONFIG, BaseSDKOptions, DecibelWriteDex, GasPriceManager, @@ -19,10 +19,10 @@ async def main() -> None: private_key = PrivateKey.from_hex(os.environ["PRIVATE_KEY"]) account = Account.load_key(private_key.hex()) - gas = GasPriceManager(NETNA_CONFIG) + gas = GasPriceManager(TESTNET_CONFIG) await gas.initialize() - read = DecibelReadDex(NETNA_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) + read = DecibelReadDex(TESTNET_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) markets = await read.markets.get_all() btc_market = next((m for m in markets if m.market_name == "BTC/USD"), None) @@ -42,7 +42,7 @@ async def main() -> None: sl_size = amount_to_chain_units(0.001, btc_market.sz_decimals) write = DecibelWriteDex( - NETNA_CONFIG, + TESTNET_CONFIG, account, opts=BaseSDKOptions( node_api_key=os.environ.get("APTOS_NODE_API_KEY"), @@ -53,7 +53,7 @@ async def main() -> None: ), ) - market_addr = get_market_addr("BTC/USD", NETNA_CONFIG.deployment.perp_engine_global) + market_addr = get_market_addr("BTC/USD", TESTNET_CONFIG.deployment.perp_engine_global) tx_result = await write.place_tp_sl_order_for_position( market_addr=market_addr, diff --git a/examples/write/place_twap_order.py b/examples/write/place_twap_order.py index 6ecef4e..1c99248 100644 --- a/examples/write/place_twap_order.py +++ b/examples/write/place_twap_order.py @@ -5,7 +5,7 @@ from aptos_sdk.ed25519 import PrivateKey from decibel import ( - NETNA_CONFIG, + TESTNET_CONFIG, BaseSDKOptions, DecibelWriteDex, GasPriceManager, @@ -21,14 +21,14 @@ async def main() -> None: account = Account.load_key(private_key.hex()) gas = GasPriceManager( - NETNA_CONFIG, + TESTNET_CONFIG, opts=GasPriceManagerOptions( node_api_key=os.environ.get("APTOS_NODE_API_KEY"), ), ) await gas.initialize() - read = DecibelReadDex(NETNA_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) + read = DecibelReadDex(TESTNET_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) markets = await read.markets.get_all() ETH_market = next((m for m in markets if m.market_name == "ETH/USD"), None) @@ -40,7 +40,7 @@ async def main() -> None: size = amount_to_chain_units(2000, ETH_market.sz_decimals) write = DecibelWriteDex( - NETNA_CONFIG, + TESTNET_CONFIG, account, opts=BaseSDKOptions( node_api_key=os.environ.get("APTOS_NODE_API_KEY"), diff --git a/examples/write/revoke_builder_fee.py b/examples/write/revoke_builder_fee.py index 2c19797..cbe2fcf 100644 --- a/examples/write/revoke_builder_fee.py +++ b/examples/write/revoke_builder_fee.py @@ -5,7 +5,7 @@ from aptos_sdk.ed25519 import PrivateKey from decibel import ( - NETNA_CONFIG, + TESTNET_CONFIG, BaseSDKOptions, DecibelWriteDex, GasPriceManager, @@ -16,11 +16,11 @@ async def main() -> None: private_key = PrivateKey.from_hex(os.environ["PRIVATE_KEY"]) account = Account.load_key(private_key.hex()) - gas = GasPriceManager(NETNA_CONFIG) + gas = GasPriceManager(TESTNET_CONFIG) await gas.initialize() write = DecibelWriteDex( - NETNA_CONFIG, + TESTNET_CONFIG, account, opts=BaseSDKOptions( node_api_key=os.environ.get("APTOS_NODE_API_KEY"), diff --git a/examples/write/revoke_delegation.py b/examples/write/revoke_delegation.py index bb280c2..33df188 100644 --- a/examples/write/revoke_delegation.py +++ b/examples/write/revoke_delegation.py @@ -5,7 +5,7 @@ from aptos_sdk.ed25519 import PrivateKey from decibel import ( - NETNA_CONFIG, + TESTNET_CONFIG, BaseSDKOptions, DecibelWriteDex, GasPriceManager, @@ -16,11 +16,11 @@ async def main() -> None: private_key = PrivateKey.from_hex(os.environ["PRIVATE_KEY"]) account = Account.load_key(private_key.hex()) - gas = GasPriceManager(NETNA_CONFIG) + gas = GasPriceManager(TESTNET_CONFIG) await gas.initialize() write = DecibelWriteDex( - NETNA_CONFIG, + TESTNET_CONFIG, account, opts=BaseSDKOptions( node_api_key=os.environ.get("APTOS_NODE_API_KEY"), diff --git a/examples/write/trigger_matching.py b/examples/write/trigger_matching.py index 186eabe..552f616 100644 --- a/examples/write/trigger_matching.py +++ b/examples/write/trigger_matching.py @@ -5,7 +5,7 @@ from aptos_sdk.ed25519 import PrivateKey from decibel import ( - NETNA_CONFIG, + TESTNET_CONFIG, BaseSDKOptions, DecibelWriteDex, GasPriceManager, @@ -17,11 +17,11 @@ async def main() -> None: private_key = PrivateKey.from_hex(os.environ["PRIVATE_KEY"]) account = Account.load_key(private_key.hex()) - gas = GasPriceManager(NETNA_CONFIG) + gas = GasPriceManager(TESTNET_CONFIG) await gas.initialize() write = DecibelWriteDex( - NETNA_CONFIG, + TESTNET_CONFIG, account, opts=BaseSDKOptions( node_api_key=os.environ.get("APTOS_NODE_API_KEY"), @@ -32,7 +32,7 @@ async def main() -> None: ), ) - market_addr = get_market_addr("BTC/USD", NETNA_CONFIG.deployment.perp_engine_global) + market_addr = get_market_addr("BTC/USD", TESTNET_CONFIG.deployment.perp_engine_global) result = await write.trigger_matching( market_addr=market_addr, diff --git a/examples/write/update_tp_sl_order.py b/examples/write/update_tp_sl_order.py index ff8b1d5..2834f76 100644 --- a/examples/write/update_tp_sl_order.py +++ b/examples/write/update_tp_sl_order.py @@ -5,7 +5,7 @@ from aptos_sdk.ed25519 import PrivateKey from decibel import ( - NETNA_CONFIG, + TESTNET_CONFIG, BaseSDKOptions, DecibelWriteDex, GasPriceManager, @@ -19,10 +19,10 @@ async def main() -> None: private_key = PrivateKey.from_hex(os.environ["PRIVATE_KEY"]) account = Account.load_key(private_key.hex()) - gas = GasPriceManager(NETNA_CONFIG) + gas = GasPriceManager(TESTNET_CONFIG) await gas.initialize() - read = DecibelReadDex(NETNA_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) + read = DecibelReadDex(TESTNET_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY")) markets = await read.markets.get_all() btc_market = next((m for m in markets if m.market_name == "BTC/USD"), None) @@ -32,7 +32,7 @@ async def main() -> None: return write = DecibelWriteDex( - NETNA_CONFIG, + TESTNET_CONFIG, account, opts=BaseSDKOptions( node_api_key=os.environ.get("APTOS_NODE_API_KEY"), @@ -43,7 +43,7 @@ async def main() -> None: ), ) - market_addr = get_market_addr("BTC/USD", NETNA_CONFIG.deployment.perp_engine_global) + market_addr = get_market_addr("BTC/USD", TESTNET_CONFIG.deployment.perp_engine_global) tp_trigger = amount_to_chain_units(105000.0, btc_market.px_decimals) tp_limit = amount_to_chain_units(104900.0, btc_market.px_decimals) diff --git a/examples/write/withdraw.py b/examples/write/withdraw.py index 77957a6..caa6733 100644 --- a/examples/write/withdraw.py +++ b/examples/write/withdraw.py @@ -5,7 +5,7 @@ from aptos_sdk.ed25519 import PrivateKey from decibel import ( - NETNA_CONFIG, + TESTNET_CONFIG, BaseSDKOptions, DecibelWriteDex, GasPriceManager, @@ -17,11 +17,11 @@ async def main() -> None: private_key = PrivateKey.from_hex(os.environ["PRIVATE_KEY"]) account = Account.load_key(private_key.hex()) - gas = GasPriceManager(NETNA_CONFIG) + gas = GasPriceManager(TESTNET_CONFIG) await gas.initialize() write = DecibelWriteDex( - NETNA_CONFIG, + TESTNET_CONFIG, account, opts=BaseSDKOptions( node_api_key=os.environ.get("APTOS_NODE_API_KEY"), diff --git a/examples/write/withdraw_from_vault.py b/examples/write/withdraw_from_vault.py index 8a30cae..eb3bd50 100644 --- a/examples/write/withdraw_from_vault.py +++ b/examples/write/withdraw_from_vault.py @@ -5,7 +5,7 @@ from aptos_sdk.ed25519 import PrivateKey from decibel import ( - NETNA_CONFIG, + TESTNET_CONFIG, BaseSDKOptions, DecibelWriteDex, GasPriceManager, @@ -17,11 +17,11 @@ async def main() -> None: private_key = PrivateKey.from_hex(os.environ["PRIVATE_KEY"]) account = Account.load_key(private_key.hex()) - gas = GasPriceManager(NETNA_CONFIG) + gas = GasPriceManager(TESTNET_CONFIG) await gas.initialize() write = DecibelWriteDex( - NETNA_CONFIG, + TESTNET_CONFIG, account, opts=BaseSDKOptions( node_api_key=os.environ.get("APTOS_NODE_API_KEY"), diff --git a/src/decibel/__init__.py b/src/decibel/__init__.py index ee781fc..3228380 100644 --- a/src/decibel/__init__.py +++ b/src/decibel/__init__.py @@ -8,7 +8,6 @@ LOCAL_CONFIG, MAINNET_CONFIG, NAMED_CONFIGS, - NETNA_CONFIG, TESTNET_CONFIG, CompatVersion, DecibelConfig, @@ -199,7 +198,6 @@ "MoveFunction", "MoveFunctionId", "NAMED_CONFIGS", - "NETNA_CONFIG", "Network", "OrderEvent", "OrderEventClientOrderId", diff --git a/src/decibel/_constants.py b/src/decibel/_constants.py index ad7fa15..a5b28fb 100644 --- a/src/decibel/_constants.py +++ b/src/decibel/_constants.py @@ -14,7 +14,6 @@ "DEFAULT_TXN_CONFIRM_TIMEOUT", "DEFAULT_TXN_SUBMIT_TIMEOUT", "MAINNET_CONFIG", - "NETNA_CONFIG", "TESTNET_CONFIG", "LOCAL_CONFIG", "DOCKER_CONFIG", @@ -93,7 +92,6 @@ def _create_deployment(package: str) -> Deployment: _MAINNET_PACKAGE = "0x50ead22afd6ffd9769e3b3d6e0e64a2a350d68e8b102c4e72e33d0b8cfdfdb06" _MAINNET_USDC = "0xbae207659db88bea0cbead6da0ed00aac12edcdda169e591cd41c94180b46f3b" -_NETNA_PACKAGE = "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95" _TESTNET_PACKAGE = "0xe7da2794b1d8af76532ed95f38bfdf1136abfd8ea3a240189971988a83101b7f" _LOCAL_PACKAGE = "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95" _DOCKER_PACKAGE = "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95" @@ -117,18 +115,6 @@ def _create_deployment(package: str) -> Deployment: compat_version=CompatVersion.V0_4, ) -NETNA_CONFIG = DecibelConfig( - network=Network.CUSTOM, - fullnode_url="https://api.netna.staging.aptoslabs.com/v1", - trading_http_url="https://api.netna.staging.aptoslabs.com/decibel", - trading_ws_url="wss://api.netna.staging.aptoslabs.com/decibel/ws", - gas_station_url="https://api.netna.staging.aptoslabs.com/gs/v1", - gas_station_api_key=None, - deployment=_create_deployment(_NETNA_PACKAGE), - chain_id=208, - compat_version=CompatVersion.V0_4, -) - TESTNET_CONFIG = DecibelConfig( network=Network.TESTNET, fullnode_url="https://api.testnet.aptoslabs.com/v1", @@ -168,7 +154,6 @@ def _create_deployment(package: str) -> Deployment: NAMED_CONFIGS: dict[str, DecibelConfig] = { "mainnet": MAINNET_CONFIG, - "netna": NETNA_CONFIG, "testnet": TESTNET_CONFIG, "local": LOCAL_CONFIG, "docker": DOCKER_CONFIG, diff --git a/src/decibel/_fee_pay.py b/src/decibel/_fee_pay.py index fc677e8..9169400 100644 --- a/src/decibel/_fee_pay.py +++ b/src/decibel/_fee_pay.py @@ -308,9 +308,6 @@ def _get_default_gas_station_url(config: DecibelConfig) -> str: if config.network == Network.TESTNET: return "https://api.testnet.aptoslabs.com/gs/v1" - if config.chain_id == 208: - return "https://api.netna.aptoslabs.com/gs/v1" - if config.gas_station_url: return config.gas_station_url diff --git a/src/decibel/abi/_registry.py b/src/decibel/abi/_registry.py index 28638ee..06ec745 100644 --- a/src/decibel/abi/_registry.py +++ b/src/decibel/abi/_registry.py @@ -17,7 +17,6 @@ "get_default_abi_data", ] -CHAIN_ID_NETNA = 208 CHAIN_ID_TESTNET = 2 CHAIN_ID_MAINNET = 1 @@ -34,20 +33,18 @@ def _load_abi_json(filename: str) -> ABIData: def get_abi_data(chain_id: int | None) -> ABIData: if chain_id == CHAIN_ID_MAINNET: return _load_abi_json("mainnet.json") - elif chain_id == CHAIN_ID_NETNA: - return _load_abi_json("netna.json") elif chain_id == CHAIN_ID_TESTNET: return _load_abi_json("testnet.json") else: warnings.warn( - f"Unknown chain_id {chain_id}, falling back to NETNA ABIs", + f"Unknown chain_id {chain_id}, falling back to TESTNET ABIs", stacklevel=2, ) - return _load_abi_json("netna.json") + return _load_abi_json("testnet.json") def get_default_abi_data() -> ABIData: - return _load_abi_json("netna.json") + return _load_abi_json("testnet.json") class AbiRegistry: diff --git a/src/decibel/abi/generate.py b/src/decibel/abi/generate.py index 36c7821..922d735 100644 --- a/src/decibel/abi/generate.py +++ b/src/decibel/abi/generate.py @@ -15,7 +15,6 @@ from decibel._constants import ( MAINNET_CONFIG, NAMED_CONFIGS, - NETNA_CONFIG, TESTNET_CONFIG, DecibelConfig, ) @@ -45,9 +44,7 @@ def _setup_cli_logging() -> None: def get_abi_filename(config: DecibelConfig) -> str: - if config == NETNA_CONFIG: - return "netna.json" - elif config == TESTNET_CONFIG: + if config == TESTNET_CONFIG: return "testnet.json" elif config == MAINNET_CONFIG: return "mainnet.json" diff --git a/src/decibel/abi/json/netna.json b/src/decibel/abi/json/netna.json deleted file mode 100644 index 09e4dd6..0000000 --- a/src/decibel/abi/json/netna.json +++ /dev/null @@ -1,2417 +0,0 @@ -{ - "packageAddress": "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95", - "network": "custom", - "fullnodeUrl": "https://api.netna.staging.aptoslabs.com/v1", - "fetchedAt": "2026-02-12T02:22:18.400383Z", - "abis": { - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::admin_apis::initialize": { - "name": "initialize", - "visibility": "public", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "0x1::object::Object<0x1::fungible_asset::Metadata>", - "u8", - "address" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::admin_apis::increment_time": { - "name": "increment_time", - "visibility": "public", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "u64" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::admin_apis::set_max_referral_codes_for_address": { - "name": "set_max_referral_codes_for_address", - "visibility": "public", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "address", - "u64" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::admin_apis::set_max_usage_per_referral_code_for_address": { - "name": "set_max_usage_per_referral_code_for_address", - "visibility": "public", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "address", - "u64" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::admin_apis::delist_market": { - "name": "delist_market", - "visibility": "public", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_market::PerpMarket>", - "0x1::option::Option<0x1::string::String>" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::admin_apis::admin_register_referral_code": { - "name": "admin_register_referral_code", - "visibility": "public", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "address", - "0x1::string::String" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::admin_apis::admin_register_referrer": { - "name": "admin_register_referrer", - "visibility": "public", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "address", - "0x1::string::String" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::admin_apis::update_fee_config": { - "name": "update_fee_config", - "visibility": "public", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "vector", - "vector", - "vector", - "u128", - "vector", - "vector", - "u64", - "u64", - "bool", - "u64", - "u64", - "u128", - "u128" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::admin_apis::drain_async_queue": { - "name": "drain_async_queue", - "visibility": "public", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_market::PerpMarket>" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::admin_apis::add_to_account_creation_allow_list": { - "name": "add_to_account_creation_allow_list", - "visibility": "public", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "vector
" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::admin_apis::delist_market_with_mark_price": { - "name": "delist_market_with_mark_price", - "visibility": "public", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_market::PerpMarket>", - "u64", - "0x1::option::Option<0x1::string::String>" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::admin_apis::register_market_with_composite_oracle_primary_chainlink": { - "name": "register_market_with_composite_oracle_primary_chainlink", - "visibility": "public", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "0x1::string::String", - "u8", - "u64", - "u64", - "u64", - "u64", - "u8", - "bool", - "vector", - "u64", - "u8", - "u64", - "u64", - "u64", - "u8" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::admin_apis::register_market_with_composite_oracle_primary_pyth": { - "name": "register_market_with_composite_oracle_primary_pyth", - "visibility": "public", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "0x1::string::String", - "u8", - "u64", - "u64", - "u64", - "u64", - "u8", - "bool", - "vector", - "u64", - "u64", - "u8", - "u64", - "u64", - "u64", - "u8" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::admin_apis::register_market_with_internal_oracle": { - "name": "register_market_with_internal_oracle", - "visibility": "public", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "0x1::string::String", - "u8", - "u64", - "u64", - "u64", - "u64", - "u8", - "bool", - "u64", - "u64" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::admin_apis::register_market_with_pyth_oracle": { - "name": "register_market_with_pyth_oracle", - "visibility": "public", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "0x1::string::String", - "u8", - "u64", - "u64", - "u64", - "u64", - "u8", - "bool", - "vector", - "u64", - "u64", - "u8" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::admin_apis::set_backstop_liquidator_high_watermark": { - "name": "set_backstop_liquidator_high_watermark", - "visibility": "public", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_market::PerpMarket>", - "i64" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::admin_apis::set_global_exchange_open": { - "name": "set_global_exchange_open", - "visibility": "public", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "bool" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::admin_apis::set_invite_only_account_creation": { - "name": "set_invite_only_account_creation", - "visibility": "public", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "bool" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::admin_apis::set_market_allowlist_only": { - "name": "set_market_allowlist_only", - "visibility": "public", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_market::PerpMarket>", - "vector
", - "0x1::option::Option<0x1::string::String>" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::admin_apis::set_market_halted": { - "name": "set_market_halted", - "visibility": "public", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_market::PerpMarket>", - "0x1::option::Option<0x1::string::String>" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::admin_apis::set_market_margin_call_backstop_pct": { - "name": "set_market_margin_call_backstop_pct", - "visibility": "public", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_market::PerpMarket>", - "u64" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::admin_apis::set_market_margin_call_fee_pct": { - "name": "set_market_margin_call_fee_pct", - "visibility": "public", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_market::PerpMarket>", - "u64" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::admin_apis::set_market_max_leverage": { - "name": "set_market_max_leverage", - "visibility": "public", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_market::PerpMarket>", - "u8" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::admin_apis::set_market_notional_open_interest": { - "name": "set_market_notional_open_interest", - "visibility": "public", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_market::PerpMarket>", - "u64" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::admin_apis::set_market_open": { - "name": "set_market_open", - "visibility": "public", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_market::PerpMarket>", - "0x1::option::Option<0x1::string::String>" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::admin_apis::set_market_open_interest": { - "name": "set_market_open_interest", - "visibility": "public", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_market::PerpMarket>", - "u64" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::admin_apis::set_market_reduce_only": { - "name": "set_market_reduce_only", - "visibility": "public", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_market::PerpMarket>", - "vector
", - "0x1::option::Option<0x1::string::String>" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::admin_apis::set_market_slippage_pcts": { - "name": "set_market_slippage_pcts", - "visibility": "public", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_market::PerpMarket>", - "vector" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::admin_apis::set_market_unrealized_pnl_haircut": { - "name": "set_market_unrealized_pnl_haircut", - "visibility": "public", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_market::PerpMarket>", - "u64" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::admin_apis::set_market_withdrawable_margin_leverage": { - "name": "set_market_withdrawable_margin_leverage", - "visibility": "public", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_market::PerpMarket>", - "u8" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::admin_apis::add_admin": { - "name": "add_admin", - "visibility": "public", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "address" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::admin_apis::add_elevated_admin": { - "name": "add_elevated_admin", - "visibility": "public", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "address" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::admin_apis::add_invite_only_referral_management_permission": { - "name": "add_invite_only_referral_management_permission", - "visibility": "public", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "address" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::admin_apis::add_oracle_and_mark_update_permission": { - "name": "add_oracle_and_mark_update_permission", - "visibility": "public", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "address" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::admin_apis::admin_register_affiliate": { - "name": "admin_register_affiliate", - "visibility": "public", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "address" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::admin_apis::init_account_status_cache_for_subaccount": { - "name": "init_account_status_cache_for_subaccount", - "visibility": "public", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "address" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::admin_apis::remove_admin": { - "name": "remove_admin", - "visibility": "public", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "address" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::admin_apis::remove_elevated_admin": { - "name": "remove_elevated_admin", - "visibility": "public", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "address" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::admin_apis::remove_invite_only_referral_management_permission": { - "name": "remove_invite_only_referral_management_permission", - "visibility": "public", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "address" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::admin_apis::remove_oracle_and_mark_update_permission": { - "name": "remove_oracle_and_mark_update_permission", - "visibility": "public", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "address" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::admin_apis::set_global_max_builder_fee": { - "name": "set_global_max_builder_fee", - "visibility": "public", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "u64" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::admin_apis::set_market_adl_trigger_threshold": { - "name": "set_market_adl_trigger_threshold", - "visibility": "public", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_market::PerpMarket>", - "u64" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::admin_apis::set_market_funding_rate_pause_timeout_microseconds": { - "name": "set_market_funding_rate_pause_timeout_microseconds", - "visibility": "public", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_market::PerpMarket>", - "u64" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::admin_apis::update_mark_for_chainlink_oracle": { - "name": "update_mark_for_chainlink_oracle", - "visibility": "public", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_market::PerpMarket>", - "vector", - "vector
", - "bool" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::admin_apis::update_mark_for_composite_chainlink": { - "name": "update_mark_for_composite_chainlink", - "visibility": "public", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_market::PerpMarket>", - "0x1::option::Option", - "0x1::option::Option>", - "0x1::option::Option", - "0x1::option::Option", - "vector
", - "bool" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::admin_apis::update_mark_for_internal_oracle": { - "name": "update_mark_for_internal_oracle", - "visibility": "public", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_market::PerpMarket>", - "u64", - "vector
", - "bool" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::admin_apis::update_mark_for_pyth_oracle": { - "name": "update_mark_for_pyth_oracle", - "visibility": "public", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_market::PerpMarket>", - "vector", - "vector
", - "bool" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::public_apis::close_delisted_position": { - "name": "close_delisted_position", - "visibility": "public", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "address", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_market::PerpMarket>" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::public_apis::trigger_matching": { - "name": "trigger_matching", - "visibility": "public", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_market::PerpMarket>", - "u32" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::public_apis::liquidate_positions": { - "name": "liquidate_positions", - "visibility": "public", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "vector
", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_market::PerpMarket>" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::public_apis::liquidate_position": { - "name": "liquidate_position", - "visibility": "public", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "address", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_market::PerpMarket>" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::dex_accounts::primary_subaccount": { - "name": "primary_subaccount", - "visibility": "public", - "is_entry": false, - "is_view": true, - "generic_type_params": [], - "params": [ - "address" - ], - "return": [ - "address" - ] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::dex_accounts::primary_subaccount_object": { - "name": "primary_subaccount_object", - "visibility": "public", - "is_entry": false, - "is_view": true, - "generic_type_params": [], - "params": [ - "address" - ], - "return": [ - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::dex_accounts::Subaccount>" - ] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::dex_accounts::seeded_subacccount_address": { - "name": "seeded_subacccount_address", - "visibility": "public", - "is_entry": false, - "is_view": true, - "generic_type_params": [], - "params": [ - "address", - "vector" - ], - "return": [ - "address" - ] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::dex_accounts_entry::register_referral_code": { - "name": "register_referral_code", - "visibility": "private", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "0x1::string::String" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::dex_accounts_entry::register_referrer": { - "name": "register_referrer", - "visibility": "private", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "0x1::string::String" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::dex_accounts_entry::configure_user_settings_for_market": { - "name": "configure_user_settings_for_market", - "visibility": "private", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "address", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_market::PerpMarket>", - "bool", - "u8" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::dex_accounts_entry::transfer_margin_to_isolated_position": { - "name": "transfer_margin_to_isolated_position", - "visibility": "private", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::dex_accounts::Subaccount>", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_market::PerpMarket>", - "bool", - "0x1::object::Object<0x1::fungible_asset::Metadata>", - "u64" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::dex_accounts_entry::deposit_to_isolated_position_margin": { - "name": "deposit_to_isolated_position_margin", - "visibility": "private", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::dex_accounts::Subaccount>", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_market::PerpMarket>", - "0x1::object::Object<0x1::fungible_asset::Metadata>", - "u64" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::dex_accounts_entry::cancel_tp_sl_order_for_position": { - "name": "cancel_tp_sl_order_for_position", - "visibility": "private", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::dex_accounts::Subaccount>", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_market::PerpMarket>", - "u128" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::dex_accounts_entry::place_tp_sl_order_for_position": { - "name": "place_tp_sl_order_for_position", - "visibility": "private", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::dex_accounts::Subaccount>", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_market::PerpMarket>", - "0x1::option::Option", - "0x1::option::Option", - "0x1::option::Option", - "0x1::option::Option", - "0x1::option::Option", - "0x1::option::Option", - "0x1::option::Option
", - "0x1::option::Option" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::dex_accounts_entry::withdraw_from_isolated_position_margin": { - "name": "withdraw_from_isolated_position_margin", - "visibility": "private", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::dex_accounts::Subaccount>", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_market::PerpMarket>", - "0x1::object::Object<0x1::fungible_asset::Metadata>", - "u64" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::dex_accounts_entry::deactivate_subaccount": { - "name": "deactivate_subaccount", - "visibility": "private", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::dex_accounts::Subaccount>", - "bool" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::dex_accounts_entry::delegate_ability_to_sub_delegate_to_for_subaccount": { - "name": "delegate_ability_to_sub_delegate_to_for_subaccount", - "visibility": "private", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "address", - "address", - "0x1::option::Option" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::dex_accounts_entry::delegate_trading_to_for_subaccount": { - "name": "delegate_trading_to_for_subaccount", - "visibility": "friend", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "address", - "address", - "0x1::option::Option" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::dex_accounts_entry::deposit_to_subaccount_at": { - "name": "deposit_to_subaccount_at", - "visibility": "private", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "address", - "0x1::object::Object<0x1::fungible_asset::Metadata>", - "u64" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::dex_accounts_entry::reactivate_subaccount": { - "name": "reactivate_subaccount", - "visibility": "private", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::dex_accounts::Subaccount>" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::dex_accounts_entry::revoke_all_delegations": { - "name": "revoke_all_delegations", - "visibility": "private", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::dex_accounts::Subaccount>" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::dex_accounts_entry::revoke_delegation": { - "name": "revoke_delegation", - "visibility": "private", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::dex_accounts::Subaccount>", - "address" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::dex_accounts_entry::transfer_collateral_between_subaccounts": { - "name": "transfer_collateral_between_subaccounts", - "visibility": "private", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::dex_accounts::Subaccount>", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::dex_accounts::Subaccount>", - "0x1::object::Object<0x1::fungible_asset::Metadata>", - "u64" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::dex_accounts_entry::withdraw_from_subaccount": { - "name": "withdraw_from_subaccount", - "visibility": "private", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::dex_accounts::Subaccount>", - "0x1::object::Object<0x1::fungible_asset::Metadata>", - "u64" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::dex_accounts_entry::contribute_to_vault": { - "name": "contribute_to_vault", - "visibility": "private", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::dex_accounts::Subaccount>", - "address", - "0x1::object::Object<0x1::fungible_asset::Metadata>", - "u64" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::dex_accounts_entry::redeem_from_vault": { - "name": "redeem_from_vault", - "visibility": "private", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::dex_accounts::Subaccount>", - "address", - "u64" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::dex_accounts_entry::add_delegated_trader_and_deposit_to_subaccount": { - "name": "add_delegated_trader_and_deposit_to_subaccount", - "visibility": "private", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "address", - "0x1::object::Object<0x1::fungible_asset::Metadata>", - "u64", - "address", - "0x1::option::Option" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::dex_accounts_entry::approve_max_builder_fee_for_subaccount": { - "name": "approve_max_builder_fee_for_subaccount", - "visibility": "private", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::dex_accounts::Subaccount>", - "address", - "u64" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::dex_accounts_entry::cancel_bulk_order_to_subaccount": { - "name": "cancel_bulk_order_to_subaccount", - "visibility": "private", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::dex_accounts::Subaccount>", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_market::PerpMarket>" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::dex_accounts_entry::cancel_client_order_to_subaccount": { - "name": "cancel_client_order_to_subaccount", - "visibility": "private", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::dex_accounts::Subaccount>", - "0x1::string::String", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_market::PerpMarket>" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::dex_accounts_entry::cancel_order_to_subaccount": { - "name": "cancel_order_to_subaccount", - "visibility": "private", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::dex_accounts::Subaccount>", - "u128", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_market::PerpMarket>" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::dex_accounts_entry::cancel_twap_orders_to_subaccount": { - "name": "cancel_twap_orders_to_subaccount", - "visibility": "private", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::dex_accounts::Subaccount>", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_market::PerpMarket>", - "u128" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::dex_accounts_entry::create_new_subaccount": { - "name": "create_new_subaccount", - "visibility": "private", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::dex_accounts_entry::place_bulk_orders_to_subaccount": { - "name": "place_bulk_orders_to_subaccount", - "visibility": "private", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::dex_accounts::Subaccount>", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_market::PerpMarket>", - "u64", - "vector", - "vector", - "vector", - "vector", - "0x1::option::Option
", - "0x1::option::Option" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::dex_accounts_entry::place_market_order_to_subaccount": { - "name": "place_market_order_to_subaccount", - "visibility": "private", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::dex_accounts::Subaccount>", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_market::PerpMarket>", - "u64", - "bool", - "bool", - "0x1::option::Option<0x1::string::String>", - "0x1::option::Option", - "0x1::option::Option", - "0x1::option::Option", - "0x1::option::Option", - "0x1::option::Option", - "0x1::option::Option
", - "0x1::option::Option" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::dex_accounts_entry::place_order_to_subaccount": { - "name": "place_order_to_subaccount", - "visibility": "private", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::dex_accounts::Subaccount>", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_market::PerpMarket>", - "u64", - "u64", - "bool", - "u8", - "bool", - "0x1::option::Option<0x1::string::String>", - "0x1::option::Option", - "0x1::option::Option", - "0x1::option::Option", - "0x1::option::Option", - "0x1::option::Option", - "0x1::option::Option
", - "0x1::option::Option" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::dex_accounts_entry::place_twap_order_to_subaccount": { - "name": "place_twap_order_to_subaccount", - "visibility": "private", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::dex_accounts::Subaccount>", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_market::PerpMarket>", - "u64", - "bool", - "bool", - "u64", - "u64", - "0x1::option::Option
", - "0x1::option::Option" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::dex_accounts_entry::place_twap_order_to_subaccount_v2": { - "name": "place_twap_order_to_subaccount_v2", - "visibility": "private", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::dex_accounts::Subaccount>", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_market::PerpMarket>", - "u64", - "bool", - "bool", - "0x1::option::Option<0x1::string::String>", - "u64", - "u64", - "0x1::option::Option
", - "0x1::option::Option" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::dex_accounts_entry::revoke_max_builder_fee_for_subaccount": { - "name": "revoke_max_builder_fee_for_subaccount", - "visibility": "private", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::dex_accounts::Subaccount>", - "address" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::dex_accounts_entry::update_client_order_to_subaccount": { - "name": "update_client_order_to_subaccount", - "visibility": "private", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::dex_accounts::Subaccount>", - "0x1::string::String", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_market::PerpMarket>", - "u64", - "u64", - "bool", - "u8", - "bool", - "0x1::option::Option", - "0x1::option::Option", - "0x1::option::Option", - "0x1::option::Option", - "0x1::option::Option
", - "0x1::option::Option" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::dex_accounts_entry::update_order_to_subaccount": { - "name": "update_order_to_subaccount", - "visibility": "private", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::dex_accounts::Subaccount>", - "u128", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_market::PerpMarket>", - "u64", - "u64", - "bool", - "u8", - "bool", - "0x1::option::Option", - "0x1::option::Option", - "0x1::option::Option", - "0x1::option::Option", - "0x1::option::Option
", - "0x1::option::Option" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::dex_accounts_entry::update_sl_order_for_position": { - "name": "update_sl_order_for_position", - "visibility": "private", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::dex_accounts::Subaccount>", - "u128", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_market::PerpMarket>", - "0x1::option::Option", - "0x1::option::Option", - "0x1::option::Option" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::dex_accounts_entry::update_tp_order_for_position": { - "name": "update_tp_order_for_position", - "visibility": "private", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::dex_accounts::Subaccount>", - "u128", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_market::PerpMarket>", - "0x1::option::Option", - "0x1::option::Option", - "0x1::option::Option" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_engine::get_oracle_price": { - "name": "get_oracle_price", - "visibility": "public", - "is_entry": false, - "is_view": true, - "generic_type_params": [], - "params": [ - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_market::PerpMarket>" - ], - "return": [ - "u64" - ] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_engine::get_market_mode": { - "name": "get_market_mode", - "visibility": "public", - "is_entry": false, - "is_view": true, - "generic_type_params": [], - "params": [ - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_market::PerpMarket>" - ], - "return": [ - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_market_config::MarketMode" - ] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_engine::get_oracle_source": { - "name": "get_oracle_source", - "visibility": "public", - "is_entry": false, - "is_view": true, - "generic_type_params": [], - "params": [ - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_market::PerpMarket>" - ], - "return": [ - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::oracle::OracleSource" - ] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_engine::get_primary_store_balance_in_balance_precision": { - "name": "get_primary_store_balance_in_balance_precision", - "visibility": "public", - "is_entry": false, - "is_view": true, - "generic_type_params": [], - "params": [], - "return": [ - "u64" - ] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_engine::primary_asset_metadata": { - "name": "primary_asset_metadata", - "visibility": "public", - "is_entry": false, - "is_view": true, - "generic_type_params": [], - "params": [], - "return": [ - "0x1::object::Object<0x1::fungible_asset::Metadata>" - ] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_engine::get_mark_and_oracle_price": { - "name": "get_mark_and_oracle_price", - "visibility": "public", - "is_entry": false, - "is_view": true, - "generic_type_params": [], - "params": [ - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_market::PerpMarket>" - ], - "return": [ - "u64", - "u64" - ] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_engine::get_mark_price": { - "name": "get_mark_price", - "visibility": "public", - "is_entry": false, - "is_view": true, - "generic_type_params": [], - "params": [ - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_market::PerpMarket>" - ], - "return": [ - "u64" - ] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_engine::backstop_liquidator": { - "name": "backstop_liquidator", - "visibility": "public", - "is_entry": false, - "is_view": true, - "generic_type_params": [], - "params": [], - "return": [ - "address" - ] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_engine::market_max_leverage": { - "name": "market_max_leverage", - "visibility": "public", - "is_entry": false, - "is_view": true, - "generic_type_params": [], - "params": [ - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_market::PerpMarket>" - ], - "return": [ - "u8" - ] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_engine::cross_position_status": { - "name": "cross_position_status", - "visibility": "public", - "is_entry": false, - "is_view": true, - "generic_type_params": [], - "params": [ - "address" - ], - "return": [ - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_positions::AccountStatusDetailed" - ] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_engine::get_position_funding_index_at_last_update": { - "name": "get_position_funding_index_at_last_update", - "visibility": "public", - "is_entry": false, - "is_view": true, - "generic_type_params": [], - "params": [ - "address", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_market::PerpMarket>" - ], - "return": [ - "i128" - ] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_engine::get_position_is_long": { - "name": "get_position_is_long", - "visibility": "public", - "is_entry": false, - "is_view": true, - "generic_type_params": [], - "params": [ - "address", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_market::PerpMarket>" - ], - "return": [ - "bool" - ] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_engine::get_position_size": { - "name": "get_position_size", - "visibility": "public", - "is_entry": false, - "is_view": true, - "generic_type_params": [], - "params": [ - "address", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_market::PerpMarket>" - ], - "return": [ - "u64" - ] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_engine::get_position_unrealized_funding_amount_before_last_update": { - "name": "get_position_unrealized_funding_amount_before_last_update", - "visibility": "public", - "is_entry": false, - "is_view": true, - "generic_type_params": [], - "params": [ - "address", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_market::PerpMarket>" - ], - "return": [ - "i64" - ] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_engine::get_position_unrealized_funding_cost": { - "name": "get_position_unrealized_funding_cost", - "visibility": "public", - "is_entry": false, - "is_view": true, - "generic_type_params": [], - "params": [ - "address", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_market::PerpMarket>" - ], - "return": [ - "i64" - ] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_engine::has_any_assets_or_positions": { - "name": "has_any_assets_or_positions", - "visibility": "public", - "is_entry": false, - "is_view": true, - "generic_type_params": [], - "params": [ - "address" - ], - "return": [ - "bool" - ] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_engine::has_position": { - "name": "has_position", - "visibility": "public", - "is_entry": false, - "is_view": true, - "generic_type_params": [], - "params": [ - "address", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_market::PerpMarket>" - ], - "return": [ - "bool" - ] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_engine::is_position_isolated": { - "name": "is_position_isolated", - "visibility": "public", - "is_entry": false, - "is_view": true, - "generic_type_params": [], - "params": [ - "address", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_market::PerpMarket>" - ], - "return": [ - "bool" - ] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_engine::is_position_liquidatable": { - "name": "is_position_liquidatable", - "visibility": "public", - "is_entry": false, - "is_view": true, - "generic_type_params": [], - "params": [ - "address", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_market::PerpMarket>" - ], - "return": [ - "bool" - ] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_engine::list_positions": { - "name": "list_positions", - "visibility": "public", - "is_entry": false, - "is_view": true, - "generic_type_params": [], - "params": [ - "address" - ], - "return": [ - "vector<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::position_view_types::PositionViewInfo>" - ] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_engine::view_position": { - "name": "view_position", - "visibility": "public", - "is_entry": false, - "is_view": true, - "generic_type_params": [], - "params": [ - "address", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_market::PerpMarket>" - ], - "return": [ - "0x1::option::Option<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::position_view_types::PositionViewInfo>" - ] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_engine::get_current_open_interest": { - "name": "get_current_open_interest", - "visibility": "public", - "is_entry": false, - "is_view": true, - "generic_type_params": [], - "params": [ - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_market::PerpMarket>" - ], - "return": [ - "u64" - ] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_engine::get_max_notional_open_interest": { - "name": "get_max_notional_open_interest", - "visibility": "public", - "is_entry": false, - "is_view": true, - "generic_type_params": [], - "params": [ - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_market::PerpMarket>" - ], - "return": [ - "u64" - ] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_engine::get_account_balance_fungible": { - "name": "get_account_balance_fungible", - "visibility": "public", - "is_entry": false, - "is_view": true, - "generic_type_params": [], - "params": [ - "address" - ], - "return": [ - "u64" - ] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_engine::get_account_net_asset_value_fungible": { - "name": "get_account_net_asset_value_fungible", - "visibility": "public", - "is_entry": false, - "is_view": true, - "generic_type_params": [], - "params": [ - "address", - "bool" - ], - "return": [ - "i64" - ] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_engine::get_isolated_position_margin": { - "name": "get_isolated_position_margin", - "visibility": "public", - "is_entry": false, - "is_view": true, - "generic_type_params": [], - "params": [ - "address", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_market::PerpMarket>" - ], - "return": [ - "u64" - ] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_engine::max_allowed_withdraw_fungible_amount": { - "name": "max_allowed_withdraw_fungible_amount", - "visibility": "public", - "is_entry": false, - "is_view": true, - "generic_type_params": [], - "params": [ - "address", - "0x1::object::Object<0x1::fungible_asset::Metadata>" - ], - "return": [ - "u64" - ] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_engine::get_async_queue_length": { - "name": "get_async_queue_length", - "visibility": "friend", - "is_entry": false, - "is_view": true, - "generic_type_params": [], - "params": [ - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_market::PerpMarket>" - ], - "return": [ - "u64" - ] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_engine::market_min_size": { - "name": "market_min_size", - "visibility": "public", - "is_entry": false, - "is_view": true, - "generic_type_params": [], - "params": [ - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_market::PerpMarket>" - ], - "return": [ - "u64" - ] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_engine::market_lot_size": { - "name": "market_lot_size", - "visibility": "public", - "is_entry": false, - "is_view": true, - "generic_type_params": [], - "params": [ - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_market::PerpMarket>" - ], - "return": [ - "u64" - ] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_engine::collateral_balance_decimals": { - "name": "collateral_balance_decimals", - "visibility": "public", - "is_entry": false, - "is_view": true, - "generic_type_params": [], - "params": [], - "return": [ - "u8" - ] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_engine::get_blp_pnl": { - "name": "get_blp_pnl", - "visibility": "public", - "is_entry": false, - "is_view": true, - "generic_type_params": [], - "params": [ - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_market::PerpMarket>" - ], - "return": [ - "i64" - ] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_engine::get_max_open_interest_delta": { - "name": "get_max_open_interest_delta", - "visibility": "public", - "is_entry": false, - "is_view": true, - "generic_type_params": [], - "params": [ - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_market::PerpMarket>" - ], - "return": [ - "u64" - ] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_engine::get_oracle_internal_snapshot": { - "name": "get_oracle_internal_snapshot", - "visibility": "public", - "is_entry": false, - "is_view": true, - "generic_type_params": [], - "params": [ - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_market::PerpMarket>" - ], - "return": [ - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_engine::OracleInternalSnapshot" - ] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_engine::get_position_avg_price": { - "name": "get_position_avg_price", - "visibility": "public", - "is_entry": false, - "is_view": true, - "generic_type_params": [], - "params": [ - "address", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_market::PerpMarket>" - ], - "return": [ - "u64" - ] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_engine::get_position_entry_price_times_size_sum": { - "name": "get_position_entry_price_times_size_sum", - "visibility": "public", - "is_entry": false, - "is_view": true, - "generic_type_params": [], - "params": [ - "address", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_market::PerpMarket>" - ], - "return": [ - "u128" - ] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_engine::get_remaining_size_for_order": { - "name": "get_remaining_size_for_order", - "visibility": "public", - "is_entry": false, - "is_view": true, - "generic_type_params": [], - "params": [ - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_market::PerpMarket>", - "u128" - ], - "return": [ - "u64" - ] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_engine::is_exchange_open": { - "name": "is_exchange_open", - "visibility": "public", - "is_entry": false, - "is_view": true, - "generic_type_params": [], - "params": [], - "return": [ - "bool" - ] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_engine::is_market_open": { - "name": "is_market_open", - "visibility": "public", - "is_entry": false, - "is_view": true, - "generic_type_params": [], - "params": [ - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_market::PerpMarket>" - ], - "return": [ - "bool" - ] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_engine::is_supported_collateral": { - "name": "is_supported_collateral", - "visibility": "public", - "is_entry": false, - "is_view": true, - "generic_type_params": [], - "params": [ - "0x1::object::Object<0x1::fungible_asset::Metadata>" - ], - "return": [ - "bool" - ] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_engine::list_markets": { - "name": "list_markets", - "visibility": "public", - "is_entry": false, - "is_view": true, - "generic_type_params": [], - "params": [], - "return": [ - "vector
" - ] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_engine::market_margin_call_fee_pct": { - "name": "market_margin_call_fee_pct", - "visibility": "public", - "is_entry": false, - "is_view": true, - "generic_type_params": [], - "params": [ - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_market::PerpMarket>" - ], - "return": [ - "u64" - ] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_engine::market_name": { - "name": "market_name", - "visibility": "public", - "is_entry": false, - "is_view": true, - "generic_type_params": [], - "params": [ - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_market::PerpMarket>" - ], - "return": [ - "0x1::string::String" - ] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_engine::market_slippage_pcts": { - "name": "market_slippage_pcts", - "visibility": "public", - "is_entry": false, - "is_view": true, - "generic_type_params": [], - "params": [ - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_market::PerpMarket>" - ], - "return": [ - "vector" - ] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_engine::market_sz_decimals": { - "name": "market_sz_decimals", - "visibility": "public", - "is_entry": false, - "is_view": true, - "generic_type_params": [], - "params": [ - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_market::PerpMarket>" - ], - "return": [ - "u8" - ] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_engine::market_ticker_size": { - "name": "market_ticker_size", - "visibility": "public", - "is_entry": false, - "is_view": true, - "generic_type_params": [], - "params": [ - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_market::PerpMarket>" - ], - "return": [ - "u64" - ] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_engine::view_position_status": { - "name": "view_position_status", - "visibility": "public", - "is_entry": false, - "is_view": true, - "generic_type_params": [], - "params": [ - "address", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_market::PerpMarket>" - ], - "return": [ - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::perp_positions::AccountStatusDetailed" - ] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::usdc::burn": { - "name": "burn", - "visibility": "public", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "address", - "u64" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::usdc::mint": { - "name": "mint", - "visibility": "public", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "address", - "u64" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::usdc::add_admin": { - "name": "add_admin", - "visibility": "public", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "address" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::usdc::remove_admin": { - "name": "remove_admin", - "visibility": "public", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "address" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::usdc::available_restricted_mint_for": { - "name": "available_restricted_mint_for", - "visibility": "public", - "is_entry": false, - "is_view": true, - "generic_type_params": [], - "params": [ - "address" - ], - "return": [ - "u64" - ] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::usdc::can_mint": { - "name": "can_mint", - "visibility": "public", - "is_entry": false, - "is_view": true, - "generic_type_params": [], - "params": [ - "address" - ], - "return": [ - "bool" - ] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::usdc::can_restricted_mint": { - "name": "can_restricted_mint", - "visibility": "public", - "is_entry": false, - "is_view": true, - "generic_type_params": [], - "params": [ - "address" - ], - "return": [ - "bool" - ] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::usdc::change_restricted_mint_settings": { - "name": "change_restricted_mint_settings", - "visibility": "public", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "0x1::option::Option", - "0x1::option::Option", - "0x1::option::Option" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::usdc::enter_trading_competition": { - "name": "enter_trading_competition", - "visibility": "public", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::usdc::get_admin_count": { - "name": "get_admin_count", - "visibility": "public", - "is_entry": false, - "is_view": true, - "generic_type_params": [], - "params": [], - "return": [ - "u64" - ] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::usdc::is_admin": { - "name": "is_admin", - "visibility": "public", - "is_entry": false, - "is_view": true, - "generic_type_params": [], - "params": [ - "address" - ], - "return": [ - "bool" - ] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::usdc::is_public_minting_allowed": { - "name": "is_public_minting_allowed", - "visibility": "public", - "is_entry": false, - "is_view": true, - "generic_type_params": [], - "params": [], - "return": [ - "bool" - ] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::usdc::mints_remaining": { - "name": "mints_remaining", - "visibility": "public", - "is_entry": false, - "is_view": true, - "generic_type_params": [], - "params": [], - "return": [ - "u64" - ] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::usdc::restricted_mint": { - "name": "restricted_mint", - "visibility": "public", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "u64" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::usdc::restricted_mint_daily_reset_timestamp": { - "name": "restricted_mint_daily_reset_timestamp", - "visibility": "public", - "is_entry": false, - "is_view": true, - "generic_type_params": [], - "params": [], - "return": [ - "u64" - ] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::usdc::restricted_mint_daily_reset_timestamp_for": { - "name": "restricted_mint_daily_reset_timestamp_for", - "visibility": "public", - "is_entry": false, - "is_view": true, - "generic_type_params": [], - "params": [ - "address" - ], - "return": [ - "u64" - ] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::usdc::set_public_minting": { - "name": "set_public_minting", - "visibility": "public", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "bool" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::vault::distribute_fees": { - "name": "distribute_fees", - "visibility": "public", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::vault::Vault>" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::vault::approve_become_admin": { - "name": "approve_become_admin", - "visibility": "friend", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::vault::Vault>" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::vault::cancel_admin_change_request": { - "name": "cancel_admin_change_request", - "visibility": "friend", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::vault::Vault>" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::vault::delegate_dex_actions_to": { - "name": "delegate_dex_actions_to", - "visibility": "friend", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::vault::Vault>", - "address", - "0x1::option::Option" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::vault::get_vault_admin": { - "name": "get_vault_admin", - "visibility": "public", - "is_entry": false, - "is_view": true, - "generic_type_params": [], - "params": [ - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::vault::Vault>" - ], - "return": [ - "address" - ] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::vault::get_vault_contribution_asset_type": { - "name": "get_vault_contribution_asset_type", - "visibility": "public", - "is_entry": false, - "is_view": true, - "generic_type_params": [], - "params": [ - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::vault::Vault>" - ], - "return": [ - "0x1::object::Object<0x1::fungible_asset::Metadata>" - ] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::vault::get_vault_net_asset_value": { - "name": "get_vault_net_asset_value", - "visibility": "public", - "is_entry": false, - "is_view": true, - "generic_type_params": [], - "params": [ - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::vault::Vault>" - ], - "return": [ - "u64" - ] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::vault::get_vault_num_shares": { - "name": "get_vault_num_shares", - "visibility": "public", - "is_entry": false, - "is_view": true, - "generic_type_params": [], - "params": [ - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::vault::Vault>" - ], - "return": [ - "u64" - ] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::vault::get_vault_portfolio_subaccounts": { - "name": "get_vault_portfolio_subaccounts", - "visibility": "public", - "is_entry": false, - "is_view": true, - "generic_type_params": [], - "params": [ - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::vault::Vault>" - ], - "return": [ - "vector
" - ] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::vault::get_vault_share_asset_type": { - "name": "get_vault_share_asset_type", - "visibility": "public", - "is_entry": false, - "is_view": true, - "generic_type_params": [], - "params": [ - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::vault::Vault>" - ], - "return": [ - "0x1::object::Object<0x1::fungible_asset::Metadata>" - ] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::vault::request_admin_change": { - "name": "request_admin_change", - "visibility": "friend", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::vault::Vault>", - "address" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::vault::update_vault_fee_recipient_and_manager": { - "name": "update_vault_fee_recipient_and_manager", - "visibility": "friend", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::vault::Vault>", - "address" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::vault::update_vault_max_outstanding_shares": { - "name": "update_vault_max_outstanding_shares", - "visibility": "friend", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::vault::Vault>", - "u64" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::vault::update_vault_use_global_redemption_slippage_adjustment": { - "name": "update_vault_use_global_redemption_slippage_adjustment", - "visibility": "friend", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::vault::Vault>", - "bool" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::vault_api::activate_vault": { - "name": "activate_vault", - "visibility": "public", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::vault::Vault>" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::vault_api::process_pending_requests": { - "name": "process_pending_requests", - "visibility": "public", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "u32" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::vault_api::create_and_fund_vault": { - "name": "create_and_fund_vault", - "visibility": "public", - "is_entry": true, - "is_view": false, - "generic_type_params": [], - "params": [ - "&signer", - "0x1::option::Option<0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::dex_accounts::Subaccount>>", - "0x1::object::Object<0x1::fungible_asset::Metadata>", - "0x1::string::String", - "0x1::string::String", - "vector<0x1::string::String>", - "0x1::string::String", - "0x1::string::String", - "0x1::string::String", - "u64", - "u64", - "u64", - "u64", - "bool", - "bool" - ], - "return": [] - }, - "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::vault_api::get_max_synchronous_redemption": { - "name": "get_max_synchronous_redemption", - "visibility": "public", - "is_entry": false, - "is_view": true, - "generic_type_params": [], - "params": [ - "0x1::object::Object<0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95::vault::Vault>" - ], - "return": [ - "u64" - ] - } - }, - "errors": [], - "summary": { - "totalModules": 9, - "totalFunctions": 172, - "successful": 172, - "failed": 0 - }, - "modules": [ - "admin_apis", - "public_apis", - "dex_accounts", - "dex_accounts_entry", - "dex_accounts_vault_extension", - "perp_engine", - "usdc", - "vault", - "vault_api" - ] -} \ No newline at end of file diff --git a/tests/abi/test_registry.py b/tests/abi/test_registry.py index d525703..606374d 100644 --- a/tests/abi/test_registry.py +++ b/tests/abi/test_registry.py @@ -6,11 +6,6 @@ class TestGetAbiData: - def test_netna_chain_id(self) -> None: - data = get_abi_data(208) - assert data.network == "custom" - assert "netna" in data.fullnode_url - def test_testnet_chain_id(self) -> None: data = get_abi_data(2) assert data.network == "testnet" @@ -22,13 +17,13 @@ def test_unknown_chain_id_falls_back_with_warning(self) -> None: data = get_abi_data(999) assert len(w) == 1 assert "Unknown chain_id" in str(w[0].message) - assert "netna" in data.fullnode_url + assert "testnet" in data.fullnode_url class TestGetDefaultAbiData: - def test_returns_netna(self) -> None: + def test_returns_testnet(self) -> None: data = get_default_abi_data() - assert "netna" in data.fullnode_url + assert "testnet" in data.fullnode_url class TestAbiRegistry: @@ -37,10 +32,6 @@ def test_init_with_default(self) -> None: assert registry.package_address is not None assert len(registry.modules) == 9 - def test_init_with_netna_chain_id(self) -> None: - registry = AbiRegistry(chain_id=208) - assert "netna" in registry.abi_data.fullnode_url - def test_init_with_testnet_chain_id(self) -> None: registry = AbiRegistry(chain_id=2) assert "testnet" in registry.abi_data.fullnode_url @@ -48,7 +39,7 @@ def test_init_with_testnet_chain_id(self) -> None: def test_get_all_functions(self) -> None: registry = AbiRegistry() funcs = registry.get_all_functions() - assert len(funcs) == 172 + assert len(funcs) > 0 def test_get_entry_functions(self) -> None: registry = AbiRegistry() From 9a2c97e6d25921afc26318ee592ff27f717c9bf5 Mon Sep 17 00:00:00 2001 From: WGB5445 <919603023@qq.com> Date: Mon, 13 Apr 2026 20:21:39 +0800 Subject: [PATCH 2/3] Refactor margin usage logging and update enum classes to StrEnum This commit improves the logging format for margin usage in the market maker bot and updates the Network and CompatVersion classes to inherit from StrEnum for better string representation. These changes enhance code clarity and maintainability. --- examples/write/market_maker_bot.py | 6 +++--- src/decibel/_constants.py | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/write/market_maker_bot.py b/examples/write/market_maker_bot.py index 4fca0fe..bf5ffcf 100644 --- a/examples/write/market_maker_bot.py +++ b/examples/write/market_maker_bot.py @@ -9,10 +9,10 @@ from aptos_sdk.ed25519 import PrivateKey from decibel import ( + NAMED_CONFIGS, BaseSDKOptions, DecibelWriteDex, GasPriceManager, - NAMED_CONFIGS, PlaceOrderSuccess, TimeInForce, amount_to_chain_units, @@ -237,12 +237,12 @@ async def _run_cycle( print( f"\n[cycle {cycle}] mid={mid if mid is not None else 'N/A'} " f"inventory={inventory:+.6f} " - f"margin={margin_usage*100:.2f}% open_orders={len(open_order_ids)}" + f"margin={margin_usage * 100:.2f}% open_orders={len(open_order_ids)}" ) if margin_usage > settings.max_margin_usage: print( - f" paused: margin {margin_usage*100:.2f}% > {settings.max_margin_usage*100:.2f}%" + f" paused: margin {margin_usage * 100:.2f}% > {settings.max_margin_usage * 100:.2f}%" ) return if mid is None: diff --git a/src/decibel/_constants.py b/src/decibel/_constants.py index a5b28fb..e7e1d5d 100644 --- a/src/decibel/_constants.py +++ b/src/decibel/_constants.py @@ -1,7 +1,7 @@ from __future__ import annotations from dataclasses import dataclass -from enum import Enum +from enum import StrEnum from aptos_sdk.account_address import AccountAddress @@ -32,13 +32,13 @@ DEFAULT_TXN_SUBMIT_TIMEOUT = 10.0 -class Network(str, Enum): +class Network(StrEnum): MAINNET = "mainnet" TESTNET = "testnet" CUSTOM = "custom" -class CompatVersion(str, Enum): +class CompatVersion(StrEnum): V0_4 = "v0.4" # decibel-testnet-release-v0.4 - and final version. From 23d51b67de5ca43bd3b72f2c54bf73b7ed80ca32 Mon Sep 17 00:00:00 2001 From: WGB5445 <919603023@qq.com> Date: Tue, 14 Apr 2026 15:19:46 +0800 Subject: [PATCH 3/3] Remove market maker bot example from this PR --- examples/write/market_maker_bot.py | 487 ----------------------------- 1 file changed, 487 deletions(-) delete mode 100644 examples/write/market_maker_bot.py diff --git a/examples/write/market_maker_bot.py b/examples/write/market_maker_bot.py deleted file mode 100644 index bf5ffcf..0000000 --- a/examples/write/market_maker_bot.py +++ /dev/null @@ -1,487 +0,0 @@ -from __future__ import annotations - -import argparse -import asyncio -import os -from dataclasses import dataclass - -from aptos_sdk.account import Account -from aptos_sdk.ed25519 import PrivateKey - -from decibel import ( - NAMED_CONFIGS, - BaseSDKOptions, - DecibelWriteDex, - GasPriceManager, - PlaceOrderSuccess, - TimeInForce, - amount_to_chain_units, - round_to_tick_size, - round_to_valid_order_size, -) -from decibel.read import DecibelReadDex, PerpMarket - - -@dataclass(frozen=True) -class MMSettings: - market_name: str = "BTC/USD" - spread: float = 0.001 - order_size: float = 0.001 - max_inventory: float = 0.005 - skew_per_unit: float = 0.0001 - max_margin_usage: float = 0.5 - refresh_interval_s: float = 20.0 - cooldown_s: float = 1.5 - cancel_resync_s: float = 8.0 - max_cycles: int = 0 - dry_run: bool = False - - -def _env_bool(name: str, default: bool = False) -> bool: - raw = os.getenv(name) - if raw is None: - return default - return raw.strip().lower() in {"1", "true", "yes", "y", "on"} - - -def _normalize_market_name(name: str) -> str: - return name.strip().replace("-", "/").upper() - - -def _resolve_market(markets: list[PerpMarket], requested_name: str) -> PerpMarket | None: - requested = _normalize_market_name(requested_name) - for market in markets: - if _normalize_market_name(market.market_name) == requested: - return market - return None - - -def _compute_quotes( - *, - mid: float, - inventory: float, - market: PerpMarket, - settings: MMSettings, -) -> tuple[float, float, float] | None: - tick_size = int(market.tick_size) - lot_size = int(market.lot_size) - min_size = int(market.min_size) - - if mid <= 0: - return None - - tick_human = tick_size / (10**market.px_decimals) - min_spread = tick_human / mid - if settings.spread < min_spread: - raise ValueError( - f"spread {settings.spread} is tighter than one tick ({min_spread:.8f}); " - "increase --spread", - ) - - if abs(inventory) >= settings.max_inventory: - return None - - valid_size = round_to_valid_order_size( - settings.order_size, - lot_size=lot_size, - sz_decimals=market.sz_decimals, - min_size=min_size, - ) - if valid_size <= 0: - return None - - half_spread = settings.spread / 2.0 - skew = inventory * settings.skew_per_unit - - raw_bid = mid * (1.0 - half_spread - skew) - raw_ask = mid * (1.0 + half_spread - skew) - - bid = round_to_tick_size( - raw_bid, - tick_size=tick_size, - px_decimals=market.px_decimals, - round_up=False, - ) - ask = round_to_tick_size( - raw_ask, - tick_size=tick_size, - px_decimals=market.px_decimals, - round_up=True, - ) - - if ask <= bid: - ask = round_to_tick_size( - bid + tick_human, - tick_size=tick_size, - px_decimals=market.px_decimals, - round_up=True, - ) - - return bid, ask, valid_size - - -async def _sync_state( - read: DecibelReadDex, - market: PerpMarket, - subaccount_addr: str, -) -> tuple[float | None, float, float, list[str]]: - overview_task = read.account_overview.get_by_addr(sub_addr=subaccount_addr) - positions_task = read.user_positions.get_by_addr(sub_addr=subaccount_addr, limit=100) - orders_task = read.user_open_orders.get_by_addr(sub_addr=subaccount_addr, limit=200) - prices_task = read.market_prices.get_all() - - overview, positions, open_orders, prices = await asyncio.gather( - overview_task, - positions_task, - orders_task, - prices_task, - ) - - inventory = 0.0 - for pos in positions: - if pos.market == market.market_addr: - inventory = pos.size - break - - market_order_ids = [ - order.order_id for order in open_orders.items if order.market == market.market_addr - ] - - mid: float | None = None - for price in prices: - if price.market == market.market_addr: - mid = price.mid_px or price.mark_px - break - - if mid is None: - try: - depth = await read.market_depth.get_by_name(market.market_name, limit=1) - if depth.bids and depth.asks: - mid = (depth.bids[0].price + depth.asks[0].price) / 2.0 - except Exception as exc: - print(f" warning: failed depth fallback for {market.market_name}: {exc}") - - return mid, inventory, overview.cross_margin_ratio, market_order_ids - - -async def _cancel_market_orders( - write: DecibelWriteDex, - market_name: str, - order_ids: list[str], - subaccount_addr: str, - dry_run: bool, -) -> tuple[int, int]: - cancelled = 0 - failed = 0 - for order_id in order_ids: - if dry_run: - print(f" [dry-run] would cancel {order_id}") - cancelled += 1 - continue - try: - await write.cancel_order( - order_id=order_id, - market_name=market_name, - subaccount_addr=subaccount_addr, - ) - cancelled += 1 - except Exception as exc: - print(f" cancel failed ({order_id}): {exc}") - failed += 1 - return cancelled, failed - - -async def _place_quote( - write: DecibelWriteDex | None, - *, - market: PerpMarket, - subaccount_addr: str, - is_buy: bool, - price: float, - size: float, - dry_run: bool, -) -> None: - side = "bid" if is_buy else "ask" - if dry_run: - print(f" [dry-run] would place {side}: {size} @ {price}") - return - if write is None: - raise RuntimeError("write client is required in live mode") - - result = await write.place_order( - market_name=market.market_name, - price=amount_to_chain_units(price, market.px_decimals), - size=amount_to_chain_units(size, market.sz_decimals), - is_buy=is_buy, - time_in_force=TimeInForce.PostOnly, - is_reduce_only=False, - subaccount_addr=subaccount_addr, - tick_size=market.tick_size, - ) - if isinstance(result, PlaceOrderSuccess): - print(f" {side} placed: {price} x {size} (tx={result.transaction_hash[:16]}...)") - else: - print(f" {side} failed: {result.error}") - - -async def _run_cycle( - cycle: int, - *, - read: DecibelReadDex, - write: DecibelWriteDex | None, - market: PerpMarket, - subaccount_addr: str, - settings: MMSettings, -) -> None: - mid, inventory, margin_usage, open_order_ids = await _sync_state(read, market, subaccount_addr) - print( - f"\n[cycle {cycle}] mid={mid if mid is not None else 'N/A'} " - f"inventory={inventory:+.6f} " - f"margin={margin_usage * 100:.2f}% open_orders={len(open_order_ids)}" - ) - - if margin_usage > settings.max_margin_usage: - print( - f" paused: margin {margin_usage * 100:.2f}% > {settings.max_margin_usage * 100:.2f}%" - ) - return - if mid is None: - print(" paused: no mid price available") - return - - quotes = _compute_quotes( - mid=mid, - inventory=inventory, - market=market, - settings=settings, - ) - if quotes is None: - print( - f" paused: inventory {inventory:+.6f} at/above max {settings.max_inventory}; " - "canceling resting orders only" - ) - if write is not None and open_order_ids: - await _cancel_market_orders( - write, - market_name=market.market_name, - order_ids=open_order_ids, - subaccount_addr=subaccount_addr, - dry_run=settings.dry_run, - ) - return - - bid, ask, size = quotes - print(f" quotes: bid={bid} ask={ask} size={size}") - - failed = 0 - if write is not None and open_order_ids: - cancelled, failed = await _cancel_market_orders( - write, - market_name=market.market_name, - order_ids=open_order_ids, - subaccount_addr=subaccount_addr, - dry_run=settings.dry_run, - ) - print(f" cancelled={cancelled} failed={failed}") - - if failed > 0: - await asyncio.sleep(settings.cancel_resync_s) - still_open = await read.user_open_orders.get_by_addr(sub_addr=subaccount_addr, limit=200) - market_still_open = [o for o in still_open.items if o.market == market.market_addr] - if market_still_open: - print(f" still {len(market_still_open)} open orders, skip this cycle") - return - - await _place_quote( - write, - market=market, - subaccount_addr=subaccount_addr, - is_buy=True, - price=bid, - size=size, - dry_run=settings.dry_run, - ) - await asyncio.sleep(settings.cooldown_s) - await _place_quote( - write, - market=market, - subaccount_addr=subaccount_addr, - is_buy=False, - price=ask, - size=size, - dry_run=settings.dry_run, - ) - - -def _parse_args() -> argparse.Namespace: - parser = argparse.ArgumentParser( - description=( - "Single-file Decibel market maker bot: each cycle cancels existing market " - "orders and places a POST_ONLY bid/ask around mid price with inventory skew." - ), - ) - parser.add_argument( - "--network", - default=os.getenv("NETWORK", "testnet"), - choices=("testnet", "mainnet"), - help="Network profile from decibel.NAMED_CONFIGS", - ) - parser.add_argument( - "--market", - default=os.getenv("MARKET_NAME", "BTC/USD"), - help="Market symbol, e.g. BTC/USD", - ) - parser.add_argument("--spread", type=float, default=float(os.getenv("MM_SPREAD", "0.001"))) - parser.add_argument( - "--order-size", - type=float, - default=float(os.getenv("MM_ORDER_SIZE", "0.001")), - ) - parser.add_argument( - "--max-inventory", - type=float, - default=float(os.getenv("MM_MAX_INVENTORY", "0.005")), - ) - parser.add_argument( - "--skew-per-unit", - type=float, - default=float(os.getenv("MM_SKEW_PER_UNIT", "0.0001")), - ) - parser.add_argument( - "--max-margin-usage", - type=float, - default=float(os.getenv("MM_MAX_MARGIN", "0.5")), - help="Pause quoting when cross_margin_ratio exceeds this value", - ) - parser.add_argument( - "--refresh-interval", - type=float, - default=float(os.getenv("MM_REFRESH_S", "20")), - help="Seconds between cycles", - ) - parser.add_argument( - "--cooldown", - type=float, - default=float(os.getenv("MM_COOLDOWN_S", "1.5")), - help="Seconds between placing bid and ask", - ) - parser.add_argument( - "--cancel-resync", - type=float, - default=float(os.getenv("MM_CANCEL_RESYNC_S", "8")), - help="Sleep before re-checking open orders after cancel failures", - ) - parser.add_argument( - "--max-cycles", - type=int, - default=int(os.getenv("MAX_CYCLES", "0")), - help="Stop after N cycles (0 = run forever)", - ) - parser.add_argument( - "--dry-run", - action=argparse.BooleanOptionalAction, - default=_env_bool("DRY_RUN", False), - help="Simulate cancels/orders without sending transactions", - ) - return parser.parse_args() - - -async def main() -> int: - args = _parse_args() - - subaccount_addr = os.getenv("SUBACCOUNT_ADDRESS", "").strip() - node_api_key = os.getenv("APTOS_NODE_API_KEY", "").strip() or None - private_key_hex = os.getenv("PRIVATE_KEY", "").strip() - - if not subaccount_addr: - print("Error: SUBACCOUNT_ADDRESS is required") - return 1 - - dry_run = args.dry_run - if not private_key_hex: - print("PRIVATE_KEY missing, forcing dry-run mode") - dry_run = True - - settings = MMSettings( - market_name=args.market, - spread=args.spread, - order_size=args.order_size, - max_inventory=args.max_inventory, - skew_per_unit=args.skew_per_unit, - max_margin_usage=args.max_margin_usage, - refresh_interval_s=args.refresh_interval, - cooldown_s=args.cooldown, - cancel_resync_s=args.cancel_resync, - max_cycles=args.max_cycles, - dry_run=dry_run, - ) - - config = NAMED_CONFIGS[args.network] - read = DecibelReadDex(config, api_key=node_api_key) - - gas: GasPriceManager | None = None - write: DecibelWriteDex | None = None - try: - markets = await read.markets.get_all() - market = _resolve_market(markets, settings.market_name) - if market is None: - preview = ", ".join(m.market_name for m in markets[:8]) - print(f"Market '{settings.market_name}' not found. Sample: {preview}") - return 1 - - print(f"Starting MM bot on {market.market_name} ({args.network})") - print( - f" spread={settings.spread} order_size={settings.order_size} " - f"max_inventory={settings.max_inventory} skew_per_unit={settings.skew_per_unit}" - ) - print( - f" max_margin_usage={settings.max_margin_usage} " - f"refresh={settings.refresh_interval_s}s " - f"cooldown={settings.cooldown_s}s dry_run={settings.dry_run}" - ) - - if not settings.dry_run: - private_key = PrivateKey.from_hex(private_key_hex) - account = Account.load_key(private_key.hex()) - gas = GasPriceManager(config) - await gas.initialize() - write = DecibelWriteDex( - config, - account, - opts=BaseSDKOptions( - node_api_key=node_api_key, - gas_price_manager=gas, - skip_simulate=False, - no_fee_payer=True, - time_delta_ms=0, - ), - ) - - cycle = 1 - while True: - try: - await _run_cycle( - cycle, - read=read, - write=write, - market=market, - subaccount_addr=subaccount_addr, - settings=settings, - ) - except Exception as exc: - print(f" [cycle {cycle} error] {exc}") - - if settings.max_cycles > 0 and cycle >= settings.max_cycles: - break - cycle += 1 - await asyncio.sleep(settings.refresh_interval_s) - finally: - await read.ws.close() - if gas is not None: - await gas.destroy() - - return 0 - - -if __name__ == "__main__": - raise SystemExit(asyncio.run(main()))