UNPKG

@d8x/perpetuals-sdk

Version:

Node TypeScript SDK for D8X Perpetual Futures

1,600 lines (1,599 loc) 41.7 kB
[ { "inputs": [], "stateMutability": "nonpayable", "type": "constructor" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "uint8", "name": "poolId", "type": "uint8" }, { "indexed": false, "internalType": "address", "name": "oldOwner", "type": "address" }, { "indexed": false, "internalType": "address", "name": "newOwner", "type": "address" }, { "indexed": false, "internalType": "uint32", "name": "numLots", "type": "uint32" } ], "name": "BrokerLotsTransferred", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "uint8", "name": "poolId", "type": "uint8" }, { "indexed": false, "internalType": "address", "name": "oldOwner", "type": "address" }, { "indexed": false, "internalType": "address", "name": "newOwner", "type": "address" }, { "indexed": false, "internalType": "int128", "name": "fVolume", "type": "int128" } ], "name": "BrokerVolumeTransferred", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "uint24", "name": "perpetualId", "type": "uint24" }, { "indexed": true, "internalType": "address", "name": "trader", "type": "address" } ], "name": "Clear", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "uint8", "name": "poolId", "type": "uint8" }, { "indexed": true, "internalType": "uint24", "name": "perpetualId", "type": "uint24" }, { "indexed": true, "internalType": "address", "name": "trader", "type": "address" }, { "indexed": false, "internalType": "int128", "name": "protocolFeeCC", "type": "int128" }, { "indexed": false, "internalType": "int128", "name": "participationFundFeeCC", "type": "int128" } ], "name": "DistributeFees", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "address", "name": "previousGovernance", "type": "address" }, { "indexed": true, "internalType": "address", "name": "newGovernance", "type": "address" } ], "name": "GovernanceTransferred", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "bytes4", "name": "_sig", "type": "bytes4" }, { "indexed": true, "internalType": "address", "name": "_oldImplementation", "type": "address" }, { "indexed": true, "internalType": "address", "name": "_newImplementation", "type": "address" } ], "name": "ImplementationChanged", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "uint24", "name": "perpetualId", "type": "uint24" }, { "indexed": true, "internalType": "address", "name": "liquidator", "type": "address" }, { "indexed": true, "internalType": "address", "name": "trader", "type": "address" }, { "indexed": false, "internalType": "int128", "name": "amountLiquidatedBC", "type": "int128" }, { "indexed": false, "internalType": "int128", "name": "liquidationPrice", "type": "int128" }, { "indexed": false, "internalType": "int128", "name": "newPositionSizeBC", "type": "int128" }, { "indexed": false, "internalType": "int128", "name": "fFeeCC", "type": "int128" }, { "indexed": false, "internalType": "int128", "name": "fPnlCC", "type": "int128" } ], "name": "Liquidate", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "uint8", "name": "poolId", "type": "uint8" }, { "indexed": true, "internalType": "address", "name": "user", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "tokenAmount", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "shareAmount", "type": "uint256" } ], "name": "LiquidityAdded", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "uint8", "name": "id", "type": "uint8" }, { "indexed": false, "internalType": "address", "name": "marginTokenAddress", "type": "address" }, { "indexed": false, "internalType": "address", "name": "shareTokenAddress", "type": "address" }, { "indexed": false, "internalType": "uint16", "name": "iTargetPoolSizeUpdateTime", "type": "uint16" }, { "indexed": false, "internalType": "int128", "name": "fBrokerCollateralLotSize", "type": "int128" } ], "name": "LiquidityPoolCreated", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "bool", "name": "pauseOn", "type": "bool" }, { "indexed": false, "internalType": "uint8", "name": "poolId", "type": "uint8" } ], "name": "LiquidityProvisionPaused", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "uint8", "name": "poolId", "type": "uint8" }, { "indexed": true, "internalType": "address", "name": "user", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "tokenAmount", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "shareAmount", "type": "uint256" } ], "name": "LiquidityRemoved", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "uint8", "name": "poolId", "type": "uint8" }, { "indexed": true, "internalType": "address", "name": "user", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "shareAmount", "type": "uint256" } ], "name": "LiquidityWithdrawalInitiated", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "address", "name": "previousMaintainer", "type": "address" }, { "indexed": true, "internalType": "address", "name": "newMaintainer", "type": "address" } ], "name": "MaintainerTransferred", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "address", "name": "account", "type": "address" } ], "name": "Paused", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "uint8", "name": "poolId", "type": "uint8" }, { "indexed": false, "internalType": "uint24", "name": "id", "type": "uint24" }, { "indexed": false, "internalType": "int128[7]", "name": "baseParams", "type": "int128[7]" }, { "indexed": false, "internalType": "int128[5]", "name": "underlyingRiskParams", "type": "int128[5]" }, { "indexed": false, "internalType": "int128[12]", "name": "defaultFundRiskParams", "type": "int128[12]" }, { "indexed": false, "internalType": "uint256", "name": "eCollateralCurrency", "type": "uint256" } ], "name": "PerpetualCreated", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "uint24", "name": "perpetualId", "type": "uint24" }, { "indexed": true, "internalType": "bytes32", "name": "orderHash", "type": "bytes32" } ], "name": "PerpetualLimitOrderCancelled", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "address", "name": "_oldOwner", "type": "address" }, { "indexed": true, "internalType": "address", "name": "_newOwner", "type": "address" } ], "name": "ProxyOwnershipTransferred", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "uint8", "name": "_liqPoolID", "type": "uint8" } ], "name": "RunLiquidityPool", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "uint8", "name": "delay", "type": "uint8" } ], "name": "SetBlockDelay", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "uint32[]", "name": "designations", "type": "uint32[]" }, { "indexed": false, "internalType": "uint16[]", "name": "fees", "type": "uint16[]" } ], "name": "SetBrokerDesignations", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "uint256[]", "name": "tiers", "type": "uint256[]" }, { "indexed": false, "internalType": "uint16[]", "name": "feesTbps", "type": "uint16[]" } ], "name": "SetBrokerTiers", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "uint256[]", "name": "tiers", "type": "uint256[]" }, { "indexed": false, "internalType": "uint16[]", "name": "feesTbps", "type": "uint16[]" } ], "name": "SetBrokerVolumeTiers", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "uint24", "name": "perpetualId", "type": "uint24" } ], "name": "SetClearedState", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "address", "name": "trader", "type": "address" }, { "indexed": true, "internalType": "address", "name": "delegate", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "index", "type": "uint256" } ], "name": "SetDelegate", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "uint24", "name": "perpetualId", "type": "uint24" }, { "indexed": false, "internalType": "int128", "name": "fSettlementMarkPremiumRate", "type": "int128" }, { "indexed": false, "internalType": "int128", "name": "fSettlementS2Price", "type": "int128" }, { "indexed": false, "internalType": "int128", "name": "fSettlementS3Price", "type": "int128" } ], "name": "SetEmergencyState", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "uint24", "name": "perpetualId", "type": "uint24" } ], "name": "SetNormalState", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "uint24", "name": "perpetualId", "type": "uint24" }, { "indexed": false, "internalType": "bytes4[2]", "name": "baseQuoteS2", "type": "bytes4[2]" }, { "indexed": false, "internalType": "bytes4[2]", "name": "baseQuoteS3", "type": "bytes4[2]" } ], "name": "SetOracles", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "uint24", "name": "perpetualId", "type": "uint24" }, { "indexed": false, "internalType": "string", "name": "name", "type": "string" }, { "indexed": false, "internalType": "int128", "name": "value", "type": "int128" } ], "name": "SetParameter", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "uint24", "name": "perpetualId", "type": "uint24" }, { "indexed": false, "internalType": "string", "name": "name", "type": "string" }, { "indexed": false, "internalType": "int128", "name": "value1", "type": "int128" }, { "indexed": false, "internalType": "int128", "name": "value2", "type": "int128" } ], "name": "SetParameterPair", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "uint24", "name": "perpetualId", "type": "uint24" }, { "indexed": false, "internalType": "int128[7]", "name": "baseParams", "type": "int128[7]" } ], "name": "SetPerpetualBaseParameters", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "uint24", "name": "perpetualId", "type": "uint24" }, { "indexed": false, "internalType": "int128[5]", "name": "underlyingRiskParams", "type": "int128[5]" }, { "indexed": false, "internalType": "int128[12]", "name": "defaultFundRiskParams", "type": "int128[12]" } ], "name": "SetPerpetualRiskParameters", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "uint8", "name": "poolId", "type": "uint8" }, { "indexed": false, "internalType": "string", "name": "name", "type": "string" }, { "indexed": false, "internalType": "int128", "name": "value", "type": "int128" } ], "name": "SetPoolParameter", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "uint256[]", "name": "tiers", "type": "uint256[]" }, { "indexed": false, "internalType": "uint16[]", "name": "feesTbps", "type": "uint16[]" } ], "name": "SetTraderTiers", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "uint256[]", "name": "tiers", "type": "uint256[]" }, { "indexed": false, "internalType": "uint16[]", "name": "feesTbps", "type": "uint16[]" } ], "name": "SetTraderVolumeTiers", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "address", "name": "tokenAddr", "type": "address" } ], "name": "SetUtilityToken", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "uint24", "name": "perpetualId", "type": "uint24" }, { "indexed": true, "internalType": "address", "name": "trader", "type": "address" }, { "indexed": false, "internalType": "int256", "name": "amount", "type": "int256" } ], "name": "Settle", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "uint24", "name": "perpetualId", "type": "uint24" } ], "name": "SettleState", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "uint24", "name": "perpetualId", "type": "uint24" } ], "name": "SettlementComplete", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "uint24", "name": "perpetualId", "type": "uint24" }, { "indexed": true, "internalType": "address", "name": "trader", "type": "address" }, { "indexed": false, "internalType": "int128", "name": "amount", "type": "int128" } ], "name": "TokensDeposited", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "uint24", "name": "perpetualId", "type": "uint24" }, { "indexed": true, "internalType": "address", "name": "trader", "type": "address" }, { "indexed": false, "internalType": "int128", "name": "amount", "type": "int128" } ], "name": "TokensWithdrawn", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "uint24", "name": "perpetualId", "type": "uint24" }, { "indexed": true, "internalType": "address", "name": "trader", "type": "address" }, { "components": [ { "internalType": "uint16", "name": "leverageTDR", "type": "uint16" }, { "internalType": "uint16", "name": "brokerFeeTbps", "type": "uint16" }, { "internalType": "uint24", "name": "iPerpetualId", "type": "uint24" }, { "internalType": "address", "name": "traderAddr", "type": "address" }, { "internalType": "uint32", "name": "executionTimestamp", "type": "uint32" }, { "internalType": "address", "name": "brokerAddr", "type": "address" }, { "internalType": "uint32", "name": "submittedTimestamp", "type": "uint32" }, { "internalType": "uint32", "name": "flags", "type": "uint32" }, { "internalType": "uint32", "name": "iDeadline", "type": "uint32" }, { "internalType": "address", "name": "executorAddr", "type": "address" }, { "internalType": "int128", "name": "fAmount", "type": "int128" }, { "internalType": "int128", "name": "fLimitPrice", "type": "int128" }, { "internalType": "int128", "name": "fTriggerPrice", "type": "int128" }, { "internalType": "bytes", "name": "brokerSignature", "type": "bytes" } ], "indexed": false, "internalType": "struct IPerpetualOrder.Order", "name": "order", "type": "tuple" }, { "indexed": false, "internalType": "bytes32", "name": "orderDigest", "type": "bytes32" }, { "indexed": false, "internalType": "int128", "name": "newPositionSizeBC", "type": "int128" }, { "indexed": false, "internalType": "int128", "name": "price", "type": "int128" }, { "indexed": false, "internalType": "int128", "name": "fFeeCC", "type": "int128" }, { "indexed": false, "internalType": "int128", "name": "fPnlCC", "type": "int128" }, { "indexed": false, "internalType": "int128", "name": "fB2C", "type": "int128" } ], "name": "Trade", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "string", "name": "name", "type": "string" }, { "indexed": false, "internalType": "address", "name": "oldOBFactory", "type": "address" }, { "indexed": false, "internalType": "address", "name": "newOBFactory", "type": "address" } ], "name": "TransferAddressTo", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "address", "name": "account", "type": "address" } ], "name": "Unpaused", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "uint8", "name": "poolId", "type": "uint8" }, { "indexed": false, "internalType": "uint32", "name": "iLots", "type": "uint32" }, { "indexed": false, "internalType": "uint32", "name": "iNewBrokerLots", "type": "uint32" } ], "name": "UpdateBrokerAddedCash", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "uint24", "name": "perpetualId", "type": "uint24" }, { "indexed": false, "internalType": "int128", "name": "fFundingRate", "type": "int128" } ], "name": "UpdateFundingRate", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "uint24", "name": "perpetualId", "type": "uint24" }, { "indexed": true, "internalType": "address", "name": "trader", "type": "address" }, { "indexed": false, "internalType": "int128", "name": "fFundingPaymentCC", "type": "int128" } ], "name": "UpdateMarginAccount", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "uint24", "name": "perpetualId", "type": "uint24" }, { "indexed": false, "internalType": "int128", "name": "fMidPricePremium", "type": "int128" }, { "indexed": false, "internalType": "int128", "name": "fMarkPricePremium", "type": "int128" }, { "indexed": false, "internalType": "int128", "name": "fMarkIndexPrice", "type": "int128" } ], "name": "UpdateMarkPrice", "type": "event" }, { "stateMutability": "payable", "type": "fallback" }, { "inputs": [ { "internalType": "uint8", "name": "", "type": "uint8" }, { "internalType": "address", "name": "", "type": "address" } ], "name": "brokerVolumeEMA", "outputs": [ { "internalType": "int128", "name": "fTradingVolumeEMAusd", "type": "int128" }, { "internalType": "uint64", "name": "timestamp", "type": "uint64" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "name": "brokerVolumeFeesTbps", "outputs": [ { "internalType": "uint16", "name": "", "type": "uint16" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "name": "brokerVolumeTiers", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "bytes4", "name": "_sig", "type": "bytes4" } ], "name": "getImplementation", "outputs": [ { "internalType": "address", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "string", "name": "_moduleName", "type": "string" } ], "name": "getModuleImplementationAddress", "outputs": [ { "internalType": "address", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "getProxyOwner", "outputs": [ { "internalType": "address", "name": "_owner", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "governance", "outputs": [ { "internalType": "address", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "lastBaseToUSDUpdateTs", "outputs": [ { "internalType": "uint64", "name": "", "type": "uint64" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "uint8", "name": "", "type": "uint8" } ], "name": "liquidityProvisionIsPaused", "outputs": [ { "internalType": "bool", "name": "", "type": "bool" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "maintainer", "outputs": [ { "internalType": "address", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "pause", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "paused", "outputs": [ { "internalType": "bool", "name": "", "type": "bool" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "uint24", "name": "", "type": "uint24" } ], "name": "perpBaseToUSDOracle", "outputs": [ { "internalType": "address", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "uint24", "name": "", "type": "uint24" } ], "name": "perpToLastBaseToUSD", "outputs": [ { "internalType": "int128", "name": "", "type": "int128" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "_impl", "type": "address" } ], "name": "setImplementation", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "_impl", "type": "address" } ], "name": "setImplementationCrossModules", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "_owner", "type": "address" } ], "name": "setProxyOwner", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "uint8", "name": "", "type": "uint8" }, { "internalType": "address", "name": "", "type": "address" } ], "name": "traderVolumeEMA", "outputs": [ { "internalType": "int128", "name": "fTradingVolumeEMAusd", "type": "int128" }, { "internalType": "uint64", "name": "timestamp", "type": "uint64" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "name": "traderVolumeFeesTbps", "outputs": [ { "internalType": "uint16", "name": "", "type": "uint16" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "name": "traderVolumeTiers", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "newGovernance", "type": "address" } ], "name": "transferGovernance", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "newMaintainer", "type": "address" } ], "name": "transferMaintainer", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "unpause", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "stateMutability": "payable", "type": "receive" } ]