0 txs
1 call
constructor
constructor()
functions
checkCollateralCap
viewfunction checkCollateralCap(uint256 depositAmount_) view
checkGlobalMarginPositive
viewfunction checkGlobalMarginPositive() view
checkSkewMax
viewfunction checkSkewMax(uint256 sizeChange_, int256 stableCollateralChange_) view
collateral
viewfunction collateral() view returns (address)
getGlobalPositions
viewfunction getGlobalPositions() view returns (tuple globalPositionsDetails_)
getMaxPositionIds
viewfunction getMaxPositionIds() view returns (uint256[] openPositionIds_)
getPosition
viewfunction getPosition(uint256 tokenId_) view returns (tuple positionDetails_)
getProtocolFee
viewfunction getProtocolFee(uint256 feeAmount_) view returns (uint256 protocolFeePortion_)
getTradeFee
viewfunction getTradeFee(uint256 size_) view returns (uint256 tradeFee_)
getWithdrawalFee
viewfunction getWithdrawalFee(uint256 amount_) view returns (uint256 withdrawalFee_)
isAuthorizedModule
viewfunction isAuthorizedModule(address moduleAddress) view returns (bool authorized)
isMaxPositionsReached
viewfunction isMaxPositionsReached() view returns (bool maxReached_)
isModulePaused
viewfunction isModulePaused(bytes32 moduleKey) view returns (bool paused)
isPositionOpenWhitelisted
viewfunction isPositionOpenWhitelisted(address account_) view returns (bool whitelisted_)
leverageTradingFee
viewfunction leverageTradingFee() view returns (uint64)
maxDeltaError
viewfunction maxDeltaError() view returns (uint256)
maxPositions
viewfunction maxPositions() view returns (uint256)
moduleAddress
viewfunction moduleAddress(bytes32 moduleKey) view returns (address moduleAddress)
owner
viewfunction owner() view returns (address)
protocolFeePercentage
viewfunction protocolFeePercentage() view returns (uint64)
protocolFeeRecipient
viewfunction protocolFeeRecipient() view returns (address)
skewFractionMax
viewfunction skewFractionMax() view returns (uint256)
stableCollateralCap
viewfunction stableCollateralCap() view returns (uint256)
stableCollateralTotal
viewfunction stableCollateralTotal() view returns (uint256)
stableWithdrawFee
viewfunction stableWithdrawFee() view returns (uint64)
addAuthorizedModule
nonpayablefunction addAuthorizedModule(tuple module_)
addAuthorizedModules
nonpayablefunction addAuthorizedModules(tuple[] modules_)
deletePosition
nonpayablefunction deletePosition(uint256 tokenId_)
initialize
nonpayablefunction initialize(address collateral_, address protocolFeeRecipient_, uint64 protocolFeePercentage_, uint64 leverageTradingFee_, uint64 stableWithdrawFee_, uint256 maxDeltaError_, uint256 skewFractionMax_, uint256 stableCollateralCap_, uint256 maxPositions_)
pauseModule
nonpayablefunction pauseModule(bytes32 moduleKey_)
removeAuthorizedModule
nonpayablefunction removeAuthorizedModule(bytes32 modKey_)
renounceOwnership
nonpayablefunction renounceOwnership()
sendCollateral
nonpayablefunction sendCollateral(address to_, uint256 amount_)
setLeverageTradingFee
nonpayablefunction setLeverageTradingFee(uint64 leverageTradingFee_)
setMaxDeltaError
nonpayablefunction setMaxDeltaError(uint256 maxDeltaError_)
setMaxPositions
nonpayablefunction setMaxPositions(uint256 maxPositions_)
setMaxPositionsWhitelist
nonpayablefunction setMaxPositionsWhitelist(address account_, bool whitelisted_)
setPosition
nonpayablefunction setPosition(tuple newPosition_, uint256 tokenId_)
setProtocolFeePercentage
nonpayablefunction setProtocolFeePercentage(uint64 protocolFeePercentage_)
setProtocolFeeRecipient
nonpayablefunction setProtocolFeeRecipient(address protocolFeeRecipient_)
setSkewFractionMax
nonpayablefunction setSkewFractionMax(uint256 skewFractionMax_)
setStableCollateralCap
nonpayablefunction setStableCollateralCap(uint256 collateralCap_)
setStableWithdrawFee
nonpayablefunction setStableWithdrawFee(uint64 stableWithdrawFee_)
transferOwnership
nonpayablefunction transferOwnership(address newOwner)
unpauseModule
nonpayablefunction unpauseModule(bytes32 moduleKey_)
updateGlobalMargin
nonpayablefunction updateGlobalMargin(int256 marginDelta_)
updateGlobalPositionData
nonpayablefunction updateGlobalPositionData(uint256 price_, int256 marginDelta_, int256 additionalSizeDelta_)
updateStableCollateralTotal
nonpayablefunction updateStableCollateralTotal(int256 stableCollateralAdjustment_)
events
Initialized
event Initialized(uint64 version)
OwnershipTransferred
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)
errors
AddressEmptyCode
error AddressEmptyCode(address target)
AddressInsufficientBalance
error AddressInsufficientBalance(address account)
AddressNotWhitelisted
error AddressNotWhitelisted(address account)
DepositCapReached
error DepositCapReached(uint256 collateralCap)
FailedInnerCall
error FailedInnerCall()
InsufficientGlobalMargin
error InsufficientGlobalMargin()
InvalidInitialization
error InvalidInitialization()
InvalidPercentageValue
error InvalidPercentageValue(uint64 percentage)
MarginMismatchOnClose
error MarginMismatchOnClose()
MaxPositionsInitZero
error MaxPositionsInitZero()
MaxPositionsReached
error MaxPositionsReached()
MaxSkewReached
error MaxSkewReached(uint256 skewFraction)
NotInitializing
error NotInitializing()
OnlyAuthorizedModule
error OnlyAuthorizedModule(address msgSender)
OwnableInvalidOwner
error OwnableInvalidOwner(address owner)
OwnableUnauthorizedAccount
error OwnableUnauthorizedAccount(address account)
SafeCastOverflowedIntToUint
error SafeCastOverflowedIntToUint(int256 value)
SafeERC20FailedOperation
error SafeERC20FailedOperation(address token)
ValueNotPositive
error ValueNotPositive(string variableName)
ZeroAddress
error ZeroAddress(string variableName)
ZeroValue
error ZeroValue(string variableName)
creation bytecode
0x6080604052348015600f57600080fd5b506016601a565b60ca565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00805468010000000000000000900460ff161560695760405163f92ee8a960e01b815260040160405180910390fd5b80546001600160401b039081161460c75780546001600160401b0319166001600160401b0390811782556040519081527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b50565b611eee806100d96000396000f3fe608060405234801561001057600080fd5b50600436106103205760003560e01c8063816eda20116101a7578063c26ad3f0116100ee578063e20aa36111610097578063f2fde38b11610071578063f2fde38b14610748578063f584bcdc1461075b578063fc3d3f381461076e57600080fd5b8063e20aa361146106da578063e521cb92146106ef578063eb02c3011461070257600080fd5b8063d8dfeb45116100c8578063d8dfeb45146106ab578063e0a1ba37146106be578063e0ef5962146106d157600080fd5b8063c26ad3f01461067c578063c695514f1461068f578063c6a1a8cb146106a257600080fd5b806396528df011610150578063aa10e9f01161012a578063aa10e9f014610625578063b93332e61461064e578063bfac64971461066157600080fd5b806396528df0146105f65780639eb33862146105ff578063a890c2bd1461061257600080fd5b80638c23492b116101815780638c23492b146105985780638da5cb5b146105ab5780638e50e509146105db57600080fd5b8063816eda201461056957806385820ba31461057c578063896068a61461058557600080fd5b80633e6ea8051161026b57806364df049e11610214578063715018a6116101ee578063715018a61461053b5780637677f109146105435780637f9b2f1c1461055657600080fd5b806364df049e146104ea57806368888dc3146105155780636f13490f1461052857600080fd5b806360435c301161024557806360435c30146104bc57806362502169146104c457806362cecda9146104d757600080fd5b80633e6ea8051461046a5780635856f00e146104965780635a3bf71d146104a957600080fd5b80631d109d39116102cd5780633658eb10116102a75780633658eb101461042157806337f3e0d214610434578063399dd4631461044757600080fd5b80631d109d39146103be57806323b94706146103eb5780632b47fe9b146103fe57600080fd5b806316dc7668116102fe57806316dc766814610378578063170ba5b2146103815780631cc5b7761461039457600080fd5b80630ce8fe61146103255780630f0245ad1461033a57806315991a1a14610360575b600080fd5b610338610333366004611a33565b610781565b005b61034d610348366004611a55565b610881565b6040519081526020015b60405180910390f35b6103686108ba565b6040519015158152602001610357565b61034d60355481565b61033861038f366004611a55565b6108dd565b61039c610912565b6040805182518152602080840151908201529181015190820152606001610357565b6001546103d29067ffffffffffffffff1681565b60405167ffffffffffffffff9091168152602001610357565b6103386103f9366004611a55565b61095b565b61036861040c366004611a55565b603b6020526000908152604090205460ff1681565b61033861042f366004611a6e565b610968565b610338610442366004611a55565b610a19565b610368610455366004611ab4565b603a6020526000908152604090205460ff1681565b610368610478366004611ab4565b6001600160a01b031660009081526038602052604090205460ff1690565b6103386104a4366004611aee565b610a5b565b6103386104b7366004611b17565b610a6c565b610338610a9f565b6103386104d2366004611b50565b610ac4565b6103386104e5366004611b7c565b610b11565b6000546104fd906001600160a01b031681565b6040516001600160a01b039091168152602001610357565b610338610523366004611a55565b610c2f565b610338610536366004611aee565b610cd7565b610338610ce8565b610338610551366004611a55565b610cfc565b610338610564366004611b97565b610d1c565b610338610577366004611a55565b610f07565b61034d60315481565b610338610593366004611a55565b610f2a565b6103386105a6366004611a55565b610f9a565b7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300546001600160a01b03166104fd565b6000546103d290600160a01b900467ffffffffffffffff1681565b61034d60345481565b61034d61060d366004611a55565b610fdf565b610338610620366004611a55565b61100b565b6104fd610633366004611a55565b6039602052600090815260409020546001600160a01b031681565b61033861065c366004611a55565b611018565b6001546103d290600160401b900467ffffffffffffffff1681565b61033861068a366004611c25565b611025565b61033861069d366004611aee565b61106a565b61034d60325481565b6030546104fd906001600160a01b031681565b6103386106cc366004611c9c565b61107b565b61034d60335481565b6106e26111b6565b6040516103579190611cc8565b6103386106fd366004611ab4565b6111c2565b610715610710366004611a55565b6111d3565b60405161035791908151815260208083015190820152604080830151908201526060918201519181019190915260800190565b610338610756366004611ab4565b611243565b610338610769366004611a55565b61127e565b61034d61077c366004611a55565b6112d1565b600019603354101561087d57603e546031546000036107e05760405163046c82ad60e41b81526020600482015260156024820152741cdd18589b1950dbdb1b185d195c985b151bdd185b605a1b60448201526064015b60405180910390fd5b6000826031546107f09190611d21565b12156107fe576107fe611d49565b6108088382611d5f565b60000361081457505050565b6000610852836031546108279190611d21565b6108318685611d5f565b61084390670de0b6b3a7640000611d72565b61084d9190611d9f565b6112f6565b905060335481111561087a576040516348c9e5b760e11b8152600481018290526024016107d7565b50505b5050565b60008054670de0b6b3a7640000906108aa90600160a01b900467ffffffffffffffff1684611d72565b6108b49190611dcd565b92915050565b6000806035541180156108d857506035546108d56036611320565b10155b905090565b60325460315481906108f0908490611d5f565b111561087d57604051633033b43160e21b8152600481018290526024016107d7565b61093660405180606001604052806000815260200160008152602001600081525090565b5060408051606081018252603c548152603d546020820152603e549181019190915290565b61096361132a565b603355565b336000908152603a602052604081205460ff161515900361099e57604051633b9e98fd60e11b81523360048201526024016107d7565b603554156109de576035546109b36036611320565b106109d15760405163cf886df360e01b815260040160405180910390fd5b6109dc603682611385565b505b6000818152603f60205260409020829061087a8282813581556020820135600182015560408201356002820155606090910135600390910155565b336000908152603a602052604081205460ff1615159003610a4f57604051633b9e98fd60e11b81523360048201526024016107d7565b610a5881611398565b50565b610a6361132a565b610a5881611404565b610a7461132a565b6001600160a01b03919091166000908152603860205260409020805460ff1916911515919091179055565b603c546000811215610a585760405163e0d3938560e01b815260040160405180910390fd5b336000908152603a602052604081205460ff1615159003610afa57604051633b9e98fd60e11b81523360048201526024016107d7565b60305461087d906001600160a01b03168383611467565b610b1961132a565b6000610b2b6040830160208401611ab4565b6001600160a01b031603610b725760405163eac0d38960e01b815260206004820152600d60248201526c6d6f64756c654164647265737360981b60448201526064016107d7565b8035610bad5760405163046c82ad60e41b81526020600482015260096024820152686d6f64756c654b657960b81b60448201526064016107d7565b610bbd6040820160208301611ab4565b8135600090815260396020908152604080832080546001600160a01b0319166001600160a01b039590951694909417909355600192603a9291610c04918601908601611ab4565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905550565b610c3761132a565b80600003610c785760405163046c82ad60e41b815260206004820152600d60248201526c6d6178506f736974696f6e735f60981b60448201526064016107d7565b603554158015610c8a57506000603154115b15610ca8576040516390a6c06160e01b815260040160405180910390fd5b80610cb36036611320565b1115610cd25760405163cf886df360e01b815260040160405180910390fd5b603555565b610cdf61132a565b610a58816114d3565b610cf061132a565b610cfa6000611545565b565b610d0461132a565b6000908152603b60205260409020805460ff19169055565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a008054600160401b810460ff16159067ffffffffffffffff16600081158015610d625750825b905060008267ffffffffffffffff166001148015610d7f5750303b155b905081158015610d8d575080155b15610dab5760405163f92ee8a960e01b815260040160405180910390fd5b845467ffffffffffffffff191660011785558315610dda57845468ff00000000000000001916600160401b1785555b610de3336115b6565b610e698d8d8c8e6000805467ffffffffffffffff948516600160a01b027fffffffff000000000000000000000000000000000000000000000000000000009091166001600160a01b03909616959095179490941790935560018054938316600160401b026fffffffffffffffffffffffffffffffff199094169190921617919091179055565b8d603060006101000a8154816001600160a01b0302191690836001600160a01b03160217905550866032819055508760338190555088603481905550856035819055508315610ef757845468ff000000000000000019168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b5050505050505050505050505050565b610f0f61132a565b6000908152603b60205260409020805460ff19166001179055565b336000908152603a602052604081205460ff1615159003610f6057604051633b9e98fd60e11b81523360048201526024016107d7565b60355415610f7557610f736036826115c7565b505b6000908152603f60205260408120818155600181018290556002810182905560030155565b610fa261132a565b600090815260396020908152604080832080546001600160a01b031981169091556001600160a01b03168352603a9091529020805460ff19169055565b600154600090670de0b6b3a7640000906108aa908490600160401b900467ffffffffffffffff16611d72565b61101361132a565b603455565b61102061132a565b603255565b61102d61132a565b8060005b8160ff168160ff16101561087a5761106284848360ff1681811061105757611057611de1565b905060400201610b11565b600101611031565b61107261132a565b610a58816115d3565b336000908152603a602052604081205460ff16151590036110b157604051633b9e98fd60e11b81523360048201526024016107d7565b603c546000906110c2908490611d21565b603d54603e54919250906110d68482611d21565b156111585760006110e78583611d21565b6110f18689611df7565b6110fb8486611df7565b6111059190611d21565b61110f9190611d9f565b9050604051806060016040528085815260200182815260200161113c87603c6002015461084d9190611d21565b90528051603c556020810151603d5560400151603e55506111ae565b600083131561117e5782603160008282546111739190611d5f565b9091555061119e9050565b61118783611e27565b603160008282546111989190611e43565b90915550505b6000603c819055603d819055603e555b505050505050565b60606108d86036611654565b6111ca61132a565b610a5881611661565b6111fe6040518060800160405280600081526020016000815260200160008152602001600081525090565b506000908152603f6020908152604091829020825160808101845281548152600182015492810192909252600281015492820192909252600390910154606082015290565b61124b61132a565b6001600160a01b03811661127557604051631e4fbdf760e01b8152600060048201526024016107d7565b610a5881611545565b336000908152603a602052604081205460ff16151590036112b457604051633b9e98fd60e11b81523360048201526024016107d7565b80603c60000160008282546112c99190611d21565b909155505050565b600154600090670de0b6b3a7640000906108aa90849067ffffffffffffffff16611d72565b60008082121561131c57604051635467221960e11b8152600481018390526024016107d7565b5090565b60006108b4825490565b3361135c7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300546001600160a01b031690565b6001600160a01b031614610cfa5760405163118cdaa760e01b81523360048201526024016107d7565b600061139183836116da565b9392505050565b6000816031546113a89190611d21565b905060008112156113f457604051634f686b7d60e01b81526020600482015260156024820152741cdd18589b1950dbdb1b185d195c985b151bdd185b605a1b60448201526064016107d7565b6113fd816112f6565b6031555050565b670de0b6b3a76400008167ffffffffffffffff16111561144357604051631dcd7d4960e11b815267ffffffffffffffff821660048201526024016107d7565b6001805467ffffffffffffffff191667ffffffffffffffff92909216919091179055565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1663a9059cbb60e01b1790526114ce908490611729565b505050565b670de0b6b3a76400008167ffffffffffffffff16111561151257604051631dcd7d4960e11b815267ffffffffffffffff821660048201526024016107d7565b6001805467ffffffffffffffff909216600160401b026fffffffffffffffff000000000000000019909216919091179055565b7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c19930080546001600160a01b031981166001600160a01b03848116918217845560405192169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3505050565b6115be61178c565b610a58816117d5565b600061139183836117dd565b670de0b6b3a76400008167ffffffffffffffff16111561161257604051631dcd7d4960e11b815267ffffffffffffffff821660048201526024016107d7565b6000805467ffffffffffffffff909216600160a01b027fffffffff0000000000000000ffffffffffffffffffffffffffffffffffffffff909216919091179055565b60606000611391836118d0565b6001600160a01b0381166116b85760405163eac0d38960e01b815260206004820152601460248201527f70726f746f636f6c466565526563697069656e7400000000000000000000000060448201526064016107d7565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000818152600183016020526040812054611721575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556108b4565b5060006108b4565b600061173e6001600160a01b0384168361192c565b905080516000141580156117635750808060200190518101906117619190611e56565b155b156114ce57604051635274afe760e01b81526001600160a01b03841660048201526024016107d7565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0054600160401b900460ff16610cfa57604051631afcd79f60e31b815260040160405180910390fd5b61124b61178c565b600081815260018301602052604081205480156118c6576000611801600183611e43565b855490915060009061181590600190611e43565b905080821461187a57600086600001828154811061183557611835611de1565b906000526020600020015490508087600001848154811061185857611858611de1565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061188b5761188b611e73565b6001900381819060005260206000200160009055905585600101600086815260200190815260200160002060009055600193505050506108b4565b60009150506108b4565b60608160000180548060200260200160405190810160405280929190818152602001828054801561192057602002820191906000526020600020905b81548152602001906001019080831161190c575b50505050509050919050565b60606113918383600084600080856001600160a01b031684866040516119529190611e89565b60006040518083038185875af1925050503d806000811461198f576040519150601f19603f3d011682016040523d82523d6000602084013e611994565b606091505b50915091506119a48683836119ae565b9695505050505050565b6060826119c3576119be82611a0a565b611391565b81511580156119da57506001600160a01b0384163b155b15611a0357604051639996b31560e01b81526001600160a01b03851660048201526024016107d7565b5080611391565b805115611a1a5780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b60008060408385031215611a4657600080fd5b50508035926020909101359150565b600060208284031215611a6757600080fd5b5035919050565b60008082840360a0811215611a8257600080fd5b6080811215611a9057600080fd5b50919360808501359350915050565b6001600160a01b0381168114610a5857600080fd5b600060208284031215611ac657600080fd5b813561139181611a9f565b803567ffffffffffffffff81168114611ae957600080fd5b919050565b600060208284031215611b0057600080fd5b61139182611ad1565b8015158114610a5857600080fd5b60008060408385031215611b2a57600080fd5b8235611b3581611a9f565b91506020830135611b4581611b09565b809150509250929050565b60008060408385031215611b6357600080fd5b8235611b6e81611a9f565b946020939093013593505050565b60006040828403128015611b8f57600080fd5b509092915050565b60008060008060008060008060006101208a8c031215611bb657600080fd5b8935611bc181611a9f565b985060208a0135611bd181611a9f565b9750611bdf60408b01611ad1565b9650611bed60608b01611ad1565b9550611bfb60808b01611ad1565b989b979a50959894979660a0860135965060c08601359560e0810135955061010001359350915050565b60008060208385031215611c3857600080fd5b823567ffffffffffffffff811115611c4f57600080fd5b8301601f81018513611c6057600080fd5b803567ffffffffffffffff811115611c7757600080fd5b8560208260061b8401011115611c8c57600080fd5b6020919091019590945092505050565b600080600060608486031215611cb157600080fd5b505081359360208301359350604090920135919050565b602080825282518282018190526000918401906040840190835b81811015611d00578351835260209384019390920191600101611ce2565b509095945050505050565b634e487b7160e01b600052601160045260246000fd5b8082018281126000831280158216821582161715611d4157611d41611d0b565b505092915050565b634e487b7160e01b600052600160045260246000fd5b808201808211156108b4576108b4611d0b565b80820281158282048414176108b4576108b4611d0b565b634e487b7160e01b600052601260045260246000fd5b600082611dae57611dae611d89565b600160ff1b821460001984141615611dc857611dc8611d0b565b500590565b600082611ddc57611ddc611d89565b500490565b634e487b7160e01b600052603260045260246000fd5b80820260008212600160ff1b84141615611e1357611e13611d0b565b81810583148215176108b4576108b4611d0b565b6000600160ff1b8201611e3c57611e3c611d0b565b5060000390565b818103818111156108b4576108b4611d0b565b600060208284031215611e6857600080fd5b815161139181611b09565b634e487b7160e01b600052603160045260246000fd5b6000825160005b81811015611eaa5760208186018101518583015201611e90565b50600092019182525091905056fea2646970667358221220dc7a2a5bc88e3b5f92fc02b99cb45b0c9b81ce95ae5307387bea3400f022564564736f6c634300081c0033