Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@nftperp/sdk

Package Overview
Dependencies
Maintainers
2
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nftperp/sdk - npm Package Compare versions

Comparing version 2.0.6 to 3.0.0

abis/ERC20.json

484

abis/ClearingHouseViewer.json

@@ -1,234 +0,250 @@

[
{
"inputs": [
{
"internalType": "contract ClearingHouse",
"name": "_clearingHouse",
"type": "address"
}
],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"inputs": [],
"name": "clearingHouse",
"outputs": [
{
"internalType": "contract ClearingHouse",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "contract IAmm",
"name": "_amm",
"type": "address"
},
{
"internalType": "address",
"name": "_trader",
"type": "address"
}
],
"name": "getFreeCollateral",
"outputs": [
{
"components": [
{
"internalType": "int256",
"name": "d",
"type": "int256"
}
],
"internalType": "struct SignedDecimal.signedDecimal",
"name": "",
"type": "tuple"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "contract IAmm",
"name": "_amm",
"type": "address"
},
{
"internalType": "address",
"name": "_trader",
"type": "address"
}
],
"name": "getMarginRatio",
"outputs": [
{
"components": [
{
"internalType": "int256",
"name": "d",
"type": "int256"
}
],
"internalType": "struct SignedDecimal.signedDecimal",
"name": "",
"type": "tuple"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "contract IERC20",
"name": "_quoteToken",
"type": "address"
},
{
"internalType": "address",
"name": "_trader",
"type": "address"
}
],
"name": "getPersonalBalanceWithFundingPayment",
"outputs": [
{
"components": [
{
"internalType": "uint256",
"name": "d",
"type": "uint256"
}
],
"internalType": "struct Decimal.decimal",
"name": "margin",
"type": "tuple"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "contract IAmm",
"name": "_amm",
"type": "address"
},
{
"internalType": "address",
"name": "_trader",
"type": "address"
}
],
"name": "getPersonalPositionWithFundingPayment",
"outputs": [
{
"components": [
{
"components": [
{
"internalType": "int256",
"name": "d",
"type": "int256"
}
],
"internalType": "struct SignedDecimal.signedDecimal",
"name": "size",
"type": "tuple"
},
{
"components": [
{
"internalType": "uint256",
"name": "d",
"type": "uint256"
}
],
"internalType": "struct Decimal.decimal",
"name": "margin",
"type": "tuple"
},
{
"components": [
{
"internalType": "uint256",
"name": "d",
"type": "uint256"
}
],
"internalType": "struct Decimal.decimal",
"name": "openNotional",
"type": "tuple"
},
{
"components": [
{
"internalType": "int256",
"name": "d",
"type": "int256"
}
],
"internalType": "struct SignedDecimal.signedDecimal",
"name": "lastUpdatedCumulativePremiumFraction",
"type": "tuple"
},
{
"internalType": "uint256",
"name": "blockNumber",
"type": "uint256"
}
],
"internalType": "struct ClearingHouse.Position",
"name": "position",
"type": "tuple"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "contract IAmm",
"name": "_amm",
"type": "address"
},
{
"internalType": "address",
"name": "_trader",
"type": "address"
},
{
"internalType": "enum ClearingHouse.PnlCalcOption",
"name": "_pnlCalcOption",
"type": "uint8"
}
],
"name": "getUnrealizedPnl",
"outputs": [
{
"components": [
{
"internalType": "int256",
"name": "d",
"type": "int256"
}
],
"internalType": "struct SignedDecimal.signedDecimal",
"name": "",
"type": "tuple"
}
],
"stateMutability": "view",
"type": "function"
}
]
{
"_format": "hh-sol-artifact-1",
"contractName": "ClearingHouseViewer",
"sourceName": "contracts/ClearingHouseViewer.sol",
"abi": [
{
"inputs": [
{
"internalType": "contract ClearingHouse",
"name": "_clearingHouse",
"type": "address"
}
],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"inputs": [],
"name": "clearingHouse",
"outputs": [
{
"internalType": "contract ClearingHouse",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "contract IAmm",
"name": "_amm",
"type": "address"
},
{
"internalType": "address",
"name": "_trader",
"type": "address"
}
],
"name": "getFreeCollateral",
"outputs": [
{
"components": [
{
"internalType": "int256",
"name": "d",
"type": "int256"
}
],
"internalType": "struct SignedDecimal.signedDecimal",
"name": "",
"type": "tuple"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "contract IAmm",
"name": "_amm",
"type": "address"
},
{
"internalType": "address",
"name": "_trader",
"type": "address"
}
],
"name": "getMarginRatio",
"outputs": [
{
"components": [
{
"internalType": "int256",
"name": "d",
"type": "int256"
}
],
"internalType": "struct SignedDecimal.signedDecimal",
"name": "",
"type": "tuple"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "contract IERC20",
"name": "_quoteToken",
"type": "address"
},
{
"internalType": "address",
"name": "_trader",
"type": "address"
}
],
"name": "getPersonalBalanceWithFundingPayment",
"outputs": [
{
"components": [
{
"internalType": "uint256",
"name": "d",
"type": "uint256"
}
],
"internalType": "struct Decimal.decimal",
"name": "margin",
"type": "tuple"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "contract IAmm",
"name": "_amm",
"type": "address"
},
{
"internalType": "address",
"name": "_trader",
"type": "address"
}
],
"name": "getPersonalPositionWithFundingPayment",
"outputs": [
{
"components": [
{
"components": [
{
"internalType": "int256",
"name": "d",
"type": "int256"
}
],
"internalType": "struct SignedDecimal.signedDecimal",
"name": "size",
"type": "tuple"
},
{
"components": [
{
"internalType": "uint256",
"name": "d",
"type": "uint256"
}
],
"internalType": "struct Decimal.decimal",
"name": "margin",
"type": "tuple"
},
{
"components": [
{
"internalType": "uint256",
"name": "d",
"type": "uint256"
}
],
"internalType": "struct Decimal.decimal",
"name": "openNotional",
"type": "tuple"
},
{
"components": [
{
"internalType": "int256",
"name": "d",
"type": "int256"
}
],
"internalType": "struct SignedDecimal.signedDecimal",
"name": "lastUpdatedCumulativePremiumFractionLong",
"type": "tuple"
},
{
"components": [
{
"internalType": "int256",
"name": "d",
"type": "int256"
}
],
"internalType": "struct SignedDecimal.signedDecimal",
"name": "lastUpdatedCumulativePremiumFractionShort",
"type": "tuple"
},
{
"internalType": "uint256",
"name": "blockNumber",
"type": "uint256"
}
],
"internalType": "struct ClearingHouse.Position",
"name": "position",
"type": "tuple"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "contract IAmm",
"name": "_amm",
"type": "address"
},
{
"internalType": "address",
"name": "_trader",
"type": "address"
}
],
"name": "getUnrealizedPnl",
"outputs": [
{
"components": [
{
"internalType": "int256",
"name": "d",
"type": "int256"
}
],
"internalType": "struct SignedDecimal.signedDecimal",
"name": "",
"type": "tuple"
}
],
"stateMutability": "view",
"type": "function"
}
],
"bytecode": "0x608060405234801561001057600080fd5b5060405161132d38038061132d83398101604081905261002f91610054565b600080546001600160a01b0319166001600160a01b0392909216919091179055610084565b60006020828403121561006657600080fd5b81516001600160a01b038116811461007d57600080fd5b9392505050565b61129a806100936000396000f3fe608060405234801561001057600080fd5b50600436106100625760003560e01c80630acdddfb146100675780630af968001461008e57806316f6c558146100ae57806333d3bd3014610112578063bafe871c14610125578063ea0a45f914610138575b600080fd5b61007a610075366004610bcc565b61014b565b604051905181526020015b60405180910390f35b6000546100a1906001600160a01b031681565b6040516100859190610c05565b6100c16100bc366004610bcc565b6101d3565b6040516100859190600060c0820190508251518252602083015151602083015260408301515160408301526060830151516060830152608083015151608083015260a083015160a083015292915050565b61007a610120366004610bcc565b610322565b61007a610133366004610bcc565b61056d565b61007a610146366004610bcc565b61074c565b610153610b4d565b60008054604051638bedf3bb60e01b81526001600160a01b0390911690638bedf3bb9061018890879087908690600401610c19565b6040805180830381865afa1580156101a4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101c89190610ce4565b925050505b92915050565b6101db610b60565b600054604051630b33dc1960e41b81526001600160a01b039091169063b33dc1909061020d9086908690600401610d19565b60c060405180830381865afa15801561022a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061024e9190610d33565b60008054604051636891397b60e01b8152929350909182916001600160a01b031690636891397b90610284908890600401610c05565b6040805180830381865afa1580156102a0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102c49190610ce4565b9150915060006102eb6102d88585856107ce565b6102e58660200151610850565b906108bd565b905060006102f7825190565b121561030a576103056108e3565b610313565b610313816108fe565b60208501525091949350505050565b61032a610b4d565b600061033684846101d3565b60008054604051638bedf3bb60e01b8152929350909182916001600160a01b031690638bedf3bb9061037090899089908690600401610c19565b6040805180830381865afa15801561038c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103b09190610ce4565b60008054604051638bedf3bb60e01b81529395509193509182916001600160a01b031690638bedf3bb906103ec908b908b908690600401610c19565b6040805180830381865afa158015610408573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061042c9190610ce4565b91509150610438610b4d565b610440610b4d565b8251855113610450578486610453565b82845b6020890151919350915060009061046b908490610934565b905060008061048e61048a8b60200151856109a490919063ffffffff16565b5190565b1361049957816104a6565b6104a68960200151610850565b905060008c6001600160a01b031663b13c86a36040518163ffffffff1660e01b815260040160a060405180830381865afa1580156104e8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061050c9190610dd2565b6020015190506000806105218c600001515190565b1361053e576105398261053387610850565b90610a0a565b61054f565b61054f826105338d60400151610850565b905061055b8382610a75565b9e9d5050505050505050505050505050565b610575610b4d565b60008060009054906101000a90046001600160a01b03166001600160a01b031663b79023036040518163ffffffff1660e01b8152600401602060405180830381865afa1580156105c9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105ed9190610e64565b90506000816001600160a01b031663b7538c626040518163ffffffff1660e01b8152600401600060405180830381865afa15801561062f573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526106579190810190610e81565b905060005b815181101561074357856001600160a01b031682828151811061068157610681610f32565b60200260200101516001600160a01b031663fdf262b76040518163ffffffff1660e01b8152600401602060405180830381865afa1580156106c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106ea9190610e64565b6001600160a01b03160361073157600061071d83838151811061070f5761070f610f32565b6020026020010151876101d3565b60200151905061072d8582610a92565b9450505b8061073b81610f5e565b91505061065c565b50505092915050565b610754610b4d565b60005460405163ea0a45f960e01b81526001600160a01b039091169063ea0a45f9906107869086908690600401610d19565b602060405180830381865afa1580156107a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107c79190610f77565b9392505050565b6107d6610b4d565b8351516000036107ef576107e86108e3565b90506107c7565b8351516000121561082b576107e8600019610825866000015161081f886060015188610a7590919063ffffffff16565b90610aaf565b90610acc565b6107e8600019610825866000015161081f886080015187610a7590919063ffffffff16565b610858610b4d565b8180600001516001600160ff1b03101560405180606001604052806033815260200161123260339139906108a85760405162461bcd60e51b815260040161089f9190610f93565b60405180910390fd5b50506040805160208101909152915182525090565b6108c5610b4d565b6108cd610b4d565b825184516108da91610ae9565b81529392505050565b6108eb610b4d565b5060408051602081019091526000815290565b610906610b4d565b61090e610b4d565b82516000131561092c578251610925906000610fe8565b81526101cd565b915182525090565b61093c610b4d565b8180600001516001600160ff1b03101560405180606001604052806033815260200161123260339139906109835760405162461bcd60e51b815260040161089f9190610f93565b5061098c610b4d565b8351855161099a9190611027565b8152949350505050565b6109ac610b4d565b8180600001516001600160ff1b03101560405180606001604052806033815260200161123260339139906109f35760405162461bcd60e51b815260040161089f9190610f93565b506109fc610b4d565b8351855161099a9190610fe8565b610a12610b4d565b8180600001516001600160ff1b0310156040518060600160405280603381526020016112326033913990610a595760405162461bcd60e51b815260040161089f9190610f93565b50610a62610b4d565b6101c8610a6e85610850565b8690610aaf565b610a7d610b4d565b610a85610b4d565b825184516108da91610af5565b610a9a610b4d565b610aa2610b4d565b825184516108da91610b01565b610ab7610b4d565b610abf610b4d565b825184516108da91610b0d565b610ad4610b4d565b610adc610b4d565b83516108da908490611068565b60006107c78284611027565b60006107c78284610fe8565b60006107c782846110ed565b60006107c7838360126000610b2182610b3d565b610b2b8486611068565b610b359190611105565b949350505050565b60006101cd60ff8316600a611225565b6040518060200160405280600081525090565b6040518060c00160405280610b73610b4d565b8152602001610b80610b4d565b8152602001610b8d610b4d565b8152602001610b9a610b4d565b8152602001610ba7610b4d565b8152602001600081525090565b6001600160a01b0381168114610bc957600080fd5b50565b60008060408385031215610bdf57600080fd5b8235610bea81610bb4565b91506020830135610bfa81610bb4565b809150509250929050565b6001600160a01b0391909116815260200190565b6001600160a01b038481168252831660208201526060810160028310610c4f57634e487b7160e01b600052602160045260246000fd5b826040830152949350505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715610c9b57610c9b610c5d565b604052919050565b600060208284031215610cb557600080fd5b604051602081016001600160401b0381118282101715610cd757610cd7610c5d565b6040529151825250919050565b60008060408385031215610cf757600080fd5b610d018484610ca3565b9150610d108460208501610ca3565b90509250929050565b6001600160a01b0392831681529116602082015260400190565b600060c08284031215610d4557600080fd5b60405160c081016001600160401b0381118282101715610d6757610d67610c5d565b604052610d748484610ca3565b8152610d838460208501610ca3565b6020820152610d958460408501610ca3565b6040820152610da78460608501610ca3565b6060820152610db98460808501610ca3565b608082015260a083015160a08201528091505092915050565b600060a08284031215610de457600080fd5b60405160a081016001600160401b0381118282101715610e0657610e06610c5d565b604052610e138484610ca3565b8152610e228460208501610ca3565b6020820152610e348460408501610ca3565b6040820152610e468460608501610ca3565b6060820152610e588460808501610ca3565b60808201529392505050565b600060208284031215610e7657600080fd5b81516107c781610bb4565b60006020808385031215610e9457600080fd5b82516001600160401b0380821115610eab57600080fd5b818501915085601f830112610ebf57600080fd5b815181811115610ed157610ed1610c5d565b8060051b9150610ee2848301610c73565b8181529183018401918481019088841115610efc57600080fd5b938501935b83851015610f265784519250610f1683610bb4565b8282529385019390850190610f01565b98975050505050505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201610f7057610f70610f48565b5060010190565b600060208284031215610f8957600080fd5b6107c78383610ca3565b600060208083528351808285015260005b81811015610fc057858101830151858201604001528201610fa4565b81811115610fd2576000604083870101525b50601f01601f1916929092016040019392505050565b60008083128015600160ff1b85018412161561100657611006610f48565b6001600160ff1b038401831381161561102157611021610f48565b50500390565b600080821280156001600160ff1b038490038513161561104957611049610f48565b600160ff1b839003841281161561106257611062610f48565b50500190565b60006001600160ff1b038184138284138082168684048611161561108e5761108e610f48565b600160ff1b60008712828116878305891216156110ad576110ad610f48565b600087129250878205871284841616156110c9576110c9610f48565b878505871281841616156110df576110df610f48565b505050929093029392505050565b6000821982111561110057611100610f48565b500190565b60008261112257634e487b7160e01b600052601260045260246000fd5b600160ff1b82146000198414161561113c5761113c610f48565b500590565b600181815b8085111561117c57816000190482111561116257611162610f48565b8085161561116f57918102915b93841c9390800290611146565b509250929050565b600082611193575060016101cd565b816111a0575060006101cd565b81600181146111b657600281146111c0576111dc565b60019150506101cd565b60ff8411156111d1576111d1610f48565b50506001821b6101cd565b5060208310610133831016604e8410600b84101617156111ff575081810a6101cd565b6112098383611141565b806000190482111561121d5761121d610f48565b029392505050565b60006107c7838361118456fe4d69786564446563696d616c3a2075696e742076616c756520697320626967676572207468616e205f494e543235365f4d4158a264697066735822122020c231f83529fc4ab047b372ac81925ee50cb0868581af59fdaea592f9d5e36a64736f6c634300080d0033",
"deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100625760003560e01c80630acdddfb146100675780630af968001461008e57806316f6c558146100ae57806333d3bd3014610112578063bafe871c14610125578063ea0a45f914610138575b600080fd5b61007a610075366004610bcc565b61014b565b604051905181526020015b60405180910390f35b6000546100a1906001600160a01b031681565b6040516100859190610c05565b6100c16100bc366004610bcc565b6101d3565b6040516100859190600060c0820190508251518252602083015151602083015260408301515160408301526060830151516060830152608083015151608083015260a083015160a083015292915050565b61007a610120366004610bcc565b610322565b61007a610133366004610bcc565b61056d565b61007a610146366004610bcc565b61074c565b610153610b4d565b60008054604051638bedf3bb60e01b81526001600160a01b0390911690638bedf3bb9061018890879087908690600401610c19565b6040805180830381865afa1580156101a4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101c89190610ce4565b925050505b92915050565b6101db610b60565b600054604051630b33dc1960e41b81526001600160a01b039091169063b33dc1909061020d9086908690600401610d19565b60c060405180830381865afa15801561022a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061024e9190610d33565b60008054604051636891397b60e01b8152929350909182916001600160a01b031690636891397b90610284908890600401610c05565b6040805180830381865afa1580156102a0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102c49190610ce4565b9150915060006102eb6102d88585856107ce565b6102e58660200151610850565b906108bd565b905060006102f7825190565b121561030a576103056108e3565b610313565b610313816108fe565b60208501525091949350505050565b61032a610b4d565b600061033684846101d3565b60008054604051638bedf3bb60e01b8152929350909182916001600160a01b031690638bedf3bb9061037090899089908690600401610c19565b6040805180830381865afa15801561038c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103b09190610ce4565b60008054604051638bedf3bb60e01b81529395509193509182916001600160a01b031690638bedf3bb906103ec908b908b908690600401610c19565b6040805180830381865afa158015610408573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061042c9190610ce4565b91509150610438610b4d565b610440610b4d565b8251855113610450578486610453565b82845b6020890151919350915060009061046b908490610934565b905060008061048e61048a8b60200151856109a490919063ffffffff16565b5190565b1361049957816104a6565b6104a68960200151610850565b905060008c6001600160a01b031663b13c86a36040518163ffffffff1660e01b815260040160a060405180830381865afa1580156104e8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061050c9190610dd2565b6020015190506000806105218c600001515190565b1361053e576105398261053387610850565b90610a0a565b61054f565b61054f826105338d60400151610850565b905061055b8382610a75565b9e9d5050505050505050505050505050565b610575610b4d565b60008060009054906101000a90046001600160a01b03166001600160a01b031663b79023036040518163ffffffff1660e01b8152600401602060405180830381865afa1580156105c9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105ed9190610e64565b90506000816001600160a01b031663b7538c626040518163ffffffff1660e01b8152600401600060405180830381865afa15801561062f573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526106579190810190610e81565b905060005b815181101561074357856001600160a01b031682828151811061068157610681610f32565b60200260200101516001600160a01b031663fdf262b76040518163ffffffff1660e01b8152600401602060405180830381865afa1580156106c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106ea9190610e64565b6001600160a01b03160361073157600061071d83838151811061070f5761070f610f32565b6020026020010151876101d3565b60200151905061072d8582610a92565b9450505b8061073b81610f5e565b91505061065c565b50505092915050565b610754610b4d565b60005460405163ea0a45f960e01b81526001600160a01b039091169063ea0a45f9906107869086908690600401610d19565b602060405180830381865afa1580156107a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107c79190610f77565b9392505050565b6107d6610b4d565b8351516000036107ef576107e86108e3565b90506107c7565b8351516000121561082b576107e8600019610825866000015161081f886060015188610a7590919063ffffffff16565b90610aaf565b90610acc565b6107e8600019610825866000015161081f886080015187610a7590919063ffffffff16565b610858610b4d565b8180600001516001600160ff1b03101560405180606001604052806033815260200161123260339139906108a85760405162461bcd60e51b815260040161089f9190610f93565b60405180910390fd5b50506040805160208101909152915182525090565b6108c5610b4d565b6108cd610b4d565b825184516108da91610ae9565b81529392505050565b6108eb610b4d565b5060408051602081019091526000815290565b610906610b4d565b61090e610b4d565b82516000131561092c578251610925906000610fe8565b81526101cd565b915182525090565b61093c610b4d565b8180600001516001600160ff1b03101560405180606001604052806033815260200161123260339139906109835760405162461bcd60e51b815260040161089f9190610f93565b5061098c610b4d565b8351855161099a9190611027565b8152949350505050565b6109ac610b4d565b8180600001516001600160ff1b03101560405180606001604052806033815260200161123260339139906109f35760405162461bcd60e51b815260040161089f9190610f93565b506109fc610b4d565b8351855161099a9190610fe8565b610a12610b4d565b8180600001516001600160ff1b0310156040518060600160405280603381526020016112326033913990610a595760405162461bcd60e51b815260040161089f9190610f93565b50610a62610b4d565b6101c8610a6e85610850565b8690610aaf565b610a7d610b4d565b610a85610b4d565b825184516108da91610af5565b610a9a610b4d565b610aa2610b4d565b825184516108da91610b01565b610ab7610b4d565b610abf610b4d565b825184516108da91610b0d565b610ad4610b4d565b610adc610b4d565b83516108da908490611068565b60006107c78284611027565b60006107c78284610fe8565b60006107c782846110ed565b60006107c7838360126000610b2182610b3d565b610b2b8486611068565b610b359190611105565b949350505050565b60006101cd60ff8316600a611225565b6040518060200160405280600081525090565b6040518060c00160405280610b73610b4d565b8152602001610b80610b4d565b8152602001610b8d610b4d565b8152602001610b9a610b4d565b8152602001610ba7610b4d565b8152602001600081525090565b6001600160a01b0381168114610bc957600080fd5b50565b60008060408385031215610bdf57600080fd5b8235610bea81610bb4565b91506020830135610bfa81610bb4565b809150509250929050565b6001600160a01b0391909116815260200190565b6001600160a01b038481168252831660208201526060810160028310610c4f57634e487b7160e01b600052602160045260246000fd5b826040830152949350505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715610c9b57610c9b610c5d565b604052919050565b600060208284031215610cb557600080fd5b604051602081016001600160401b0381118282101715610cd757610cd7610c5d565b6040529151825250919050565b60008060408385031215610cf757600080fd5b610d018484610ca3565b9150610d108460208501610ca3565b90509250929050565b6001600160a01b0392831681529116602082015260400190565b600060c08284031215610d4557600080fd5b60405160c081016001600160401b0381118282101715610d6757610d67610c5d565b604052610d748484610ca3565b8152610d838460208501610ca3565b6020820152610d958460408501610ca3565b6040820152610da78460608501610ca3565b6060820152610db98460808501610ca3565b608082015260a083015160a08201528091505092915050565b600060a08284031215610de457600080fd5b60405160a081016001600160401b0381118282101715610e0657610e06610c5d565b604052610e138484610ca3565b8152610e228460208501610ca3565b6020820152610e348460408501610ca3565b6040820152610e468460608501610ca3565b6060820152610e588460808501610ca3565b60808201529392505050565b600060208284031215610e7657600080fd5b81516107c781610bb4565b60006020808385031215610e9457600080fd5b82516001600160401b0380821115610eab57600080fd5b818501915085601f830112610ebf57600080fd5b815181811115610ed157610ed1610c5d565b8060051b9150610ee2848301610c73565b8181529183018401918481019088841115610efc57600080fd5b938501935b83851015610f265784519250610f1683610bb4565b8282529385019390850190610f01565b98975050505050505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201610f7057610f70610f48565b5060010190565b600060208284031215610f8957600080fd5b6107c78383610ca3565b600060208083528351808285015260005b81811015610fc057858101830151858201604001528201610fa4565b81811115610fd2576000604083870101525b50601f01601f1916929092016040019392505050565b60008083128015600160ff1b85018412161561100657611006610f48565b6001600160ff1b038401831381161561102157611021610f48565b50500390565b600080821280156001600160ff1b038490038513161561104957611049610f48565b600160ff1b839003841281161561106257611062610f48565b50500190565b60006001600160ff1b038184138284138082168684048611161561108e5761108e610f48565b600160ff1b60008712828116878305891216156110ad576110ad610f48565b600087129250878205871284841616156110c9576110c9610f48565b878505871281841616156110df576110df610f48565b505050929093029392505050565b6000821982111561110057611100610f48565b500190565b60008261112257634e487b7160e01b600052601260045260246000fd5b600160ff1b82146000198414161561113c5761113c610f48565b500590565b600181815b8085111561117c57816000190482111561116257611162610f48565b8085161561116f57918102915b93841c9390800290611146565b509250929050565b600082611193575060016101cd565b816111a0575060006101cd565b81600181146111b657600281146111c0576111dc565b60019150506101cd565b60ff8411156111d1576111d1610f48565b50506001821b6101cd565b5060208310610133831016604e8410600b84101617156111ff575081810a6101cd565b6112098383611141565b806000190482111561121d5761121d610f48565b029392505050565b60006107c7838361118456fe4d69786564446563696d616c3a2075696e742076616c756520697320626967676572207468616e205f494e543235365f4d4158a264697066735822122020c231f83529fc4ab047b372ac81925ee50cb0868581af59fdaea592f9d5e36a64736f6c634300080d0033",
"linkReferences": {},
"deployedLinkReferences": {}
}
declare const abis: {
ammAbi: ({
amm: ({
anonymous: boolean;

@@ -16,2 +16,7 @@ inputs: {

inputs: ({
internalType: string;
name: string;
type: string;
components?: undefined;
} | {
components: {

@@ -25,7 +30,2 @@ internalType: string;

type: string;
} | {
internalType: string;
name: string;
type: string;
components?: undefined;
})[];

@@ -117,14 +117,7 @@ name: string;

anonymous?: undefined;
} | {
})[];
clearingHouse: ({
anonymous: boolean;
inputs: {
components: {
components: {
internalType: string;
name: string;
type: string;
}[];
internalType: string;
name: string;
type: string;
}[];
indexed: boolean;
internalType: string;

@@ -135,11 +128,7 @@ name: string;

name: string;
outputs: never[];
stateMutability: string;
type: string;
anonymous?: undefined;
})[];
chAbi: ({
anonymous: boolean;
outputs?: undefined;
stateMutability?: undefined;
} | {
inputs: ({
indexed: boolean;
internalType: string;

@@ -155,3 +144,2 @@ name: string;

}[];
indexed: boolean;
internalType: string;

@@ -162,5 +150,6 @@ name: string;

name: string;
outputs: never[];
stateMutability: string;
type: string;
outputs?: undefined;
stateMutability?: undefined;
anonymous?: undefined;
} | {

@@ -197,17 +186,7 @@ inputs: {

} | {
inputs: ({
inputs: {
internalType: string;
name: string;
type: string;
components?: undefined;
} | {
components: {
internalType: string;
name: string;
type: string;
}[];
internalType: string;
name: string;
type: string;
})[];
}[];
name: string;

@@ -233,3 +212,3 @@ outputs: ({

})[];
chvAbi: ({
clearingHouseViewer: ({
inputs: {

@@ -284,3 +263,3 @@ internalType: string;

})[];
ifAbi: ({
insuranceFund: ({
anonymous: boolean;

@@ -334,3 +313,3 @@ inputs: {

})[];
mockWethAbi: ({
erc20Abi: ({
anonymous: boolean;

@@ -337,0 +316,0 @@ inputs: {

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const Amm_json_1 = __importDefault(require("./Amm.json"));
const ClearingHouse_json_1 = __importDefault(require("./ClearingHouse.json"));
const ClearingHouseViewer_json_1 = __importDefault(require("./ClearingHouseViewer.json"));
const InsuranceFund_json_1 = __importDefault(require("./InsuranceFund.json"));
const MockWETH_json_1 = __importDefault(require("./MockWETH.json"));
const abis = { ammAbi: Amm_json_1.default, chAbi: ClearingHouse_json_1.default, chvAbi: ClearingHouseViewer_json_1.default, ifAbi: InsuranceFund_json_1.default, mockWethAbi: MockWETH_json_1.default };
const Amm_json_1 = require("./Amm.json");
const ClearingHouse_json_1 = require("./ClearingHouse.json");
const ClearingHouseViewer_json_1 = require("./ClearingHouseViewer.json");
const InsuranceFund_json_1 = require("./InsuranceFund.json");
const ERC20_json_1 = require("./ERC20.json");
const abis = { amm: Amm_json_1.abi, clearingHouse: ClearingHouse_json_1.abi, clearingHouseViewer: ClearingHouseViewer_json_1.abi, insuranceFund: InsuranceFund_json_1.abi, erc20Abi: ERC20_json_1.abi };
exports.default = abis;

@@ -1,292 +0,301 @@

[
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "amm",
"type": "address"
}
],
"name": "AmmAdded",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "amm",
"type": "address"
}
],
"name": "AmmRemoved",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "previousOwner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "OwnershipTransferred",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "tokenAddress",
"type": "address"
}
],
"name": "TokenAdded",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "tokenAddress",
"type": "address"
}
],
"name": "TokenRemoved",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "withdrawer",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "Withdrawn",
"type": "event"
},
{
"inputs": [
{
"internalType": "contract IAmm",
"name": "_amm",
"type": "address"
}
],
"name": "addAmm",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"name": "ammMap",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "getAllAmms",
"outputs": [
{
"internalType": "contract IAmm[]",
"name": "",
"type": "address[]"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "getQuoteTokenLength",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "initialize",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "contract IAmm",
"name": "_amm",
"type": "address"
}
],
"name": "isExistedAmm",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "owner",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"name": "quoteTokens",
"outputs": [
{
"internalType": "contract IERC20",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "contract IAmm",
"name": "_amm",
"type": "address"
}
],
"name": "removeAmm",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "contract IERC20",
"name": "_token",
"type": "address"
}
],
"name": "removeToken",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "renounceOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "_beneficiary",
"type": "address"
}
],
"name": "setBeneficiary",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "transferOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "contract IERC20",
"name": "_quoteToken",
"type": "address"
},
{
"components": [
{
"internalType": "uint256",
"name": "d",
"type": "uint256"
}
],
"internalType": "struct Decimal.decimal",
"name": "_amount",
"type": "tuple"
}
],
"name": "withdraw",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
]
{
"_format": "hh-sol-artifact-1",
"contractName": "InsuranceFund",
"sourceName": "contracts/InsuranceFund.sol",
"abi": [
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "amm",
"type": "address"
}
],
"name": "AmmAdded",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "amm",
"type": "address"
}
],
"name": "AmmRemoved",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "previousOwner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "OwnershipTransferred",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "tokenAddress",
"type": "address"
}
],
"name": "TokenAdded",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "tokenAddress",
"type": "address"
}
],
"name": "TokenRemoved",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "withdrawer",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "Withdrawn",
"type": "event"
},
{
"inputs": [
{
"internalType": "contract IAmm",
"name": "_amm",
"type": "address"
}
],
"name": "addAmm",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"name": "ammMap",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "getAllAmms",
"outputs": [
{
"internalType": "contract IAmm[]",
"name": "",
"type": "address[]"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "getQuoteTokenLength",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "initialize",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "contract IAmm",
"name": "_amm",
"type": "address"
}
],
"name": "isExistedAmm",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "owner",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"name": "quoteTokens",
"outputs": [
{
"internalType": "contract IERC20",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "contract IAmm",
"name": "_amm",
"type": "address"
}
],
"name": "removeAmm",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "contract IERC20",
"name": "_token",
"type": "address"
}
],
"name": "removeToken",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "renounceOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "_beneficiary",
"type": "address"
}
],
"name": "setBeneficiary",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "transferOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "contract IERC20",
"name": "_quoteToken",
"type": "address"
},
{
"components": [
{
"internalType": "uint256",
"name": "d",
"type": "uint256"
}
],
"internalType": "struct Decimal.decimal",
"name": "_amount",
"type": "tuple"
}
],
"name": "withdraw",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
],
"bytecode": "0x608060405234801561001057600080fd5b506116cc806100206000396000f3fe608060405234801561001057600080fd5b50600436106100ba5760003560e01c80630774a784146100bf5780631c31f710146100e7578063252978b8146100fc5780632c9115c71461010f5780635fa7b5841461012f578063715018a6146101425780638129fc1c1461014a5780638da5cb5b14610152578063b7538c621461015a578063bd4247f91461016f578063beb0597a14610192578063cf230979146101a3578063d926de1c146101b6578063f2fde38b146101c9575b600080fd5b6100d26100cd366004611288565b6101dc565b60405190151581526020015b60405180910390f35b6100fa6100f5366004611288565b6101fa565b005b6100fa61010a3660046112a5565b610254565b61012261011d3660046112e6565b6103c8565b6040516100de91906112ff565b6100fa61013d366004611288565b6103f2565b6100fa610677565b6100fa6106b2565b61012261077b565b61016261078a565b6040516100de9190611313565b6100d261017d366004611288565b60ca6020526000908152604090205460ff1681565b60cd546040519081526020016100de565b6100fa6101b1366004611288565b6107ec565b6100fa6101c4366004611288565b6109c4565b6100fa6101d7366004611288565b610be7565b6001600160a01b0316600090815260ca602052604090205460ff1690565b3361020361077b565b6001600160a01b0316146102325760405162461bcd60e51b815260040161022990611360565b60405180910390fd5b60ce80546001600160a01b0319166001600160a01b0392909216919091179055565b60ce5482906001600160a01b031633146102ac5760405162461bcd60e51b815260206004820152601960248201527863616c6c6572206973206e6f742062656e656669636961727960381b6044820152606401610229565b6102b581610c84565b6102fa5760405162461bcd60e51b8152602060048201526016602482015275105cdcd95d081a5cc81b9bdd081cdd5c1c1bdc9d195960521b6044820152606401610229565b600061030582610ca2565b905061031d61031936859003850185611395565b5190565b8151101561035f5760405162461bcd60e51b815260206004820152600f60248201526e08ceadcc840dcdee840cadcdeeaced608b1b6044820152606401610229565b610378823361037336879003870187611395565b610cba565b7f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5336103ac61031936879003870187611395565b6040516103ba9291906113e4565b60405180910390a150505050565b60cd81815481106103d857600080fd5b6000918252602090912001546001600160a01b0316905081565b336103fb61077b565b6001600160a01b0316146104215760405162461bcd60e51b815260040161022990611360565b61042a81610c84565b61046a5760405162461bcd60e51b81526020600482015260116024820152701d1bdad95b881b9bdd08195e1a5cdd1959607a1b6044820152606401610229565b6001600160a01b038116600090815260cb60205260408120805460ff1916905560cd54905b818110156105a257826001600160a01b031660cd82815481106104b4576104b46113fd565b6000918252602090912001546001600160a01b031603610590576104d9600183611429565b8110156105585760cd6104ed600184611429565b815481106104fd576104fd6113fd565b60009182526020909120015460cd80546001600160a01b039092169183908110610529576105296113fd565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055505b60cd80548061056957610569611440565b600082815260209020810160001990810180546001600160a01b03191690550190556105a2565b8061059a81611456565b91505061048f565b5060006105b161031984610ca2565b111561063c57816001600160a01b031663a9059cbb6105ce61077b565b6105da61031986610ca2565b6040518363ffffffff1660e01b81526004016105f79291906113e4565b6020604051808303816000875af1158015610616573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061063a919061146f565b505b7f4c910b69fe65a61f7531b9c5042b2329ca7179c77290aa7e2eb3afa3c8511fd38260405161066b91906112ff565b60405180910390a15050565b3361068061077b565b6001600160a01b0316146106a65760405162461bcd60e51b815260040161022990611360565b6106b06000610da2565b565b600054610100900460ff166106cd5760005460ff16156106d1565b303b155b6107345760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610229565b600054610100900460ff16158015610756576000805461ffff19166101011790555b61075e610df4565b610766610e23565b8015610778576000805461ff00191690555b50565b6033546001600160a01b031690565b606060cc8054806020026020016040519081016040528092919081815260200182805480156107e257602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116107c4575b5050505050905090565b336107f561077b565b6001600160a01b03161461081b5760405162461bcd60e51b815260040161022990611360565b610824816101dc565b6108625760405162461bcd60e51b815260206004820152600f60248201526e185b5b481b9bdd08195e1a5cdd1959608a1b6044820152606401610229565b6001600160a01b038116600090815260ca60205260408120805460ff1916905560cc54905b818110156109bf57826001600160a01b031660cc82815481106108ac576108ac6113fd565b6000918252602090912001546001600160a01b0316036109ad5760cc6108d3600184611429565b815481106108e3576108e36113fd565b60009182526020909120015460cc80546001600160a01b03909216918390811061090f5761090f6113fd565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060cc80548061094e5761094e611440565b600082815260209020810160001990810180546001600160a01b03191690550190556040517fdaad2af263ebb3abf337a324f20752addc3bf170971ce7b80cc3bfea1fcf30ee906109a09085906112ff565b60405180910390a1505050565b806109b781611456565b915050610887565b505050565b336109cd61077b565b6001600160a01b0316146109f35760405162461bcd60e51b815260040161022990611360565b6109fc816101dc565b15610a3d5760405162461bcd60e51b8152602060048201526011602482015270185b5b48185b1c9958591e481859191959607a1b6044820152606401610229565b6001600160a01b038116600081815260ca6020526040808220805460ff1916600190811790915560cc805491820181559092527f47197230e1e4b29fc0bd84d7d78966c0925452aff72a2a121538b102457e9ebe90910180546001600160a01b031916909217909155517f10cdbb821aa416c854add806e1d7e8138afe2a538921cebe99b1351362ae38b290610ad49083906112ff565b60405180910390a16000816001600160a01b031663fdf262b76040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b1c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b409190611491565b9050610b4b81610c84565b610be35760cd805460018082019092557f83978b4c69c48dd978ab43fe30f077615294f938fb7f936d9eb340e51ea7db2e0180546001600160a01b0319166001600160a01b038416908117909155600090815260cb602052604090819020805460ff1916909217909155517f784c8f4dbf0ffedd6e72c76501c545a70f8b203b30a26ce542bf92ba87c248a49061066b9083906112ff565b5050565b33610bf061077b565b6001600160a01b031614610c165760405162461bcd60e51b815260040161022990611360565b6001600160a01b038116610c7b5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610229565b61077881610da2565b6001600160a01b0316600090815260cb602052604090205460ff1690565b610caa611260565b610cb48230610e52565b92915050565b610cc383610ed7565b6000610ccf8484610e52565b90506000610cdd8584610f21565b60405163a9059cbb60e01b81529091506001600160a01b0386169063a9059cbb90610d0e90879085906004016113e4565b6020604051808303816000875af1158015610d2d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d51919061146f565b610d8f5760405162461bcd60e51b815260206004820152600f60248201526e1d1c985b9cd9995c8819985a5b1959608a1b6044820152606401610229565b610d9b85858385610f8b565b5050505050565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff16610e1b5760405162461bcd60e51b8152600401610229906114ae565b6106b0610fff565b600054610100900460ff16610e4a5760405162461bcd60e51b8152600401610229906114ae565b6106b061102f565b610e5a611260565b610ed083846001600160a01b03166370a08231856040518263ffffffff1660e01b8152600401610e8a91906112ff565b602060405180830381865afa158015610ea7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ecb91906114f9565b61105d565b9392505050565b6000610ee2826110e9565b6001600160a01b0383166000908152609760205260409020549091508114610be3576001600160a01b0391909116600090815260976020526040902055565b600080610f2d846110e9565b905060128110610f6157610f42601282611429565b610f4d90600a6115f6565b8351610f599190611602565b915050610cb4565b610f6c816012611429565b610f7790600a6115f6565b8351610f839190611621565b949350505050565b610fb2610fa2610f9b868561105d565b83906111fd565b610fac8686610e52565b90611223565b60000b15610ff95760405162461bcd60e51b815260206004820152601460248201527318985b185b98d9481a5b98dbdb9cda5cdd195b9d60621b6044820152606401610229565b50505050565b600054610100900460ff166110265760405162461bcd60e51b8152600401610229906114ae565b6106b033610da2565b600054610100900460ff166110565760405162461bcd60e51b8152600401610229906114ae565b6001606555565b611065611260565b6000611070846110e9565b9050601281106110b25760405180602001604052806012836110929190611429565b61109d90600a6115f6565b6110a79086611621565b815250915050610cb4565b60405180602001604052808260126110ca9190611429565b6110d590600a6115f6565b6110df9086611602565b9052949350505050565b6001600160a01b038116600090815260976020526040812054808203610cb45760408051600481526024810182526020810180516001600160e01b031663313ce56760e01b179052905160009182916001600160a01b0387169161114c91611643565b600060405180830381855afa9150503d8060008114611187576040519150601f19603f3d011682016040523d82523d6000602084013e61118c565b606091505b509150915081801561119e5750805115155b6111e05760405162461bcd60e51b815260206004820152601360248201527219d95d08191958da5b585b1cc819985a5b1959606a1b6044820152606401610229565b808060200190518101906111f491906114f9565b95945050505050565b611205611260565b61120d611260565b8251845161121a91611254565b81529392505050565b80518251600091101561123857506001610cb4565b81518351101561124b5750600019610cb4565b50600092915050565b6000610ed0828461167e565b6040518060200160405280600081525090565b6001600160a01b038116811461077857600080fd5b60006020828403121561129a57600080fd5b8135610ed081611273565b60008082840360408112156112b957600080fd5b83356112c481611273565b92506020601f19820112156112d857600080fd5b506020830190509250929050565b6000602082840312156112f857600080fd5b5035919050565b6001600160a01b0391909116815260200190565b6020808252825182820181905260009190848201906040850190845b818110156113545783516001600160a01b03168352928401929184019160010161132f565b50909695505050505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6000602082840312156113a757600080fd5b604051602081016001600160401b03811182821017156113d757634e487b7160e01b600052604160045260246000fd5b6040529135825250919050565b6001600160a01b03929092168252602082015260400190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60008282101561143b5761143b611413565b500390565b634e487b7160e01b600052603160045260246000fd5b60006001820161146857611468611413565b5060010190565b60006020828403121561148157600080fd5b81518015158114610ed057600080fd5b6000602082840312156114a357600080fd5b8151610ed081611273565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60006020828403121561150b57600080fd5b5051919050565b600181815b8085111561154d57816000190482111561153357611533611413565b8085161561154057918102915b93841c9390800290611517565b509250929050565b60008261156457506001610cb4565b8161157157506000610cb4565b81600181146115875760028114611591576115ad565b6001915050610cb4565b60ff8411156115a2576115a2611413565b50506001821b610cb4565b5060208310610133831016604e8410600b84101617156115d0575081810a610cb4565b6115da8383611512565b80600019048211156115ee576115ee611413565b029392505050565b6000610ed08383611555565b600081600019048311821515161561161c5761161c611413565b500290565b60008261163e57634e487b7160e01b600052601260045260246000fd5b500490565b6000825160005b81811015611664576020818601810151858301520161164a565b81811115611673576000828501525b509190910192915050565b6000821982111561169157611691611413565b50019056fea26469706673582212205df75432d86869437ec42d7092665855540db18dc4a22115b8a2ea56686bcbca64736f6c634300080d0033",
"deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100ba5760003560e01c80630774a784146100bf5780631c31f710146100e7578063252978b8146100fc5780632c9115c71461010f5780635fa7b5841461012f578063715018a6146101425780638129fc1c1461014a5780638da5cb5b14610152578063b7538c621461015a578063bd4247f91461016f578063beb0597a14610192578063cf230979146101a3578063d926de1c146101b6578063f2fde38b146101c9575b600080fd5b6100d26100cd366004611288565b6101dc565b60405190151581526020015b60405180910390f35b6100fa6100f5366004611288565b6101fa565b005b6100fa61010a3660046112a5565b610254565b61012261011d3660046112e6565b6103c8565b6040516100de91906112ff565b6100fa61013d366004611288565b6103f2565b6100fa610677565b6100fa6106b2565b61012261077b565b61016261078a565b6040516100de9190611313565b6100d261017d366004611288565b60ca6020526000908152604090205460ff1681565b60cd546040519081526020016100de565b6100fa6101b1366004611288565b6107ec565b6100fa6101c4366004611288565b6109c4565b6100fa6101d7366004611288565b610be7565b6001600160a01b0316600090815260ca602052604090205460ff1690565b3361020361077b565b6001600160a01b0316146102325760405162461bcd60e51b815260040161022990611360565b60405180910390fd5b60ce80546001600160a01b0319166001600160a01b0392909216919091179055565b60ce5482906001600160a01b031633146102ac5760405162461bcd60e51b815260206004820152601960248201527863616c6c6572206973206e6f742062656e656669636961727960381b6044820152606401610229565b6102b581610c84565b6102fa5760405162461bcd60e51b8152602060048201526016602482015275105cdcd95d081a5cc81b9bdd081cdd5c1c1bdc9d195960521b6044820152606401610229565b600061030582610ca2565b905061031d61031936859003850185611395565b5190565b8151101561035f5760405162461bcd60e51b815260206004820152600f60248201526e08ceadcc840dcdee840cadcdeeaced608b1b6044820152606401610229565b610378823361037336879003870187611395565b610cba565b7f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5336103ac61031936879003870187611395565b6040516103ba9291906113e4565b60405180910390a150505050565b60cd81815481106103d857600080fd5b6000918252602090912001546001600160a01b0316905081565b336103fb61077b565b6001600160a01b0316146104215760405162461bcd60e51b815260040161022990611360565b61042a81610c84565b61046a5760405162461bcd60e51b81526020600482015260116024820152701d1bdad95b881b9bdd08195e1a5cdd1959607a1b6044820152606401610229565b6001600160a01b038116600090815260cb60205260408120805460ff1916905560cd54905b818110156105a257826001600160a01b031660cd82815481106104b4576104b46113fd565b6000918252602090912001546001600160a01b031603610590576104d9600183611429565b8110156105585760cd6104ed600184611429565b815481106104fd576104fd6113fd565b60009182526020909120015460cd80546001600160a01b039092169183908110610529576105296113fd565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055505b60cd80548061056957610569611440565b600082815260209020810160001990810180546001600160a01b03191690550190556105a2565b8061059a81611456565b91505061048f565b5060006105b161031984610ca2565b111561063c57816001600160a01b031663a9059cbb6105ce61077b565b6105da61031986610ca2565b6040518363ffffffff1660e01b81526004016105f79291906113e4565b6020604051808303816000875af1158015610616573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061063a919061146f565b505b7f4c910b69fe65a61f7531b9c5042b2329ca7179c77290aa7e2eb3afa3c8511fd38260405161066b91906112ff565b60405180910390a15050565b3361068061077b565b6001600160a01b0316146106a65760405162461bcd60e51b815260040161022990611360565b6106b06000610da2565b565b600054610100900460ff166106cd5760005460ff16156106d1565b303b155b6107345760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610229565b600054610100900460ff16158015610756576000805461ffff19166101011790555b61075e610df4565b610766610e23565b8015610778576000805461ff00191690555b50565b6033546001600160a01b031690565b606060cc8054806020026020016040519081016040528092919081815260200182805480156107e257602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116107c4575b5050505050905090565b336107f561077b565b6001600160a01b03161461081b5760405162461bcd60e51b815260040161022990611360565b610824816101dc565b6108625760405162461bcd60e51b815260206004820152600f60248201526e185b5b481b9bdd08195e1a5cdd1959608a1b6044820152606401610229565b6001600160a01b038116600090815260ca60205260408120805460ff1916905560cc54905b818110156109bf57826001600160a01b031660cc82815481106108ac576108ac6113fd565b6000918252602090912001546001600160a01b0316036109ad5760cc6108d3600184611429565b815481106108e3576108e36113fd565b60009182526020909120015460cc80546001600160a01b03909216918390811061090f5761090f6113fd565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060cc80548061094e5761094e611440565b600082815260209020810160001990810180546001600160a01b03191690550190556040517fdaad2af263ebb3abf337a324f20752addc3bf170971ce7b80cc3bfea1fcf30ee906109a09085906112ff565b60405180910390a1505050565b806109b781611456565b915050610887565b505050565b336109cd61077b565b6001600160a01b0316146109f35760405162461bcd60e51b815260040161022990611360565b6109fc816101dc565b15610a3d5760405162461bcd60e51b8152602060048201526011602482015270185b5b48185b1c9958591e481859191959607a1b6044820152606401610229565b6001600160a01b038116600081815260ca6020526040808220805460ff1916600190811790915560cc805491820181559092527f47197230e1e4b29fc0bd84d7d78966c0925452aff72a2a121538b102457e9ebe90910180546001600160a01b031916909217909155517f10cdbb821aa416c854add806e1d7e8138afe2a538921cebe99b1351362ae38b290610ad49083906112ff565b60405180910390a16000816001600160a01b031663fdf262b76040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b1c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b409190611491565b9050610b4b81610c84565b610be35760cd805460018082019092557f83978b4c69c48dd978ab43fe30f077615294f938fb7f936d9eb340e51ea7db2e0180546001600160a01b0319166001600160a01b038416908117909155600090815260cb602052604090819020805460ff1916909217909155517f784c8f4dbf0ffedd6e72c76501c545a70f8b203b30a26ce542bf92ba87c248a49061066b9083906112ff565b5050565b33610bf061077b565b6001600160a01b031614610c165760405162461bcd60e51b815260040161022990611360565b6001600160a01b038116610c7b5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610229565b61077881610da2565b6001600160a01b0316600090815260cb602052604090205460ff1690565b610caa611260565b610cb48230610e52565b92915050565b610cc383610ed7565b6000610ccf8484610e52565b90506000610cdd8584610f21565b60405163a9059cbb60e01b81529091506001600160a01b0386169063a9059cbb90610d0e90879085906004016113e4565b6020604051808303816000875af1158015610d2d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d51919061146f565b610d8f5760405162461bcd60e51b815260206004820152600f60248201526e1d1c985b9cd9995c8819985a5b1959608a1b6044820152606401610229565b610d9b85858385610f8b565b5050505050565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff16610e1b5760405162461bcd60e51b8152600401610229906114ae565b6106b0610fff565b600054610100900460ff16610e4a5760405162461bcd60e51b8152600401610229906114ae565b6106b061102f565b610e5a611260565b610ed083846001600160a01b03166370a08231856040518263ffffffff1660e01b8152600401610e8a91906112ff565b602060405180830381865afa158015610ea7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ecb91906114f9565b61105d565b9392505050565b6000610ee2826110e9565b6001600160a01b0383166000908152609760205260409020549091508114610be3576001600160a01b0391909116600090815260976020526040902055565b600080610f2d846110e9565b905060128110610f6157610f42601282611429565b610f4d90600a6115f6565b8351610f599190611602565b915050610cb4565b610f6c816012611429565b610f7790600a6115f6565b8351610f839190611621565b949350505050565b610fb2610fa2610f9b868561105d565b83906111fd565b610fac8686610e52565b90611223565b60000b15610ff95760405162461bcd60e51b815260206004820152601460248201527318985b185b98d9481a5b98dbdb9cda5cdd195b9d60621b6044820152606401610229565b50505050565b600054610100900460ff166110265760405162461bcd60e51b8152600401610229906114ae565b6106b033610da2565b600054610100900460ff166110565760405162461bcd60e51b8152600401610229906114ae565b6001606555565b611065611260565b6000611070846110e9565b9050601281106110b25760405180602001604052806012836110929190611429565b61109d90600a6115f6565b6110a79086611621565b815250915050610cb4565b60405180602001604052808260126110ca9190611429565b6110d590600a6115f6565b6110df9086611602565b9052949350505050565b6001600160a01b038116600090815260976020526040812054808203610cb45760408051600481526024810182526020810180516001600160e01b031663313ce56760e01b179052905160009182916001600160a01b0387169161114c91611643565b600060405180830381855afa9150503d8060008114611187576040519150601f19603f3d011682016040523d82523d6000602084013e61118c565b606091505b509150915081801561119e5750805115155b6111e05760405162461bcd60e51b815260206004820152601360248201527219d95d08191958da5b585b1cc819985a5b1959606a1b6044820152606401610229565b808060200190518101906111f491906114f9565b95945050505050565b611205611260565b61120d611260565b8251845161121a91611254565b81529392505050565b80518251600091101561123857506001610cb4565b81518351101561124b5750600019610cb4565b50600092915050565b6000610ed0828461167e565b6040518060200160405280600081525090565b6001600160a01b038116811461077857600080fd5b60006020828403121561129a57600080fd5b8135610ed081611273565b60008082840360408112156112b957600080fd5b83356112c481611273565b92506020601f19820112156112d857600080fd5b506020830190509250929050565b6000602082840312156112f857600080fd5b5035919050565b6001600160a01b0391909116815260200190565b6020808252825182820181905260009190848201906040850190845b818110156113545783516001600160a01b03168352928401929184019160010161132f565b50909695505050505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6000602082840312156113a757600080fd5b604051602081016001600160401b03811182821017156113d757634e487b7160e01b600052604160045260246000fd5b6040529135825250919050565b6001600160a01b03929092168252602082015260400190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60008282101561143b5761143b611413565b500390565b634e487b7160e01b600052603160045260246000fd5b60006001820161146857611468611413565b5060010190565b60006020828403121561148157600080fd5b81518015158114610ed057600080fd5b6000602082840312156114a357600080fd5b8151610ed081611273565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60006020828403121561150b57600080fd5b5051919050565b600181815b8085111561154d57816000190482111561153357611533611413565b8085161561154057918102915b93841c9390800290611517565b509250929050565b60008261156457506001610cb4565b8161157157506000610cb4565b81600181146115875760028114611591576115ad565b6001915050610cb4565b60ff8411156115a2576115a2611413565b50506001821b610cb4565b5060208310610133831016604e8410600b84101617156115d0575081810a610cb4565b6115da8383611512565b80600019048211156115ee576115ee611413565b029392505050565b6000610ed08383611555565b600081600019048311821515161561161c5761161c611413565b500290565b60008261163e57634e487b7160e01b600052601260045260246000fd5b500490565b6000825160005b81811015611664576020818601810151858301520161164a565b81811115611673576000828501525b509190910192915050565b6000821982111561169157611691611413565b50019056fea26469706673582212205df75432d86869437ec42d7092665855540db18dc4a22115b8a2ea56686bcbca64736f6c634300080d0033",
"linkReferences": {},
"deployedLinkReferences": {}
}

@@ -5,26 +5,21 @@ "use strict";

exports.config = {
BETA: {
API_BASE_URL: "https://api.nftperp.xyz",
TRADING_COMP: {
chainId: 42161,
ch: "0x23046B6bc1972370A06c15f6d4F589B7607caD5E",
chv: "0x43e870F2E26d5415367A30985075F90bBb5a5E9A",
iF: "0x3594FDDdF773e44AbFB2E5E16e59Be401c6eb235",
weth: "0xCFc27f521576afAA8397cdb65c7b52eDDDF93579",
ch: "0x1BBd56e80284B7064B44b2f4Bc494A268E614D36",
chv: "0x50116ee8bC6C75d917E047fAa959398c78119813",
iF: "0x745a2743a5CB63362a1f614C719ff982FB337f25",
weth: "0x6cfbBAdC695fA71909F0191Ee5d6eeb259daF1eE",
amms: {
BAYC: "0x7273c7aE8F597BEfAEDCA07B6491ba6C876c2a89",
MOONBIRDS: "0xb50BedcA449f7F9980c3606e4Fe1FB8F48C6A228",
MAYC: "0x0a85c1a91C817A6836b8a4B706365A73e2BB1225",
DOODLES: "0x904aD4EdAA907ed274AFbafb91804a6D98ab9c4c",
CLONEX: "0xfcB2B0660Fe2eFb49Bbb1330Bf74AdccF18736EB",
},
},
HACKATHON: {
chainId: 421611,
ch: "0x77EdF4f58987DFFE429115C10CDb4bb3c012BFe1",
chv: "0x583ac89476dE4b4Bf1A282B0dff225d3bA1b47ca",
iF: "0x52A4A2ef8DeF1d937145FEd1F2A7223EFA2F6f18",
weth: "0xEBbc3452Cc911591e4F18f3b36727Df45d6bd1f9",
amms: {
BAYC: "0xF34d6dc7f737B59c68854f7a139f71d9e0E37ee5",
MILADY: "0x246A801C1905a8E0FcE3AaB6561966c8BfC3D7bf",
PUNKS: "0xEe4826F21D47A6DEF4c3BaA6633bcec24D7A2375",
AZUKI: "0x70A1Bee795A05F78a7185545c7e6A93D02442F5C",
MAYC: "0xB92c47eBc522cae7edC911e3D62691420FE1E90a",
DOODLES: "0xaC2Eadb88D9E4eEF34452943330f93E9A81De72d",
MOONBIRDS: "0xB25E0D85Df2CAD9D8d3e9B033729634ECd737BF8",
BGAN: "0x92B96d53cead8F3E13BCEe03F1d9691A50194D1a",
GOBBLERS: "0xE56472DDCC9100d933a3D9e1b59c1C63F9f83DD2",
},
},
};
{
"name": "@nftperp/sdk",
"version": "2.0.6",
"version": "3.0.0",
"description": "SDK for nftperp protocol",

@@ -32,2 +32,3 @@ "main": "sdk.js",

"dependencies": {
"axios": "^1.1.3",
"big.js": "^6.2.1",

@@ -34,0 +35,0 @@ "ethers": "^5.6.9"

import { Wallet } from "ethers";
import { Amm, AmmInfo, Instance, PositionDisplay, Side } from "./types";
import { Amm, AmmInfoResponse, CalcFeeResponse, ClosePosTxSummaryResponse, FundingInfoResponse, Instance, PositionResponse, Side, TransactionSummaryResponse } from "./types";
export declare class SDK {

@@ -7,4 +7,2 @@ private readonly _wallet;

private readonly _ch;
private readonly _chv;
private readonly _if;
private readonly _weth;

@@ -21,6 +19,7 @@ /**

/**
* Get mock weth from faucet for paper trading on beta
* @returns `5` mock weth
* use trading comp faucet
* grants 5 `mock weth`
* @returns tx hash
*/
useFaucet(): Promise<string>;
faucet(): Promise<string>;
/**

@@ -31,3 +30,3 @@ * Open a new position

* @param params.side buy or sell
* @param params.margin collateral amount
* @param params.amount collateral amount
* @param params.leverage leverage

@@ -39,3 +38,3 @@ * @returns tx hash

side: Side;
margin: number;
amount: number;
leverage: number;

@@ -63,3 +62,3 @@ slippagePercent?: number;

amm: Amm;
partialClosePercent: number;
closePercent: number;
slippagePercent?: number;

@@ -71,3 +70,3 @@ }): Promise<string>;

* @param params.amm amm eg bayc
* @param params.marginToAdd margin to add
* @param params.amount margin to add
* @returns tx hash

@@ -77,3 +76,3 @@ */

amm: Amm;
marginToAdd: number;
amount: number;
}): Promise<string>;

@@ -84,3 +83,3 @@ /**

* @param params.amm amm eg bayc
* @param params.marginToRemove margin to remove
* @param params.amount margin to remove
* @returns

@@ -90,5 +89,12 @@ */

amm: Amm;
marginToRemove: number;
amount: number;
}): Promise<string>;
/**
* Get all positions
* @returns all positions
*/
getAllPositions(trader?: string): Promise<{
[key in Amm]: PositionResponse;
}>;
/**
* Get position

@@ -98,119 +104,124 @@ * @param amm amm eg bayc

*/
getPosition(amm: Amm, trader?: string): Promise<PositionDisplay>;
getPosition(amm: Amm, trader?: string): Promise<PositionResponse>;
/**
* Get margin ratio. margin ratio = active margin / active notional
* calc fee
* @param params.amm amm eg bayc
* @returns margin ratio
* @param params.amount collateral amount
* @param params.leverage leverage
* @param params.side buy or sell
* @param params.open is opening position?
* @returns fee in `eth`
*/
getMarginRatio(params: {
calcFee(params: {
amm: Amm;
trader?: string;
}): Promise<number>;
amount: number;
leverage: number;
side: Side;
open: boolean;
}): Promise<CalcFeeResponse>;
/**
* Get mark price (nftperp price)
* @param amm amm eg bayc
* @returns mark price
* get open pos tx summary
* @param params.amm amm eg bayc
* @param params.amount collateral amount
* @param params.leverage leverage
* @param params.side buy or sell
* @returns open pos tx summary
*/
getMarkPrice(amm: Amm): Promise<number>;
getOpenPosTxSummary(params: {
amm: Amm;
amount: number;
leverage: number;
side: Side;
}): Promise<TransactionSummaryResponse>;
/**
* Get index price (real price - as per marketplaces)
* @param amm amm eg bayc
* @returns index price
* get open pos tx summary
* @param params.amm amm eg bayc
* @param params.closePercent percent to close
* @returns close pos tx summary
*/
getIndexPrice(amm: Amm): Promise<number>;
getClosePosTxSummary(params: {
amm: Amm;
closePercent?: number;
}): Promise<ClosePosTxSummaryResponse>;
/**
* Get funding details
* get upnl
* @param amm amm eg bayc
* @returns funding period and next funding time, prev funding rate (`wei`)
* @returns upnl in `eth`
*/
getFundingInfo(amm: Amm): Promise<{
fundingPeriod: number;
nextFundingTime: number;
previousFundingPercent: number;
}>;
getUpnl(amm: Amm): Promise<string>;
/**
* Get asset info
* get funding payment
* @param amm amm eg bayc
* @returns Amm Info
* @returns funding payment in `eth`
*/
getAmmInfo(amm: Amm): Promise<AmmInfo>;
getFundingPayment(amm: Amm): Promise<string>;
/**
* Get supported Amms
* @returns Amms
* get liquidation price
* @param amm amm eg bayc
* @returns liquidation price in `eth`
*/
getSupportedAmms(instance: Instance): (keyof typeof Amm)[];
getLiquidationPrice(amm: Amm): Promise<string>;
/**
* get notional longs and shorts
* @returns open interest info in `wei`
* Get margin ratio. margin ratio = active margin / active notional
* @param params.amm amm eg bayc
* @returns margin ratio
*/
private _getOpenInterestInfo;
getMarginRatio(amm: Amm): Promise<string>;
/**
* get spot price
* @returns spot price in `wei`
* get max leverage for amm
* @param amm amm eg bayc
* @returns max leverage
*/
private _getSpotPrice;
getMaxLeverage(amm: Amm): Promise<string>;
/**
* get underlying price
* @returns underlying price in `wei`
* Get mark price (trading price)
* @param amm amm eg bayc
* @returns mark price
*/
private _getUnderlyingPrice;
getMarkPrice(amm: Amm): Promise<string>;
/**
* get trader position
* @returns position (size, margin, notional) in `wei`
* Get index price (oracle price - as per marketplaces)
* @param amm amm eg bayc
* @returns index price
*/
private _getPosition;
getIndexPrice(amm: Amm): Promise<string>;
/**
* get liquidation price
* https://www.notion.so/New-liquidation-price-formula-exact-solution-6fc007bd28134f1397d13c8a6e6c1fbc
*
* @returns liq price in `eth`
* Get funding info
* @param amm amm eg bayc
* @returns funding info
*/
private _getLiquidationPrice;
getFundingInfo(amm: Amm): Promise<FundingInfoResponse>;
/**
* get reserves
* @returns quote asset reserve (y) and base asset reserve (x) in `wei`
* Get mark price twap
* @param amm amm eg bayc
* @returns mark price twap interval
*/
private _getReserves;
getMarkPriceTwap(amm: Amm): Promise<string>;
/**
* get position with funding payment (margin is inclusive of funding)
* @returns position (size, margin, notional) in `wei`
* Get mark price twap interval
* @param amm amm eg bayc
* @returns mark price twap interval
*/
private _getPositionWithFundingPayment;
getMarkPriceTwapinterval(amm: Amm): Promise<string>;
/**
* get margin ratio
* @returns margin ratio in `wei`
* Get amm info
* @param amm amm eg bayc
* @returns amm Info
*/
private _getMarginRatio;
getAmmInfo(amm: Amm): Promise<AmmInfoResponse>;
/**
* get active notional and upnl
* @returns pn and upnl in `wei`
* Get margin ratio. margin ratio = active margin / active notional
* @param params.amm amm eg bayc
* @returns margin ratio
*/
private _getPositionNotionalAndUpnl;
getMaintenanceMarginRatio(amm: Amm): Promise<string>;
/**
* get imr, mmr, plr, lfr
* @returns ratios in `wei`
* Get supported Amms
* @returns Amms
*/
private _getRatios;
getSupportedAmms(instance: Instance): (keyof typeof Amm)[];
/**
* calc fees
* @requires notional in `wei`
* @returns fees in `wei`
*/
private _calcFee;
/**
* get base asset out
* @requires notional in `eth`
* @returns base asset out in `wei`
*/
private _getBaseAssetOut;
/**
* get quote asset out
* @requires size in `wei`
* @returns quote asset out in `wei`
*/
private _getQuoteAssetOut;
/**
* get base asset amount limit
* @requires notional in `eth`
* @returns base asset amount limit in `wei`
* @requires baseAssetOut in `eth`
* @returns base asset amount limit in `eth`
*/

@@ -220,4 +231,5 @@ private _getSlippageBaseAssetAmount;

* get quote asset amount limit
* @requires size in `wei`
* @returns quote asset amount limit `wei`
* @param `side` side of existing position
* @requires outputNotional in `eth`
* @returns quote asset amount limit `eth`
*/

@@ -227,3 +239,3 @@ private _getSlippageQuoteAssetAmount;

* get balance of quote token
* @returns balance in `wei`
* @returns balance in `eth`
*/

@@ -233,3 +245,3 @@ private _getBalance;

* throws if balance below amount
* @requires amount in `wei`
* @requires amount in `eth`
*/

@@ -239,3 +251,3 @@ private _checkBalance;

* allowance of quote token on clearing house
* @returns allowance in `wei`
* @returns allowance in `eth`
*/

@@ -250,3 +262,3 @@ private _getAllowance;

* approves if allowance less than amount
* @requires amount in `wei`
* @requires amount in `eth`
*/

@@ -280,6 +292,2 @@ private _checkAllowance;

/**
* get amm instance to interact with amm
*/
private _getAmmInstance;
/**
* get amm address

@@ -286,0 +294,0 @@ */

@@ -8,8 +8,7 @@ "use strict";

const ethers_1 = require("ethers");
const abis_1 = __importDefault(require("./abis"));
const configDao_1 = require("./utils/configDao");
const format_1 = require("./utils/format");
const api_1 = __importDefault(require("./services/api"));
const types_1 = require("./types");
const abis_1 = __importDefault(require("./abis"));
const big_js_1 = __importDefault(require("big.js"));
const mathUtil_1 = require("./utils/math/mathUtil");
const commonUtil_1 = require("./utils/common/commonUtil");
const configDao_1 = require("./utils/dao/configDao");
class SDK {

@@ -19,4 +18,2 @@ _wallet;

_ch;
_chv;
_if;
_weth;

@@ -31,7 +28,5 @@ /**

void this._validateWalletAndInstance(wallet, instance);
const { ch, chv, iF, weth } = (0, configDao_1.getInstanceConfig)(instance);
this._ch = new ethers_1.Contract(ch, abis_1.default.chAbi, wallet);
this._chv = new ethers_1.Contract(chv, abis_1.default.chvAbi, wallet);
this._if = new ethers_1.Contract(iF, abis_1.default.ifAbi, wallet);
this._weth = new ethers_1.Contract(weth, abis_1.default.mockWethAbi, wallet);
const { ch, weth } = (0, configDao_1.getInstanceConfig)(instance);
this._ch = new ethers_1.Contract(ch, abis_1.default.clearingHouse, wallet);
this._weth = new ethers_1.Contract(weth, abis_1.default.erc20Abi, wallet);
this._wallet = wallet;

@@ -41,10 +36,8 @@ this._instance = instance;

/**
* Get mock weth from faucet for paper trading on beta
* @returns `5` mock weth
* use trading comp faucet
* grants 5 `mock weth`
* @returns tx hash
*/
async useFaucet() {
if (this._instance !== types_1.Instance.BETA) {
(0, commonUtil_1._throw)("faucet is only available for beta instance");
}
const tx = await this._weth.mint();
async faucet() {
const tx = await this._weth.faucet();
return tx.hash;

@@ -57,3 +50,3 @@ }

* @param params.side buy or sell
* @param params.margin collateral amount
* @param params.amount collateral amount
* @param params.leverage leverage

@@ -63,10 +56,9 @@ * @returns tx hash

async openPosition(params) {
const { amm, side, margin, leverage, slippagePercent } = params;
const notional = (0, mathUtil_1.toBig)(margin).mul(leverage);
const fees = await this._calcFee(amm, (0, mathUtil_1.toWei)(notional), side);
const totalCost = (0, mathUtil_1.toWei)(margin).add(fees);
await this._checkBalance(totalCost);
await this._checkAllowance(totalCost);
const slippageAmount = await this._getSlippageBaseAssetAmount(amm, side, notional, slippagePercent);
return await this._openPosition(this._getAmmAddress(amm), side, (0, mathUtil_1.toDecimal)((0, mathUtil_1.toWei)(margin)), (0, mathUtil_1.toDecimal)((0, mathUtil_1.toWei)(leverage)), (0, mathUtil_1.toDecimal)(slippageAmount));
const { amm, side, amount, leverage, slippagePercent } = params;
const trader = await this._getAddress();
const txSummary = await api_1.default.transactionSummary(amm, { amount, leverage, side, trader });
await this._checkBalance((0, format_1.big)(txSummary.totalCost));
await this._checkAllowance((0, format_1.big)(txSummary.totalCost));
const baseAssetAmountLimit = this._getSlippageBaseAssetAmount(side, (0, format_1.big)(txSummary.outputSize), slippagePercent);
return await this._openPosition(this._getAmmAddress(amm), side === types_1.Side.BUY ? 0 : 1, (0, format_1.toDecimalWei)(amount), (0, format_1.toDecimalWei)(leverage), (0, format_1.toDecimalWei)(baseAssetAmountLimit));
}

@@ -81,10 +73,11 @@ /**

const { amm, slippagePercent } = params;
const { size } = await this._getPosition(amm);
if (size.eq(0)) {
(0, commonUtil_1._throw)("no position found");
const { size, trader, side } = await this.getPosition(amm);
if ((0, format_1.big)(size).eq(0)) {
throw new Error("no position found");
}
// closing long is equivalent of shorting
const side = size.gt(0) ? types_1.Side.SELL : types_1.Side.BUY;
const slippageAmount = await this._getSlippageQuoteAssetAmount(amm, side, size, slippagePercent);
return await this._closePosition(this._getAmmAddress(amm), (0, mathUtil_1.toDecimal)(slippageAmount));
const txSummary = await api_1.default.closePosTransactionSummary(amm, { trader, closePercent: 100 });
const quoteAssetAmountLimit = this._getSlippageQuoteAssetAmount(
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
side, (0, format_1.big)(txSummary.outputNotional), slippagePercent);
return await this._closePosition(this._getAmmAddress(amm), (0, format_1.toDecimalWei)(quoteAssetAmountLimit));
}

@@ -99,12 +92,12 @@ /**

async partialClose(params) {
const { amm, partialClosePercent, slippagePercent } = params;
const { size } = await this._getPosition(amm);
if (size.eq(0)) {
(0, commonUtil_1._throw)("no such position");
const { amm, closePercent, slippagePercent } = params;
const { size, trader, side } = await this.getPosition(amm);
if ((0, format_1.big)(size).eq(0)) {
throw new Error("no such position");
}
const side = size.gt(0) ? types_1.Side.SELL : types_1.Side.BUY;
const partialCloseFraction = (0, mathUtil_1.toBig)(partialClosePercent).div(100);
const sizeToClose = size.mul(partialCloseFraction).round(0, 0);
const slippageAmount = await this._getSlippageQuoteAssetAmount(amm, side, sizeToClose, slippagePercent);
return await this._partialClose(this._getAmmAddress(amm), (0, mathUtil_1.toDecimal)((0, mathUtil_1.toWei)(partialCloseFraction)), (0, mathUtil_1.toDecimal)(slippageAmount));
const txSummary = await api_1.default.closePosTransactionSummary(amm, { trader, closePercent });
const quoteAssetAmountLimit = this._getSlippageQuoteAssetAmount(
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
side, (0, format_1.big)(txSummary.outputNotional), slippagePercent);
return await this._partialClose(this._getAmmAddress(amm), (0, format_1.toDecimalWei)(closePercent / 100), (0, format_1.toDecimalWei)(quoteAssetAmountLimit));
}

@@ -115,14 +108,14 @@ /**

* @param params.amm amm eg bayc
* @param params.marginToAdd margin to add
* @param params.amount margin to add
* @returns tx hash
*/
async addMargin(params) {
const { amm, marginToAdd } = params;
const { size } = await this._getPosition(amm);
if (size.eq(0)) {
(0, commonUtil_1._throw)("no position found");
const { amm, amount } = params;
const { size } = await this.getPosition(amm);
if ((0, format_1.big)(size).eq(0)) {
throw new Error("no position found");
}
await this._checkBalance((0, mathUtil_1.toWei)(marginToAdd));
await this._checkAllowance((0, mathUtil_1.toWei)(marginToAdd));
return await this._addMargin(this._getAmmAddress(amm), (0, mathUtil_1.toDecimal)((0, mathUtil_1.toWei)(marginToAdd)));
await this._checkBalance((0, format_1.big)(amount));
await this._checkAllowance((0, format_1.big)(amount));
return await this._addMargin(this._getAmmAddress(amm), (0, format_1.toDecimalWei)(amount));
}

@@ -133,20 +126,26 @@ /**

* @param params.amm amm eg bayc
* @param params.marginToRemove margin to remove
* @param params.amount margin to remove
* @returns
*/
async removeMargin(params) {
const { amm, marginToRemove } = params;
const { size, margin } = await this._getPositionWithFundingPayment(amm);
if (size.eq(0)) {
(0, commonUtil_1._throw)("no position found");
const { amm, amount } = params;
const { size, trader } = await this.getPosition(amm);
if ((0, format_1.big)(size).eq(0)) {
throw new Error("no position found");
}
const { positionNotional, upnl } = await this._getPositionNotionalAndUpnl(amm);
const { mmr } = await this._getRatios(amm);
const newMarginRatio = margin.add(upnl).sub((0, mathUtil_1.toWei)(marginToRemove)).div(positionNotional);
if (newMarginRatio.lt(mmr)) {
(0, commonUtil_1._throw)("position goes below mmr after removal. try removing a small amount to keep above mmr");
const freeCollateral = await api_1.default.freeCollateral(amm, trader);
if ((0, format_1.big)(amount).gt(freeCollateral)) {
throw new Error("remove amount beyond free collateral");
}
return await this._removeMargin(this._getAmmAddress(amm), (0, mathUtil_1.toDecimal)((0, mathUtil_1.toWei)(marginToRemove)));
return await this._removeMargin(this._getAmmAddress(amm), (0, format_1.toDecimalWei)(amount));
}
/**
* Get all positions
* @returns all positions
*/
async getAllPositions(trader) {
const positions = await api_1.default.positions(trader ?? (await this._getAddress()));
return positions;
}
/**
* Get position

@@ -157,319 +156,222 @@ * @param amm amm eg bayc

async getPosition(amm, trader) {
const { size, margin, openNotional } = await this._getPosition(amm, trader);
if (size.eq(0)) {
return {
size: 0,
margin: 0,
leverage: 0,
notional: 0,
pnl: 0,
fundingPayment: 0,
entryPrice: null,
liquidationPrice: null,
};
}
const liquidationPrice = await this._getLiquidationPrice(amm, trader);
const { upnl } = await this._getPositionNotionalAndUpnl(amm, trader);
const { margin: marginWithFunding } = await this._getPositionWithFundingPayment(amm, trader);
const pnl = (0, mathUtil_1.format)((0, mathUtil_1.fromWei)(upnl), 4);
const fundingPayment = (0, mathUtil_1.format)((0, mathUtil_1.fromWei)(marginWithFunding.sub(margin)), 4);
return {
size: (0, mathUtil_1.format)((0, mathUtil_1.fromWei)(size)),
margin: (0, mathUtil_1.format)((0, mathUtil_1.fromWei)(margin)),
leverage: (0, mathUtil_1.format)(openNotional.div(margin)),
notional: (0, mathUtil_1.format)((0, mathUtil_1.fromWei)(openNotional)),
pnl: pnl === 0 ? 0 : pnl,
fundingPayment: fundingPayment === 0 ? 0 : fundingPayment,
entryPrice: (0, mathUtil_1.format)(openNotional.div(size.abs())),
liquidationPrice: (0, mathUtil_1.format)(liquidationPrice),
};
const position = await api_1.default.position(amm, trader ?? (await this._getAddress()));
return position;
}
/**
* Get margin ratio. margin ratio = active margin / active notional
* calc fee
* @param params.amm amm eg bayc
* @returns margin ratio
* @param params.amount collateral amount
* @param params.leverage leverage
* @param params.side buy or sell
* @param params.open is opening position?
* @returns fee in `eth`
*/
async getMarginRatio(params) {
const { amm, trader } = params;
const mr = await this._getMarginRatio(amm, trader);
return (0, mathUtil_1.format)((0, mathUtil_1.fromWei)(mr), undefined, true);
async calcFee(params) {
const { amm, amount, leverage, side, open } = params;
const feeData = await api_1.default.calcFee(amm, { amount, leverage, side, open });
return feeData;
}
/**
* Get mark price (nftperp price)
* @param amm amm eg bayc
* @returns mark price
* get open pos tx summary
* @param params.amm amm eg bayc
* @param params.amount collateral amount
* @param params.leverage leverage
* @param params.side buy or sell
* @returns open pos tx summary
*/
async getMarkPrice(amm) {
const spotPrice = await this._getSpotPrice(amm);
return (0, mathUtil_1.format)((0, mathUtil_1.fromWei)(spotPrice));
async getOpenPosTxSummary(params) {
const { amm, amount, leverage, side } = params;
const trader = await this._getAddress();
const txSummary = await api_1.default.transactionSummary(amm, { amount, leverage, side, trader });
return txSummary;
}
/**
* Get index price (real price - as per marketplaces)
* @param amm amm eg bayc
* @returns index price
* get open pos tx summary
* @param params.amm amm eg bayc
* @param params.closePercent percent to close
* @returns close pos tx summary
*/
async getIndexPrice(amm) {
const indexPrice = await this._getUnderlyingPrice(amm);
return (0, mathUtil_1.format)((0, mathUtil_1.fromWei)(indexPrice));
async getClosePosTxSummary(params) {
const { amm, closePercent } = params;
const trader = await this._getAddress();
const txSummary = await api_1.default.closePosTransactionSummary(amm, {
trader,
closePercent: closePercent ?? 100,
});
return txSummary;
}
/**
* Get funding details
* get upnl
* @param amm amm eg bayc
* @returns funding period and next funding time, prev funding rate (`wei`)
* @returns upnl in `eth`
*/
async getFundingInfo(amm) {
const ammInstance = this._getAmmInstance(amm);
const fundingPeriod = await ammInstance.fundingPeriod();
const nextFundingTime = await ammInstance.nextFundingTime();
const previousFundingRate = await ammInstance.fundingRate();
return {
fundingPeriod: (0, mathUtil_1.format)((0, mathUtil_1.toBig)(fundingPeriod)),
nextFundingTime: (0, mathUtil_1.format)((0, mathUtil_1.toBig)(nextFundingTime)),
previousFundingPercent: (0, mathUtil_1.format)((0, mathUtil_1.fromWei)(previousFundingRate).mul(100)),
};
async getUpnl(amm) {
const trader = await this._getAddress();
const { size, unrealizedPnl } = await api_1.default.position(amm, trader);
if ((0, format_1.big)(size).eq(0)) {
throw new Error("no position found");
}
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
return unrealizedPnl;
}
/**
* Get asset info
* get funding payment
* @param amm amm eg bayc
* @returns Amm Info
* @returns funding payment in `eth`
*/
async getAmmInfo(amm) {
const markPrice = await this._getSpotPrice(amm);
const indexPrice = await this._getUnderlyingPrice(amm);
const { nextFundingTime, previousFundingPercent } = await this.getFundingInfo(amm);
const { openInterest, openInterestLongs, openInterestShorts } = await this._getOpenInterestInfo(amm);
const { imr, mmr, lfr } = await this._getRatios(amm);
return {
amm,
markPrice: (0, mathUtil_1.format)((0, mathUtil_1.fromWei)(markPrice)),
indexPrice: (0, mathUtil_1.format)((0, mathUtil_1.fromWei)(indexPrice)),
maxLeverage: (0, mathUtil_1.format)((0, mathUtil_1.toWei)(1).div(imr)),
maintenanceMarginPercent: (0, mathUtil_1.format)((0, mathUtil_1.fromWei)(mmr).mul(100)),
fullLiquidationPercent: (0, mathUtil_1.format)((0, mathUtil_1.fromWei)(lfr).mul(100)),
previousFundingPercent,
nextFundingTime,
openInterest: (0, mathUtil_1.format)((0, mathUtil_1.fromWei)(openInterest)),
openInterestLongs: (0, mathUtil_1.format)((0, mathUtil_1.fromWei)(openInterestLongs)),
openInterestShorts: (0, mathUtil_1.format)((0, mathUtil_1.fromWei)(openInterestShorts)),
};
async getFundingPayment(amm) {
const trader = await this._getAddress();
const { size, fundingPayment } = await api_1.default.position(amm, trader);
if ((0, format_1.big)(size).eq(0)) {
throw new Error("no position found");
}
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
return fundingPayment;
}
/**
* Get supported Amms
* @returns Amms
* get liquidation price
* @param amm amm eg bayc
* @returns liquidation price in `eth`
*/
getSupportedAmms(instance) {
const { amms } = (0, configDao_1.getInstanceConfig)(instance);
return Object.keys(amms);
async getLiquidationPrice(amm) {
const trader = await this._getAddress();
const { size, liquidationPrice } = await api_1.default.position(amm, trader);
if ((0, format_1.big)(size).eq(0)) {
throw new Error("no position found");
}
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
return liquidationPrice;
}
//
// PRIVATE
//
/**
* get notional longs and shorts
* @returns open interest info in `wei`
* Get margin ratio. margin ratio = active margin / active notional
* @param params.amm amm eg bayc
* @returns margin ratio
*/
async _getOpenInterestInfo(amm) {
const { openInterest, openInterestLongs, openInterestShorts } = await this._ch.openInterestMap(this._getAmmAddress(amm));
return {
openInterestLongs: (0, mathUtil_1.fromDecimal)(openInterestLongs),
openInterestShorts: (0, mathUtil_1.fromDecimal)(openInterestShorts),
openInterest: (0, mathUtil_1.fromDecimal)(openInterest),
};
async getMarginRatio(amm) {
const trader = await this._getAddress();
const { size, marginRatio } = await api_1.default.position(amm, trader);
if ((0, format_1.big)(size).eq(0)) {
throw new Error("no position found");
}
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
return marginRatio;
}
/**
* get spot price
* @returns spot price in `wei`
* get max leverage for amm
* @param amm amm eg bayc
* @returns max leverage
*/
async _getSpotPrice(amm) {
const ammInstance = this._getAmmInstance(amm);
const spotPrice = await ammInstance.getSpotPrice();
return (0, mathUtil_1.fromDecimal)(spotPrice);
async getMaxLeverage(amm) {
const ammInfo = await api_1.default.ammInfo(amm);
return (0, format_1.stringify)((0, format_1.big)(1).div(ammInfo.initMarginRatio));
}
/**
* get underlying price
* @returns underlying price in `wei`
* Get mark price (trading price)
* @param amm amm eg bayc
* @returns mark price
*/
async _getUnderlyingPrice(amm) {
const ammInstance = this._getAmmInstance(amm);
const underlyingPrice = await ammInstance.getUnderlyingPrice();
return (0, mathUtil_1.fromDecimal)(underlyingPrice);
async getMarkPrice(amm) {
const markPrice = await api_1.default.markPrice(amm);
return markPrice;
}
/**
* get trader position
* @returns position (size, margin, notional) in `wei`
* Get index price (oracle price - as per marketplaces)
* @param amm amm eg bayc
* @returns index price
*/
async _getPosition(amm, trader) {
const { size, margin, openNotional } = await this._ch.getPosition(this._getAmmAddress(amm), trader ?? (await this._getAddress()));
return {
size: (0, mathUtil_1.fromDecimal)(size),
margin: (0, mathUtil_1.fromDecimal)(margin),
openNotional: (0, mathUtil_1.fromDecimal)(openNotional),
};
async getIndexPrice(amm) {
const indexPrice = await api_1.default.indexPrice(amm);
return indexPrice;
}
/**
* get liquidation price
* https://www.notion.so/New-liquidation-price-formula-exact-solution-6fc007bd28134f1397d13c8a6e6c1fbc
*
* @returns liq price in `eth`
* Get funding info
* @param amm amm eg bayc
* @returns funding info
*/
async _getLiquidationPrice(amm, trader) {
const position = await this._getPositionWithFundingPayment(amm, trader);
const size = (0, mathUtil_1.fromWei)(position.size);
if (size.eq(0))
return (0, mathUtil_1.toBig)(0);
const mr = (0, mathUtil_1.fromWei)(await this._getMarginRatio(amm, trader));
const leverage = (0, mathUtil_1.toBig)(1).div(mr);
if (leverage.lt(1.0001))
return (0, mathUtil_1.toBig)(0);
const ratios = await this._getRatios(amm);
const reserves = await this._getReserves(amm);
const margin = (0, mathUtil_1.fromWei)(position.margin);
const openNotional = (0, mathUtil_1.fromWei)(position.openNotional);
const mmr = (0, mathUtil_1.fromWei)(ratios.mmr);
const k = (0, mathUtil_1.fromWei)(reserves.quoteAssetReserve).mul((0, mathUtil_1.fromWei)(reserves.baseAssetReserve));
const pn = size.gt(0)
? margin.minus(openNotional).div(mmr.minus(1))
: margin.add(openNotional).div(mmr.add(1));
const x = size.gte(0)
? size
.mul(-0.5)
.add(size.mul(pn).pow(2).add(pn.mul(k).mul(size).mul(4)).sqrt().div(pn.mul(2)))
: size
.mul(-0.5)
.add(size.mul(pn).pow(2).minus(pn.mul(k).mul(size).mul(4)).sqrt().div(pn.mul(-2)));
return k.div(x.pow(2));
async getFundingInfo(amm) {
const fundingInfo = await api_1.default.fundingInfo(amm);
return fundingInfo;
}
/**
* get reserves
* @returns quote asset reserve (y) and base asset reserve (x) in `wei`
* Get mark price twap
* @param amm amm eg bayc
* @returns mark price twap interval
*/
async _getReserves(amm) {
const ammInstance = this._getAmmInstance(amm);
const [quoteAssetReserve, baseAssetReserve] = await ammInstance.getReserves();
return {
quoteAssetReserve: (0, mathUtil_1.fromDecimal)(quoteAssetReserve),
baseAssetReserve: (0, mathUtil_1.fromDecimal)(baseAssetReserve),
};
async getMarkPriceTwap(amm) {
const markPriceTwap = await api_1.default.markPriceTwap(amm);
return markPriceTwap;
}
/**
* get position with funding payment (margin is inclusive of funding)
* @returns position (size, margin, notional) in `wei`
* Get mark price twap interval
* @param amm amm eg bayc
* @returns mark price twap interval
*/
async _getPositionWithFundingPayment(amm, trader) {
const { size, margin, openNotional } = await this._chv.getPersonalPositionWithFundingPayment(this._getAmmAddress(amm), trader ?? (await this._getAddress()));
return {
size: (0, mathUtil_1.fromDecimal)(size),
margin: (0, mathUtil_1.fromDecimal)(margin),
openNotional: (0, mathUtil_1.fromDecimal)(openNotional),
};
async getMarkPriceTwapinterval(amm) {
const markPriceTwapInterval = await api_1.default.markPriceTwapInterval(amm);
return markPriceTwapInterval;
}
/**
* get margin ratio
* @returns margin ratio in `wei`
* Get amm info
* @param amm amm eg bayc
* @returns amm Info
*/
async _getMarginRatio(amm, trader) {
const marginRatio = await this._ch.getMarginRatio(this._getAmmAddress(amm), trader ?? (await this._getAddress()));
return (0, mathUtil_1.fromDecimal)(marginRatio);
async getAmmInfo(amm) {
const ammInfo = await api_1.default.ammInfo(amm);
return ammInfo;
}
/**
* get active notional and upnl
* @returns pn and upnl in `wei`
* Get margin ratio. margin ratio = active margin / active notional
* @param params.amm amm eg bayc
* @returns margin ratio
*/
async _getPositionNotionalAndUpnl(amm, trader) {
const _ = await this._ch.getPositionNotionalAndUnrealizedPnl(this._getAmmAddress(amm), trader ?? (await this._getAddress()), 0);
return {
positionNotional: (0, mathUtil_1.fromDecimal)(_.positionNotional),
upnl: (0, mathUtil_1.fromDecimal)(_.unrealizedPnl),
};
async getMaintenanceMarginRatio(amm) {
const { maintenanceMarginRatio } = await api_1.default.ammInfo(amm);
return maintenanceMarginRatio;
}
/**
* get imr, mmr, plr, lfr
* @returns ratios in `wei`
* Get supported Amms
* @returns Amms
*/
async _getRatios(amm) {
const ammInstance = this._getAmmInstance(amm);
const ratios = await ammInstance.getRatios();
return {
imr: (0, mathUtil_1.fromDecimal)(ratios.initMarginRatio),
mmr: (0, mathUtil_1.fromDecimal)(ratios.maintenanceMarginRatio),
plr: (0, mathUtil_1.fromDecimal)(ratios.partialLiquidationRatio),
lfr: (0, mathUtil_1.fromDecimal)(ratios.liquidationFeeRatio),
};
getSupportedAmms(instance) {
const { amms } = (0, configDao_1.getInstanceConfig)(instance);
return Object.keys(amms);
}
//
// PRIVATE
//
/**
* calc fees
* @requires notional in `wei`
* @returns fees in `wei`
*/
async _calcFee(amm, notional, side) {
const ammInstance = this._getAmmInstance(amm);
const fees = await ammInstance.calcFee((0, mathUtil_1.toDecimal)(notional), side);
return (0, mathUtil_1.fromDecimal)(fees[0]).add((0, mathUtil_1.fromDecimal)(fees[1]));
}
/**
* get base asset out
* @requires notional in `eth`
* @returns base asset out in `wei`
*/
async _getBaseAssetOut(amm, dir, notional) {
const ammInstance = this._getAmmInstance(amm);
const baseAssetOut = await ammInstance.getInputPrice(dir, (0, mathUtil_1.toDecimal)((0, mathUtil_1.toWei)(notional)));
return (0, mathUtil_1.fromDecimal)(baseAssetOut);
}
/**
* get quote asset out
* @requires size in `wei`
* @returns quote asset out in `wei`
*/
async _getQuoteAssetOut(amm, dir, size) {
const ammInstance = this._getAmmInstance(amm);
const quoteAssetOut = await ammInstance.getOutputPrice(dir, (0, mathUtil_1.toDecimal)(size));
return (0, mathUtil_1.fromDecimal)(quoteAssetOut);
}
/**
* get base asset amount limit
* @requires notional in `eth`
* @returns base asset amount limit in `wei`
* @requires baseAssetOut in `eth`
* @returns base asset amount limit in `eth`
*/
async _getSlippageBaseAssetAmount(amm, side, notional, slippagePercent) {
if (!slippagePercent) {
return (0, mathUtil_1.toBig)(0);
}
// direction of quote
const dir = side === types_1.Side.BUY ? types_1.DirectionOfAsset.ADD_TO_AMM : types_1.DirectionOfAsset.REMOVE_FROM_AMM;
const baseAssetOut = await this._getBaseAssetOut(amm, dir, notional);
const slippageFraction = (0, big_js_1.default)(slippagePercent).div(100);
_getSlippageBaseAssetAmount(side, baseAssetOut, slippagePercent = 1) {
const slippageAmount = baseAssetOut.mul(slippagePercent).div(100);
if (side === types_1.Side.BUY) {
return baseAssetOut.mul((0, mathUtil_1.toBig)(1).sub(slippageFraction)).round(0, 0); // round down
return baseAssetOut.sub(slippageAmount).round(0, 0);
}
return baseAssetOut.mul((0, mathUtil_1.toBig)(1).add(slippageFraction)).round(0, 1); // round up
return baseAssetOut.add(slippageAmount).round(0, 0);
}
/**
* get quote asset amount limit
* @requires size in `wei`
* @returns quote asset amount limit `wei`
* @param `side` side of existing position
* @requires outputNotional in `eth`
* @returns quote asset amount limit `eth`
*/
async _getSlippageQuoteAssetAmount(amm, side, size, slippagePercent) {
if (!slippagePercent) {
return (0, mathUtil_1.toBig)(0);
_getSlippageQuoteAssetAmount(side, outputNotional, slippagePercent = 1) {
const slippageAmount = outputNotional.mul(slippagePercent).div(100);
if (side === types_1.Side.BUY) {
return outputNotional.sub(slippageAmount).round(0, 0);
}
// direction of base
const dir = side === types_1.Side.SELL ? types_1.DirectionOfAsset.ADD_TO_AMM : types_1.DirectionOfAsset.REMOVE_FROM_AMM;
const quoteAssetOut = await this._getQuoteAssetOut(amm, dir, size);
const slippageFraction = (0, big_js_1.default)(slippagePercent).div(100);
if (side === types_1.Side.SELL) {
return quoteAssetOut.mul((0, mathUtil_1.toBig)(1).sub(slippageFraction)).round(0, 0);
}
return quoteAssetOut.mul((0, mathUtil_1.toBig)(1).add(slippageFraction)).round(0, 1);
return outputNotional.add(slippageAmount).round(0, 0);
}
/**
* get balance of quote token
* @returns balance in `wei`
* @returns balance in `eth`
*/
async _getBalance() {
return (0, mathUtil_1.toBig)(await this._weth.balanceOf(await this._getAddress()));
return (0, format_1.fromWei)(await this._weth.balanceOf(await this._getAddress()));
}
/**
* throws if balance below amount
* @requires amount in `wei`
* @requires amount in `eth`
*/

@@ -479,3 +381,3 @@ async _checkBalance(amount) {

if (balance.lt(amount)) {
(0, commonUtil_1._throw)(`insufficient balance, required: ${(0, mathUtil_1.format)((0, mathUtil_1.fromWei)(amount))}`);
throw new Error(`insufficient balance, required: ${(0, format_1.stringify)(amount)}`);
}

@@ -485,6 +387,6 @@ }

* allowance of quote token on clearing house
* @returns allowance in `wei`
* @returns allowance in `eth`
*/
async _getAllowance() {
return (0, mathUtil_1.toBig)(await this._weth.allowance(await this._getAddress(), this._ch.address));
return (0, format_1.fromWei)(await this._weth.allowance(await this._getAddress(), this._ch.address));
}

@@ -501,3 +403,3 @@ /**

* approves if allowance less than amount
* @requires amount in `wei`
* @requires amount in `eth`
*/

@@ -515,3 +417,3 @@ async _checkAllowance(amount) {

async _openPosition(amm, side, margin, leverage, baseAssetAmountLimit) {
const tx = await this._ch.openPosition(amm, side, margin, leverage, baseAssetAmountLimit, false);
const tx = await this._ch.openPosition(amm, side, margin, leverage, baseAssetAmountLimit);
return tx.hash;

@@ -524,3 +426,3 @@ }

async _closePosition(amm, quoteAssetAmountLimit) {
const tx = await this._ch.closePosition(amm, quoteAssetAmountLimit, false);
const tx = await this._ch.closePosition(amm, quoteAssetAmountLimit);
return tx.hash;

@@ -533,3 +435,3 @@ }

async _partialClose(amm, partialCloseRatio, quoteAssetAmountLimit) {
const tx = await this._ch.partialClose(amm, partialCloseRatio, quoteAssetAmountLimit, false);
const tx = await this._ch.partialClose(amm, partialCloseRatio, quoteAssetAmountLimit);
return tx.hash;

@@ -554,8 +456,2 @@ }

/**
* get amm instance to interact with amm
*/
_getAmmInstance(amm) {
return new ethers_1.Contract(this._getAmmAddress(amm), abis_1.default.ammAbi, this._wallet);
}
/**
* get amm address

@@ -570,5 +466,8 @@ */

async _validateWalletAndInstance(wallet, instance) {
if (!wallet.provider) {
throw new Error("wallet has no provider attached");
}
const { chainId } = await wallet.provider.getNetwork();
if (chainId !== (0, configDao_1.getInstanceConfig)(instance).chainId) {
(0, commonUtil_1._throw)("provider rpc and instance do not match");
throw new Error("provider rpc and instance do not match");
}

@@ -582,3 +481,3 @@ }

if (!addy)
(0, commonUtil_1._throw)("signer has no account attached");
throw new Error("signer has no address attached");
return addy;

@@ -585,0 +484,0 @@ }

@@ -26,3 +26,4 @@ import type { BaseContract, BigNumber, BigNumberish, BytesLike, CallOverrides, ContractTransaction, Overrides, PopulatedTransaction, Signer, utils } from "ethers";

openNotional: Decimal.DecimalStruct;
lastUpdatedCumulativePremiumFraction: SignedDecimal.SignedDecimalStruct;
lastUpdatedCumulativePremiumFractionLong: SignedDecimal.SignedDecimalStruct;
lastUpdatedCumulativePremiumFractionShort: SignedDecimal.SignedDecimalStruct;
blockNumber: PromiseOrValue<BigNumberish>;

@@ -35,2 +36,3 @@ };

SignedDecimal.SignedDecimalStructOutput,
SignedDecimal.SignedDecimalStructOutput,
BigNumber

@@ -41,3 +43,4 @@ ] & {

openNotional: Decimal.DecimalStructOutput;
lastUpdatedCumulativePremiumFraction: SignedDecimal.SignedDecimalStructOutput;
lastUpdatedCumulativePremiumFractionLong: SignedDecimal.SignedDecimalStructOutput;
lastUpdatedCumulativePremiumFractionShort: SignedDecimal.SignedDecimalStructOutput;
blockNumber: BigNumber;

@@ -49,9 +52,6 @@ };

"addMargin(address,(uint256))": FunctionFragment;
"backstopLiquidityProviderMap(address)": FunctionFragment;
"calculateAmmPnlK(address,(uint256))": FunctionFragment;
"calculateAmmPnlY(address,(int256))": FunctionFragment;
"closePosition(address,(uint256),bool)": FunctionFragment;
"feePool()": FunctionFragment;
"feeToken()": FunctionFragment;
"feeTokenStatus()": FunctionFragment;
"closePosition(address,(uint256))": FunctionFragment;
"cumulativePremiumFractionLong(address,uint256)": FunctionFragment;
"cumulativePremiumFractionShort(address,uint256)": FunctionFragment;
"fundingRateDeltaCapRatio()": FunctionFragment;
"getLatestCumulativePremiumFraction(address)": FunctionFragment;

@@ -61,43 +61,30 @@ "getMarginRatio(address,address)": FunctionFragment;

"getPositionNotionalAndUnrealizedPnl(address,address,uint8)": FunctionFragment;
"getUnadjustedPosition(address,address)": FunctionFragment;
"initialize(address)": FunctionFragment;
"initialize(address,uint256)": FunctionFragment;
"insuranceFund()": FunctionFragment;
"liquidate(address,address)": FunctionFragment;
"liquidateWithSlippage(address,address,(uint256))": FunctionFragment;
"liquidationFeeRatio()": FunctionFragment;
"openInterestMap(address)": FunctionFragment;
"openPosition(address,uint8,(uint256),(uint256),(uint256),bool)": FunctionFragment;
"openInterestNotionalMap(address)": FunctionFragment;
"openPosition(address,uint8,(uint256),(uint256),(uint256))": FunctionFragment;
"owner()": FunctionFragment;
"partialClose(address,(uint256),(uint256),bool)": FunctionFragment;
"partialLiquidationRatio()": FunctionFragment;
"partialClose(address,(uint256),(uint256))": FunctionFragment;
"pause()": FunctionFragment;
"paused()": FunctionFragment;
"payFunding(address)": FunctionFragment;
"positionMap(address,address)": FunctionFragment;
"removeMargin(address,(uint256))": FunctionFragment;
"renounceOwnership()": FunctionFragment;
"repegAmmK(address,(uint256))": FunctionFragment;
"repegAmmY(address,(uint256))": FunctionFragment;
"repegBot()": FunctionFragment;
"repegFeesTotal()": FunctionFragment;
"setBackstopLiquidityProvider(address,bool)": FunctionFragment;
"setFeeToken(address)": FunctionFragment;
"setFeeTokenStatus(uint8)": FunctionFragment;
"setRepegBot(address)": FunctionFragment;
"setTollPool(address)": FunctionFragment;
"repegBots(address)": FunctionFragment;
"repegLiquidityDepth(address,(uint256))": FunctionFragment;
"repegPrice(address)": FunctionFragment;
"setRepegBot(address,address)": FunctionFragment;
"settleFunding(address)": FunctionFragment;
"tollMap(address)": FunctionFragment;
"totalPositionSizeMap(address)": FunctionFragment;
"transferOwnership(address)": FunctionFragment;
"unpause()": FunctionFragment;
};
getFunction(nameOrSignatureOrTopic: "addMargin" | "backstopLiquidityProviderMap" | "calculateAmmPnlK" | "calculateAmmPnlY" | "closePosition" | "feePool" | "feeToken" | "feeTokenStatus" | "getLatestCumulativePremiumFraction" | "getMarginRatio" | "getPosition" | "getPositionNotionalAndUnrealizedPnl" | "getUnadjustedPosition" | "initialize" | "insuranceFund" | "liquidate" | "liquidateWithSlippage" | "liquidationFeeRatio" | "openInterestMap" | "openPosition" | "owner" | "partialClose" | "partialLiquidationRatio" | "pause" | "paused" | "payFunding" | "removeMargin" | "renounceOwnership" | "repegAmmK" | "repegAmmY" | "repegBot" | "repegFeesTotal" | "setBackstopLiquidityProvider" | "setFeeToken" | "setFeeTokenStatus" | "setRepegBot" | "setTollPool" | "transferOwnership" | "unpause"): FunctionFragment;
getFunction(nameOrSignatureOrTopic: "addMargin" | "closePosition" | "cumulativePremiumFractionLong" | "cumulativePremiumFractionShort" | "fundingRateDeltaCapRatio" | "getLatestCumulativePremiumFraction" | "getMarginRatio" | "getPosition" | "getPositionNotionalAndUnrealizedPnl" | "initialize" | "insuranceFund" | "liquidate" | "openInterestNotionalMap" | "openPosition" | "owner" | "partialClose" | "pause" | "paused" | "positionMap" | "removeMargin" | "renounceOwnership" | "repegBots" | "repegLiquidityDepth" | "repegPrice" | "setRepegBot" | "settleFunding" | "tollMap" | "totalPositionSizeMap" | "transferOwnership" | "unpause"): FunctionFragment;
encodeFunctionData(functionFragment: "addMargin", values: [PromiseOrValue<string>, Decimal.DecimalStruct]): string;
encodeFunctionData(functionFragment: "backstopLiquidityProviderMap", values: [PromiseOrValue<string>]): string;
encodeFunctionData(functionFragment: "calculateAmmPnlK", values: [PromiseOrValue<string>, Decimal.DecimalStruct]): string;
encodeFunctionData(functionFragment: "calculateAmmPnlY", values: [PromiseOrValue<string>, SignedDecimal.SignedDecimalStruct]): string;
encodeFunctionData(functionFragment: "closePosition", values: [
PromiseOrValue<string>,
Decimal.DecimalStruct,
PromiseOrValue<boolean>
]): string;
encodeFunctionData(functionFragment: "feePool", values?: undefined): string;
encodeFunctionData(functionFragment: "feeToken", values?: undefined): string;
encodeFunctionData(functionFragment: "feeTokenStatus", values?: undefined): string;
encodeFunctionData(functionFragment: "closePosition", values: [PromiseOrValue<string>, Decimal.DecimalStruct]): string;
encodeFunctionData(functionFragment: "cumulativePremiumFractionLong", values: [PromiseOrValue<string>, PromiseOrValue<BigNumberish>]): string;
encodeFunctionData(functionFragment: "cumulativePremiumFractionShort", values: [PromiseOrValue<string>, PromiseOrValue<BigNumberish>]): string;
encodeFunctionData(functionFragment: "fundingRateDeltaCapRatio", values?: undefined): string;
encodeFunctionData(functionFragment: "getLatestCumulativePremiumFraction", values: [PromiseOrValue<string>]): string;

@@ -111,13 +98,6 @@ encodeFunctionData(functionFragment: "getMarginRatio", values: [PromiseOrValue<string>, PromiseOrValue<string>]): string;

]): string;
encodeFunctionData(functionFragment: "getUnadjustedPosition", values: [PromiseOrValue<string>, PromiseOrValue<string>]): string;
encodeFunctionData(functionFragment: "initialize", values: [PromiseOrValue<string>]): string;
encodeFunctionData(functionFragment: "initialize", values: [PromiseOrValue<string>, PromiseOrValue<BigNumberish>]): string;
encodeFunctionData(functionFragment: "insuranceFund", values?: undefined): string;
encodeFunctionData(functionFragment: "liquidate", values: [PromiseOrValue<string>, PromiseOrValue<string>]): string;
encodeFunctionData(functionFragment: "liquidateWithSlippage", values: [
PromiseOrValue<string>,
PromiseOrValue<string>,
Decimal.DecimalStruct
]): string;
encodeFunctionData(functionFragment: "liquidationFeeRatio", values?: undefined): string;
encodeFunctionData(functionFragment: "openInterestMap", values: [PromiseOrValue<string>]): string;
encodeFunctionData(functionFragment: "openInterestNotionalMap", values: [PromiseOrValue<string>]): string;
encodeFunctionData(functionFragment: "openPosition", values: [

@@ -128,4 +108,3 @@ PromiseOrValue<string>,

Decimal.DecimalStruct,
Decimal.DecimalStruct,
PromiseOrValue<boolean>
Decimal.DecimalStruct
]): string;

@@ -136,30 +115,23 @@ encodeFunctionData(functionFragment: "owner", values?: undefined): string;

Decimal.DecimalStruct,
Decimal.DecimalStruct,
PromiseOrValue<boolean>
Decimal.DecimalStruct
]): string;
encodeFunctionData(functionFragment: "partialLiquidationRatio", values?: undefined): string;
encodeFunctionData(functionFragment: "pause", values?: undefined): string;
encodeFunctionData(functionFragment: "paused", values?: undefined): string;
encodeFunctionData(functionFragment: "payFunding", values: [PromiseOrValue<string>]): string;
encodeFunctionData(functionFragment: "positionMap", values: [PromiseOrValue<string>, PromiseOrValue<string>]): string;
encodeFunctionData(functionFragment: "removeMargin", values: [PromiseOrValue<string>, Decimal.DecimalStruct]): string;
encodeFunctionData(functionFragment: "renounceOwnership", values?: undefined): string;
encodeFunctionData(functionFragment: "repegAmmK", values: [PromiseOrValue<string>, Decimal.DecimalStruct]): string;
encodeFunctionData(functionFragment: "repegAmmY", values: [PromiseOrValue<string>, Decimal.DecimalStruct]): string;
encodeFunctionData(functionFragment: "repegBot", values?: undefined): string;
encodeFunctionData(functionFragment: "repegFeesTotal", values?: undefined): string;
encodeFunctionData(functionFragment: "setBackstopLiquidityProvider", values: [PromiseOrValue<string>, PromiseOrValue<boolean>]): string;
encodeFunctionData(functionFragment: "setFeeToken", values: [PromiseOrValue<string>]): string;
encodeFunctionData(functionFragment: "setFeeTokenStatus", values: [PromiseOrValue<BigNumberish>]): string;
encodeFunctionData(functionFragment: "setRepegBot", values: [PromiseOrValue<string>]): string;
encodeFunctionData(functionFragment: "setTollPool", values: [PromiseOrValue<string>]): string;
encodeFunctionData(functionFragment: "repegBots", values: [PromiseOrValue<string>]): string;
encodeFunctionData(functionFragment: "repegLiquidityDepth", values: [PromiseOrValue<string>, Decimal.DecimalStruct]): string;
encodeFunctionData(functionFragment: "repegPrice", values: [PromiseOrValue<string>]): string;
encodeFunctionData(functionFragment: "setRepegBot", values: [PromiseOrValue<string>, PromiseOrValue<string>]): string;
encodeFunctionData(functionFragment: "settleFunding", values: [PromiseOrValue<string>]): string;
encodeFunctionData(functionFragment: "tollMap", values: [PromiseOrValue<string>]): string;
encodeFunctionData(functionFragment: "totalPositionSizeMap", values: [PromiseOrValue<string>]): string;
encodeFunctionData(functionFragment: "transferOwnership", values: [PromiseOrValue<string>]): string;
encodeFunctionData(functionFragment: "unpause", values?: undefined): string;
decodeFunctionResult(functionFragment: "addMargin", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "backstopLiquidityProviderMap", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "calculateAmmPnlK", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "calculateAmmPnlY", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "closePosition", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "feePool", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "feeToken", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "feeTokenStatus", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "cumulativePremiumFractionLong", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "cumulativePremiumFractionShort", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "fundingRateDeltaCapRatio", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "getLatestCumulativePremiumFraction", data: BytesLike): Result;

@@ -169,32 +141,25 @@ decodeFunctionResult(functionFragment: "getMarginRatio", data: BytesLike): Result;

decodeFunctionResult(functionFragment: "getPositionNotionalAndUnrealizedPnl", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "getUnadjustedPosition", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "initialize", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "insuranceFund", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "liquidate", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "liquidateWithSlippage", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "liquidationFeeRatio", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "openInterestMap", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "openInterestNotionalMap", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "openPosition", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "owner", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "partialClose", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "partialLiquidationRatio", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "pause", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "paused", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "payFunding", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "positionMap", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "removeMargin", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "renounceOwnership", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "repegAmmK", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "repegAmmY", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "repegBot", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "repegFeesTotal", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "setBackstopLiquidityProvider", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "setFeeToken", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "setFeeTokenStatus", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "repegBots", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "repegLiquidityDepth", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "repegPrice", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "setRepegBot", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "setTollPool", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "settleFunding", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "tollMap", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "totalPositionSizeMap", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "transferOwnership", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "unpause", data: BytesLike): Result;
events: {
"BackstopLiquidityProviderChanged(address,bool)": EventFragment;
"BotStatusSet(address)": EventFragment;
"FundingPayment(address,uint256,uint256,int256,int256,int256)": EventFragment;
"MarginChanged(address,address,int256,int256)": EventFragment;

@@ -204,10 +169,8 @@ "OwnershipTransferred(address,address)": EventFragment;

"PositionChanged(address,address,uint256,uint256,int256,uint256,int256,int256,int256,uint256,uint256,uint256,int256)": EventFragment;
"PositionLiquidated(address,address,uint256,uint256,uint256,address,uint256)": EventFragment;
"ReferredPositionChanged(bytes32)": EventFragment;
"Repeg(address,tuple,tuple,tuple)": EventFragment;
"RestrictionModeEntered(address,uint256)": EventFragment;
"PositionLiquidated(address,address,address,uint256,uint256,uint256,uint256,uint256)": EventFragment;
"Repeg(address,uint256,uint256,uint256,uint256,int256,uint256)": EventFragment;
"RepegBotSet(address,address)": EventFragment;
"Unpaused(address)": EventFragment;
};
getEvent(nameOrSignatureOrTopic: "BackstopLiquidityProviderChanged"): EventFragment;
getEvent(nameOrSignatureOrTopic: "BotStatusSet"): EventFragment;
getEvent(nameOrSignatureOrTopic: "FundingPayment"): EventFragment;
getEvent(nameOrSignatureOrTopic: "MarginChanged"): EventFragment;

@@ -218,23 +181,25 @@ getEvent(nameOrSignatureOrTopic: "OwnershipTransferred"): EventFragment;

getEvent(nameOrSignatureOrTopic: "PositionLiquidated"): EventFragment;
getEvent(nameOrSignatureOrTopic: "ReferredPositionChanged"): EventFragment;
getEvent(nameOrSignatureOrTopic: "Repeg"): EventFragment;
getEvent(nameOrSignatureOrTopic: "RestrictionModeEntered"): EventFragment;
getEvent(nameOrSignatureOrTopic: "RepegBotSet"): EventFragment;
getEvent(nameOrSignatureOrTopic: "Unpaused"): EventFragment;
}
export interface BackstopLiquidityProviderChangedEventObject {
account: string;
isProvider: boolean;
export interface FundingPaymentEventObject {
amm: string;
markPrice: BigNumber;
indexPrice: BigNumber;
premiumFractionLong: BigNumber;
premiumFractionShort: BigNumber;
insuranceFundPnl: BigNumber;
}
export declare type BackstopLiquidityProviderChangedEvent = TypedEvent<[
export declare type FundingPaymentEvent = TypedEvent<[
string,
boolean
], BackstopLiquidityProviderChangedEventObject>;
export declare type BackstopLiquidityProviderChangedEventFilter = TypedEventFilter<BackstopLiquidityProviderChangedEvent>;
export interface BotStatusSetEventObject {
bot: string;
}
export declare type BotStatusSetEvent = TypedEvent<[string], BotStatusSetEventObject>;
export declare type BotStatusSetEventFilter = TypedEventFilter<BotStatusSetEvent>;
BigNumber,
BigNumber,
BigNumber,
BigNumber,
BigNumber
], FundingPaymentEventObject>;
export declare type FundingPaymentEventFilter = TypedEventFilter<FundingPaymentEvent>;
export interface MarginChangedEventObject {
sender: string;
trader: string;
amm: string;

@@ -269,3 +234,3 @@ amount: BigNumber;

margin: BigNumber;
positionNotional: BigNumber;
exchangedPositionNotional: BigNumber;
exchangedPositionSize: BigNumber;

@@ -278,3 +243,3 @@ fee: BigNumber;

liquidationPenalty: BigNumber;
spotPrice: BigNumber;
markPrice: BigNumber;
fundingPayment: BigNumber;

@@ -301,6 +266,7 @@ }

amm: string;
positionNotional: BigNumber;
positionSize: BigNumber;
liquidationFee: BigNumber;
liquidator: string;
liquidatedPositionNotional: BigNumber;
liquidatedPositionSize: BigNumber;
liquidationReward: BigNumber;
insuranceFundProfit: BigNumber;
badDebt: BigNumber;

@@ -311,38 +277,38 @@ }

string,
string,
BigNumber,
BigNumber,
BigNumber,
string,
BigNumber,
BigNumber
], PositionLiquidatedEventObject>;
export declare type PositionLiquidatedEventFilter = TypedEventFilter<PositionLiquidatedEvent>;
export interface ReferredPositionChangedEventObject {
referralCode: string;
}
export declare type ReferredPositionChangedEvent = TypedEvent<[
string
], ReferredPositionChangedEventObject>;
export declare type ReferredPositionChangedEventFilter = TypedEventFilter<ReferredPositionChangedEvent>;
export interface RepegEventObject {
amm: string;
quoteAssetReserve: Decimal.DecimalStructOutput;
baseAssetReserve: Decimal.DecimalStructOutput;
pnl: SignedDecimal.SignedDecimalStructOutput;
quoteAssetReserveBefore: BigNumber;
baseAssetReserveBefore: BigNumber;
quoteAssetReserveAfter: BigNumber;
baseAssetReserveAfter: BigNumber;
repegPnl: BigNumber;
repegDebt: BigNumber;
}
export declare type RepegEvent = TypedEvent<[
string,
Decimal.DecimalStructOutput,
Decimal.DecimalStructOutput,
SignedDecimal.SignedDecimalStructOutput
BigNumber,
BigNumber,
BigNumber,
BigNumber,
BigNumber,
BigNumber
], RepegEventObject>;
export declare type RepegEventFilter = TypedEventFilter<RepegEvent>;
export interface RestrictionModeEnteredEventObject {
export interface RepegBotSetEventObject {
amm: string;
blockNumber: BigNumber;
bot: string;
}
export declare type RestrictionModeEnteredEvent = TypedEvent<[
export declare type RepegBotSetEvent = TypedEvent<[
string,
BigNumber
], RestrictionModeEnteredEventObject>;
export declare type RestrictionModeEnteredEventFilter = TypedEventFilter<RestrictionModeEnteredEvent>;
string
], RepegBotSetEventObject>;
export declare type RepegBotSetEventFilter = TypedEventFilter<RepegBotSetEvent>;
export interface UnpausedEventObject {

@@ -371,12 +337,21 @@ account: string;

}): Promise<ContractTransaction>;
backstopLiquidityProviderMap(arg0: PromiseOrValue<string>, overrides?: CallOverrides): Promise<[boolean]>;
calculateAmmPnlK(amm: PromiseOrValue<string>, k: Decimal.DecimalStruct, overrides?: CallOverrides): Promise<[SignedDecimal.SignedDecimalStructOutput]>;
calculateAmmPnlY(amm: PromiseOrValue<string>, p2: SignedDecimal.SignedDecimalStruct, overrides?: CallOverrides): Promise<[SignedDecimal.SignedDecimalStructOutput]>;
closePosition(_amm: PromiseOrValue<string>, _quoteAssetAmountLimit: Decimal.DecimalStruct, _feesInFeeToken: PromiseOrValue<boolean>, overrides?: Overrides & {
closePosition(_amm: PromiseOrValue<string>, _quoteAssetAmountLimit: Decimal.DecimalStruct, overrides?: Overrides & {
from?: PromiseOrValue<string>;
}): Promise<ContractTransaction>;
feePool(overrides?: CallOverrides): Promise<[string]>;
feeToken(overrides?: CallOverrides): Promise<[string]>;
feeTokenStatus(overrides?: CallOverrides): Promise<[number]>;
getLatestCumulativePremiumFraction(_amm: PromiseOrValue<string>, overrides?: CallOverrides): Promise<[SignedDecimal.SignedDecimalStructOutput]>;
cumulativePremiumFractionLong(arg0: PromiseOrValue<string>, arg1: PromiseOrValue<BigNumberish>, overrides?: CallOverrides): Promise<[BigNumber] & {
d: BigNumber;
}>;
cumulativePremiumFractionShort(arg0: PromiseOrValue<string>, arg1: PromiseOrValue<BigNumberish>, overrides?: CallOverrides): Promise<[BigNumber] & {
d: BigNumber;
}>;
fundingRateDeltaCapRatio(overrides?: CallOverrides): Promise<[BigNumber] & {
d: BigNumber;
}>;
getLatestCumulativePremiumFraction(_amm: PromiseOrValue<string>, overrides?: CallOverrides): Promise<[
SignedDecimal.SignedDecimalStructOutput,
SignedDecimal.SignedDecimalStructOutput
] & {
latestCumulativePremiumFractionLong: SignedDecimal.SignedDecimalStructOutput;
latestCumulativePremiumFractionShort: SignedDecimal.SignedDecimalStructOutput;
}>;
getMarginRatio(_amm: PromiseOrValue<string>, _trader: PromiseOrValue<string>, overrides?: CallOverrides): Promise<[SignedDecimal.SignedDecimalStructOutput]>;

@@ -391,8 +366,3 @@ getPosition(_amm: PromiseOrValue<string>, _trader: PromiseOrValue<string>, overrides?: CallOverrides): Promise<[ClearingHouse.PositionStructOutput]>;

}>;
getUnadjustedPosition(_amm: PromiseOrValue<string>, _trader: PromiseOrValue<string>, overrides?: CallOverrides): Promise<[
ClearingHouse.PositionStructOutput
] & {
position: ClearingHouse.PositionStructOutput;
}>;
initialize(_insuranceFund: PromiseOrValue<string>, overrides?: Overrides & {
initialize(_insuranceFund: PromiseOrValue<string>, _fundingRateDeltaCapRatio: PromiseOrValue<BigNumberish>, overrides?: Overrides & {
from?: PromiseOrValue<string>;

@@ -404,27 +374,12 @@ }): Promise<ContractTransaction>;

}): Promise<ContractTransaction>;
liquidateWithSlippage(_amm: PromiseOrValue<string>, _trader: PromiseOrValue<string>, _quoteAssetAmountLimit: Decimal.DecimalStruct, overrides?: Overrides & {
from?: PromiseOrValue<string>;
}): Promise<ContractTransaction>;
liquidationFeeRatio(overrides?: CallOverrides): Promise<[BigNumber] & {
openInterestNotionalMap(arg0: PromiseOrValue<string>, overrides?: CallOverrides): Promise<[BigNumber] & {
d: BigNumber;
}>;
openInterestMap(arg0: PromiseOrValue<string>, overrides?: CallOverrides): Promise<[
Decimal.DecimalStructOutput,
Decimal.DecimalStructOutput,
Decimal.DecimalStructOutput
] & {
openInterest: Decimal.DecimalStructOutput;
openInterestLongs: Decimal.DecimalStructOutput;
openInterestShorts: Decimal.DecimalStructOutput;
}>;
openPosition(_amm: PromiseOrValue<string>, _side: PromiseOrValue<BigNumberish>, _quoteAssetAmount: Decimal.DecimalStruct, _leverage: Decimal.DecimalStruct, _baseAssetAmountLimit: Decimal.DecimalStruct, _feesInFeeToken: PromiseOrValue<boolean>, overrides?: Overrides & {
openPosition(_amm: PromiseOrValue<string>, _side: PromiseOrValue<BigNumberish>, _quoteAssetAmount: Decimal.DecimalStruct, _leverage: Decimal.DecimalStruct, _baseAssetAmountLimit: Decimal.DecimalStruct, overrides?: Overrides & {
from?: PromiseOrValue<string>;
}): Promise<ContractTransaction>;
owner(overrides?: CallOverrides): Promise<[string]>;
partialClose(_amm: PromiseOrValue<string>, _partialCloseRatio: Decimal.DecimalStruct, _quoteAssetAmountLimit: Decimal.DecimalStruct, _feesInFeeToken: PromiseOrValue<boolean>, overrides?: Overrides & {
partialClose(_amm: PromiseOrValue<string>, _partialCloseRatio: Decimal.DecimalStruct, _quoteAssetAmountLimit: Decimal.DecimalStruct, overrides?: Overrides & {
from?: PromiseOrValue<string>;
}): Promise<ContractTransaction>;
partialLiquidationRatio(overrides?: CallOverrides): Promise<[BigNumber] & {
d: BigNumber;
}>;
pause(overrides?: Overrides & {

@@ -434,5 +389,17 @@ from?: PromiseOrValue<string>;

paused(overrides?: CallOverrides): Promise<[boolean]>;
payFunding(_amm: PromiseOrValue<string>, overrides?: Overrides & {
from?: PromiseOrValue<string>;
}): Promise<ContractTransaction>;
positionMap(arg0: PromiseOrValue<string>, arg1: PromiseOrValue<string>, overrides?: CallOverrides): Promise<[
SignedDecimal.SignedDecimalStructOutput,
Decimal.DecimalStructOutput,
Decimal.DecimalStructOutput,
SignedDecimal.SignedDecimalStructOutput,
SignedDecimal.SignedDecimalStructOutput,
BigNumber
] & {
size: SignedDecimal.SignedDecimalStructOutput;
margin: Decimal.DecimalStructOutput;
openNotional: Decimal.DecimalStructOutput;
lastUpdatedCumulativePremiumFractionLong: SignedDecimal.SignedDecimalStructOutput;
lastUpdatedCumulativePremiumFractionShort: SignedDecimal.SignedDecimalStructOutput;
blockNumber: BigNumber;
}>;
removeMargin(_amm: PromiseOrValue<string>, _removedMargin: Decimal.DecimalStruct, overrides?: Overrides & {

@@ -444,27 +411,27 @@ from?: PromiseOrValue<string>;

}): Promise<ContractTransaction>;
repegAmmK(amm: PromiseOrValue<string>, k: Decimal.DecimalStruct, overrides?: Overrides & {
repegBots(arg0: PromiseOrValue<string>, overrides?: CallOverrides): Promise<[string]>;
repegLiquidityDepth(_amm: PromiseOrValue<string>, _multiplier: Decimal.DecimalStruct, overrides?: Overrides & {
from?: PromiseOrValue<string>;
}): Promise<ContractTransaction>;
repegAmmY(amm: PromiseOrValue<string>, _quoteAssetReserve: Decimal.DecimalStruct, overrides?: Overrides & {
repegPrice(_amm: PromiseOrValue<string>, overrides?: Overrides & {
from?: PromiseOrValue<string>;
}): Promise<ContractTransaction>;
repegBot(overrides?: CallOverrides): Promise<[string]>;
repegFeesTotal(overrides?: CallOverrides): Promise<[BigNumber] & {
d: BigNumber;
}>;
setBackstopLiquidityProvider(account: PromiseOrValue<string>, isProvider: PromiseOrValue<boolean>, overrides?: Overrides & {
setRepegBot(_amm: PromiseOrValue<string>, _repegBot: PromiseOrValue<string>, overrides?: Overrides & {
from?: PromiseOrValue<string>;
}): Promise<ContractTransaction>;
setFeeToken(_token: PromiseOrValue<string>, overrides?: Overrides & {
settleFunding(_amm: PromiseOrValue<string>, overrides?: Overrides & {
from?: PromiseOrValue<string>;
}): Promise<ContractTransaction>;
setFeeTokenStatus(_status: PromiseOrValue<BigNumberish>, overrides?: Overrides & {
from?: PromiseOrValue<string>;
}): Promise<ContractTransaction>;
setRepegBot(_bot: PromiseOrValue<string>, overrides?: Overrides & {
from?: PromiseOrValue<string>;
}): Promise<ContractTransaction>;
setTollPool(_feePool: PromiseOrValue<string>, overrides?: Overrides & {
from?: PromiseOrValue<string>;
}): Promise<ContractTransaction>;
tollMap(arg0: PromiseOrValue<string>, overrides?: CallOverrides): Promise<[BigNumber] & {
d: BigNumber;
}>;
totalPositionSizeMap(arg0: PromiseOrValue<string>, overrides?: CallOverrides): Promise<[
SignedDecimal.SignedDecimalStructOutput,
Decimal.DecimalStructOutput,
Decimal.DecimalStructOutput
] & {
netPositionSize: SignedDecimal.SignedDecimalStructOutput;
positionSizeLong: Decimal.DecimalStructOutput;
positionSizeShort: Decimal.DecimalStructOutput;
}>;
transferOwnership(newOwner: PromiseOrValue<string>, overrides?: Overrides & {

@@ -480,12 +447,15 @@ from?: PromiseOrValue<string>;

}): Promise<ContractTransaction>;
backstopLiquidityProviderMap(arg0: PromiseOrValue<string>, overrides?: CallOverrides): Promise<boolean>;
calculateAmmPnlK(amm: PromiseOrValue<string>, k: Decimal.DecimalStruct, overrides?: CallOverrides): Promise<SignedDecimal.SignedDecimalStructOutput>;
calculateAmmPnlY(amm: PromiseOrValue<string>, p2: SignedDecimal.SignedDecimalStruct, overrides?: CallOverrides): Promise<SignedDecimal.SignedDecimalStructOutput>;
closePosition(_amm: PromiseOrValue<string>, _quoteAssetAmountLimit: Decimal.DecimalStruct, _feesInFeeToken: PromiseOrValue<boolean>, overrides?: Overrides & {
closePosition(_amm: PromiseOrValue<string>, _quoteAssetAmountLimit: Decimal.DecimalStruct, overrides?: Overrides & {
from?: PromiseOrValue<string>;
}): Promise<ContractTransaction>;
feePool(overrides?: CallOverrides): Promise<string>;
feeToken(overrides?: CallOverrides): Promise<string>;
feeTokenStatus(overrides?: CallOverrides): Promise<number>;
getLatestCumulativePremiumFraction(_amm: PromiseOrValue<string>, overrides?: CallOverrides): Promise<SignedDecimal.SignedDecimalStructOutput>;
cumulativePremiumFractionLong(arg0: PromiseOrValue<string>, arg1: PromiseOrValue<BigNumberish>, overrides?: CallOverrides): Promise<BigNumber>;
cumulativePremiumFractionShort(arg0: PromiseOrValue<string>, arg1: PromiseOrValue<BigNumberish>, overrides?: CallOverrides): Promise<BigNumber>;
fundingRateDeltaCapRatio(overrides?: CallOverrides): Promise<BigNumber>;
getLatestCumulativePremiumFraction(_amm: PromiseOrValue<string>, overrides?: CallOverrides): Promise<[
SignedDecimal.SignedDecimalStructOutput,
SignedDecimal.SignedDecimalStructOutput
] & {
latestCumulativePremiumFractionLong: SignedDecimal.SignedDecimalStructOutput;
latestCumulativePremiumFractionShort: SignedDecimal.SignedDecimalStructOutput;
}>;
getMarginRatio(_amm: PromiseOrValue<string>, _trader: PromiseOrValue<string>, overrides?: CallOverrides): Promise<SignedDecimal.SignedDecimalStructOutput>;

@@ -500,4 +470,3 @@ getPosition(_amm: PromiseOrValue<string>, _trader: PromiseOrValue<string>, overrides?: CallOverrides): Promise<ClearingHouse.PositionStructOutput>;

}>;
getUnadjustedPosition(_amm: PromiseOrValue<string>, _trader: PromiseOrValue<string>, overrides?: CallOverrides): Promise<ClearingHouse.PositionStructOutput>;
initialize(_insuranceFund: PromiseOrValue<string>, overrides?: Overrides & {
initialize(_insuranceFund: PromiseOrValue<string>, _fundingRateDeltaCapRatio: PromiseOrValue<BigNumberish>, overrides?: Overrides & {
from?: PromiseOrValue<string>;

@@ -509,23 +478,10 @@ }): Promise<ContractTransaction>;

}): Promise<ContractTransaction>;
liquidateWithSlippage(_amm: PromiseOrValue<string>, _trader: PromiseOrValue<string>, _quoteAssetAmountLimit: Decimal.DecimalStruct, overrides?: Overrides & {
openInterestNotionalMap(arg0: PromiseOrValue<string>, overrides?: CallOverrides): Promise<BigNumber>;
openPosition(_amm: PromiseOrValue<string>, _side: PromiseOrValue<BigNumberish>, _quoteAssetAmount: Decimal.DecimalStruct, _leverage: Decimal.DecimalStruct, _baseAssetAmountLimit: Decimal.DecimalStruct, overrides?: Overrides & {
from?: PromiseOrValue<string>;
}): Promise<ContractTransaction>;
liquidationFeeRatio(overrides?: CallOverrides): Promise<BigNumber>;
openInterestMap(arg0: PromiseOrValue<string>, overrides?: CallOverrides): Promise<[
Decimal.DecimalStructOutput,
Decimal.DecimalStructOutput,
Decimal.DecimalStructOutput
] & {
openInterest: Decimal.DecimalStructOutput;
openInterestLongs: Decimal.DecimalStructOutput;
openInterestShorts: Decimal.DecimalStructOutput;
}>;
openPosition(_amm: PromiseOrValue<string>, _side: PromiseOrValue<BigNumberish>, _quoteAssetAmount: Decimal.DecimalStruct, _leverage: Decimal.DecimalStruct, _baseAssetAmountLimit: Decimal.DecimalStruct, _feesInFeeToken: PromiseOrValue<boolean>, overrides?: Overrides & {
from?: PromiseOrValue<string>;
}): Promise<ContractTransaction>;
owner(overrides?: CallOverrides): Promise<string>;
partialClose(_amm: PromiseOrValue<string>, _partialCloseRatio: Decimal.DecimalStruct, _quoteAssetAmountLimit: Decimal.DecimalStruct, _feesInFeeToken: PromiseOrValue<boolean>, overrides?: Overrides & {
partialClose(_amm: PromiseOrValue<string>, _partialCloseRatio: Decimal.DecimalStruct, _quoteAssetAmountLimit: Decimal.DecimalStruct, overrides?: Overrides & {
from?: PromiseOrValue<string>;
}): Promise<ContractTransaction>;
partialLiquidationRatio(overrides?: CallOverrides): Promise<BigNumber>;
pause(overrides?: Overrides & {

@@ -535,5 +491,17 @@ from?: PromiseOrValue<string>;

paused(overrides?: CallOverrides): Promise<boolean>;
payFunding(_amm: PromiseOrValue<string>, overrides?: Overrides & {
from?: PromiseOrValue<string>;
}): Promise<ContractTransaction>;
positionMap(arg0: PromiseOrValue<string>, arg1: PromiseOrValue<string>, overrides?: CallOverrides): Promise<[
SignedDecimal.SignedDecimalStructOutput,
Decimal.DecimalStructOutput,
Decimal.DecimalStructOutput,
SignedDecimal.SignedDecimalStructOutput,
SignedDecimal.SignedDecimalStructOutput,
BigNumber
] & {
size: SignedDecimal.SignedDecimalStructOutput;
margin: Decimal.DecimalStructOutput;
openNotional: Decimal.DecimalStructOutput;
lastUpdatedCumulativePremiumFractionLong: SignedDecimal.SignedDecimalStructOutput;
lastUpdatedCumulativePremiumFractionShort: SignedDecimal.SignedDecimalStructOutput;
blockNumber: BigNumber;
}>;
removeMargin(_amm: PromiseOrValue<string>, _removedMargin: Decimal.DecimalStruct, overrides?: Overrides & {

@@ -545,25 +513,25 @@ from?: PromiseOrValue<string>;

}): Promise<ContractTransaction>;
repegAmmK(amm: PromiseOrValue<string>, k: Decimal.DecimalStruct, overrides?: Overrides & {
repegBots(arg0: PromiseOrValue<string>, overrides?: CallOverrides): Promise<string>;
repegLiquidityDepth(_amm: PromiseOrValue<string>, _multiplier: Decimal.DecimalStruct, overrides?: Overrides & {
from?: PromiseOrValue<string>;
}): Promise<ContractTransaction>;
repegAmmY(amm: PromiseOrValue<string>, _quoteAssetReserve: Decimal.DecimalStruct, overrides?: Overrides & {
repegPrice(_amm: PromiseOrValue<string>, overrides?: Overrides & {
from?: PromiseOrValue<string>;
}): Promise<ContractTransaction>;
repegBot(overrides?: CallOverrides): Promise<string>;
repegFeesTotal(overrides?: CallOverrides): Promise<BigNumber>;
setBackstopLiquidityProvider(account: PromiseOrValue<string>, isProvider: PromiseOrValue<boolean>, overrides?: Overrides & {
setRepegBot(_amm: PromiseOrValue<string>, _repegBot: PromiseOrValue<string>, overrides?: Overrides & {
from?: PromiseOrValue<string>;
}): Promise<ContractTransaction>;
setFeeToken(_token: PromiseOrValue<string>, overrides?: Overrides & {
settleFunding(_amm: PromiseOrValue<string>, overrides?: Overrides & {
from?: PromiseOrValue<string>;
}): Promise<ContractTransaction>;
setFeeTokenStatus(_status: PromiseOrValue<BigNumberish>, overrides?: Overrides & {
from?: PromiseOrValue<string>;
}): Promise<ContractTransaction>;
setRepegBot(_bot: PromiseOrValue<string>, overrides?: Overrides & {
from?: PromiseOrValue<string>;
}): Promise<ContractTransaction>;
setTollPool(_feePool: PromiseOrValue<string>, overrides?: Overrides & {
from?: PromiseOrValue<string>;
}): Promise<ContractTransaction>;
tollMap(arg0: PromiseOrValue<string>, overrides?: CallOverrides): Promise<BigNumber>;
totalPositionSizeMap(arg0: PromiseOrValue<string>, overrides?: CallOverrides): Promise<[
SignedDecimal.SignedDecimalStructOutput,
Decimal.DecimalStructOutput,
Decimal.DecimalStructOutput
] & {
netPositionSize: SignedDecimal.SignedDecimalStructOutput;
positionSizeLong: Decimal.DecimalStructOutput;
positionSizeShort: Decimal.DecimalStructOutput;
}>;
transferOwnership(newOwner: PromiseOrValue<string>, overrides?: Overrides & {

@@ -577,10 +545,13 @@ from?: PromiseOrValue<string>;

addMargin(_amm: PromiseOrValue<string>, _addedMargin: Decimal.DecimalStruct, overrides?: CallOverrides): Promise<void>;
backstopLiquidityProviderMap(arg0: PromiseOrValue<string>, overrides?: CallOverrides): Promise<boolean>;
calculateAmmPnlK(amm: PromiseOrValue<string>, k: Decimal.DecimalStruct, overrides?: CallOverrides): Promise<SignedDecimal.SignedDecimalStructOutput>;
calculateAmmPnlY(amm: PromiseOrValue<string>, p2: SignedDecimal.SignedDecimalStruct, overrides?: CallOverrides): Promise<SignedDecimal.SignedDecimalStructOutput>;
closePosition(_amm: PromiseOrValue<string>, _quoteAssetAmountLimit: Decimal.DecimalStruct, _feesInFeeToken: PromiseOrValue<boolean>, overrides?: CallOverrides): Promise<void>;
feePool(overrides?: CallOverrides): Promise<string>;
feeToken(overrides?: CallOverrides): Promise<string>;
feeTokenStatus(overrides?: CallOverrides): Promise<number>;
getLatestCumulativePremiumFraction(_amm: PromiseOrValue<string>, overrides?: CallOverrides): Promise<SignedDecimal.SignedDecimalStructOutput>;
closePosition(_amm: PromiseOrValue<string>, _quoteAssetAmountLimit: Decimal.DecimalStruct, overrides?: CallOverrides): Promise<void>;
cumulativePremiumFractionLong(arg0: PromiseOrValue<string>, arg1: PromiseOrValue<BigNumberish>, overrides?: CallOverrides): Promise<BigNumber>;
cumulativePremiumFractionShort(arg0: PromiseOrValue<string>, arg1: PromiseOrValue<BigNumberish>, overrides?: CallOverrides): Promise<BigNumber>;
fundingRateDeltaCapRatio(overrides?: CallOverrides): Promise<BigNumber>;
getLatestCumulativePremiumFraction(_amm: PromiseOrValue<string>, overrides?: CallOverrides): Promise<[
SignedDecimal.SignedDecimalStructOutput,
SignedDecimal.SignedDecimalStructOutput
] & {
latestCumulativePremiumFractionLong: SignedDecimal.SignedDecimalStructOutput;
latestCumulativePremiumFractionShort: SignedDecimal.SignedDecimalStructOutput;
}>;
getMarginRatio(_amm: PromiseOrValue<string>, _trader: PromiseOrValue<string>, overrides?: CallOverrides): Promise<SignedDecimal.SignedDecimalStructOutput>;

@@ -595,41 +566,43 @@ getPosition(_amm: PromiseOrValue<string>, _trader: PromiseOrValue<string>, overrides?: CallOverrides): Promise<ClearingHouse.PositionStructOutput>;

}>;
getUnadjustedPosition(_amm: PromiseOrValue<string>, _trader: PromiseOrValue<string>, overrides?: CallOverrides): Promise<ClearingHouse.PositionStructOutput>;
initialize(_insuranceFund: PromiseOrValue<string>, overrides?: CallOverrides): Promise<void>;
initialize(_insuranceFund: PromiseOrValue<string>, _fundingRateDeltaCapRatio: PromiseOrValue<BigNumberish>, overrides?: CallOverrides): Promise<void>;
insuranceFund(overrides?: CallOverrides): Promise<string>;
liquidate(_amm: PromiseOrValue<string>, _trader: PromiseOrValue<string>, overrides?: CallOverrides): Promise<void>;
liquidateWithSlippage(_amm: PromiseOrValue<string>, _trader: PromiseOrValue<string>, _quoteAssetAmountLimit: Decimal.DecimalStruct, overrides?: CallOverrides): Promise<[
openInterestNotionalMap(arg0: PromiseOrValue<string>, overrides?: CallOverrides): Promise<BigNumber>;
openPosition(_amm: PromiseOrValue<string>, _side: PromiseOrValue<BigNumberish>, _quoteAssetAmount: Decimal.DecimalStruct, _leverage: Decimal.DecimalStruct, _baseAssetAmountLimit: Decimal.DecimalStruct, overrides?: CallOverrides): Promise<void>;
owner(overrides?: CallOverrides): Promise<string>;
partialClose(_amm: PromiseOrValue<string>, _partialCloseRatio: Decimal.DecimalStruct, _quoteAssetAmountLimit: Decimal.DecimalStruct, overrides?: CallOverrides): Promise<void>;
pause(overrides?: CallOverrides): Promise<void>;
paused(overrides?: CallOverrides): Promise<boolean>;
positionMap(arg0: PromiseOrValue<string>, arg1: PromiseOrValue<string>, overrides?: CallOverrides): Promise<[
SignedDecimal.SignedDecimalStructOutput,
Decimal.DecimalStructOutput,
boolean
Decimal.DecimalStructOutput,
SignedDecimal.SignedDecimalStructOutput,
SignedDecimal.SignedDecimalStructOutput,
BigNumber
] & {
quoteAssetAmount: Decimal.DecimalStructOutput;
isPartialClose: boolean;
size: SignedDecimal.SignedDecimalStructOutput;
margin: Decimal.DecimalStructOutput;
openNotional: Decimal.DecimalStructOutput;
lastUpdatedCumulativePremiumFractionLong: SignedDecimal.SignedDecimalStructOutput;
lastUpdatedCumulativePremiumFractionShort: SignedDecimal.SignedDecimalStructOutput;
blockNumber: BigNumber;
}>;
liquidationFeeRatio(overrides?: CallOverrides): Promise<BigNumber>;
openInterestMap(arg0: PromiseOrValue<string>, overrides?: CallOverrides): Promise<[
removeMargin(_amm: PromiseOrValue<string>, _removedMargin: Decimal.DecimalStruct, overrides?: CallOverrides): Promise<void>;
renounceOwnership(overrides?: CallOverrides): Promise<void>;
repegBots(arg0: PromiseOrValue<string>, overrides?: CallOverrides): Promise<string>;
repegLiquidityDepth(_amm: PromiseOrValue<string>, _multiplier: Decimal.DecimalStruct, overrides?: CallOverrides): Promise<void>;
repegPrice(_amm: PromiseOrValue<string>, overrides?: CallOverrides): Promise<void>;
setRepegBot(_amm: PromiseOrValue<string>, _repegBot: PromiseOrValue<string>, overrides?: CallOverrides): Promise<void>;
settleFunding(_amm: PromiseOrValue<string>, overrides?: CallOverrides): Promise<void>;
tollMap(arg0: PromiseOrValue<string>, overrides?: CallOverrides): Promise<BigNumber>;
totalPositionSizeMap(arg0: PromiseOrValue<string>, overrides?: CallOverrides): Promise<[
SignedDecimal.SignedDecimalStructOutput,
Decimal.DecimalStructOutput,
Decimal.DecimalStructOutput,
Decimal.DecimalStructOutput
] & {
openInterest: Decimal.DecimalStructOutput;
openInterestLongs: Decimal.DecimalStructOutput;
openInterestShorts: Decimal.DecimalStructOutput;
netPositionSize: SignedDecimal.SignedDecimalStructOutput;
positionSizeLong: Decimal.DecimalStructOutput;
positionSizeShort: Decimal.DecimalStructOutput;
}>;
openPosition(_amm: PromiseOrValue<string>, _side: PromiseOrValue<BigNumberish>, _quoteAssetAmount: Decimal.DecimalStruct, _leverage: Decimal.DecimalStruct, _baseAssetAmountLimit: Decimal.DecimalStruct, _feesInFeeToken: PromiseOrValue<boolean>, overrides?: CallOverrides): Promise<void>;
owner(overrides?: CallOverrides): Promise<string>;
partialClose(_amm: PromiseOrValue<string>, _partialCloseRatio: Decimal.DecimalStruct, _quoteAssetAmountLimit: Decimal.DecimalStruct, _feesInFeeToken: PromiseOrValue<boolean>, overrides?: CallOverrides): Promise<void>;
partialLiquidationRatio(overrides?: CallOverrides): Promise<BigNumber>;
pause(overrides?: CallOverrides): Promise<void>;
paused(overrides?: CallOverrides): Promise<boolean>;
payFunding(_amm: PromiseOrValue<string>, overrides?: CallOverrides): Promise<void>;
removeMargin(_amm: PromiseOrValue<string>, _removedMargin: Decimal.DecimalStruct, overrides?: CallOverrides): Promise<void>;
renounceOwnership(overrides?: CallOverrides): Promise<void>;
repegAmmK(amm: PromiseOrValue<string>, k: Decimal.DecimalStruct, overrides?: CallOverrides): Promise<void>;
repegAmmY(amm: PromiseOrValue<string>, _quoteAssetReserve: Decimal.DecimalStruct, overrides?: CallOverrides): Promise<void>;
repegBot(overrides?: CallOverrides): Promise<string>;
repegFeesTotal(overrides?: CallOverrides): Promise<BigNumber>;
setBackstopLiquidityProvider(account: PromiseOrValue<string>, isProvider: PromiseOrValue<boolean>, overrides?: CallOverrides): Promise<void>;
setFeeToken(_token: PromiseOrValue<string>, overrides?: CallOverrides): Promise<void>;
setFeeTokenStatus(_status: PromiseOrValue<BigNumberish>, overrides?: CallOverrides): Promise<void>;
setRepegBot(_bot: PromiseOrValue<string>, overrides?: CallOverrides): Promise<void>;
setTollPool(_feePool: PromiseOrValue<string>, overrides?: CallOverrides): Promise<void>;
transferOwnership(newOwner: PromiseOrValue<string>, overrides?: CallOverrides): Promise<void>;

@@ -639,8 +612,6 @@ unpause(overrides?: CallOverrides): Promise<void>;

filters: {
"BackstopLiquidityProviderChanged(address,bool)"(account?: PromiseOrValue<string> | null, isProvider?: PromiseOrValue<boolean> | null): BackstopLiquidityProviderChangedEventFilter;
BackstopLiquidityProviderChanged(account?: PromiseOrValue<string> | null, isProvider?: PromiseOrValue<boolean> | null): BackstopLiquidityProviderChangedEventFilter;
"BotStatusSet(address)"(bot?: PromiseOrValue<string> | null): BotStatusSetEventFilter;
BotStatusSet(bot?: PromiseOrValue<string> | null): BotStatusSetEventFilter;
"MarginChanged(address,address,int256,int256)"(sender?: PromiseOrValue<string> | null, amm?: PromiseOrValue<string> | null, amount?: null, fundingPayment?: null): MarginChangedEventFilter;
MarginChanged(sender?: PromiseOrValue<string> | null, amm?: PromiseOrValue<string> | null, amount?: null, fundingPayment?: null): MarginChangedEventFilter;
"FundingPayment(address,uint256,uint256,int256,int256,int256)"(amm?: PromiseOrValue<string> | null, markPrice?: null, indexPrice?: null, premiumFractionLong?: null, premiumFractionShort?: null, insuranceFundPnl?: null): FundingPaymentEventFilter;
FundingPayment(amm?: PromiseOrValue<string> | null, markPrice?: null, indexPrice?: null, premiumFractionLong?: null, premiumFractionShort?: null, insuranceFundPnl?: null): FundingPaymentEventFilter;
"MarginChanged(address,address,int256,int256)"(trader?: PromiseOrValue<string> | null, amm?: PromiseOrValue<string> | null, amount?: null, fundingPayment?: null): MarginChangedEventFilter;
MarginChanged(trader?: PromiseOrValue<string> | null, amm?: PromiseOrValue<string> | null, amount?: null, fundingPayment?: null): MarginChangedEventFilter;
"OwnershipTransferred(address,address)"(previousOwner?: PromiseOrValue<string> | null, newOwner?: PromiseOrValue<string> | null): OwnershipTransferredEventFilter;

@@ -650,12 +621,10 @@ OwnershipTransferred(previousOwner?: PromiseOrValue<string> | null, newOwner?: PromiseOrValue<string> | null): OwnershipTransferredEventFilter;

Paused(account?: null): PausedEventFilter;
"PositionChanged(address,address,uint256,uint256,int256,uint256,int256,int256,int256,uint256,uint256,uint256,int256)"(trader?: PromiseOrValue<string> | null, amm?: PromiseOrValue<string> | null, margin?: null, positionNotional?: null, exchangedPositionSize?: null, fee?: null, positionSizeAfter?: null, realizedPnl?: null, unrealizedPnlAfter?: null, badDebt?: null, liquidationPenalty?: null, spotPrice?: null, fundingPayment?: null): PositionChangedEventFilter;
PositionChanged(trader?: PromiseOrValue<string> | null, amm?: PromiseOrValue<string> | null, margin?: null, positionNotional?: null, exchangedPositionSize?: null, fee?: null, positionSizeAfter?: null, realizedPnl?: null, unrealizedPnlAfter?: null, badDebt?: null, liquidationPenalty?: null, spotPrice?: null, fundingPayment?: null): PositionChangedEventFilter;
"PositionLiquidated(address,address,uint256,uint256,uint256,address,uint256)"(trader?: PromiseOrValue<string> | null, amm?: PromiseOrValue<string> | null, positionNotional?: null, positionSize?: null, liquidationFee?: null, liquidator?: null, badDebt?: null): PositionLiquidatedEventFilter;
PositionLiquidated(trader?: PromiseOrValue<string> | null, amm?: PromiseOrValue<string> | null, positionNotional?: null, positionSize?: null, liquidationFee?: null, liquidator?: null, badDebt?: null): PositionLiquidatedEventFilter;
"ReferredPositionChanged(bytes32)"(referralCode?: PromiseOrValue<BytesLike> | null): ReferredPositionChangedEventFilter;
ReferredPositionChanged(referralCode?: PromiseOrValue<BytesLike> | null): ReferredPositionChangedEventFilter;
"Repeg(address,tuple,tuple,tuple)"(amm?: null, quoteAssetReserve?: null, baseAssetReserve?: null, pnl?: null): RepegEventFilter;
Repeg(amm?: null, quoteAssetReserve?: null, baseAssetReserve?: null, pnl?: null): RepegEventFilter;
"RestrictionModeEntered(address,uint256)"(amm?: null, blockNumber?: null): RestrictionModeEnteredEventFilter;
RestrictionModeEntered(amm?: null, blockNumber?: null): RestrictionModeEnteredEventFilter;
"PositionChanged(address,address,uint256,uint256,int256,uint256,int256,int256,int256,uint256,uint256,uint256,int256)"(trader?: PromiseOrValue<string> | null, amm?: PromiseOrValue<string> | null, margin?: null, exchangedPositionNotional?: null, exchangedPositionSize?: null, fee?: null, positionSizeAfter?: null, realizedPnl?: null, unrealizedPnlAfter?: null, badDebt?: null, liquidationPenalty?: null, markPrice?: null, fundingPayment?: null): PositionChangedEventFilter;
PositionChanged(trader?: PromiseOrValue<string> | null, amm?: PromiseOrValue<string> | null, margin?: null, exchangedPositionNotional?: null, exchangedPositionSize?: null, fee?: null, positionSizeAfter?: null, realizedPnl?: null, unrealizedPnlAfter?: null, badDebt?: null, liquidationPenalty?: null, markPrice?: null, fundingPayment?: null): PositionChangedEventFilter;
"PositionLiquidated(address,address,address,uint256,uint256,uint256,uint256,uint256)"(trader?: PromiseOrValue<string> | null, amm?: PromiseOrValue<string> | null, liquidator?: PromiseOrValue<string> | null, liquidatedPositionNotional?: null, liquidatedPositionSize?: null, liquidationReward?: null, insuranceFundProfit?: null, badDebt?: null): PositionLiquidatedEventFilter;
PositionLiquidated(trader?: PromiseOrValue<string> | null, amm?: PromiseOrValue<string> | null, liquidator?: PromiseOrValue<string> | null, liquidatedPositionNotional?: null, liquidatedPositionSize?: null, liquidationReward?: null, insuranceFundProfit?: null, badDebt?: null): PositionLiquidatedEventFilter;
"Repeg(address,uint256,uint256,uint256,uint256,int256,uint256)"(amm?: PromiseOrValue<string> | null, quoteAssetReserveBefore?: null, baseAssetReserveBefore?: null, quoteAssetReserveAfter?: null, baseAssetReserveAfter?: null, repegPnl?: null, repegDebt?: null): RepegEventFilter;
Repeg(amm?: PromiseOrValue<string> | null, quoteAssetReserveBefore?: null, baseAssetReserveBefore?: null, quoteAssetReserveAfter?: null, baseAssetReserveAfter?: null, repegPnl?: null, repegDebt?: null): RepegEventFilter;
"RepegBotSet(address,address)"(amm?: PromiseOrValue<string> | null, bot?: PromiseOrValue<string> | null): RepegBotSetEventFilter;
RepegBotSet(amm?: PromiseOrValue<string> | null, bot?: PromiseOrValue<string> | null): RepegBotSetEventFilter;
"Unpaused(address)"(account?: null): UnpausedEventFilter;

@@ -668,11 +637,8 @@ Unpaused(account?: null): UnpausedEventFilter;

}): Promise<BigNumber>;
backstopLiquidityProviderMap(arg0: PromiseOrValue<string>, overrides?: CallOverrides): Promise<BigNumber>;
calculateAmmPnlK(amm: PromiseOrValue<string>, k: Decimal.DecimalStruct, overrides?: CallOverrides): Promise<BigNumber>;
calculateAmmPnlY(amm: PromiseOrValue<string>, p2: SignedDecimal.SignedDecimalStruct, overrides?: CallOverrides): Promise<BigNumber>;
closePosition(_amm: PromiseOrValue<string>, _quoteAssetAmountLimit: Decimal.DecimalStruct, _feesInFeeToken: PromiseOrValue<boolean>, overrides?: Overrides & {
closePosition(_amm: PromiseOrValue<string>, _quoteAssetAmountLimit: Decimal.DecimalStruct, overrides?: Overrides & {
from?: PromiseOrValue<string>;
}): Promise<BigNumber>;
feePool(overrides?: CallOverrides): Promise<BigNumber>;
feeToken(overrides?: CallOverrides): Promise<BigNumber>;
feeTokenStatus(overrides?: CallOverrides): Promise<BigNumber>;
cumulativePremiumFractionLong(arg0: PromiseOrValue<string>, arg1: PromiseOrValue<BigNumberish>, overrides?: CallOverrides): Promise<BigNumber>;
cumulativePremiumFractionShort(arg0: PromiseOrValue<string>, arg1: PromiseOrValue<BigNumberish>, overrides?: CallOverrides): Promise<BigNumber>;
fundingRateDeltaCapRatio(overrides?: CallOverrides): Promise<BigNumber>;
getLatestCumulativePremiumFraction(_amm: PromiseOrValue<string>, overrides?: CallOverrides): Promise<BigNumber>;

@@ -682,4 +648,3 @@ getMarginRatio(_amm: PromiseOrValue<string>, _trader: PromiseOrValue<string>, overrides?: CallOverrides): Promise<BigNumber>;

getPositionNotionalAndUnrealizedPnl(_amm: PromiseOrValue<string>, _trader: PromiseOrValue<string>, _pnlCalcOption: PromiseOrValue<BigNumberish>, overrides?: CallOverrides): Promise<BigNumber>;
getUnadjustedPosition(_amm: PromiseOrValue<string>, _trader: PromiseOrValue<string>, overrides?: CallOverrides): Promise<BigNumber>;
initialize(_insuranceFund: PromiseOrValue<string>, overrides?: Overrides & {
initialize(_insuranceFund: PromiseOrValue<string>, _fundingRateDeltaCapRatio: PromiseOrValue<BigNumberish>, overrides?: Overrides & {
from?: PromiseOrValue<string>;

@@ -691,15 +656,10 @@ }): Promise<BigNumber>;

}): Promise<BigNumber>;
liquidateWithSlippage(_amm: PromiseOrValue<string>, _trader: PromiseOrValue<string>, _quoteAssetAmountLimit: Decimal.DecimalStruct, overrides?: Overrides & {
openInterestNotionalMap(arg0: PromiseOrValue<string>, overrides?: CallOverrides): Promise<BigNumber>;
openPosition(_amm: PromiseOrValue<string>, _side: PromiseOrValue<BigNumberish>, _quoteAssetAmount: Decimal.DecimalStruct, _leverage: Decimal.DecimalStruct, _baseAssetAmountLimit: Decimal.DecimalStruct, overrides?: Overrides & {
from?: PromiseOrValue<string>;
}): Promise<BigNumber>;
liquidationFeeRatio(overrides?: CallOverrides): Promise<BigNumber>;
openInterestMap(arg0: PromiseOrValue<string>, overrides?: CallOverrides): Promise<BigNumber>;
openPosition(_amm: PromiseOrValue<string>, _side: PromiseOrValue<BigNumberish>, _quoteAssetAmount: Decimal.DecimalStruct, _leverage: Decimal.DecimalStruct, _baseAssetAmountLimit: Decimal.DecimalStruct, _feesInFeeToken: PromiseOrValue<boolean>, overrides?: Overrides & {
from?: PromiseOrValue<string>;
}): Promise<BigNumber>;
owner(overrides?: CallOverrides): Promise<BigNumber>;
partialClose(_amm: PromiseOrValue<string>, _partialCloseRatio: Decimal.DecimalStruct, _quoteAssetAmountLimit: Decimal.DecimalStruct, _feesInFeeToken: PromiseOrValue<boolean>, overrides?: Overrides & {
partialClose(_amm: PromiseOrValue<string>, _partialCloseRatio: Decimal.DecimalStruct, _quoteAssetAmountLimit: Decimal.DecimalStruct, overrides?: Overrides & {
from?: PromiseOrValue<string>;
}): Promise<BigNumber>;
partialLiquidationRatio(overrides?: CallOverrides): Promise<BigNumber>;
pause(overrides?: Overrides & {

@@ -709,5 +669,3 @@ from?: PromiseOrValue<string>;

paused(overrides?: CallOverrides): Promise<BigNumber>;
payFunding(_amm: PromiseOrValue<string>, overrides?: Overrides & {
from?: PromiseOrValue<string>;
}): Promise<BigNumber>;
positionMap(arg0: PromiseOrValue<string>, arg1: PromiseOrValue<string>, overrides?: CallOverrides): Promise<BigNumber>;
removeMargin(_amm: PromiseOrValue<string>, _removedMargin: Decimal.DecimalStruct, overrides?: Overrides & {

@@ -719,25 +677,17 @@ from?: PromiseOrValue<string>;

}): Promise<BigNumber>;
repegAmmK(amm: PromiseOrValue<string>, k: Decimal.DecimalStruct, overrides?: Overrides & {
repegBots(arg0: PromiseOrValue<string>, overrides?: CallOverrides): Promise<BigNumber>;
repegLiquidityDepth(_amm: PromiseOrValue<string>, _multiplier: Decimal.DecimalStruct, overrides?: Overrides & {
from?: PromiseOrValue<string>;
}): Promise<BigNumber>;
repegAmmY(amm: PromiseOrValue<string>, _quoteAssetReserve: Decimal.DecimalStruct, overrides?: Overrides & {
repegPrice(_amm: PromiseOrValue<string>, overrides?: Overrides & {
from?: PromiseOrValue<string>;
}): Promise<BigNumber>;
repegBot(overrides?: CallOverrides): Promise<BigNumber>;
repegFeesTotal(overrides?: CallOverrides): Promise<BigNumber>;
setBackstopLiquidityProvider(account: PromiseOrValue<string>, isProvider: PromiseOrValue<boolean>, overrides?: Overrides & {
setRepegBot(_amm: PromiseOrValue<string>, _repegBot: PromiseOrValue<string>, overrides?: Overrides & {
from?: PromiseOrValue<string>;
}): Promise<BigNumber>;
setFeeToken(_token: PromiseOrValue<string>, overrides?: Overrides & {
settleFunding(_amm: PromiseOrValue<string>, overrides?: Overrides & {
from?: PromiseOrValue<string>;
}): Promise<BigNumber>;
setFeeTokenStatus(_status: PromiseOrValue<BigNumberish>, overrides?: Overrides & {
from?: PromiseOrValue<string>;
}): Promise<BigNumber>;
setRepegBot(_bot: PromiseOrValue<string>, overrides?: Overrides & {
from?: PromiseOrValue<string>;
}): Promise<BigNumber>;
setTollPool(_feePool: PromiseOrValue<string>, overrides?: Overrides & {
from?: PromiseOrValue<string>;
}): Promise<BigNumber>;
tollMap(arg0: PromiseOrValue<string>, overrides?: CallOverrides): Promise<BigNumber>;
totalPositionSizeMap(arg0: PromiseOrValue<string>, overrides?: CallOverrides): Promise<BigNumber>;
transferOwnership(newOwner: PromiseOrValue<string>, overrides?: Overrides & {

@@ -754,11 +704,8 @@ from?: PromiseOrValue<string>;

}): Promise<PopulatedTransaction>;
backstopLiquidityProviderMap(arg0: PromiseOrValue<string>, overrides?: CallOverrides): Promise<PopulatedTransaction>;
calculateAmmPnlK(amm: PromiseOrValue<string>, k: Decimal.DecimalStruct, overrides?: CallOverrides): Promise<PopulatedTransaction>;
calculateAmmPnlY(amm: PromiseOrValue<string>, p2: SignedDecimal.SignedDecimalStruct, overrides?: CallOverrides): Promise<PopulatedTransaction>;
closePosition(_amm: PromiseOrValue<string>, _quoteAssetAmountLimit: Decimal.DecimalStruct, _feesInFeeToken: PromiseOrValue<boolean>, overrides?: Overrides & {
closePosition(_amm: PromiseOrValue<string>, _quoteAssetAmountLimit: Decimal.DecimalStruct, overrides?: Overrides & {
from?: PromiseOrValue<string>;
}): Promise<PopulatedTransaction>;
feePool(overrides?: CallOverrides): Promise<PopulatedTransaction>;
feeToken(overrides?: CallOverrides): Promise<PopulatedTransaction>;
feeTokenStatus(overrides?: CallOverrides): Promise<PopulatedTransaction>;
cumulativePremiumFractionLong(arg0: PromiseOrValue<string>, arg1: PromiseOrValue<BigNumberish>, overrides?: CallOverrides): Promise<PopulatedTransaction>;
cumulativePremiumFractionShort(arg0: PromiseOrValue<string>, arg1: PromiseOrValue<BigNumberish>, overrides?: CallOverrides): Promise<PopulatedTransaction>;
fundingRateDeltaCapRatio(overrides?: CallOverrides): Promise<PopulatedTransaction>;
getLatestCumulativePremiumFraction(_amm: PromiseOrValue<string>, overrides?: CallOverrides): Promise<PopulatedTransaction>;

@@ -768,4 +715,3 @@ getMarginRatio(_amm: PromiseOrValue<string>, _trader: PromiseOrValue<string>, overrides?: CallOverrides): Promise<PopulatedTransaction>;

getPositionNotionalAndUnrealizedPnl(_amm: PromiseOrValue<string>, _trader: PromiseOrValue<string>, _pnlCalcOption: PromiseOrValue<BigNumberish>, overrides?: CallOverrides): Promise<PopulatedTransaction>;
getUnadjustedPosition(_amm: PromiseOrValue<string>, _trader: PromiseOrValue<string>, overrides?: CallOverrides): Promise<PopulatedTransaction>;
initialize(_insuranceFund: PromiseOrValue<string>, overrides?: Overrides & {
initialize(_insuranceFund: PromiseOrValue<string>, _fundingRateDeltaCapRatio: PromiseOrValue<BigNumberish>, overrides?: Overrides & {
from?: PromiseOrValue<string>;

@@ -777,15 +723,10 @@ }): Promise<PopulatedTransaction>;

}): Promise<PopulatedTransaction>;
liquidateWithSlippage(_amm: PromiseOrValue<string>, _trader: PromiseOrValue<string>, _quoteAssetAmountLimit: Decimal.DecimalStruct, overrides?: Overrides & {
openInterestNotionalMap(arg0: PromiseOrValue<string>, overrides?: CallOverrides): Promise<PopulatedTransaction>;
openPosition(_amm: PromiseOrValue<string>, _side: PromiseOrValue<BigNumberish>, _quoteAssetAmount: Decimal.DecimalStruct, _leverage: Decimal.DecimalStruct, _baseAssetAmountLimit: Decimal.DecimalStruct, overrides?: Overrides & {
from?: PromiseOrValue<string>;
}): Promise<PopulatedTransaction>;
liquidationFeeRatio(overrides?: CallOverrides): Promise<PopulatedTransaction>;
openInterestMap(arg0: PromiseOrValue<string>, overrides?: CallOverrides): Promise<PopulatedTransaction>;
openPosition(_amm: PromiseOrValue<string>, _side: PromiseOrValue<BigNumberish>, _quoteAssetAmount: Decimal.DecimalStruct, _leverage: Decimal.DecimalStruct, _baseAssetAmountLimit: Decimal.DecimalStruct, _feesInFeeToken: PromiseOrValue<boolean>, overrides?: Overrides & {
from?: PromiseOrValue<string>;
}): Promise<PopulatedTransaction>;
owner(overrides?: CallOverrides): Promise<PopulatedTransaction>;
partialClose(_amm: PromiseOrValue<string>, _partialCloseRatio: Decimal.DecimalStruct, _quoteAssetAmountLimit: Decimal.DecimalStruct, _feesInFeeToken: PromiseOrValue<boolean>, overrides?: Overrides & {
partialClose(_amm: PromiseOrValue<string>, _partialCloseRatio: Decimal.DecimalStruct, _quoteAssetAmountLimit: Decimal.DecimalStruct, overrides?: Overrides & {
from?: PromiseOrValue<string>;
}): Promise<PopulatedTransaction>;
partialLiquidationRatio(overrides?: CallOverrides): Promise<PopulatedTransaction>;
pause(overrides?: Overrides & {

@@ -795,5 +736,3 @@ from?: PromiseOrValue<string>;

paused(overrides?: CallOverrides): Promise<PopulatedTransaction>;
payFunding(_amm: PromiseOrValue<string>, overrides?: Overrides & {
from?: PromiseOrValue<string>;
}): Promise<PopulatedTransaction>;
positionMap(arg0: PromiseOrValue<string>, arg1: PromiseOrValue<string>, overrides?: CallOverrides): Promise<PopulatedTransaction>;
removeMargin(_amm: PromiseOrValue<string>, _removedMargin: Decimal.DecimalStruct, overrides?: Overrides & {

@@ -805,25 +744,17 @@ from?: PromiseOrValue<string>;

}): Promise<PopulatedTransaction>;
repegAmmK(amm: PromiseOrValue<string>, k: Decimal.DecimalStruct, overrides?: Overrides & {
repegBots(arg0: PromiseOrValue<string>, overrides?: CallOverrides): Promise<PopulatedTransaction>;
repegLiquidityDepth(_amm: PromiseOrValue<string>, _multiplier: Decimal.DecimalStruct, overrides?: Overrides & {
from?: PromiseOrValue<string>;
}): Promise<PopulatedTransaction>;
repegAmmY(amm: PromiseOrValue<string>, _quoteAssetReserve: Decimal.DecimalStruct, overrides?: Overrides & {
repegPrice(_amm: PromiseOrValue<string>, overrides?: Overrides & {
from?: PromiseOrValue<string>;
}): Promise<PopulatedTransaction>;
repegBot(overrides?: CallOverrides): Promise<PopulatedTransaction>;
repegFeesTotal(overrides?: CallOverrides): Promise<PopulatedTransaction>;
setBackstopLiquidityProvider(account: PromiseOrValue<string>, isProvider: PromiseOrValue<boolean>, overrides?: Overrides & {
setRepegBot(_amm: PromiseOrValue<string>, _repegBot: PromiseOrValue<string>, overrides?: Overrides & {
from?: PromiseOrValue<string>;
}): Promise<PopulatedTransaction>;
setFeeToken(_token: PromiseOrValue<string>, overrides?: Overrides & {
settleFunding(_amm: PromiseOrValue<string>, overrides?: Overrides & {
from?: PromiseOrValue<string>;
}): Promise<PopulatedTransaction>;
setFeeTokenStatus(_status: PromiseOrValue<BigNumberish>, overrides?: Overrides & {
from?: PromiseOrValue<string>;
}): Promise<PopulatedTransaction>;
setRepegBot(_bot: PromiseOrValue<string>, overrides?: Overrides & {
from?: PromiseOrValue<string>;
}): Promise<PopulatedTransaction>;
setTollPool(_feePool: PromiseOrValue<string>, overrides?: Overrides & {
from?: PromiseOrValue<string>;
}): Promise<PopulatedTransaction>;
tollMap(arg0: PromiseOrValue<string>, overrides?: CallOverrides): Promise<PopulatedTransaction>;
totalPositionSizeMap(arg0: PromiseOrValue<string>, overrides?: CallOverrides): Promise<PopulatedTransaction>;
transferOwnership(newOwner: PromiseOrValue<string>, overrides?: Overrides & {

@@ -830,0 +761,0 @@ from?: PromiseOrValue<string>;

@@ -26,3 +26,4 @@ import type { BaseContract, BigNumber, BigNumberish, BytesLike, CallOverrides, PopulatedTransaction, Signer, utils } from "ethers";

openNotional: Decimal.DecimalStruct;
lastUpdatedCumulativePremiumFraction: SignedDecimal.SignedDecimalStruct;
lastUpdatedCumulativePremiumFractionLong: SignedDecimal.SignedDecimalStruct;
lastUpdatedCumulativePremiumFractionShort: SignedDecimal.SignedDecimalStruct;
blockNumber: PromiseOrValue<BigNumberish>;

@@ -35,2 +36,3 @@ };

SignedDecimal.SignedDecimalStructOutput,
SignedDecimal.SignedDecimalStructOutput,
BigNumber

@@ -41,3 +43,4 @@ ] & {

openNotional: Decimal.DecimalStructOutput;
lastUpdatedCumulativePremiumFraction: SignedDecimal.SignedDecimalStructOutput;
lastUpdatedCumulativePremiumFractionLong: SignedDecimal.SignedDecimalStructOutput;
lastUpdatedCumulativePremiumFractionShort: SignedDecimal.SignedDecimalStructOutput;
blockNumber: BigNumber;

@@ -53,3 +56,3 @@ };

"getPersonalPositionWithFundingPayment(address,address)": FunctionFragment;
"getUnrealizedPnl(address,address,uint8)": FunctionFragment;
"getUnrealizedPnl(address,address)": FunctionFragment;
};

@@ -62,7 +65,3 @@ getFunction(nameOrSignatureOrTopic: "clearingHouse" | "getFreeCollateral" | "getMarginRatio" | "getPersonalBalanceWithFundingPayment" | "getPersonalPositionWithFundingPayment" | "getUnrealizedPnl"): FunctionFragment;

encodeFunctionData(functionFragment: "getPersonalPositionWithFundingPayment", values: [PromiseOrValue<string>, PromiseOrValue<string>]): string;
encodeFunctionData(functionFragment: "getUnrealizedPnl", values: [
PromiseOrValue<string>,
PromiseOrValue<string>,
PromiseOrValue<BigNumberish>
]): string;
encodeFunctionData(functionFragment: "getUnrealizedPnl", values: [PromiseOrValue<string>, PromiseOrValue<string>]): string;
decodeFunctionResult(functionFragment: "clearingHouse", data: BytesLike): Result;

@@ -104,3 +103,3 @@ decodeFunctionResult(functionFragment: "getFreeCollateral", data: BytesLike): Result;

}>;
getUnrealizedPnl(_amm: PromiseOrValue<string>, _trader: PromiseOrValue<string>, _pnlCalcOption: PromiseOrValue<BigNumberish>, overrides?: CallOverrides): Promise<[SignedDecimal.SignedDecimalStructOutput]>;
getUnrealizedPnl(_amm: PromiseOrValue<string>, _trader: PromiseOrValue<string>, overrides?: CallOverrides): Promise<[SignedDecimal.SignedDecimalStructOutput]>;
};

@@ -112,3 +111,3 @@ clearingHouse(overrides?: CallOverrides): Promise<string>;

getPersonalPositionWithFundingPayment(_amm: PromiseOrValue<string>, _trader: PromiseOrValue<string>, overrides?: CallOverrides): Promise<ClearingHouse.PositionStructOutput>;
getUnrealizedPnl(_amm: PromiseOrValue<string>, _trader: PromiseOrValue<string>, _pnlCalcOption: PromiseOrValue<BigNumberish>, overrides?: CallOverrides): Promise<SignedDecimal.SignedDecimalStructOutput>;
getUnrealizedPnl(_amm: PromiseOrValue<string>, _trader: PromiseOrValue<string>, overrides?: CallOverrides): Promise<SignedDecimal.SignedDecimalStructOutput>;
callStatic: {

@@ -120,3 +119,3 @@ clearingHouse(overrides?: CallOverrides): Promise<string>;

getPersonalPositionWithFundingPayment(_amm: PromiseOrValue<string>, _trader: PromiseOrValue<string>, overrides?: CallOverrides): Promise<ClearingHouse.PositionStructOutput>;
getUnrealizedPnl(_amm: PromiseOrValue<string>, _trader: PromiseOrValue<string>, _pnlCalcOption: PromiseOrValue<BigNumberish>, overrides?: CallOverrides): Promise<SignedDecimal.SignedDecimalStructOutput>;
getUnrealizedPnl(_amm: PromiseOrValue<string>, _trader: PromiseOrValue<string>, overrides?: CallOverrides): Promise<SignedDecimal.SignedDecimalStructOutput>;
};

@@ -130,3 +129,3 @@ filters: {};

getPersonalPositionWithFundingPayment(_amm: PromiseOrValue<string>, _trader: PromiseOrValue<string>, overrides?: CallOverrides): Promise<BigNumber>;
getUnrealizedPnl(_amm: PromiseOrValue<string>, _trader: PromiseOrValue<string>, _pnlCalcOption: PromiseOrValue<BigNumberish>, overrides?: CallOverrides): Promise<BigNumber>;
getUnrealizedPnl(_amm: PromiseOrValue<string>, _trader: PromiseOrValue<string>, overrides?: CallOverrides): Promise<BigNumber>;
};

@@ -139,4 +138,4 @@ populateTransaction: {

getPersonalPositionWithFundingPayment(_amm: PromiseOrValue<string>, _trader: PromiseOrValue<string>, overrides?: CallOverrides): Promise<PopulatedTransaction>;
getUnrealizedPnl(_amm: PromiseOrValue<string>, _trader: PromiseOrValue<string>, _pnlCalcOption: PromiseOrValue<BigNumberish>, overrides?: CallOverrides): Promise<PopulatedTransaction>;
getUnrealizedPnl(_amm: PromiseOrValue<string>, _trader: PromiseOrValue<string>, overrides?: CallOverrides): Promise<PopulatedTransaction>;
};
}

@@ -1,5 +0,17 @@

import { Signer } from "ethers";
import type { Provider } from "@ethersproject/providers";
import { Signer, ContractFactory, Overrides } from "ethers";
import type { Provider, TransactionRequest } from "@ethersproject/providers";
import type { PromiseOrValue } from "../common";
import type { Amm, AmmInterface } from "../Amm";
export declare class Amm__factory {
declare type AmmConstructorParams = [signer?: Signer] | ConstructorParameters<typeof ContractFactory>;
export declare class Amm__factory extends ContractFactory {
constructor(...args: AmmConstructorParams);
deploy(overrides?: Overrides & {
from?: PromiseOrValue<string>;
}): Promise<Amm>;
getDeployTransaction(overrides?: Overrides & {
from?: PromiseOrValue<string>;
}): TransactionRequest;
attach(address: string): Amm;
connect(signer: Signer): Amm__factory;
static readonly bytecode = "0x608060405234801561001057600080fd5b5061459e806100206000396000f3fe608060405234801561001057600080fd5b506004361061036e5760003560e01c806298f34d14610373578063013dd7951461038f57806301905e98146103cf578063021bd8ea146103e757806305307703146103fa5780630902f1ac146104025780630aa33fa91461041f5780630d451c8f146104345780630dd68c701461043c578063113773941461044f578063130234cf146104575780631d3acb441461047a5780631e1ff13b14610484578063203b37881461049757806321e00985146104aa578063252a4ba5146104dd57806329f9b17b146104f05780632a5aa292146104f85780632c453bdf1461050b5780632d77407d146105365780632d7cb219146105835780632f84885914610596578063332b82fa1461059e578063385b50f4146105a657806341d3c84c146105ae578063471be2fa146105d25780634894d183146105db5780634cb876f2146105ee57806350799c81146105f8578063525454101461060b57806358a4c3dc1461061357806358c0994a1461061c57806359362b8814610624578063604096321461062c5780636c127446146106345780636d206d6d146106475780636fa42ede1461064f5780636fdca5e014610662578063715018a614610675578063724e78da1461067d578063741bef1a1461069057806374d7c62b146106a357806375df6389146106ac5780637cb9dcee146106bf5780637fd44dae146106d2578063862c04e3146106dc5780638da5cb5b146106ef5780638f40d932146106f7578063918a8d32146107015780639bf5d1d4146107145780639e010362146107275780639ece77c81461072f578063a6174e5614610742578063a7b774a01461074b578063a8f8be4e1461075e578063b0919abe14610771578063b13c86a31461077b578063b42baf3e146107ca578063b4f40c61146107fb578063c2de442f14610805578063c9566fcc1461080e578063c9dde75614610818578063d48f271d1461082b578063d56f2fda14610835578063d71ec2ad14610848578063da0c59271461085b578063de8b31921461086e578063df7d275914610881578063e0037a6c14610894578063e1f1027f1461089d578063e4bc2eb9146108b0578063ed83d79c146108ba578063f1b5df86146108c2578063f2fde38b146108d5578063f4fe3e9c146108e8578063fcfff16f146108f1578063fdf262b714610905575b600080fd5b61037b610918565b604051905181526020015b60405180910390f35b6103a261039d366004613c96565b610934565b6040805195518652935160208601529151928401929092529051606083015251608082015260a001610386565b607b546103d99081565b604051908152602001610386565b61037b6103f5366004613c96565b610abd565b61037b610b9c565b61040a610bb8565b60408051925183529051602083015201610386565b61043261042d366004613c96565b610bea565b005b6088546103d9565b61043261044a366004613cb2565b610c6f565b61037b610d00565b61046a610465366004613cfb565b610d1c565b6040519015158152602001610386565b6067546103d99081565b610432610492366004613d17565b610e40565b6104326104a5366004613c96565b610e74565b6104bd6104b8366004613d17565b610ee8565b604080519451855292516020850152918301526060820152608001610386565b6104326104eb366004613d30565b610f39565b61037b610fd9565b610432610506366004613d17565b610ff5565b60865461051e906001600160a01b031681565b6040516001600160a01b039091168152602001610386565b6040805160208082018352606f54825282518082018452607054815283519182019093526071548152610567929083565b6040805193518452915160208401525190820152606001610386565b610432610591366004613c96565b611067565b61037b6110d2565b6103a26110ee565b61037b6112b4565b604080516020808201835260725482528251908101909252607354825261040a9182565b6103d9607f5481565b61037b6105e9366004613cfb565b6112d0565b6079546103d99081565b61037b610606366004613d76565b6112ee565b61037b6113f4565b6103d960855481565b61037b611410565b61037b61149a565b61037b6114b6565b610432610642366004613c96565b6114ea565b61037b61155e565b61037b61065d366004613cfb565b61157a565b610432610670366004613ddd565b611591565b610432611656565b61043261068b366004613e0d565b611691565b60845461051e906001600160a01b031681565b6103d9607e5481565b61037b6106ba366004613e42565b61175c565b6104326106cd366004613d30565b6119cd565b607d546103d99081565b6104326106ea366004613c96565b611a4c565b61051e611b34565b6066546103d99081565b61043261070f366004613e8d565b611b43565b61037b610722366004613d76565b611e6c565b61046a611f50565b61043261073d366004613e0d565b611fe6565b6103d960835481565b61037b610759366004613f0a565b612037565b61043261076c366004613c96565b6121dc565b607c546103d99081565b610783612247565b6040516103869190600060a0820190508251518252602083015151602083015260408301515160408301526060830151516060830152608083015151608083015292915050565b6040805160208082018352606c54825282518082018452606d5481528351918201909352606e548152610567929083565b6076546103d99081565b6103d960815481565b6075546103d99081565b610432610826366004613c96565b6122b4565b607a546103d99081565b610432610843366004613d30565b612328565b61037b610856366004613f45565b6123de565b61037b610869366004613cfb565b612460565b61043261087c366004613d17565b612492565b61037b61088f366004613c96565b612512565b6103d960805481565b61037b6108ab366004613cfb565b6125fa565b6074546103d99081565b61056761262c565b61037b6108d0366004613d17565b612799565b6104326108e3366004613e0d565b6127aa565b6103d960825481565b60875461046a90600160a01b900460ff1681565b60875461051e906001600160a01b031681565b610920613ba4565b506040805160208101909152606854815290565b61093c613ba4565b610944613ba4565b61094c613ba4565b610954613ba4565b61095c613ba4565b608754600160a01b900460ff1661098e5760405162461bcd60e51b815260040161098590613f81565b60405180910390fd5b6086546001600160a01b031633146109b85760405162461bcd60e51b815260040161098590613fa9565b6083546082546109c89190613ff3565b4210156109e75760405162461bcd60e51b81526004016109859061400b565b60006109f287612847565b60408051602080820183526074548252825190810190925260755482529192506000610a1e83856128e8565b90506000610a2c83866128e8565b90506000610a3a83836128e8565b90506000610a4782612512565b8451607481905584516075819055845160765542608255607d91909155607c559050610a7161290e565b600080516020614529833981519152610a88875190565b8651865186518551604051610aa195949392919061403d565b60405180910390a1949c939b5091995097509195509350505050565b610ac5613ba4565b6040805160208101909152607d548152600090610ae190612a3f565b6040805160208101909152607c548152909150600090610b0090612a3f565b90506000610b0e8383612aa3565b90506000610b22610b1d6114b6565b612a3f565b90506000610b2f87612a3f565b9050610b91610b8a610b3f612ac0565b610b84610b5e610b57610b52888a612add565b612afa565b8690612aa3565b610b7e610b6e610b52898b612aa3565b610b78888a612aa3565b90612b76565b90612b93565b90612bb0565b8690612add565b979650505050505050565b610ba4613ba4565b506040805160208101909152606b54815290565b610bc0613ba4565b610bc8613ba4565b5050604080516020808201835260745482528251908101909252607554825291565b33610bf3611b34565b6001600160a01b031614610c195760405162461bcd60e51b815260040161098590614060565b610c2281612c20565b8051606681905560408051602081019091528190527f413bcf24bd99a421ccaf50a4a1dba0cfd78558ceb34625206d2e6dfa1a53ff27905b6040519081526020015b60405180910390a150565b33610c78611b34565b6001600160a01b031614610c9e5760405162461bcd60e51b815260040161098590614060565b81516077819055815160788190556040805160208082018352908490528151808201835283905281519384528301919091527f7338f3784ceb8f9456bac0c4a69f1c6354dc325fa6455e3e3f6a8a9bf9249a7c91015b60405180910390a15050565b610d08613ba4565b506040805160208101909152607754815290565b604080516020810190915260675490819052600090600003610d4057506000610e3a565b600080610d4b612c6e565b915091506000610d5b8686612460565b905060006001876001811115610d7357610d73614095565b14610dbb5760408051602081019091526075548152610db690610d969088612e03565b60408051602081019091526074548152610db09085612e20565b90612e3d565b610df3565b60408051602081019091526075548152610df390610dd99088612e20565b60408051602081019091526074548152610db09085612e03565b90506000610e018286612e5a565b60000b13158015610e1f57506000610e198285612e5a565b60000b12155b15610e31576000945050505050610e3a565b60019450505050505b92915050565b33610e49611b34565b6001600160a01b031614610e6f5760405162461bcd60e51b815260040161098590614060565b608355565b33610e7d611b34565b6001600160a01b031614610ea35760405162461bcd60e51b815260040161098590614060565b610eac81612c20565b8051606b81905560408051602081019091528190527f6f825f18b787836f7cf974799b160538ab237aa0d14af3611fa69683a40c6d2290610c5a565b60888181548110610ef857600080fd5b600091825260209182902060408051808501825260049093029091018054835281519384019091526001810154835260028101546003909101549193509084565b33610f42611b34565b6001600160a01b031614610f685760405162461bcd60e51b815260040161098590614060565b6040805160608101825284815260208101849052018190528251606c558151606d558051606e557fdb990bcf88f23a71d18373867e3602c89a209902f2bb7fda7691dd3215287134610fb8845190565b83515b8351604051610fcc939291906140ab565b60405180910390a1505050565b610fe1613ba4565b506040805160208101909152607a54815290565b33610ffe611b34565b6001600160a01b0316146110245760405162461bcd60e51b815260040161098590614060565b607e8190556110346002826140d7565b6081556040518181527f6ce6315004c92b2957244860cf57179c165f8c77755f841dcd1a7e315dc76afb90602001610c64565b33611070611b34565b6001600160a01b0316146110965760405162461bcd60e51b815260040161098590614060565b8051606581905560408051602081019091528190527f42fb40f05167879d1c8fddb6b4cd334f303e50aaf387b80b3c27633933dac15790610c5a565b6110da613ba4565b506040805160208101909152607954815290565b6110f6613ba4565b6110fe613ba4565b611106613ba4565b61110e613ba4565b611116613ba4565b608754600160a01b900460ff1661113f5760405162461bcd60e51b815260040161098590613f81565b6086546001600160a01b031633146111695760405162461bcd60e51b815260040161098590613fa9565b6083546082546111799190613ff3565b4210156111985760405162461bcd60e51b81526004016109859061400b565b60006111a2611410565b905060006111af82610abd565b60408051602080820183526074548252825190810190925260755482529192506111da9084906128e8565b516074819055604080516020808201835260755482528251908101909252918152611204916128e8565b5160765542608255607454607d55607554607c5561122061290e565b600080516020614529833981519152611237825190565b60408051602080820183526075549182905282518082018452607454908190528351918201845290829052865192516112729493839161403d565b60405180910390a16040805160208082018352607554808352835180830185526074548152845192830190945281529299509750955093509150509091929394565b6112bc613ba4565b506040805160208101909152606954815290565b6112d8613ba4565b6112e783836000610384612e8b565b9392505050565b6112f6613ba4565b835160000361130e57611307612f2a565b90506113ec565b60008086600181111561132357611323614095565b14905061132e613ba4565b611336613ba4565b61133e613ba4565b83156113555761134e8789612e03565b9150611362565b61135f8789612e20565b91505b81516000036113ac5760405162461bcd60e51b8152602060048201526016602482015275071756f746520617373657420616674657220697320360541b6044820152606401610985565b604080516020810190915260765481526113d19083906113cb90612a3f565b90612f45565b92506113e56113e08488612bb0565b612fb2565b9450505050505b949350505050565b6113fc613ba4565b506040805160208101909152607854815290565b611418613ba4565b6040805160208101918290526084546085546331d98b3f60e01b90935260248201929092529081906001600160a01b03166331d98b3f60448301602060405180830381865afa15801561146f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061149391906140eb565b9052919050565b6114a2613ba4565b506040805160208101909152606554815290565b6114be613ba4565b60408051602080820183526075548252825190810190925260745482526114e59190612e3d565b905090565b336114f3611b34565b6001600160a01b0316146115195760405162461bcd60e51b815260040161098590614060565b61152281612c20565b8051606981905560408051602081019091528190527fe75e3e311afafb466335ae8af3bf1d55443d8937fb5ada14583f4fca729c0fa890610c5a565b611566613ba4565b506040805160208101909152606a54815290565b611582613ba4565b6112e783836001610384612e8b565b3361159a611b34565b6001600160a01b0316146115c05760405162461bcd60e51b815260040161098590614060565b60875460ff600160a01b90910416151581151514611653576087805482158015600160a01b0260ff60a01b199092169190911790915561162557610e10607e544261160b9190613ff3565b61161591906140d7565b61162190610e10614104565b6080555b604051811515907fc15f25c4eb6ac5b9dc23661b850cbdb3ee36aebed198ad870ab929bae77142de90600090a25b50565b3361165f611b34565b6001600160a01b0316146116855760405162461bcd60e51b815260040161098590614060565b61168f6000612fe8565b565b3361169a611b34565b6001600160a01b0316146116c05760405162461bcd60e51b815260040161098590614060565b6001600160a01b0381166117125760405162461bcd60e51b8152602060048201526019602482015278696e76616c696420507269636546656564206164647265737360381b6044820152606401610985565b608480546001600160a01b0319166001600160a01b0383169081179091556040517fe5b20b8497e4f3e2435ef9c20e2e26b47497ee13745ce1c681ad6640653119e690600090a250565b611764613ba4565b608754600160a01b900460ff1661178d5760405162461bcd60e51b815260040161098590613f81565b6086546001600160a01b031633146117b75760405162461bcd60e51b815260040161098590613fa9565b6117cd6117c936869003860186613c96565b5190565b6000036117dc57611307612f2a565b60018560018111156117f0576117f0614095565b0361184f576118076117c936869003860186613c96565b6040805160208082018352606654825282519081019092526074548252611831916117c9916128e8565b101561184f5760405162461bcd60e51b815260040161098590614123565b6000611864866108ab36889003880188613c96565b90506118786117c936869003860186613c96565b1561195d57600086600181111561189157611891614095565b036118fc576118a86117c936869003860186613c96565b815110156118f75760405162461bcd60e51b815260206004820152601c60248201527b2632b9b9903a3430b71036b4b734b6b0b6103130b9b2903a37b5b2b760211b6044820152606401610985565b61195d565b61190e6117c936869003860186613c96565b8151111561195d5760405162461bcd60e51b815260206004820152601c60248201527b26b7b932903a3430b71036b0bc34b6b0b6103130b9b2903a37b5b2b760211b6044820152606401610985565b6119778661197036889003880188613c96565b838661303a565b7fae6a2b946841d9afc0e1e19a94ae4af26f01125b87b5095bbfb177a9741a2ede866119ab6117c936899003890189613c96565b83516040516119bc9392919061414f565b60405180910390a195945050505050565b336119d6611b34565b6001600160a01b0316146119fc5760405162461bcd60e51b815260040161098590614060565b6040805160608101825284815260208101849052018190528251606f55815160705580516071557fd12c16549241d3cde1b026616ce24879c1f8573a0d6e6066d6cb88d339a01f75610fb8845190565b33611a55611b34565b6001600160a01b031614611a7b5760405162461bcd60e51b815260040161098590614060565b611a8481612c20565b6000611a98611a91612ac0565b8390612e5a565b60000b12611af85760405162461bcd60e51b815260206004820152602760248201527f7061727469616c206c697120726174696f2073686f756c64206265206c657373604482015266207468616e203160c81b6064820152608401610985565b8051606a81905560408051602081019091528190527f879382899c61e679db091d48ae2646f0021988fe20a18f21e1b856acbc57bb5c90610c5a565b6033546001600160a01b031690565b600054610100900460ff16611b5e5760005460ff1615611b62565b303b155b611bc55760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610985565b600054610100900460ff16158015611be7576000805461ffff19166101011790555b8915801590611bf557508715155b8015611c0057508815155b8015611c0b57508615155b8015611c1f57506001600160a01b03861615155b8015611c3357506001600160a01b03841615155b611c6f5760405162461bcd60e51b815260206004820152600d60248201526c1a5b9d985b1a59081a5b9c1d5d609a1b6044820152606401610985565b611c7761319f565b6040805160208082018352908c905260748c9055815180820183528b905260758b9055815180820183528b815282519182019092528b8152611cb8916128e8565b516076556040805160208082018352908a905260668a905581518082018352849052606584905581519081019091528390526067839055607e879055611cff6002886140d7565b60815561a8c0608355607e54607f556085859055608780546001600160a01b038681166001600160a01b03199283161790925560848054928916929091169190911790556040805160a08101825260748054608083019081528252825160208082018552607580548352818501928352428587018181524360608801908152608880546001810182556000919091529751516004989098026000805160206144768339815191528101989098559451516000805160206144968339815191528801555160008051602061454983398151915287015592516000805160206144e9833981519152909501949094558451808201865292549283905284519081018552925492839052925160008051602061450983398151915293611e2293916140ab565b60405180910390a16040805160208082018352908b9052607c8b905581519081019091528a9052607d8a90558015611e60576000805461ff00191690555b50505050505050505050565b611e74613ba4565b8351600003611e8557611307612f2a565b600080866001811115611e9a57611e9a614095565b149050611ea5613ba4565b611ead613ba4565b611eb5613ba4565b8315611ecc57611ec58689612e03565b9150611ed9565b611ed68689612e20565b91505b8151600003611f225760405162461bcd60e51b8152602060048201526015602482015274062617365206173736574206166746572206973203605c1b6044820152606401610985565b60408051602081019091526076548152611f419083906113cb90612a3f565b92506113e56113e08489612bb0565b600080611f5b611410565b90506000611f67825190565b11611fa75760405162461bcd60e51b815260206004820152601060248201526f0696e64657820707269636520697320360841b6044820152606401610985565b6000611fb16114b6565b90506000611fc96113e0846113cb86610b8487612a3f565b905067016345785d8a0000611fdc825190565b1015935050505090565b33611fef611b34565b6001600160a01b0316146120155760405162461bcd60e51b815260040161098590614060565b608680546001600160a01b0319166001600160a01b0392909216919091179055565b61203f613ba4565b6120516117c936859003850185613c96565b60000361206757612060612f2a565b90506112e7565b6000612071611410565b9050600061207d6114b6565b905060006120986117c984610db06113e086610b8489612a3f565b905060008760018111156120ae576120ae614095565b84518451106120be5760016120c1565b60005b60018111156120d2576120d2614095565b604080516020810190915260655481529114915086156121b6576040805160208101909152606f54908190521580159061211c57506040805160208101909152606f549081905283115b1561215357811561213d5750604080516020810190915260715481526121b6565b50604080516020810190915260705481526121b6565b6040805160208101909152606c54908190521580159061218357506040805160208101909152606c549081905283115b156121b65781156121a457506040805160208101909152606e5481526121b6565b506040805160208101909152606d5481525b6121cf816121c9368b90038b018b613c96565b906128e8565b9998505050505050505050565b336121e5611b34565b6001600160a01b03161461220b5760405162461bcd60e51b815260040161098590614060565b8051606781905560408051602081019091528190527f878cd65339a771e627bc9856c713f02fec044bd7607db61e3858f8d56e4ea4f590610c5a565b61224f613bb7565b506040805160c08101825260655460a0820190815281528151602081810184526068548252808301919091528251808201845260695481528284015282518082018452606a54815260608301528251908101909252606b548252608081019190915290565b336122bd611b34565b6001600160a01b0316146122e35760405162461bcd60e51b815260040161098590614060565b6122ec81612c20565b8051606881905560408051602081019091528190527fd67453718fc57aad470d91be51568530ed02cc941c846cd9e281dc56b300e95e90610c5a565b608754600160a01b900460ff166123515760405162461bcd60e51b815260040161098590613f81565b6086546001600160a01b0316331461237b5760405162461bcd60e51b815260040161098590613fa9565b6123858382612f45565b516072556123938282612f45565b5160738190556040805160208082018352607254918290528251908101909252908290527fc57b3a3cd4f9b755410fcb52f146d4f7e06805a4bafdf9da9f0ec270a90002c991610fbb565b6123e6613ba4565b608754600160a01b900460ff1661240f5760405162461bcd60e51b815260040161098590613f81565b6086546001600160a01b031633146124395760405162461bcd60e51b815260040161098590613fa9565b6113ec8461244c36869003860186613c96565b61245b36869003860186613c96565b6131ce565b612468613ba4565b60408051602080820183526074548252825190810190925260755482526112e79185918591611e6c565b3361249b611b34565b6001600160a01b0316146124c15760405162461bcd60e51b815260040161098590614060565b8060000361250d5760405162461bcd60e51b8152602060048201526019602482015278063616e206e6f742073657420696e74657276616c20746f203603c1b6044820152606401610985565b607f55565b61251a613ba4565b6040805160208101909152607c54815260009061253690612a3f565b6040805160208101909152607d54815290915060009061255590612a3f565b905060006125638284612aa3565b905060006125718385612add565b90506000612580610b1d6114b6565b9050600061258d88612a3f565b905060006125be6125a1610b528688612aa3565b610b786125b1610b528888612aa3565b610b7e610b528789612aa3565b90506121cf6125d0610b528686612add565b610b786125e0610b52888a612add565b610b7e6125f0610b52888a612add565b610b7e8888612aa3565b612602613ba4565b60408051602080820183526074548252825190810190925260755482526112e791859185916112ee565b612634613ba4565b61263c613ba4565b612644613ba4565b608754600160a01b900460ff1661266d5760405162461bcd60e51b815260040161098590613f81565b6086546001600160a01b031633146126975760405162461bcd60e51b815260040161098590613fa9565b6080544210156126e45760405162461bcd60e51b8152602060048201526018602482015277736574746c652066756e64696e6720746f6f206561726c7960401b6044820152606401610985565b6126ef607f54612799565b91506126f9611410565b9050600061270a82610b8485612a3f565b905061272e62015180612728607e54846133a690919063ffffffff16565b90613403565b93506000608154426127409190613ff3565b90506000610e10607e546080546127579190613ff3565b61276191906140d7565b61276d90610e10614104565b905081811161277c578161277e565b805b608055612789612f2a565b51607b5550939492935090919050565b6127a1613ba4565b610e3a82613420565b336127b3611b34565b6001600160a01b0316146127d95760405162461bcd60e51b815260040161098590614060565b6001600160a01b03811661283e5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610985565b61165381612fe8565b61284f613ba4565b815160009061286690670de0b6b3a7640000614104565b9050600060038211156128c957508060006128826002836140d7565b61288d906001613ff3565b90505b818110156128c3579050806002816128a881866140d7565b6128b29190613ff3565b6128bc91906140d7565b9050612890565b506128d3565b81156128d3575060015b60408051602081019091529081529392505050565b6128f0613ba4565b6128f8613ba4565b8251845161290591613452565b81529392505050565b60888054439160009161292390600190614185565b815481106129335761293361419c565b90600052602060002090600402019050806003015482036129605760745481556075546001820155612a01565b6040805160a08101825260745460808201908152815281516020808201845260755482528201908152429282019283526060820185815260888054600181018255600091909152925151600080516020614476833981519152600490940293840155905151600080516020614496833981519152830155915160008051602061454983398151915282015590516000805160206144e9833981519152909101555b6040805160208082018352607454918290528251908101835260755490819052915160008051602061450983398151915292610cf4929142906140ab565b612a47613ba4565b8180600001516001600160ff1b0310156040518060600160405280603381526020016144b66033913990612a8e5760405162461bcd60e51b815260040161098591906141b2565b50506040805160208101909152915182525090565b612aab613ba4565b612ab3613ba4565b8251845161290591613460565b612ac8613ba4565b6040518060200160405280611493601261346e565b612ae5613ba4565b612aed613ba4565b825184516129059161347e565b612b02613ba4565b8151600090612b1990670de0b6b3a7640000614207565b9050600060038213156128c95750806000612b3560028361428c565b612b409060016142ba565b90505b818112156128c357905080600281612b5b818661428c565b612b6591906142ba565b612b6f919061428c565b9050612b43565b612b7e613ba4565b612b86613ba4565b825184516129059161348c565b612b9b613ba4565b612ba3613ba4565b8251845161290591613498565b612bb8613ba4565b8180600001516001600160ff1b0310156040518060600160405280603381526020016144b66033913990612bff5760405162461bcd60e51b815260040161098591906141b2565b50612c08613ba4565b83518551612c1691906142fb565b8152949350505050565b6000612c2d611a91612ac0565b60000b13156116535760405162461bcd60e51b815260206004820152600d60248201526c696e76616c696420726174696f60981b6044820152606401610985565b612c76613ba4565b612c7e613ba4565b6088805490600090612c91600184614185565b81548110612ca157612ca161419c565b60009182526020918290206040805160a081018252600490930290910180546080840190815283528151808501835260018201548152938301939093526002830154908201526003909101546060820181905290915043148015612d055750600182115b15612d7b576088612d17600284614185565b81548110612d2757612d2761419c565b60009182526020918290206040805160a08101825260049093029091018054608084019081528352815180850183526001820154815293830193909352600283015490820152600390910154606082015290505b60208101518151600091612d8f9190612e3d565b60408051602081019091526067548152909150600090612dc290612dbb90612db5612ac0565b90612e03565b83906128e8565b60408051602081019091526067548152909150600090612df590612dee90612de8612ac0565b90612e20565b84906128e8565b919791965090945050505050565b612e0b613ba4565b612e13613ba4565b82518451612905916134a4565b612e28613ba4565b612e30613ba4565b82518451612905916134b0565b612e45613ba4565b612e4d613ba4565b82518451612905916134bc565b805182516000911015612e6f57506001610e3a565b815183511015612e825750600019610e3a565b50600092915050565b612e93613ba4565b612e9b613c03565b6001808252608854612ead9190614185565b60208201526040810151866001811115612ec957612ec9614095565b90816001811115612edc57612edc614095565b905250604080820180516020018790525101846001811115612f0057612f00614095565b90816001811115612f1357612f13614095565b905250612f2081846134ca565b9695505050505050565b612f32613ba4565b5060408051602081019091526000815290565b612f4d613ba4565b8180600001516001600160ff1b0310156040518060600160405280603381526020016144b66033913990612f945760405162461bcd60e51b815260040161098591906141b2565b50612f9d613ba4565b612fa9610b5785612a3f565b95945050505050565b612fba613ba4565b612fc2613ba4565b825160001315612fe0578251612fd99060006142fb565b8152610e3a565b915182525090565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b613046848484846136d8565b600084600181111561305a5761305a614095565b036130fa57604080516020810190915260745481526130799084612e03565b51607455604080516020810190915260755481526130979083612e20565b516075556040805160208101909152607b5481526130b59083612bb0565b51607b55604080516020810190915260795481526130d390836138c6565b516079556040805160208101909152607a5481526130f190846138c6565b51607a55613191565b604080516020810190915260745481526131149084612e20565b51607455604080516020810190915260755481526131329083612e03565b516075556040805160208101909152607b54815261315090836138c6565b51607b556040805160208101909152607954815261316e9083612bb0565b516079556040805160208101909152607a54815261318c9084612bb0565b51607a555b61319961290e565b50505050565b600054610100900460ff166131c65760405162461bcd60e51b81526004016109859061433a565b61168f61392c565b6131d6613ba4565b82516000036131e757612060612f2a565b60018460018111156131fb576131fb614095565b0361324a578251604080516020808201835260665482528251908101909252607554825261322c916117c9916128e8565b101561324a5760405162461bcd60e51b815260040161098590614123565b60006132568585612460565b905060008086600181111561326d5761326d614095565b1461327957600061327c565b60015b9050613286845190565b1561334d57600181600181111561329f5761329f614095565b036132fb578351825110156132f65760405162461bcd60e51b815260206004820152601d60248201527f4c657373207468616e206d696e696d616c2071756f746520746f6b656e0000006044820152606401610985565b61334d565b83518251111561334d5760405162461bcd60e51b815260206004820152601d60248201527f4d6f7265207468616e206d6178696d616c2071756f746520746f6b656e0000006044820152606401610985565b61335a818387600161303a565b7f0dd4066b1a6ce97fb670c3e4201e908c644193f38cbdaffd0229d7e26da3e53386613384845190565b87516040516133959392919061414f565b60405180910390a150949350505050565b6133ae613ba4565b816001600160ff1b0310156040518060600160405280603381526020016144b660339139906133f05760405162461bcd60e51b815260040161098591906141b2565b506133f9613ba4565b6113ec848461395c565b61340b613ba4565b613413613ba4565b835161290590849061428c565b613428613ba4565b613430613c03565b6000815260885461344390600190614185565b60208201526112e781846134ca565b60006112e783836012613979565b60006112e783836012613998565b6000610e3a60ff8316600a614469565b60006112e7838360126139b8565b60006112e782846142ba565b60006112e782846142fb565b60006112e78284613ff3565b60006112e78284614185565b60006112e7838360126139cd565b6134d2613ba4565b60006134dd846139e3565b9050826000036134ee579050610e3a565b60006134fa8442614185565b9050600060888660200151815481106135155761351561419c565b60009182526020918290206040805160a0810182526004909302909101805460808401908152835281518085018352600180830154825294840152600281015491830191909152600301546060820152608854909250148061357b575081816040015111155b1561358b57829350505050610e3a565b6040810151600061359c8242614185565b905060006135aa8683613b6a565b90505b88602001516000036135d0576135c38183613b87565b9650505050505050610e3a565b600189602001516135e19190614185565b60208a018190526088805490919081106135fd576135fd61419c565b60009182526020918290206040805160a0810182526004909302909101805460808401908152835281518085018352600182015481529383019390935260028301549082015260039091015460608201529350613659896139e3565b95508484604001511161368b5761368461367d6136768786614185565b8890613b6a565b8290612e03565b90506136ce565b600084604001518461369d9190614185565b90506136b36136ac8883613b6a565b8390612e03565b91506136bf8184613ff3565b925084604001519350506135ad565b6121cf8189613b87565b60408051602081019091526067549081905215613199576000806136fa612c6e565b604080516020808201835260755482528251908101909252607454825292945090925060009161372a9190612e3d565b905060006137388285612e5a565b60000b13158015613756575060006137508284612e5a565b60000b12155b6137b25760405162461bcd60e51b815260206004820152602760248201527f707269636520697320616c7265616479206f76657220666c756374756174696f6044820152661b881b1a5b5a5d60ca1b6064820152608401610985565b836138bd5760008760018111156137cb576137cb614095565b1461380d5760408051602081019091526075548152613808906137ee9087612e03565b60408051602081019091526074548152610db09089612e20565b613845565b604080516020810190915260755481526138459061382b9087612e20565b60408051602081019091526074548152610db09089612e03565b905060006138538285612e5a565b60000b131580156138715750600061386b8284612e5a565b60000b12155b6138bd5760405162461bcd60e51b815260206004820152601f60248201527f7072696365206973206f76657220666c756374756174696f6e206c696d6974006044820152606401610985565b50505050505050565b6138ce613ba4565b8180600001516001600160ff1b0310156040518060600160405280603381526020016144b660339139906139155760405162461bcd60e51b815260040161098591906141b2565b5061391e613ba4565b83518551612c1691906142ba565b600054610100900460ff166139535760405162461bcd60e51b81526004016109859061433a565b61168f33612fe8565b613964613ba4565b61396c613ba4565b8351612905908490614207565b60006139848261346e565b61398e8486614104565b6113ec91906140d7565b6000826139a48361346e565b6139ae9086614207565b6113ec919061428c565b60006139c38261346e565b6139ae8486614207565b6000826139d98361346e565b61398e9086614104565b6139eb613ba4565b60006088836020015181548110613a0457613a0461419c565b600091825260208083206040805160a08101825260049094029091018054608085019081528452815180840183526001820154815292840192909252600282015490830152600301546060820152915083516001811115613a6757613a67614095565b03613a7c57602081015181516112e791612e3d565b600183516001811115613a9157613a91614095565b03613b2b5760408301516020015151600003613aaf576112e7612f2a565b60008360400151604001516001811115613acb57613acb614095565b03613aed57604083015180516020918201518351928401516112e793906112ee565b60018360400151604001516001811115613b0957613b09614095565b03613b2b57604083015180516020918201518351928401516112e79390611e6c565b60405162461bcd60e51b81526020600482015260146024820152733737ba1039bab83837b93a32b21037b83a34b7b760611b6044820152606401610985565b613b72613ba4565b613b7a613ba4565b8351612905908490614104565b613b8f613ba4565b613b97613ba4565b83516129059084906140d7565b6040518060200160405280600081525090565b6040518060a00160405280613bca613ba4565b8152602001613bd7613ba4565b8152602001613be4613ba4565b8152602001613bf1613ba4565b8152602001613bfe613ba4565b905290565b6040805160608101909152806000815260200160008152602001613bfe60408051606081019091528060008152602001613c3b613ba4565b81526020016000905290565b600060208284031215613c5957600080fd5b604051602081016001600160401b0381118282101715613c8957634e487b7160e01b600052604160045260246000fd5b6040529135825250919050565b600060208284031215613ca857600080fd5b6112e78383613c47565b60008060408385031215613cc557600080fd5b613ccf8484613c47565b9150613cde8460208501613c47565b90509250929050565b803560028110613cf657600080fd5b919050565b60008060408385031215613d0e57600080fd5b613ccf83613ce7565b600060208284031215613d2957600080fd5b5035919050565b600080600060608486031215613d4557600080fd5b613d4f8585613c47565b9250613d5e8560208601613c47565b9150613d6d8560408601613c47565b90509250925092565b60008060008060808587031215613d8c57600080fd5b613d9585613ce7565b9350613da48660208701613c47565b9250613db38660408701613c47565b9150613dc28660608701613c47565b905092959194509250565b80358015158114613cf657600080fd5b600060208284031215613def57600080fd5b6112e782613dcd565b6001600160a01b038116811461165357600080fd5b600060208284031215613e1f57600080fd5b81356112e781613df8565b600060208284031215613e3c57600080fd5b50919050565b60008060008060808587031215613e5857600080fd5b613e6185613ce7565b9350613e708660208701613e2a565b9250613e7f8660408701613e2a565b9150613dc260608601613dcd565b60008060008060008060008060006101208a8c031215613eac57600080fd5b8935985060208a0135975060408a0135965060608a0135955060808a0135613ed381613df8565b945060a08a0135935060c08a0135613eea81613df8565b8093505060e08a013591506101008a013590509295985092959850929598565b600080600060608486031215613f1f57600080fd5b613f2884613ce7565b9250613f378560208601613e2a565b9150613d6d60408501613dcd565b600080600060608486031215613f5a57600080fd5b613f6384613ce7565b9250613f728560208601613e2a565b9150613d6d8560408601613e2a565b6020808252600e908201526d185b5b481dd85cc818db1bdcd95960921b604082015260600190565b6020808252601a908201527963616c6c6572206973206e6f7420636f756e746572506172747960301b604082015260600190565b634e487b7160e01b600052601160045260246000fd5b6000821982111561400657614006613fdd565b500190565b6020808252601890820152771c995c1959c81a5b9d195c9d985b081d1bdbc81cdb585b1b60421b604082015260600190565b948552602085019390935260408401919091526060830152608082015260a00190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052602160045260246000fd5b9283526020830191909152604082015260600190565b634e487b7160e01b600052601260045260246000fd5b6000826140e6576140e66140c1565b500490565b6000602082840312156140fd57600080fd5b5051919050565b600081600019048311821515161561411e5761411e613fdd565b500290565b6020808252601290820152711bdd995c881d1c98591a5b99c81b1a5b5a5d60721b604082015260600190565b606081016002851061417157634e487b7160e01b600052602160045260246000fd5b938152602081019290925260409091015290565b60008282101561419757614197613fdd565b500390565b634e487b7160e01b600052603260045260246000fd5b600060208083528351808285015260005b818110156141df578581018301518582016040015282016141c3565b818111156141f1576000604083870101525b50601f01601f1916929092016040019392505050565b60006001600160ff1b038184138284138082168684048611161561422d5761422d613fdd565b600160ff1b600087128281168783058912161561424c5761424c613fdd565b6000871292508782058712848416161561426857614268613fdd565b8785058712818416161561427e5761427e613fdd565b505050929093029392505050565b60008261429b5761429b6140c1565b600160ff1b8214600019841416156142b5576142b5613fdd565b500590565b600080821280156001600160ff1b03849003851316156142dc576142dc613fdd565b600160ff1b83900384128116156142f5576142f5613fdd565b50500190565b60008083128015600160ff1b85018412161561431957614319613fdd565b6001600160ff1b038401831381161561433457614334613fdd565b50500390565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b600181815b808511156143c05781600019048211156143a6576143a6613fdd565b808516156143b357918102915b93841c939080029061438a565b509250929050565b6000826143d757506001610e3a565b816143e457506000610e3a565b81600181146143fa576002811461440457614420565b6001915050610e3a565b60ff84111561441557614415613fdd565b50506001821b610e3a565b5060208310610133831016604e8410600b8410161715614443575081810a610e3a565b61444d8383614385565b806000190482111561446157614461613fdd565b029392505050565b60006112e783836143c856fe7ef464cf5a521d70c933977510816a0355b91a50eca2778837fb82da8448ecf67ef464cf5a521d70c933977510816a0355b91a50eca2778837fb82da8448ecf74d69786564446563696d616c3a2075696e742076616c756520697320626967676572207468616e205f494e543235365f4d41587ef464cf5a521d70c933977510816a0355b91a50eca2778837fb82da8448ecf93a3348362552c3897fd1f06a3233519ebd8bd76ad6e99a418a9741155fe90515f793c87aa8955ca27e2a318cdc9a5c97d6196b4eab42c2a9265c97e5ff2443067ef464cf5a521d70c933977510816a0355b91a50eca2778837fb82da8448ecf8a26469706673582212208806777a262fc4928c047f5f08393f34cd2a898c69808d1e179609c0a8379bdc64736f6c634300080d0033";
static readonly abi: ({

@@ -19,2 +31,7 @@ anonymous: boolean;

inputs: ({
internalType: string;
name: string;
type: string;
components?: undefined;
} | {
components: {

@@ -28,7 +45,2 @@ internalType: string;

type: string;
} | {
internalType: string;
name: string;
type: string;
components?: undefined;
})[];

@@ -120,23 +132,2 @@ name: string;

anonymous?: undefined;
} | {
inputs: {
components: {
components: {
internalType: string;
name: string;
type: string;
}[];
internalType: string;
name: string;
type: string;
}[];
internalType: string;
name: string;
type: string;
}[];
name: string;
outputs: never[];
stateMutability: string;
type: string;
anonymous?: undefined;
})[];

@@ -146,1 +137,2 @@ static createInterface(): AmmInterface;

}
export {};

@@ -1,8 +0,20 @@

import { Signer } from "ethers";
import type { Provider } from "@ethersproject/providers";
import { Signer, ContractFactory, Overrides } from "ethers";
import type { Provider, TransactionRequest } from "@ethersproject/providers";
import type { PromiseOrValue } from "../common";
import type { ClearingHouse, ClearingHouseInterface } from "../ClearingHouse";
export declare class ClearingHouse__factory {
declare type ClearingHouseConstructorParams = [signer?: Signer] | ConstructorParameters<typeof ContractFactory>;
export declare class ClearingHouse__factory extends ContractFactory {
constructor(...args: ClearingHouseConstructorParams);
deploy(overrides?: Overrides & {
from?: PromiseOrValue<string>;
}): Promise<ClearingHouse>;
getDeployTransaction(overrides?: Overrides & {
from?: PromiseOrValue<string>;
}): TransactionRequest;
attach(address: string): ClearingHouse;
connect(signer: Signer): ClearingHouse__factory;
static readonly bytecode = "0x608060405234801561001057600080fd5b50615a0680620000216000396000f3fe608060405234801561001057600080fd5b506004361061016a5760003560e01c80632f66c2311461016f57806330d768b01461018457806330e2ae65146101c45780633f4ba83a146101d75780635c975abb146101df5780636507e1f4146101f55780636891397b146102085780636b17ad0314610230578063715018a6146102435780637a394cc51461024b5780638456cb591461026457806385c4d2f21461026c57806386b9d81f1461027f578063893d242d146102925780638b29a8f6146102a55780638bedf3bb146102b85780638da5cb5b146102cb578063a8c1b0bc146102d3578063ac06a96e146102e6578063b0ac5f2f146102f9578063b33dc1901461031a578063b79023031461037e578063cbf512b114610392578063cd6dc687146103a5578063e38099e0146103b8578063e4bf9a31146103d9578063ea0a45f914610486578063f2fde38b146104a8578063f4344efb146104bb578063f55ce4fd146104ce575b600080fd5b61018261017d366004614ee6565b61052c565b005b6101ae610192366004614f1f565b610135602052600090815260409020546001600160a01b031681565b6040516101bb9190614f3c565b60405180910390f35b6101826101d2366004614f50565b6105bc565b6101826107f9565b60985460ff1660405190151581526020016101bb565b610182610203366004614feb565b610832565b61021b610216366004614f1f565b610c23565b604080519251835290516020830152016101bb565b61018261023e366004614f1f565b610d0f565b610182611353565b61012f546102569081565b6040519081526020016101bb565b61018261138c565b61025661027a366004615032565b6113c3565b61018261028d366004614ee6565b6113f3565b6101826102a036600461506b565b61142f565b6101826102b3366004614f1f565b61183f565b61021b6102c63660046150d7565b611974565b6101ae611b0e565b6101826102e1366004615122565b611b1d565b6101826102f4366004614f50565b611e6a565b610256610307366004614f1f565b6101316020526000908152604090205481565b61032d610328366004614ee6565b611fd8565b6040516101bb9190600060c0820190508251518252602083015151602083015260408301515160408301526060830151516060830152608083015151608083015260a083015160a083015292915050565b61012e546101ae906001600160a01b031681565b6102566103a0366004615032565b61207b565b6101826103b3366004615032565b612098565b6102566103c6366004614f1f565b6101366020526000908152604090205481565b6104546103e7366004614ee6565b6101306020908152600092835260408084208252918352918190208151808401835281548152825180850184526001830154815283518086018552600284015481528451808701865260038501548152855196870190955260048401548652600590930154919490939186565b6040805196518752945160208701529251938501939093525160608401529051608083015260a082015260c0016101bb565b610499610494366004614ee6565b6121d3565b604051905181526020016101bb565b6101826104b6366004614f1f565b6121ee565b6101826104c9366004615122565b61228e565b61051d6104dc366004614f1f565b610132602090815260009182526040918290208251808301845281548152835180840185526001830154815284519384019094526002909101548252919083565b6040516101bb93929190615158565b33610535611b0e565b6001600160a01b0316146105645760405162461bcd60e51b815260040161055b9061516f565b60405180910390fd5b6001600160a01b038281166000818152610135602052604080822080546001600160a01b0319169486169485179055517f48c865d769d5980fb5ced85b3f4f0cadfbb358025bcb3c3e61b016ec1a4423709190a35050565b60985460ff16156105df5760405162461bcd60e51b815260040161055b906151a4565b600260fc54036106015760405162461bcd60e51b815260040161055b906151ce565b600260fc5561060f826123d2565b61062661062136839003830183615205565b612480565b3360006106338483611fd8565b9050600061065a60001961065461064f36889003880188615205565b6124bb565b9061251f565b90506000610669868484612545565b905061067781606001515190565b156106945760405162461bcd60e51b815260040161055b90615221565b608080820180516020808701919091528351606087015283015191850191909152516000906106ce906106ca908990889061261c565b5190565b121561071c5760405162461bcd60e51b815260206004820152601d60248201527f6672656520636f6c6c61746572616c206973206e6f7420656e6f756768000000604482015260640161055b565b610727868585612737565b6000866001600160a01b031663fdf262b76040518163ffffffff1660e01b8152600401602060405180830381865afa158015610767573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061078b9190615243565b90506107a681866107a1368a90038a018a615205565b61279d565b866001600160a01b0316856001600160a01b03166000805160206159b18339815191526107d1865190565b60408681015151815192835260208301528051918290030190a35050600160fc555050505050565b33610802611b0e565b6001600160a01b0316146108285760405162461bcd60e51b815260040161055b9061516f565b610830612892565b565b60985460ff16156108555760405162461bcd60e51b815260040161055b906151a4565b600260fc54036108775760405162461bcd60e51b815260040161055b906151ce565b600260fc55610885836123d2565b61088e82612480565b60006108a261089b61291f565b8490612943565b60000b126108e65760405162461bcd60e51b81526020600482015260116024820152706e6f74207061727469616c20636c6f736560781b604482015260640161055b565b6108ef83612974565b3360006108fc8583611fd8565b805190915060009061090e90866129c4565b90506000866001600160a01b031663b13c86a36040518163ffffffff1660e01b815260040160a060405180830381865afa158015610950573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109749190615284565b606001519050866001600160a01b031663130234cf600061099786600001515190565b136109a35760016109a6565b60005b6109af85612a3a565b6040518363ffffffff1660e01b81526004016109cc92919061535c565b602060405180830381865afa1580156109e9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a0d9190615378565b8015610a195750805115155b8015610a3157506000610a2c8783612943565b60000b135b15610a3a578095505b6000610a4888868989612a70565b9050610a5681604001515190565b15610a735760405162461bcd60e51b815260040161055b90615221565b6000886001600160a01b031663fdf262b76040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ab3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ad79190615243565b9050610aeb81876107a18560c00151612a3a565b6000610b1b878b85602001516000610b058b600001515190565b13610b11576000610b14565b60015b6000612d73565b90506000610b848b6001600160a01b031663604096326040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b60573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106ca919061539a565b90506000610b9485608001515190565b90508b6001600160a01b0316896001600160a01b031660008051602061593e833981519152610bc98860000151602001515190565b60208901515160608a01515188518b51515160a08d01515160e08e01515160408f01515160008d8d604051610c089b9a999897969594939291906153b6565b60405180910390a35050600160fc5550505050505050505050565b610c2b614de3565b610c33614de3565b6001600160a01b03831660009081526101336020908152604080832054610134909252909120548491908115610cb2576001600160a01b038316600090815261013360205260409020610c8760018461541a565b81548110610c9757610c97615431565b60009182526020918290206040805193840190520154815294505b8015610d07576001600160a01b038316600090815261013460205260409020610cdc60018361541a565b81548110610cec57610cec615431565b60009182526020918290206040805193840190520154815293505b505050915091565b60985460ff1615610d325760405162461bcd60e51b815260040161055b906151a4565b610d3b816123d2565b6000806000836001600160a01b031663ed83d79c6040518163ffffffff1660e01b81526004016060604051808303816000875af1158015610d80573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610da49190615447565b6001600160a01b038716600090815261013260209081526040808320815160808101835281546060820190815281528251808501845260018301548152818501908152835194850184526002909201548452918201839052519598509396509194509192610e1b91610e169190612f21565b612f3e565b9050610e25614de3565b610e2d614de3565b610e35614de3565b8351600003610e57578451889350839250610e509083612fdf565b9050610e97565b610e78610e71866020015186612ffc90919063ffffffff16565b89906129c4565b9250610e94610e71866040015186612ffc90919063ffffffff16565b91505b6000610ea38488613019565b90506000610eb18489613019565b90506000610ec7610ec28484613084565b612a3a565b604080516020810190915261012f548152909150600090610ee9908390612943565b60000b13610f5857604051636ab797ed60e11b81526001600160a01b038d169063d56f2fda90610f2190899089908e90600401615158565b600060405180830381600087803b158015610f3b57600080fd5b505af1158015610f4f573d6000803e3d6000fd5b50505050611101565b604080516020810190915261012f548152600090610f76908b612f21565b90506000610f828d5190565b131561101657855187511315610fd7576000610f9e87836130a1565b90506000610fac8983613084565b9050610fcb6000196106548d60200151846129c490919063ffffffff16565b9650819850505061109d565b6000610fe388836130a1565b90506000610ff18883613084565b905061100a8b60400151826129c490919063ffffffff16565b9650819750505061109d565b85518751121561106257600061102c8783613111565b9050600061103a8983613084565b90506110596000196106548d60200151846129c490919063ffffffff16565b9650505061109d565b600061106e8883613111565b9050600061107c8883613084565b90506110958b60400151826129c490919063ffffffff16565b965081975050505b604051636ab797ed60e11b81526001600160a01b038e169063d56f2fda906110cd908a908a908f90600401615158565b600060405180830381600087803b1580156110e757600080fd5b505af11580156110fb573d6000803e3d6000fd5b50505050505b60008061110d8e610c23565b9150915061013360008f6001600160a01b03166001600160a01b0316815260200190815260200160002061114a838a61317790919063ffffffff16565b9080600181540180825580915050600190039060005260206000200160009091909190915060008201518160000155505061013460008f6001600160a01b03166001600160a01b031681526020019081526020016000206111b4828961317790919063ffffffff16565b9080600181540180825580915050600190039060005260206000200160009091909190915060008201518160000155505060008e6001600160a01b031663fdf262b76040518163ffffffff1660e01b8152600401602060405180830381865afa158015611225573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112499190615243565b90506000611255885190565b13156112725761126d8161126889612a3a565b613194565b6112ee565b600061127c885190565b12156112ee5761012e546001600160a01b031663252978b88261129e8a612a3a565b6040518363ffffffff1660e01b81526004016112bb929190615484565b600060405180830381600087803b1580156112d557600080fd5b505af11580156112e9573d6000803e3d6000fd5b505050505b8e6001600160a01b03167feab6d2156c0c3b2a09fc549136d515e220ea7e45790e18e27fee6811f5342fb06113218f5190565b8e518c518c518c5160405161133a95949392919061549e565b60405180910390a2505050505050505050505050505050565b3361135c611b0e565b6001600160a01b0316146113825760405162461bcd60e51b815260040161055b9061516f565b61083060006131e1565b33611395611b0e565b6001600160a01b0316146113bb5760405162461bcd60e51b815260040161055b9061516f565b610830613233565b61013360205281600052604060002081815481106113e057600080fd5b6000918252602090912001549150829050565b600260fc54036114155760405162461bcd60e51b815260040161055b906151ce565b600260fc55611424828261328b565b5050600160fc555050565b60985460ff16156114525760405162461bcd60e51b815260040161055b906151a4565b600260fc54036114745760405162461bcd60e51b815260040161055b906151ce565b600260fc55611482856123d2565b61148b83612480565b61149482612480565b6115196114ac836114a661064f61291f565b90613019565b866001600160a01b031663b13c86a36040518163ffffffff1660e01b815260040160a060405180830381865afa1580156114ea573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061150e9190615284565b6020015160016137c5565b61152285612974565b3361152b614df6565b600061153f61153a8985611fd8565b515190565b905060008115611550576000611553565b60015b90508080611593575087600181111561156e5761156e615324565b6000831361157d576001611580565b60005b600181111561159157611591615324565b145b156115b5576115ae89896115a78a8a612f21565b888a613836565b92506115c8565b6115c58989868a8a8a6000613a1f565b92505b6115d789858560000151612737565b801580156115e757508251515115155b15611666576116666115f98a866121d3565b8a6001600160a01b031663b13c86a36040518163ffffffff1660e01b815260040160a060405180830381865afa158015611637573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061165b9190615284565b6040015160016137c5565b604083015151156116895760405162461bcd60e51b815260040161055b90615221565b6000896001600160a01b031663fdf262b76040518163ffffffff1660e01b8152600401602060405180830381865afa1580156116c9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116ed9190615243565b905060006116fd8560c001515190565b13156117205761171b8186306117168860c00151612a3a565b613c7a565b611746565b600061172e8560c001515190565b12156117465761174681866107a18760c00151612a3a565b505050600061175d838984602001518a6001612d73565b905060006117a2896001600160a01b031663604096326040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b60573d6000803e3d6000fd5b905060006117b284608001515190565b9050896001600160a01b0316856001600160a01b031660008051602061593e8339815191526117e78760000151602001515190565b60208801515160608901515188518a51515160a08c01515160e08d01515160408e01515160008d8d6040516118269b9a999897969594939291906153b6565b60405180910390a35050600160fc555050505050505050565b6001600160a01b03808216600090815261013560205260409020548291339116811480611884575061186f611b0e565b6001600160a01b0316816001600160a01b0316145b6118a05760405162461bcd60e51b815260040161055b906154c1565b6000806000806000876001600160a01b031663332b82fa6040518163ffffffff1660e01b815260040160a0604051808303816000875af11580156118e8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061190c91906154e6565b9450945094509450945060006119228983613d72565b9050886001600160a01b0316600080516020615991833981519152611945885190565b8751875187518751875160405161196196959493929190615544565b60405180910390a2505050505050505050565b61197c614de3565b611984614de3565b60006119908686611fd8565b905060006119a18260000151612a3a565b90506119ab815190565b15611b0457815151600090811390816119c55760006119c8565b60015b905060008760018111156119de576119de615324565b03611a595760405163da0c592760e01b81526001600160a01b038a169063da0c592790611a11908490879060040161535c565b602060405180830381865afa158015611a2e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a52919061539a565b9550611acd565b6000896001600160a01b03166358c0994a6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611a99573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611abd919061539a565b9050611ac98482612f21565b9650505b81611aee57611ae98460400151611ae3886124bb565b90613111565b611aff565b611aff86611ae386604001516124bb565b945050505b5050935093915050565b6066546001600160a01b031690565b60985460ff1615611b405760405162461bcd60e51b815260040161055b906151a4565b600260fc5403611b625760405162461bcd60e51b815260040161055b906151ce565b600260fc55611b70826123d2565b611b7982612974565b33611b82614df6565b6000611b8e8584611fd8565b9050600080611b9f83600001515190565b13611bab576001611bae565b60005b90506000866001600160a01b031663b13c86a36040518163ffffffff1660e01b815260040160a060405180830381865afa158015611bf0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c149190615284565b9050866001600160a01b031663130234cf83611c338660000151612a3a565b6040518363ffffffff1660e01b8152600401611c5092919061535c565b602060405180830381865afa158015611c6d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c919190615378565b8015611ca1575060608101515115155b15611cc457611cbd87868360600151611cb8613e94565b612a70565b9350611cd2565b611ccf878688613eaf565b93505b60408401515115611cf55760405162461bcd60e51b815260040161055b90615221565b6000876001600160a01b031663fdf262b76040518163ffffffff1660e01b8152600401602060405180830381865afa158015611d35573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d599190615243565b9050611d6d81876107a18860c00151612a3a565b5050506000611d8a848785602001516000610b0587600001515190565b90506000611dcf876001600160a01b031663604096326040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b60573d6000803e3d6000fd5b90506000611ddf85608001515190565b9050876001600160a01b0316866001600160a01b031660008051602061593e833981519152611e148860000151602001515190565b60208901515160608a01515188518b51515160a08d01515160e08e01515160408f01515160008d8d604051611e539b9a999897969594939291906153b6565b60405180910390a35050600160fc55505050505050565b60985460ff1615611e8d5760405162461bcd60e51b815260040161055b906151a4565b600260fc5403611eaf5760405162461bcd60e51b815260040161055b906151ce565b600260fc55611ebd826123d2565b611ecf61062136839003830183615205565b336000611edc8483611fd8565b9050611efb611ef036859003850185615205565b602083015190614040565b6020820152611f0b848383612737565b6000846001600160a01b031663fdf262b76040518163ffffffff1660e01b8152600401602060405180830381865afa158015611f4b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f6f9190615243565b9050611f8681843061171636899003890189615205565b6001600160a01b038086169084166000805160206159b1833981519152611fb56106ca36899003890189615205565b60408051918252600060208301520160405180910390a35050600160fc55505050565b611fe0614e6a565b506001600160a01b03808316600090815261013060209081526040808320938516835292815290829020825160e081018452815460c0820190815281528351808401855260018301548152818401528351808401855260028301548152818501528351808401855260038301548152606082015283519283019093526004810154825260808301919091526005015460a08201525b92915050565b61013460205281600052604060002081815481106113e057600080fd5b603354610100900460ff166120b35760335460ff16156120b7565b303b155b61211a5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161055b565b603354610100900460ff1615801561213c576033805461ffff19166101011790555b6001600160a01b03831661217c5760405162461bcd60e51b81526020600482015260076024820152666164647228302960c81b604482015260640161055b565b61218461405d565b61218c614094565b61012e80546001600160a01b0319166001600160a01b038516179055604080516020810190915282905261012f82905580156121ce576033805461ff00191690555b505050565b6121db614de3565b6121e7838360006140c3565b9392505050565b336121f7611b0e565b6001600160a01b03161461221d5760405162461bcd60e51b815260040161055b9061516f565b6001600160a01b0381166122825760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161055b565b61228b816131e1565b50565b6001600160a01b038083166000908152610135602052604090205483913391168114806122d357506122be611b0e565b6001600160a01b0316816001600160a01b0316145b6122ef5760405162461bcd60e51b815260040161055b906154c1565b6000806000806000886001600160a01b031663013dd795896040518263ffffffff1660e01b81526004016123269151815260200190565b60a0604051808303816000875af1158015612345573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061236991906154e6565b94509450945094509450600061237f8a83613d72565b9050896001600160a01b03166000805160206159918339815191526123a2885190565b875187518751875187516040516123be96959493929190615544565b60405180910390a250505050505050505050565b61012e546040516301dd29e160e21b81526001600160a01b0390911690630774a78490612403908490600401614f3c565b602060405180830381865afa158015612420573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124449190615378565b61228b5760405162461bcd60e51b815260206004820152600d60248201526c185b5b481b9bdd08199bdd5b99609a1b604482015260640161055b565b805160000361228b5760405162461bcd60e51b81526020600482015260076024820152660c081a5b9c1d5d60ca1b604482015260640161055b565b6124c3614de3565b8180600001516001600160ff1b03101560405180606001604052806033815260200161595e603391399061250a5760405162461bcd60e51b815260040161055b9190615598565b50506040805160208101909152915182525090565b612527614de3565b61252f614de3565b835161253c9084906155cb565b81529392505050565b61254d614ebe565b61255684610c23565b60208301528152825151156125b957825151600012156125985782516060840151825161258e92916125889190613084565b90612fdf565b60408201526125b9565b8251608084015160208301516125b392916125889190613084565b60408201525b60006125e084602001516125da84604001518661308490919063ffffffff16565b906130a1565b905060006125ec825190565b1215612605576125fb81612a3a565b6060830152612614565b61260e81612a3a565b60808301525b509392505050565b612624614de3565b60006126308585611fd8565b905060008061264187876000611974565b9092509050600061265282876130a1565b905060008061265f845190565b1361266a5781612673565b612673876124bb565b90506000896001600160a01b031663b13c86a36040518163ffffffff1660e01b815260040160a060405180830381865afa1580156126b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126d99190615284565b6020015190506000806126ee88600001515190565b1361270b5761270682612700886124bb565b906129c4565b61271c565b61271c8261270089604001516124bb565b90506127288382613084565b9b9a5050505050505050505050565b6001600160a01b03928316600090815261013060209081526040808320949095168252928352839020815151815591810151516001830155918201515160028201556060820151516003820155608082015151600482015560a090910151600590910155565b6001600160a01b0383166000908152610136602090815260408083208151928301909152548152906127d9826127d38730614104565b90614182565b90506127e3835190565b815110156128805760006127f78483614182565b90506000612805878361419f565b90506000612811825190565b111561287d5761012e546040516304a52f1760e31b81526001600160a01b039091169063252978b89061284a908a908590600401615484565b600060405180830381600087803b15801561286457600080fd5b505af1158015612878573d6000803e3d6000fd5b505050505b50505b61288b85858561423e565b5050505050565b60985460ff166128db5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b604482015260640161055b565b6098805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516129159190614f3c565b60405180910390a1565b612927614de3565b604051806020016040528061293c6012614322565b9052919050565b80518251600091101561295857506001612075565b81518351101561296b5750600019612075565b50600092915050565b43806129808333611fd8565b60a00151036129c05760405162461bcd60e51b815260206004820152600c60248201526b0dcdedc40e6c2dcc8eed2c6d60a31b604482015260640161055b565b5050565b6129cc614de3565b8180600001516001600160ff1b03101560405180606001604052806033815260200161595e6033913990612a135760405162461bcd60e51b815260040161055b9190615598565b50612a1c614de3565b612a2f612a28856124bb565b8690612fdf565b9250505b5092915050565b612a42614de3565b612a4a614de3565b825160001315612a68578251612a61906000615650565b8152612075565b915182525090565b612a78614df6565b6000612a848686611fd8565b9050612a938160000151614332565b600080612aa288886000611974565b84519193509150600090612ab690886129c4565b90506000612ad461064f898760200151612f2190919063ffffffff16565b9050612ade614df6565b612ae6614ebe565b612af28460001961251f565b6060830152612b01858b6129c4565b60a08301819052612b13908690613084565b60e0830152612b2e8c88612b298660001961251f565b612545565b6060810151604080850191909152810151608084015260a0830151909150612b5f9060001990610654908690613177565b60c08301528651516001600160a01b038d169063d71ec2ad90600012612b86576001612b89565b60005b612b9287612a3a565b8c6040518463ffffffff1660e01b8152600401612bb19392919061568f565b6020604051808303816000875af1158015612bd0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612bf4919061539a565b60208301528651516000908112612c2957612c248360200151611ae3898660e001516130a190919063ffffffff16565b612c48565b612c488360e00151612c428560200151611ae38b6124bb565b90613084565b90506000612c54825190565b13612c9e5760405162461bcd60e51b815260206004820152601a602482015279076616c7565206f66206f70656e4e6f74696f6e616c203c3d20360341b604482015260640161055b565b6040805160c0810190915288518190612cb79088613084565b815260200183608001518152602001612ccf83612a3a565b8152835160208083019190915284015160408201524360609091015283528751516000908112612d00576001612d03565b60005b9050612d438e612d3e600019610654886000015160400151611ae38f604001516125da8c604001518d60a001516130a190919063ffffffff16565b614377565b612d528e85606001518361449b565b612d618e8e8660000151612737565b50919c9b505050505050505050505050565b612d7b614de3565b6001600160a01b03851663a7b774a06000856001811115612d9e57612d9e615324565b14612daa576001612dad565b60005b86856040518463ffffffff1660e01b8152600401612dcd939291906156b1565b602060405180830381865afa158015612dea573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e0e919061539a565b90506000612e1a825190565b1115612f18576000856001600160a01b031663fdf262b76040518163ffffffff1660e01b8152600401602060405180830381865afa158015612e60573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e849190615243565b90506000612e93836002614599565b90506000612ea18483614182565b9050612eaf838a3085613c7a565b6001600160a01b03831660009081526101366020908152604091829020825191820190925290548152612ee29083614040565b6001600160a01b03808516600090815261013660205260409020915190915561012e54612f149185918c911684613c7a565b5050505b95945050505050565b612f29614de3565b612f31614de3565b8251845161253c916145b6565b612f46614de3565b8151600090612f5d90670de0b6b3a76400006156d4565b905060006003821115612fc05750806000612f79600283615709565b612f8490600161571d565b90505b81811015612fba57905080600281612f9f8186615709565b612fa9919061571d565b612fb39190615709565b9050612f87565b50612fca565b8115612fca575060015b60408051602081019091529081529392505050565b612fe7614de3565b612fef614de3565b8251845161253c916145c4565b613004614de3565b61300c614de3565b8251845161253c916145d2565b613021614de3565b8180600001516001600160ff1b03101560405180606001604052806033815260200161595e60339139906130685760405162461bcd60e51b815260040161055b9190615598565b50613071614de3565b612a2f61307d856124bb565b86906145e0565b61308c614de3565b613094614de3565b8251845161253c916145fd565b6130a9614de3565b8180600001516001600160ff1b03101560405180606001604052806033815260200161595e60339139906130f05760405162461bcd60e51b815260040161055b9190615598565b506130f9614de3565b835185516131079190615735565b8152949350505050565b613119614de3565b8180600001516001600160ff1b03101560405180606001604052806033815260200161595e60339139906131605760405162461bcd60e51b815260040161055b9190615598565b50613169614de3565b835185516131079190615650565b61317f614de3565b613187614de3565b8251845161253c91614609565b60006131a08330614104565b90506000806131af8484612943565b60000b136131bd57826131bf565b815b61012e549091506131db9085906001600160a01b03168361423e565b50505050565b606680546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60985460ff16156132565760405162461bcd60e51b815260040161055b906151a4565b6098805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586129083390565b613293614de3565b600061329e846123d2565b60006132aa85856121d3565b9050846001600160a01b0316639e0103626040518163ffffffff1660e01b8152600401602060405180830381865afa1580156132ea573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061330e9190615378565b1561333e576000613321868660016140c3565b905060006133326106ca8385613084565b131561333c578091505b505b6000856001600160a01b031663b13c86a36040518163ffffffff1660e01b815260040160a060405180830381865afa15801561337e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133a29190615284565b90506133b482826040015160006137c5565b6133bc614df6565b6133c4614de3565b6133cc614de3565b6133d4614de3565b6133dc614de3565b60008b6001600160a01b031663fdf262b76040518163ffffffff1660e01b8152600401602060405180830381865afa15801561341c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906134409190615243565b905061344e87608001515190565b8851138015613461575060608701515115155b156135ba5760006134728d8d611fd8565b905060008d6001600160a01b031663da0c5927600061349385600001515190565b1361349f5760016134a2565b60005b60608c015185516134b791610ec291906129c4565b6040518363ffffffff1660e01b81526004016134d492919061535c565b602060405180830381865afa1580156134f1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613515919061539a565b90506135518e600061352985600001515190565b13613535576000613538565b60015b8f8461354261291f565b61354a613e94565b6001613a1f565b975061356e89608001518960200151612f2190919063ffffffff16565b965061357b876002614599565b94506135878786614182565b88516020015190945061359a9088614182565b88516020015287516135af908f908f90612737565b60019a505050613643565b6135cc8c8c6135c7613e94565b613eaf565b955060006135dd8760c00151612a3a565b905061360560026135ff8a608001518a60200151612f2190919063ffffffff16565b90614599565b935061360f815190565b84511115613628576136218482614182565b9450613635565b6136328185614182565b92505b61363f8484614040565b9550505b600061364d835190565b111561365d5761365d8183613194565b61366881338561279d565b336001600160a01b03168c6001600160a01b03168c6001600160a01b03167fdb3ce612ab14cee0ae0aac9f8f56a0a193c4d065cdb11cdb1dff02aaff7df2d76136b38a602001515190565b6136c08b60600151614615565b885188518b516040516136d795949392919061549e565b60405180910390a4505050506000613726896001600160a01b031663604096326040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b60573d6000803e3d6000fd5b9050600061373684608001515190565b9050896001600160a01b0316896001600160a01b031660008051602061593e83398151915261376b8760000151602001515190565b6020880151516060890151518951515160009060a08c01515160e08d01515160408e0151518d518d8d6040516137ab9b9a999897969594939291906153b6565b60405180910390a350505060200151935050509250929050565b60006137d46106ca8585613111565b9050816137e457600081126137ea565b60008112155b6131db5760405162461bcd60e51b815260206004820152601d60248201527f6d617267696e20726174696f206e6f74206d6565742063726974657261000000604482015260640161055b565b61383e614df6565b33600061384b8883611fd8565b905061385b888888886000614627565b6060840181905281516000916138719190613177565b905061388089612d3e896124bb565b61388f8985606001518a61449b565b6000896001600160a01b031663113773946040518163ffffffff1660e01b8152600401602060405180830381865afa1580156138cf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906138f3919061539a565b90506138fd815190565b1561395b5760006139178261391185612a3a565b90612943565b60000b131561395b5760405162461bcd60e51b815260206004820152601060248201526f0706f736974696f6e53697a65206361760841b604482015260640161055b565b600061396a61064f8a89612ffc565b905060006139798c8684612545565b905060006139898d886000611974565b9150508a8860200181905250808860e00181905250828860c00181905250816040015188608001819052506040518060c00160405280868152602001836080015181526020016139ea8a60200151896040015161404090919063ffffffff16565b815260200183600001518152602001836020015181526020014381525088600001819052505050505050505095945050505050565b613a27614df6565b6000613a338686612f21565b9050600080613a448b8a6000611974565b91509150613a50614df6565b835183511115613c5a576000613a668d8c611fd8565b9050613a758d8d878b8b614627565b606083015280515115613aaf57613aa9613a928260000151612a3a565b6114a6613aa28560600151612a3a565b86906129c4565b60a08301525b6000613ac08e838560a00151612545565b9050613ad98360a001518561308490919063ffffffff16565b60e0840152602083018690528151516000908112613b1557613b108460200151611ae3888760e001516130a190919063ffffffff16565b613b2e565b613b2e8460e00151612c428660200151611ae38a6124bb565b90506000613b3a825190565b13613b7d5760405162461bcd60e51b8152602060048201526013602482015272072656d61696e4e6f74696f6e616c203c3d203606c1b604482015260640161055b565b6040518060c00160405280613ba38660600151866000015161317790919063ffffffff16565b815260200183608001518152602001613bbb83612a3a565b81528351602080830191909152909301516040840152436060909301929092525082526000808d6001811115613bf357613bf3615324565b14613bff576001613c02565b60005b9050613c138e84606001518361449b565b613c4c8e612d3e600019610654876000015160400151611ae388604001516125da8b604001518c60a001516130a190919063ffffffff16565b829650505050505050613c6f565b613c688c8c8c8c8c8c6146ff565b9450505050505b979650505050505050565b613c83846148ae565b6000613c8f8584614104565b90506000613c9d86846148f8565b6040516323b872dd60e01b81526001600160a01b038781166004830152868116602483015260448201839052919250908716906323b872dd906064016020604051808303816000875af1158015613cf8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613d1c9190615378565b613d5e5760405162461bcd60e51b81526020600482015260136024820152721d1c985b9cd9995c919c9bdb4819985a5b1959606a1b604482015260640161055b565b613d6a86858385614963565b505050505050565b613d7a614de3565b6000613d8583612a3a565b90506000846001600160a01b031663fdf262b76040518163ffffffff1660e01b8152600401602060405180830381865afa158015613dc7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613deb9190615243565b9050613df6846149cb565b15613e8257613e05818361419f565b92506000613e11845190565b1115613e7d5761012e546040516304a52f1760e31b81526001600160a01b039091169063252978b890613e4a9084908790600401615484565b600060405180830381600087803b158015613e6457600080fd5b505af1158015613e78573d6000803e3d6000fd5b505050505b613e8c565b613e8c8183613194565b505092915050565b613e9c614de3565b5060408051602081019091526000815290565b613eb7614df6565b6000613ec38585611fd8565b9050613ed28160000151614332565b6000613ee086866000611974565b9150506000613ef0878484612545565b8351909150613f019060001961251f565b8460600181905250818460a001819052508060600151846040018190525080604001518460800181905250613f3f60001961065483608001516124bb565b60c08501528251516001600160a01b0388169063d71ec2ad90600012613f66576001613f69565b60005b8551613f7490612a3a565b886040518463ffffffff1660e01b8152600401613f939392919061568f565b6020604051808303816000875af1158015613fb2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613fd6919061539a565b60208501528251516000908112613fee576001613ff1565b60005b905061401c88612d3e60001961065488604001516125da88606001518a6130a190919063ffffffff16565b61402b8886606001518361449b565b61403588886149e9565b505050509392505050565b614048614de3565b614050614de3565b8251845161253c91614a9d565b603354610100900460ff166140845760405162461bcd60e51b815260040161055b90615776565b61408c614aa9565b610830614ad8565b603354610100900460ff166140bb5760405162461bcd60e51b815260040161055b90615776565b610830614b07565b6140cb614de3565b60006140d78585611fd8565b90506140e68160000151614332565b6000806140f4878787611974565b91509150613c6f87848385614b35565b61410c614de3565b6121e783846001600160a01b03166370a08231856040518263ffffffff1660e01b815260040161413c9190614f3c565b602060405180830381865afa158015614159573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061417d91906157c1565b614b6f565b61418a614de3565b614192614de3565b8251845161253c91614bfb565b6141a7614de3565b6001600160a01b03831660009081526101366020908152604091829020825191820190925290548152825181511115614206576141e48184614182565b6001600160a01b03851660009081526101366020526040902090519055612a33565b6142108382614182565b915061421a613e94565b6001600160a01b038516600090815261013660205260409020905190555092915050565b614247836148ae565b60006142538484614104565b9050600061426185846148f8565b60405163a9059cbb60e01b81526001600160a01b038681166004830152602482018390529192509086169063a9059cbb906044016020604051808303816000875af11580156142b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906142d89190615378565b6143165760405162461bcd60e51b815260206004820152600f60248201526e1d1c985b9cd9995c8819985a5b1959608a1b604482015260640161055b565b61288b85858385614963565b600061207560ff8316600a6158be565b805160000361228b5760405162461bcd60e51b81526020600482015260116024820152700706f736974696f6e53697a65206973203607c1b604482015260640161055b565b60006143ba836001600160a01b031663525454106040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b60573d6000803e3d6000fd5b6001600160a01b0384166000908152610131602090815260408083208151928301909152548152919250906143ee906124bb565b90506143fa8382613177565b90506000614406825190565b121561441757614414613e94565b90505b811561446e578161442782614615565b111561446e5760405162461bcd60e51b815260206004820152601660248201527506f766572206f70656e20696e746572657374206361760541b604482015260640161055b565b61447781612a3a565b6001600160a01b039094166000908152610131602052604090209351909355505050565b6001600160a01b03831660009081526101326020908152604091829020825160808101845281546060820190815281528351808401855260018301548152818401528351928301845260029091015482529182015280516144fd908490613177565b8152600082600181111561451357614513615324565b0361453c57614532610ec28260200151856130a190919063ffffffff16565b602082015261455b565b604081015161455590610ec2906125da8660001961251f565b60408201525b6001600160a01b0390931660009081526101326020908152604091829020855151815590850151516001820155930151516002909301929092555050565b6145a1614de3565b6145a9614de3565b835161253c908490615709565b60006121e783836012614c07565b60006121e783836012614c1c565b60006121e783836012614c3b565b6145e8614de3565b6145f0614de3565b8251845161253c91614c51565b60006121e78284615650565b60006121e78284615735565b600061462082612a3a565b5192915050565b61462f614de3565b60008086600181111561464457614644615324565b14614650576001614653565b60005b905060006146cf886001600160a01b03166375df6389848989896040518563ffffffff1660e01b815260040161468c94939291906158ca565b6020604051808303816000875af11580156146ab573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061064f919061539a565b90508160018111156146e3576146e3615324565b600103613c6f576146f68160001961251f565b92505050612f18565b614707614df6565b600061471688876135c7613e94565b905061472481604001515190565b156147415760405162461bcd60e51b815260040161055b90615221565b6020810151600090614757906127d38888612f21565b90506147666106ca8287612ffc565b600003614775578192506148a2565b61477d614de3565b61478a8360600151614615565b855111156147ac576147a96147a28460600151612a3a565b8690614182565b90505b60006147bb8b8b85858b613836565b9050604051806101000160405280826000015181526020016147ee8360200151876020015161404090919063ffffffff16565b815260200161480e8360400151876040015161404090919063ffffffff16565b815260200161482e8360600151876060015161317790919063ffffffff16565b815260200161484e8360800151876080015161317790919063ffffffff16565b815260200161486e8360a001518760a0015161317790919063ffffffff16565b815260200161488e8360c001518760c0015161317790919063ffffffff16565b815260200161489b613e94565b9052945050505b50509695505050505050565b60006148b982614c5f565b6001600160a01b03831660009081526020819052604090205490915081146129c0576001600160a01b0391909116600090815260208190526040902055565b60008061490484614c5f565b9050601281106149385761491960128261541a565b61492490600a6158be565b835161493091906156d4565b915050612075565b61494381601261541a565b61494e90600a6158be565b83515b61495b9190615709565b949350505050565b61498461497a6149738685614b6f565b8390614040565b6139118686614104565b60000b156131db5760405162461bcd60e51b815260206004820152601460248201527318985b185b98d9481a5b98dbdb9cda5cdd195b9d60621b604482015260640161055b565b600080826000015112156149e157506001919050565b506000919050565b6040518060c001604052806149fc613e94565b8152602001614a09613e94565b8152602001614a16613e94565b8152602001614a23613e94565b8152602001614a30613e94565b8152436020918201526001600160a01b0393841660009081526101308252604080822094909516815292815291839020815151815591810151516001830155918201515160028201556060820151516003820155608082015151600482015560a090910151600590910155565b60006121e7828461571d565b603354610100900460ff16614ad05760405162461bcd60e51b815260040161055b90615776565b610830614d6a565b603354610100900460ff16614aff5760405162461bcd60e51b815260040161055b90615776565b610830614d9a565b603354610100900460ff16614b2e5760405162461bcd60e51b815260040161055b90615776565b600160fc55565b614b3d614de3565b6000614b4a868686612545565b9050614b65836114a68360600151611ae385608001516124bb565b9695505050505050565b614b77614de3565b6000614b8284614c5f565b905060128110614bc4576040518060200160405280601283614ba4919061541a565b614baf90600a6158be565b614bb99086615709565b815250915050612075565b6040518060200160405280826012614bdc919061541a565b614be790600a6158be565b614bf190866156d4565b9052949350505050565b60006121e7828461541a565b6000614c1282614322565b61495184866156d4565b6000614c2782614322565b614c3184866155cb565b61495b91906158f3565b600082614c4783614322565b61495190866156d4565b60006121e783836012614dcd565b6001600160a01b0381166000908152602081905260408120548082036120755760408051600481526024810182526020810180516001600160e01b031663313ce56760e01b179052905160009182916001600160a01b03871691614cc291615921565b600060405180830381855afa9150503d8060008114614cfd576040519150601f19603f3d011682016040523d82523d6000602084013e614d02565b606091505b5091509150818015614d145750805115155b614d565760405162461bcd60e51b815260206004820152601360248201527219d95d08191958da5b585b1cc819985a5b1959606a1b604482015260640161055b565b80806020019051810190612a2f91906157c1565b603354610100900460ff16614d915760405162461bcd60e51b815260040161055b90615776565b610830336131e1565b603354610100900460ff16614dc15760405162461bcd60e51b815260040161055b90615776565b6098805460ff19169055565b600082614dd983614322565b614c3190866155cb565b6040518060200160405280600081525090565b604051806101000160405280614e0a614e6a565b8152602001614e17614de3565b8152602001614e24614de3565b8152602001614e31614de3565b8152602001614e3e614de3565b8152602001614e4b614de3565b8152602001614e58614de3565b8152602001614e65614de3565b905290565b6040518060c00160405280614e7d614de3565b8152602001614e8a614de3565b8152602001614e97614de3565b8152602001614ea4614de3565b8152602001614eb1614de3565b8152602001600081525090565b6040518060a00160405280614e31614de3565b6001600160a01b038116811461228b57600080fd5b60008060408385031215614ef957600080fd5b8235614f0481614ed1565b91506020830135614f1481614ed1565b809150509250929050565b600060208284031215614f3157600080fd5b81356121e781614ed1565b6001600160a01b0391909116815260200190565b6000808284036040811215614f6457600080fd5b8335614f6f81614ed1565b92506020601f1982011215614f8357600080fd5b506020830190509250929050565b604051602081016001600160401b0381118282101715614fc157634e487b7160e01b600052604160045260246000fd5b60405290565b600060208284031215614fd957600080fd5b614fe1614f91565b9135825250919050565b60008060006060848603121561500057600080fd5b833561500b81614ed1565b925061501a8560208601614fc7565b91506150298560408601614fc7565b90509250925092565b6000806040838503121561504557600080fd5b823561505081614ed1565b946020939093013593505050565b6002811061228b57600080fd5b600080600080600060a0868803121561508357600080fd5b853561508e81614ed1565b9450602086013561509e8161505e565b93506150ad8760408801614fc7565b92506150bc8760608801614fc7565b91506150cb8760808801614fc7565b90509295509295909350565b6000806000606084860312156150ec57600080fd5b83356150f781614ed1565b9250602084013561510781614ed1565b915060408401356151178161505e565b809150509250925092565b6000806040838503121561513557600080fd5b823561514081614ed1565b915061514f8460208501614fc7565b90509250929050565b925183529051602083015251604082015260600190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b60006020828403121561521757600080fd5b6121e78383614fc7565b602080825260089082015267189859081919589d60c21b604082015260600190565b60006020828403121561525557600080fd5b81516121e781614ed1565b60006020828403121561527257600080fd5b61527a614f91565b9151825250919050565b600060a0828403121561529657600080fd5b60405160a081016001600160401b03811182821017156152c657634e487b7160e01b600052604160045260246000fd5b6040526152d38484615260565b81526152e28460208501615260565b60208201526152f48460408501615260565b60408201526153068460608501615260565b60608201526153188460808501615260565b60808201529392505050565b634e487b7160e01b600052602160045260246000fd5b6002811061535857634e487b7160e01b600052602160045260246000fd5b9052565b6040810161536a828561533a565b825160208301529392505050565b60006020828403121561538a57600080fd5b815180151581146121e757600080fd5b6000602082840312156153ac57600080fd5b6121e78383615260565b9a8b5260208b019990995260408a01979097526060890195909552608088019390935260a087019190915260c086015260e08501526101008401526101208301526101408201526101600190565b634e487b7160e01b600052601160045260246000fd5b60008282101561542c5761542c615404565b500390565b634e487b7160e01b600052603260045260246000fd5b60008060006060848603121561545c57600080fd5b6154668585615260565b92506154758560208601615260565b91506150298560408601615260565b6001600160a01b0392909216825251602082015260400190565b948552602085019390935260408401919091526060830152608082015260a00190565b6020808252600b908201526a1b9bdd08185b1b1bddd95960aa1b604082015260600190565b600080600080600060a086880312156154fe57600080fd5b6155088787615260565b94506155178760208801615260565b93506155268760408801615260565b92506155358760608801615260565b91506150cb8760808801615260565b958652602086019490945260408501929092526060840152608083015260a082015260c00190565b60005b8381101561558757818101518382015260200161556f565b838111156131db5750506000910152565b60208152600082518060208401526155b781604085016020870161556c565b601f01601f19169190910160400192915050565b60006001600160ff1b03818413828413808216868404861116156155f1576155f1615404565b600160ff1b600087128281168783058912161561561057615610615404565b6000871292508782058712848416161561562c5761562c615404565b8785058712818416161561564257615642615404565b505050929093029392505050565b60008083128015600160ff1b85018412161561566e5761566e615404565b6001600160ff1b038401831381161561568957615689615404565b50500390565b6060810161569d828661533a565b925160208201529051604090910152919050565b606081016156bf828661533a565b92516020820152901515604090910152919050565b60008160001904831182151516156156ee576156ee615404565b500290565b634e487b7160e01b600052601260045260246000fd5b600082615718576157186156f3565b500490565b6000821982111561573057615730615404565b500190565b600080821280156001600160ff1b038490038513161561575757615757615404565b600160ff1b839003841281161561577057615770615404565b50500190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6000602082840312156157d357600080fd5b5051919050565b600181815b808511156158155781600019048211156157fb576157fb615404565b8085161561580857918102915b93841c93908002906157df565b509250929050565b60008261582c57506001612075565b8161583957506000612075565b816001811461584f576002811461585957615875565b6001915050612075565b60ff84111561586a5761586a615404565b50506001821b612075565b5060208310610133831016604e8410600b8410161715615898575081810a612075565b6158a283836157da565b80600019048211156158b6576158b6615404565b029392505050565b60006121e7838361581d565b608081016158d8828761533a565b93516020820152915160408301521515606090910152919050565b600082615902576159026156f3565b600160ff1b82146000198414161561591c5761591c615404565b500590565b6000825161593381846020870161556c565b919091019291505056fe4c7b764f428c13bbea8cc8da90ebe6eef4dafeb27a4e3d9041d64208c47ca7c24d69786564446563696d616c3a2075696e742076616c756520697320626967676572207468616e205f494e543235365f4d4158582119e93a01fa8de6f9671dd99edc406ba36b255c96318877907e40088769dc1c822fe92555a7e529201522fbd166b03a55712d945737f4cc5c1e18199caa7ba26469706673582212203fb78b50c9f6f6d9d9327fb58672d9d20f5a228b61117cbfdfba7efea7fb6bd764736f6c634300080d0033";
static readonly abi: ({
anonymous: boolean;
inputs: ({
inputs: {
indexed: boolean;

@@ -12,2 +24,12 @@ internalType: string;

type: string;
}[];
name: string;
type: string;
outputs?: undefined;
stateMutability?: undefined;
} | {
inputs: ({
internalType: string;
name: string;
type: string;
components?: undefined;

@@ -20,3 +42,2 @@ } | {

}[];
indexed: boolean;
internalType: string;

@@ -27,5 +48,6 @@ name: string;

name: string;
outputs: never[];
stateMutability: string;
type: string;
outputs?: undefined;
stateMutability?: undefined;
anonymous?: undefined;
} | {

@@ -62,17 +84,7 @@ inputs: {

} | {
inputs: ({
inputs: {
internalType: string;
name: string;
type: string;
components?: undefined;
} | {
components: {
internalType: string;
name: string;
type: string;
}[];
internalType: string;
name: string;
type: string;
})[];
}[];
name: string;

@@ -101,1 +113,2 @@ outputs: ({

}
export {};

@@ -1,5 +0,17 @@

import { Signer } from "ethers";
import type { Provider } from "@ethersproject/providers";
import { Signer, ContractFactory, Overrides } from "ethers";
import type { Provider, TransactionRequest } from "@ethersproject/providers";
import type { PromiseOrValue } from "../common";
import type { ClearingHouseViewer, ClearingHouseViewerInterface } from "../ClearingHouseViewer";
export declare class ClearingHouseViewer__factory {
declare type ClearingHouseViewerConstructorParams = [signer?: Signer] | ConstructorParameters<typeof ContractFactory>;
export declare class ClearingHouseViewer__factory extends ContractFactory {
constructor(...args: ClearingHouseViewerConstructorParams);
deploy(_clearingHouse: PromiseOrValue<string>, overrides?: Overrides & {
from?: PromiseOrValue<string>;
}): Promise<ClearingHouseViewer>;
getDeployTransaction(_clearingHouse: PromiseOrValue<string>, overrides?: Overrides & {
from?: PromiseOrValue<string>;
}): TransactionRequest;
attach(address: string): ClearingHouseViewer;
connect(signer: Signer): ClearingHouseViewer__factory;
static readonly bytecode = "0x608060405234801561001057600080fd5b5060405161132d38038061132d83398101604081905261002f91610054565b600080546001600160a01b0319166001600160a01b0392909216919091179055610084565b60006020828403121561006657600080fd5b81516001600160a01b038116811461007d57600080fd5b9392505050565b61129a806100936000396000f3fe608060405234801561001057600080fd5b50600436106100625760003560e01c80630acdddfb146100675780630af968001461008e57806316f6c558146100ae57806333d3bd3014610112578063bafe871c14610125578063ea0a45f914610138575b600080fd5b61007a610075366004610bcc565b61014b565b604051905181526020015b60405180910390f35b6000546100a1906001600160a01b031681565b6040516100859190610c05565b6100c16100bc366004610bcc565b6101d3565b6040516100859190600060c0820190508251518252602083015151602083015260408301515160408301526060830151516060830152608083015151608083015260a083015160a083015292915050565b61007a610120366004610bcc565b610322565b61007a610133366004610bcc565b61056d565b61007a610146366004610bcc565b61074c565b610153610b4d565b60008054604051638bedf3bb60e01b81526001600160a01b0390911690638bedf3bb9061018890879087908690600401610c19565b6040805180830381865afa1580156101a4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101c89190610ce4565b925050505b92915050565b6101db610b60565b600054604051630b33dc1960e41b81526001600160a01b039091169063b33dc1909061020d9086908690600401610d19565b60c060405180830381865afa15801561022a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061024e9190610d33565b60008054604051636891397b60e01b8152929350909182916001600160a01b031690636891397b90610284908890600401610c05565b6040805180830381865afa1580156102a0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102c49190610ce4565b9150915060006102eb6102d88585856107ce565b6102e58660200151610850565b906108bd565b905060006102f7825190565b121561030a576103056108e3565b610313565b610313816108fe565b60208501525091949350505050565b61032a610b4d565b600061033684846101d3565b60008054604051638bedf3bb60e01b8152929350909182916001600160a01b031690638bedf3bb9061037090899089908690600401610c19565b6040805180830381865afa15801561038c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103b09190610ce4565b60008054604051638bedf3bb60e01b81529395509193509182916001600160a01b031690638bedf3bb906103ec908b908b908690600401610c19565b6040805180830381865afa158015610408573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061042c9190610ce4565b91509150610438610b4d565b610440610b4d565b8251855113610450578486610453565b82845b6020890151919350915060009061046b908490610934565b905060008061048e61048a8b60200151856109a490919063ffffffff16565b5190565b1361049957816104a6565b6104a68960200151610850565b905060008c6001600160a01b031663b13c86a36040518163ffffffff1660e01b815260040160a060405180830381865afa1580156104e8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061050c9190610dd2565b6020015190506000806105218c600001515190565b1361053e576105398261053387610850565b90610a0a565b61054f565b61054f826105338d60400151610850565b905061055b8382610a75565b9e9d5050505050505050505050505050565b610575610b4d565b60008060009054906101000a90046001600160a01b03166001600160a01b031663b79023036040518163ffffffff1660e01b8152600401602060405180830381865afa1580156105c9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105ed9190610e64565b90506000816001600160a01b031663b7538c626040518163ffffffff1660e01b8152600401600060405180830381865afa15801561062f573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526106579190810190610e81565b905060005b815181101561074357856001600160a01b031682828151811061068157610681610f32565b60200260200101516001600160a01b031663fdf262b76040518163ffffffff1660e01b8152600401602060405180830381865afa1580156106c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106ea9190610e64565b6001600160a01b03160361073157600061071d83838151811061070f5761070f610f32565b6020026020010151876101d3565b60200151905061072d8582610a92565b9450505b8061073b81610f5e565b91505061065c565b50505092915050565b610754610b4d565b60005460405163ea0a45f960e01b81526001600160a01b039091169063ea0a45f9906107869086908690600401610d19565b602060405180830381865afa1580156107a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107c79190610f77565b9392505050565b6107d6610b4d565b8351516000036107ef576107e86108e3565b90506107c7565b8351516000121561082b576107e8600019610825866000015161081f886060015188610a7590919063ffffffff16565b90610aaf565b90610acc565b6107e8600019610825866000015161081f886080015187610a7590919063ffffffff16565b610858610b4d565b8180600001516001600160ff1b03101560405180606001604052806033815260200161123260339139906108a85760405162461bcd60e51b815260040161089f9190610f93565b60405180910390fd5b50506040805160208101909152915182525090565b6108c5610b4d565b6108cd610b4d565b825184516108da91610ae9565b81529392505050565b6108eb610b4d565b5060408051602081019091526000815290565b610906610b4d565b61090e610b4d565b82516000131561092c578251610925906000610fe8565b81526101cd565b915182525090565b61093c610b4d565b8180600001516001600160ff1b03101560405180606001604052806033815260200161123260339139906109835760405162461bcd60e51b815260040161089f9190610f93565b5061098c610b4d565b8351855161099a9190611027565b8152949350505050565b6109ac610b4d565b8180600001516001600160ff1b03101560405180606001604052806033815260200161123260339139906109f35760405162461bcd60e51b815260040161089f9190610f93565b506109fc610b4d565b8351855161099a9190610fe8565b610a12610b4d565b8180600001516001600160ff1b0310156040518060600160405280603381526020016112326033913990610a595760405162461bcd60e51b815260040161089f9190610f93565b50610a62610b4d565b6101c8610a6e85610850565b8690610aaf565b610a7d610b4d565b610a85610b4d565b825184516108da91610af5565b610a9a610b4d565b610aa2610b4d565b825184516108da91610b01565b610ab7610b4d565b610abf610b4d565b825184516108da91610b0d565b610ad4610b4d565b610adc610b4d565b83516108da908490611068565b60006107c78284611027565b60006107c78284610fe8565b60006107c782846110ed565b60006107c7838360126000610b2182610b3d565b610b2b8486611068565b610b359190611105565b949350505050565b60006101cd60ff8316600a611225565b6040518060200160405280600081525090565b6040518060c00160405280610b73610b4d565b8152602001610b80610b4d565b8152602001610b8d610b4d565b8152602001610b9a610b4d565b8152602001610ba7610b4d565b8152602001600081525090565b6001600160a01b0381168114610bc957600080fd5b50565b60008060408385031215610bdf57600080fd5b8235610bea81610bb4565b91506020830135610bfa81610bb4565b809150509250929050565b6001600160a01b0391909116815260200190565b6001600160a01b038481168252831660208201526060810160028310610c4f57634e487b7160e01b600052602160045260246000fd5b826040830152949350505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715610c9b57610c9b610c5d565b604052919050565b600060208284031215610cb557600080fd5b604051602081016001600160401b0381118282101715610cd757610cd7610c5d565b6040529151825250919050565b60008060408385031215610cf757600080fd5b610d018484610ca3565b9150610d108460208501610ca3565b90509250929050565b6001600160a01b0392831681529116602082015260400190565b600060c08284031215610d4557600080fd5b60405160c081016001600160401b0381118282101715610d6757610d67610c5d565b604052610d748484610ca3565b8152610d838460208501610ca3565b6020820152610d958460408501610ca3565b6040820152610da78460608501610ca3565b6060820152610db98460808501610ca3565b608082015260a083015160a08201528091505092915050565b600060a08284031215610de457600080fd5b60405160a081016001600160401b0381118282101715610e0657610e06610c5d565b604052610e138484610ca3565b8152610e228460208501610ca3565b6020820152610e348460408501610ca3565b6040820152610e468460608501610ca3565b6060820152610e588460808501610ca3565b60808201529392505050565b600060208284031215610e7657600080fd5b81516107c781610bb4565b60006020808385031215610e9457600080fd5b82516001600160401b0380821115610eab57600080fd5b818501915085601f830112610ebf57600080fd5b815181811115610ed157610ed1610c5d565b8060051b9150610ee2848301610c73565b8181529183018401918481019088841115610efc57600080fd5b938501935b83851015610f265784519250610f1683610bb4565b8282529385019390850190610f01565b98975050505050505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201610f7057610f70610f48565b5060010190565b600060208284031215610f8957600080fd5b6107c78383610ca3565b600060208083528351808285015260005b81811015610fc057858101830151858201604001528201610fa4565b81811115610fd2576000604083870101525b50601f01601f1916929092016040019392505050565b60008083128015600160ff1b85018412161561100657611006610f48565b6001600160ff1b038401831381161561102157611021610f48565b50500390565b600080821280156001600160ff1b038490038513161561104957611049610f48565b600160ff1b839003841281161561106257611062610f48565b50500190565b60006001600160ff1b038184138284138082168684048611161561108e5761108e610f48565b600160ff1b60008712828116878305891216156110ad576110ad610f48565b600087129250878205871284841616156110c9576110c9610f48565b878505871281841616156110df576110df610f48565b505050929093029392505050565b6000821982111561110057611100610f48565b500190565b60008261112257634e487b7160e01b600052601260045260246000fd5b600160ff1b82146000198414161561113c5761113c610f48565b500590565b600181815b8085111561117c57816000190482111561116257611162610f48565b8085161561116f57918102915b93841c9390800290611146565b509250929050565b600082611193575060016101cd565b816111a0575060006101cd565b81600181146111b657600281146111c0576111dc565b60019150506101cd565b60ff8411156111d1576111d1610f48565b50506001821b6101cd565b5060208310610133831016604e8410600b84101617156111ff575081810a6101cd565b6112098383611141565b806000190482111561121d5761121d610f48565b029392505050565b60006107c7838361118456fe4d69786564446563696d616c3a2075696e742076616c756520697320626967676572207468616e205f494e543235365f4d4158a264697066735822122020c231f83529fc4ab047b372ac81925ee50cb0868581af59fdaea592f9d5e36a64736f6c634300080d0033";
static readonly abi: ({

@@ -58,1 +70,2 @@ inputs: {

}
export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ClearingHouseViewer__factory = void 0;
/* Autogenerated file. Do not edit manually. */
/* tslint:disable */
/* eslint-disable */
Object.defineProperty(exports, "__esModule", { value: true });
exports.ClearingHouseViewer__factory = void 0;
const ethers_1 = require("ethers");

@@ -188,6 +188,18 @@ const _abi = [

internalType: "struct SignedDecimal.signedDecimal",
name: "lastUpdatedCumulativePremiumFraction",
name: "lastUpdatedCumulativePremiumFractionLong",
type: "tuple",
},
{
components: [
{
internalType: "int256",
name: "d",
type: "int256",
},
],
internalType: "struct SignedDecimal.signedDecimal",
name: "lastUpdatedCumulativePremiumFractionShort",
type: "tuple",
},
{
internalType: "uint256",

@@ -218,7 +230,2 @@ name: "blockNumber",

},
{
internalType: "enum ClearingHouse.PnlCalcOption",
name: "_pnlCalcOption",
type: "uint8",
},
],

@@ -244,3 +251,26 @@ name: "getUnrealizedPnl",

];
class ClearingHouseViewer__factory {
const _bytecode = "0x608060405234801561001057600080fd5b5060405161132d38038061132d83398101604081905261002f91610054565b600080546001600160a01b0319166001600160a01b0392909216919091179055610084565b60006020828403121561006657600080fd5b81516001600160a01b038116811461007d57600080fd5b9392505050565b61129a806100936000396000f3fe608060405234801561001057600080fd5b50600436106100625760003560e01c80630acdddfb146100675780630af968001461008e57806316f6c558146100ae57806333d3bd3014610112578063bafe871c14610125578063ea0a45f914610138575b600080fd5b61007a610075366004610bcc565b61014b565b604051905181526020015b60405180910390f35b6000546100a1906001600160a01b031681565b6040516100859190610c05565b6100c16100bc366004610bcc565b6101d3565b6040516100859190600060c0820190508251518252602083015151602083015260408301515160408301526060830151516060830152608083015151608083015260a083015160a083015292915050565b61007a610120366004610bcc565b610322565b61007a610133366004610bcc565b61056d565b61007a610146366004610bcc565b61074c565b610153610b4d565b60008054604051638bedf3bb60e01b81526001600160a01b0390911690638bedf3bb9061018890879087908690600401610c19565b6040805180830381865afa1580156101a4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101c89190610ce4565b925050505b92915050565b6101db610b60565b600054604051630b33dc1960e41b81526001600160a01b039091169063b33dc1909061020d9086908690600401610d19565b60c060405180830381865afa15801561022a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061024e9190610d33565b60008054604051636891397b60e01b8152929350909182916001600160a01b031690636891397b90610284908890600401610c05565b6040805180830381865afa1580156102a0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102c49190610ce4565b9150915060006102eb6102d88585856107ce565b6102e58660200151610850565b906108bd565b905060006102f7825190565b121561030a576103056108e3565b610313565b610313816108fe565b60208501525091949350505050565b61032a610b4d565b600061033684846101d3565b60008054604051638bedf3bb60e01b8152929350909182916001600160a01b031690638bedf3bb9061037090899089908690600401610c19565b6040805180830381865afa15801561038c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103b09190610ce4565b60008054604051638bedf3bb60e01b81529395509193509182916001600160a01b031690638bedf3bb906103ec908b908b908690600401610c19565b6040805180830381865afa158015610408573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061042c9190610ce4565b91509150610438610b4d565b610440610b4d565b8251855113610450578486610453565b82845b6020890151919350915060009061046b908490610934565b905060008061048e61048a8b60200151856109a490919063ffffffff16565b5190565b1361049957816104a6565b6104a68960200151610850565b905060008c6001600160a01b031663b13c86a36040518163ffffffff1660e01b815260040160a060405180830381865afa1580156104e8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061050c9190610dd2565b6020015190506000806105218c600001515190565b1361053e576105398261053387610850565b90610a0a565b61054f565b61054f826105338d60400151610850565b905061055b8382610a75565b9e9d5050505050505050505050505050565b610575610b4d565b60008060009054906101000a90046001600160a01b03166001600160a01b031663b79023036040518163ffffffff1660e01b8152600401602060405180830381865afa1580156105c9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105ed9190610e64565b90506000816001600160a01b031663b7538c626040518163ffffffff1660e01b8152600401600060405180830381865afa15801561062f573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526106579190810190610e81565b905060005b815181101561074357856001600160a01b031682828151811061068157610681610f32565b60200260200101516001600160a01b031663fdf262b76040518163ffffffff1660e01b8152600401602060405180830381865afa1580156106c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106ea9190610e64565b6001600160a01b03160361073157600061071d83838151811061070f5761070f610f32565b6020026020010151876101d3565b60200151905061072d8582610a92565b9450505b8061073b81610f5e565b91505061065c565b50505092915050565b610754610b4d565b60005460405163ea0a45f960e01b81526001600160a01b039091169063ea0a45f9906107869086908690600401610d19565b602060405180830381865afa1580156107a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107c79190610f77565b9392505050565b6107d6610b4d565b8351516000036107ef576107e86108e3565b90506107c7565b8351516000121561082b576107e8600019610825866000015161081f886060015188610a7590919063ffffffff16565b90610aaf565b90610acc565b6107e8600019610825866000015161081f886080015187610a7590919063ffffffff16565b610858610b4d565b8180600001516001600160ff1b03101560405180606001604052806033815260200161123260339139906108a85760405162461bcd60e51b815260040161089f9190610f93565b60405180910390fd5b50506040805160208101909152915182525090565b6108c5610b4d565b6108cd610b4d565b825184516108da91610ae9565b81529392505050565b6108eb610b4d565b5060408051602081019091526000815290565b610906610b4d565b61090e610b4d565b82516000131561092c578251610925906000610fe8565b81526101cd565b915182525090565b61093c610b4d565b8180600001516001600160ff1b03101560405180606001604052806033815260200161123260339139906109835760405162461bcd60e51b815260040161089f9190610f93565b5061098c610b4d565b8351855161099a9190611027565b8152949350505050565b6109ac610b4d565b8180600001516001600160ff1b03101560405180606001604052806033815260200161123260339139906109f35760405162461bcd60e51b815260040161089f9190610f93565b506109fc610b4d565b8351855161099a9190610fe8565b610a12610b4d565b8180600001516001600160ff1b0310156040518060600160405280603381526020016112326033913990610a595760405162461bcd60e51b815260040161089f9190610f93565b50610a62610b4d565b6101c8610a6e85610850565b8690610aaf565b610a7d610b4d565b610a85610b4d565b825184516108da91610af5565b610a9a610b4d565b610aa2610b4d565b825184516108da91610b01565b610ab7610b4d565b610abf610b4d565b825184516108da91610b0d565b610ad4610b4d565b610adc610b4d565b83516108da908490611068565b60006107c78284611027565b60006107c78284610fe8565b60006107c782846110ed565b60006107c7838360126000610b2182610b3d565b610b2b8486611068565b610b359190611105565b949350505050565b60006101cd60ff8316600a611225565b6040518060200160405280600081525090565b6040518060c00160405280610b73610b4d565b8152602001610b80610b4d565b8152602001610b8d610b4d565b8152602001610b9a610b4d565b8152602001610ba7610b4d565b8152602001600081525090565b6001600160a01b0381168114610bc957600080fd5b50565b60008060408385031215610bdf57600080fd5b8235610bea81610bb4565b91506020830135610bfa81610bb4565b809150509250929050565b6001600160a01b0391909116815260200190565b6001600160a01b038481168252831660208201526060810160028310610c4f57634e487b7160e01b600052602160045260246000fd5b826040830152949350505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715610c9b57610c9b610c5d565b604052919050565b600060208284031215610cb557600080fd5b604051602081016001600160401b0381118282101715610cd757610cd7610c5d565b6040529151825250919050565b60008060408385031215610cf757600080fd5b610d018484610ca3565b9150610d108460208501610ca3565b90509250929050565b6001600160a01b0392831681529116602082015260400190565b600060c08284031215610d4557600080fd5b60405160c081016001600160401b0381118282101715610d6757610d67610c5d565b604052610d748484610ca3565b8152610d838460208501610ca3565b6020820152610d958460408501610ca3565b6040820152610da78460608501610ca3565b6060820152610db98460808501610ca3565b608082015260a083015160a08201528091505092915050565b600060a08284031215610de457600080fd5b60405160a081016001600160401b0381118282101715610e0657610e06610c5d565b604052610e138484610ca3565b8152610e228460208501610ca3565b6020820152610e348460408501610ca3565b6040820152610e468460608501610ca3565b6060820152610e588460808501610ca3565b60808201529392505050565b600060208284031215610e7657600080fd5b81516107c781610bb4565b60006020808385031215610e9457600080fd5b82516001600160401b0380821115610eab57600080fd5b818501915085601f830112610ebf57600080fd5b815181811115610ed157610ed1610c5d565b8060051b9150610ee2848301610c73565b8181529183018401918481019088841115610efc57600080fd5b938501935b83851015610f265784519250610f1683610bb4565b8282529385019390850190610f01565b98975050505050505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201610f7057610f70610f48565b5060010190565b600060208284031215610f8957600080fd5b6107c78383610ca3565b600060208083528351808285015260005b81811015610fc057858101830151858201604001528201610fa4565b81811115610fd2576000604083870101525b50601f01601f1916929092016040019392505050565b60008083128015600160ff1b85018412161561100657611006610f48565b6001600160ff1b038401831381161561102157611021610f48565b50500390565b600080821280156001600160ff1b038490038513161561104957611049610f48565b600160ff1b839003841281161561106257611062610f48565b50500190565b60006001600160ff1b038184138284138082168684048611161561108e5761108e610f48565b600160ff1b60008712828116878305891216156110ad576110ad610f48565b600087129250878205871284841616156110c9576110c9610f48565b878505871281841616156110df576110df610f48565b505050929093029392505050565b6000821982111561110057611100610f48565b500190565b60008261112257634e487b7160e01b600052601260045260246000fd5b600160ff1b82146000198414161561113c5761113c610f48565b500590565b600181815b8085111561117c57816000190482111561116257611162610f48565b8085161561116f57918102915b93841c9390800290611146565b509250929050565b600082611193575060016101cd565b816111a0575060006101cd565b81600181146111b657600281146111c0576111dc565b60019150506101cd565b60ff8411156111d1576111d1610f48565b50506001821b6101cd565b5060208310610133831016604e8410600b84101617156111ff575081810a6101cd565b6112098383611141565b806000190482111561121d5761121d610f48565b029392505050565b60006107c7838361118456fe4d69786564446563696d616c3a2075696e742076616c756520697320626967676572207468616e205f494e543235365f4d4158a264697066735822122020c231f83529fc4ab047b372ac81925ee50cb0868581af59fdaea592f9d5e36a64736f6c634300080d0033";
const isSuperArgs = (xs) => xs.length > 1;
class ClearingHouseViewer__factory extends ethers_1.ContractFactory {
constructor(...args) {
if (isSuperArgs(args)) {
super(...args);
}
else {
super(_abi, _bytecode, args[0]);
}
}
deploy(_clearingHouse, overrides) {
return super.deploy(_clearingHouse, overrides || {});
}
getDeployTransaction(_clearingHouse, overrides) {
return super.getDeployTransaction(_clearingHouse, overrides || {});
}
attach(address) {
return super.attach(address);
}
connect(signer) {
return super.connect(signer);
}
static bytecode = _bytecode;
static abi = _abi;

@@ -247,0 +277,0 @@ static createInterface() {

export { Amm__factory } from "./Amm__factory";
export { ClearingHouse__factory } from "./ClearingHouse__factory";
export { ClearingHouseViewer__factory } from "./ClearingHouseViewer__factory";
export { ERC20__factory } from "./ERC20__factory";
export { InsuranceFund__factory } from "./InsuranceFund__factory";
export { MockWETH__factory } from "./MockWETH__factory";
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MockWETH__factory = exports.InsuranceFund__factory = exports.ClearingHouseViewer__factory = exports.ClearingHouse__factory = exports.Amm__factory = void 0;
exports.InsuranceFund__factory = exports.ERC20__factory = exports.ClearingHouseViewer__factory = exports.ClearingHouse__factory = exports.Amm__factory = void 0;
/* Autogenerated file. Do not edit manually. */

@@ -13,5 +13,5 @@ /* tslint:disable */

Object.defineProperty(exports, "ClearingHouseViewer__factory", { enumerable: true, get: function () { return ClearingHouseViewer__factory_1.ClearingHouseViewer__factory; } });
var ERC20__factory_1 = require("./ERC20__factory");
Object.defineProperty(exports, "ERC20__factory", { enumerable: true, get: function () { return ERC20__factory_1.ERC20__factory; } });
var InsuranceFund__factory_1 = require("./InsuranceFund__factory");
Object.defineProperty(exports, "InsuranceFund__factory", { enumerable: true, get: function () { return InsuranceFund__factory_1.InsuranceFund__factory; } });
var MockWETH__factory_1 = require("./MockWETH__factory");
Object.defineProperty(exports, "MockWETH__factory", { enumerable: true, get: function () { return MockWETH__factory_1.MockWETH__factory; } });

@@ -1,5 +0,17 @@

import { Signer } from "ethers";
import type { Provider } from "@ethersproject/providers";
import { Signer, ContractFactory, Overrides } from "ethers";
import type { Provider, TransactionRequest } from "@ethersproject/providers";
import type { PromiseOrValue } from "../common";
import type { InsuranceFund, InsuranceFundInterface } from "../InsuranceFund";
export declare class InsuranceFund__factory {
declare type InsuranceFundConstructorParams = [signer?: Signer] | ConstructorParameters<typeof ContractFactory>;
export declare class InsuranceFund__factory extends ContractFactory {
constructor(...args: InsuranceFundConstructorParams);
deploy(overrides?: Overrides & {
from?: PromiseOrValue<string>;
}): Promise<InsuranceFund>;
getDeployTransaction(overrides?: Overrides & {
from?: PromiseOrValue<string>;
}): TransactionRequest;
attach(address: string): InsuranceFund;
connect(signer: Signer): InsuranceFund__factory;
static readonly bytecode = "0x608060405234801561001057600080fd5b506116cc806100206000396000f3fe608060405234801561001057600080fd5b50600436106100ba5760003560e01c80630774a784146100bf5780631c31f710146100e7578063252978b8146100fc5780632c9115c71461010f5780635fa7b5841461012f578063715018a6146101425780638129fc1c1461014a5780638da5cb5b14610152578063b7538c621461015a578063bd4247f91461016f578063beb0597a14610192578063cf230979146101a3578063d926de1c146101b6578063f2fde38b146101c9575b600080fd5b6100d26100cd366004611288565b6101dc565b60405190151581526020015b60405180910390f35b6100fa6100f5366004611288565b6101fa565b005b6100fa61010a3660046112a5565b610254565b61012261011d3660046112e6565b6103c8565b6040516100de91906112ff565b6100fa61013d366004611288565b6103f2565b6100fa610677565b6100fa6106b2565b61012261077b565b61016261078a565b6040516100de9190611313565b6100d261017d366004611288565b60ca6020526000908152604090205460ff1681565b60cd546040519081526020016100de565b6100fa6101b1366004611288565b6107ec565b6100fa6101c4366004611288565b6109c4565b6100fa6101d7366004611288565b610be7565b6001600160a01b0316600090815260ca602052604090205460ff1690565b3361020361077b565b6001600160a01b0316146102325760405162461bcd60e51b815260040161022990611360565b60405180910390fd5b60ce80546001600160a01b0319166001600160a01b0392909216919091179055565b60ce5482906001600160a01b031633146102ac5760405162461bcd60e51b815260206004820152601960248201527863616c6c6572206973206e6f742062656e656669636961727960381b6044820152606401610229565b6102b581610c84565b6102fa5760405162461bcd60e51b8152602060048201526016602482015275105cdcd95d081a5cc81b9bdd081cdd5c1c1bdc9d195960521b6044820152606401610229565b600061030582610ca2565b905061031d61031936859003850185611395565b5190565b8151101561035f5760405162461bcd60e51b815260206004820152600f60248201526e08ceadcc840dcdee840cadcdeeaced608b1b6044820152606401610229565b610378823361037336879003870187611395565b610cba565b7f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5336103ac61031936879003870187611395565b6040516103ba9291906113e4565b60405180910390a150505050565b60cd81815481106103d857600080fd5b6000918252602090912001546001600160a01b0316905081565b336103fb61077b565b6001600160a01b0316146104215760405162461bcd60e51b815260040161022990611360565b61042a81610c84565b61046a5760405162461bcd60e51b81526020600482015260116024820152701d1bdad95b881b9bdd08195e1a5cdd1959607a1b6044820152606401610229565b6001600160a01b038116600090815260cb60205260408120805460ff1916905560cd54905b818110156105a257826001600160a01b031660cd82815481106104b4576104b46113fd565b6000918252602090912001546001600160a01b031603610590576104d9600183611429565b8110156105585760cd6104ed600184611429565b815481106104fd576104fd6113fd565b60009182526020909120015460cd80546001600160a01b039092169183908110610529576105296113fd565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055505b60cd80548061056957610569611440565b600082815260209020810160001990810180546001600160a01b03191690550190556105a2565b8061059a81611456565b91505061048f565b5060006105b161031984610ca2565b111561063c57816001600160a01b031663a9059cbb6105ce61077b565b6105da61031986610ca2565b6040518363ffffffff1660e01b81526004016105f79291906113e4565b6020604051808303816000875af1158015610616573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061063a919061146f565b505b7f4c910b69fe65a61f7531b9c5042b2329ca7179c77290aa7e2eb3afa3c8511fd38260405161066b91906112ff565b60405180910390a15050565b3361068061077b565b6001600160a01b0316146106a65760405162461bcd60e51b815260040161022990611360565b6106b06000610da2565b565b600054610100900460ff166106cd5760005460ff16156106d1565b303b155b6107345760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610229565b600054610100900460ff16158015610756576000805461ffff19166101011790555b61075e610df4565b610766610e23565b8015610778576000805461ff00191690555b50565b6033546001600160a01b031690565b606060cc8054806020026020016040519081016040528092919081815260200182805480156107e257602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116107c4575b5050505050905090565b336107f561077b565b6001600160a01b03161461081b5760405162461bcd60e51b815260040161022990611360565b610824816101dc565b6108625760405162461bcd60e51b815260206004820152600f60248201526e185b5b481b9bdd08195e1a5cdd1959608a1b6044820152606401610229565b6001600160a01b038116600090815260ca60205260408120805460ff1916905560cc54905b818110156109bf57826001600160a01b031660cc82815481106108ac576108ac6113fd565b6000918252602090912001546001600160a01b0316036109ad5760cc6108d3600184611429565b815481106108e3576108e36113fd565b60009182526020909120015460cc80546001600160a01b03909216918390811061090f5761090f6113fd565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060cc80548061094e5761094e611440565b600082815260209020810160001990810180546001600160a01b03191690550190556040517fdaad2af263ebb3abf337a324f20752addc3bf170971ce7b80cc3bfea1fcf30ee906109a09085906112ff565b60405180910390a1505050565b806109b781611456565b915050610887565b505050565b336109cd61077b565b6001600160a01b0316146109f35760405162461bcd60e51b815260040161022990611360565b6109fc816101dc565b15610a3d5760405162461bcd60e51b8152602060048201526011602482015270185b5b48185b1c9958591e481859191959607a1b6044820152606401610229565b6001600160a01b038116600081815260ca6020526040808220805460ff1916600190811790915560cc805491820181559092527f47197230e1e4b29fc0bd84d7d78966c0925452aff72a2a121538b102457e9ebe90910180546001600160a01b031916909217909155517f10cdbb821aa416c854add806e1d7e8138afe2a538921cebe99b1351362ae38b290610ad49083906112ff565b60405180910390a16000816001600160a01b031663fdf262b76040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b1c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b409190611491565b9050610b4b81610c84565b610be35760cd805460018082019092557f83978b4c69c48dd978ab43fe30f077615294f938fb7f936d9eb340e51ea7db2e0180546001600160a01b0319166001600160a01b038416908117909155600090815260cb602052604090819020805460ff1916909217909155517f784c8f4dbf0ffedd6e72c76501c545a70f8b203b30a26ce542bf92ba87c248a49061066b9083906112ff565b5050565b33610bf061077b565b6001600160a01b031614610c165760405162461bcd60e51b815260040161022990611360565b6001600160a01b038116610c7b5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610229565b61077881610da2565b6001600160a01b0316600090815260cb602052604090205460ff1690565b610caa611260565b610cb48230610e52565b92915050565b610cc383610ed7565b6000610ccf8484610e52565b90506000610cdd8584610f21565b60405163a9059cbb60e01b81529091506001600160a01b0386169063a9059cbb90610d0e90879085906004016113e4565b6020604051808303816000875af1158015610d2d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d51919061146f565b610d8f5760405162461bcd60e51b815260206004820152600f60248201526e1d1c985b9cd9995c8819985a5b1959608a1b6044820152606401610229565b610d9b85858385610f8b565b5050505050565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff16610e1b5760405162461bcd60e51b8152600401610229906114ae565b6106b0610fff565b600054610100900460ff16610e4a5760405162461bcd60e51b8152600401610229906114ae565b6106b061102f565b610e5a611260565b610ed083846001600160a01b03166370a08231856040518263ffffffff1660e01b8152600401610e8a91906112ff565b602060405180830381865afa158015610ea7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ecb91906114f9565b61105d565b9392505050565b6000610ee2826110e9565b6001600160a01b0383166000908152609760205260409020549091508114610be3576001600160a01b0391909116600090815260976020526040902055565b600080610f2d846110e9565b905060128110610f6157610f42601282611429565b610f4d90600a6115f6565b8351610f599190611602565b915050610cb4565b610f6c816012611429565b610f7790600a6115f6565b8351610f839190611621565b949350505050565b610fb2610fa2610f9b868561105d565b83906111fd565b610fac8686610e52565b90611223565b60000b15610ff95760405162461bcd60e51b815260206004820152601460248201527318985b185b98d9481a5b98dbdb9cda5cdd195b9d60621b6044820152606401610229565b50505050565b600054610100900460ff166110265760405162461bcd60e51b8152600401610229906114ae565b6106b033610da2565b600054610100900460ff166110565760405162461bcd60e51b8152600401610229906114ae565b6001606555565b611065611260565b6000611070846110e9565b9050601281106110b25760405180602001604052806012836110929190611429565b61109d90600a6115f6565b6110a79086611621565b815250915050610cb4565b60405180602001604052808260126110ca9190611429565b6110d590600a6115f6565b6110df9086611602565b9052949350505050565b6001600160a01b038116600090815260976020526040812054808203610cb45760408051600481526024810182526020810180516001600160e01b031663313ce56760e01b179052905160009182916001600160a01b0387169161114c91611643565b600060405180830381855afa9150503d8060008114611187576040519150601f19603f3d011682016040523d82523d6000602084013e61118c565b606091505b509150915081801561119e5750805115155b6111e05760405162461bcd60e51b815260206004820152601360248201527219d95d08191958da5b585b1cc819985a5b1959606a1b6044820152606401610229565b808060200190518101906111f491906114f9565b95945050505050565b611205611260565b61120d611260565b8251845161121a91611254565b81529392505050565b80518251600091101561123857506001610cb4565b81518351101561124b5750600019610cb4565b50600092915050565b6000610ed0828461167e565b6040518060200160405280600081525090565b6001600160a01b038116811461077857600080fd5b60006020828403121561129a57600080fd5b8135610ed081611273565b60008082840360408112156112b957600080fd5b83356112c481611273565b92506020601f19820112156112d857600080fd5b506020830190509250929050565b6000602082840312156112f857600080fd5b5035919050565b6001600160a01b0391909116815260200190565b6020808252825182820181905260009190848201906040850190845b818110156113545783516001600160a01b03168352928401929184019160010161132f565b50909695505050505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6000602082840312156113a757600080fd5b604051602081016001600160401b03811182821017156113d757634e487b7160e01b600052604160045260246000fd5b6040529135825250919050565b6001600160a01b03929092168252602082015260400190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60008282101561143b5761143b611413565b500390565b634e487b7160e01b600052603160045260246000fd5b60006001820161146857611468611413565b5060010190565b60006020828403121561148157600080fd5b81518015158114610ed057600080fd5b6000602082840312156114a357600080fd5b8151610ed081611273565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60006020828403121561150b57600080fd5b5051919050565b600181815b8085111561154d57816000190482111561153357611533611413565b8085161561154057918102915b93841c9390800290611517565b509250929050565b60008261156457506001610cb4565b8161157157506000610cb4565b81600181146115875760028114611591576115ad565b6001915050610cb4565b60ff8411156115a2576115a2611413565b50506001821b610cb4565b5060208310610133831016604e8410600b84101617156115d0575081810a610cb4565b6115da8383611512565b80600019048211156115ee576115ee611413565b029392505050565b6000610ed08383611555565b600081600019048311821515161561161c5761161c611413565b500290565b60008261163e57634e487b7160e01b600052601260045260246000fd5b500490565b6000825160005b81811015611664576020818601810151858301520161164a565b81811115611673576000828501525b509190910192915050565b6000821982111561169157611691611413565b50019056fea26469706673582212205df75432d86869437ec42d7092665855540db18dc4a22115b8a2ea56686bcbca64736f6c634300080d0033";
static readonly abi: ({

@@ -57,1 +69,2 @@ anonymous: boolean;

}
export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.InsuranceFund__factory = void 0;
/* Autogenerated file. Do not edit manually. */
/* tslint:disable */
/* eslint-disable */
Object.defineProperty(exports, "__esModule", { value: true });
exports.InsuranceFund__factory = void 0;
const ethers_1 = require("ethers");

@@ -300,3 +300,26 @@ const _abi = [

];
class InsuranceFund__factory {
const _bytecode = "0x608060405234801561001057600080fd5b506116cc806100206000396000f3fe608060405234801561001057600080fd5b50600436106100ba5760003560e01c80630774a784146100bf5780631c31f710146100e7578063252978b8146100fc5780632c9115c71461010f5780635fa7b5841461012f578063715018a6146101425780638129fc1c1461014a5780638da5cb5b14610152578063b7538c621461015a578063bd4247f91461016f578063beb0597a14610192578063cf230979146101a3578063d926de1c146101b6578063f2fde38b146101c9575b600080fd5b6100d26100cd366004611288565b6101dc565b60405190151581526020015b60405180910390f35b6100fa6100f5366004611288565b6101fa565b005b6100fa61010a3660046112a5565b610254565b61012261011d3660046112e6565b6103c8565b6040516100de91906112ff565b6100fa61013d366004611288565b6103f2565b6100fa610677565b6100fa6106b2565b61012261077b565b61016261078a565b6040516100de9190611313565b6100d261017d366004611288565b60ca6020526000908152604090205460ff1681565b60cd546040519081526020016100de565b6100fa6101b1366004611288565b6107ec565b6100fa6101c4366004611288565b6109c4565b6100fa6101d7366004611288565b610be7565b6001600160a01b0316600090815260ca602052604090205460ff1690565b3361020361077b565b6001600160a01b0316146102325760405162461bcd60e51b815260040161022990611360565b60405180910390fd5b60ce80546001600160a01b0319166001600160a01b0392909216919091179055565b60ce5482906001600160a01b031633146102ac5760405162461bcd60e51b815260206004820152601960248201527863616c6c6572206973206e6f742062656e656669636961727960381b6044820152606401610229565b6102b581610c84565b6102fa5760405162461bcd60e51b8152602060048201526016602482015275105cdcd95d081a5cc81b9bdd081cdd5c1c1bdc9d195960521b6044820152606401610229565b600061030582610ca2565b905061031d61031936859003850185611395565b5190565b8151101561035f5760405162461bcd60e51b815260206004820152600f60248201526e08ceadcc840dcdee840cadcdeeaced608b1b6044820152606401610229565b610378823361037336879003870187611395565b610cba565b7f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5336103ac61031936879003870187611395565b6040516103ba9291906113e4565b60405180910390a150505050565b60cd81815481106103d857600080fd5b6000918252602090912001546001600160a01b0316905081565b336103fb61077b565b6001600160a01b0316146104215760405162461bcd60e51b815260040161022990611360565b61042a81610c84565b61046a5760405162461bcd60e51b81526020600482015260116024820152701d1bdad95b881b9bdd08195e1a5cdd1959607a1b6044820152606401610229565b6001600160a01b038116600090815260cb60205260408120805460ff1916905560cd54905b818110156105a257826001600160a01b031660cd82815481106104b4576104b46113fd565b6000918252602090912001546001600160a01b031603610590576104d9600183611429565b8110156105585760cd6104ed600184611429565b815481106104fd576104fd6113fd565b60009182526020909120015460cd80546001600160a01b039092169183908110610529576105296113fd565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055505b60cd80548061056957610569611440565b600082815260209020810160001990810180546001600160a01b03191690550190556105a2565b8061059a81611456565b91505061048f565b5060006105b161031984610ca2565b111561063c57816001600160a01b031663a9059cbb6105ce61077b565b6105da61031986610ca2565b6040518363ffffffff1660e01b81526004016105f79291906113e4565b6020604051808303816000875af1158015610616573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061063a919061146f565b505b7f4c910b69fe65a61f7531b9c5042b2329ca7179c77290aa7e2eb3afa3c8511fd38260405161066b91906112ff565b60405180910390a15050565b3361068061077b565b6001600160a01b0316146106a65760405162461bcd60e51b815260040161022990611360565b6106b06000610da2565b565b600054610100900460ff166106cd5760005460ff16156106d1565b303b155b6107345760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610229565b600054610100900460ff16158015610756576000805461ffff19166101011790555b61075e610df4565b610766610e23565b8015610778576000805461ff00191690555b50565b6033546001600160a01b031690565b606060cc8054806020026020016040519081016040528092919081815260200182805480156107e257602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116107c4575b5050505050905090565b336107f561077b565b6001600160a01b03161461081b5760405162461bcd60e51b815260040161022990611360565b610824816101dc565b6108625760405162461bcd60e51b815260206004820152600f60248201526e185b5b481b9bdd08195e1a5cdd1959608a1b6044820152606401610229565b6001600160a01b038116600090815260ca60205260408120805460ff1916905560cc54905b818110156109bf57826001600160a01b031660cc82815481106108ac576108ac6113fd565b6000918252602090912001546001600160a01b0316036109ad5760cc6108d3600184611429565b815481106108e3576108e36113fd565b60009182526020909120015460cc80546001600160a01b03909216918390811061090f5761090f6113fd565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060cc80548061094e5761094e611440565b600082815260209020810160001990810180546001600160a01b03191690550190556040517fdaad2af263ebb3abf337a324f20752addc3bf170971ce7b80cc3bfea1fcf30ee906109a09085906112ff565b60405180910390a1505050565b806109b781611456565b915050610887565b505050565b336109cd61077b565b6001600160a01b0316146109f35760405162461bcd60e51b815260040161022990611360565b6109fc816101dc565b15610a3d5760405162461bcd60e51b8152602060048201526011602482015270185b5b48185b1c9958591e481859191959607a1b6044820152606401610229565b6001600160a01b038116600081815260ca6020526040808220805460ff1916600190811790915560cc805491820181559092527f47197230e1e4b29fc0bd84d7d78966c0925452aff72a2a121538b102457e9ebe90910180546001600160a01b031916909217909155517f10cdbb821aa416c854add806e1d7e8138afe2a538921cebe99b1351362ae38b290610ad49083906112ff565b60405180910390a16000816001600160a01b031663fdf262b76040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b1c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b409190611491565b9050610b4b81610c84565b610be35760cd805460018082019092557f83978b4c69c48dd978ab43fe30f077615294f938fb7f936d9eb340e51ea7db2e0180546001600160a01b0319166001600160a01b038416908117909155600090815260cb602052604090819020805460ff1916909217909155517f784c8f4dbf0ffedd6e72c76501c545a70f8b203b30a26ce542bf92ba87c248a49061066b9083906112ff565b5050565b33610bf061077b565b6001600160a01b031614610c165760405162461bcd60e51b815260040161022990611360565b6001600160a01b038116610c7b5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610229565b61077881610da2565b6001600160a01b0316600090815260cb602052604090205460ff1690565b610caa611260565b610cb48230610e52565b92915050565b610cc383610ed7565b6000610ccf8484610e52565b90506000610cdd8584610f21565b60405163a9059cbb60e01b81529091506001600160a01b0386169063a9059cbb90610d0e90879085906004016113e4565b6020604051808303816000875af1158015610d2d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d51919061146f565b610d8f5760405162461bcd60e51b815260206004820152600f60248201526e1d1c985b9cd9995c8819985a5b1959608a1b6044820152606401610229565b610d9b85858385610f8b565b5050505050565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff16610e1b5760405162461bcd60e51b8152600401610229906114ae565b6106b0610fff565b600054610100900460ff16610e4a5760405162461bcd60e51b8152600401610229906114ae565b6106b061102f565b610e5a611260565b610ed083846001600160a01b03166370a08231856040518263ffffffff1660e01b8152600401610e8a91906112ff565b602060405180830381865afa158015610ea7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ecb91906114f9565b61105d565b9392505050565b6000610ee2826110e9565b6001600160a01b0383166000908152609760205260409020549091508114610be3576001600160a01b0391909116600090815260976020526040902055565b600080610f2d846110e9565b905060128110610f6157610f42601282611429565b610f4d90600a6115f6565b8351610f599190611602565b915050610cb4565b610f6c816012611429565b610f7790600a6115f6565b8351610f839190611621565b949350505050565b610fb2610fa2610f9b868561105d565b83906111fd565b610fac8686610e52565b90611223565b60000b15610ff95760405162461bcd60e51b815260206004820152601460248201527318985b185b98d9481a5b98dbdb9cda5cdd195b9d60621b6044820152606401610229565b50505050565b600054610100900460ff166110265760405162461bcd60e51b8152600401610229906114ae565b6106b033610da2565b600054610100900460ff166110565760405162461bcd60e51b8152600401610229906114ae565b6001606555565b611065611260565b6000611070846110e9565b9050601281106110b25760405180602001604052806012836110929190611429565b61109d90600a6115f6565b6110a79086611621565b815250915050610cb4565b60405180602001604052808260126110ca9190611429565b6110d590600a6115f6565b6110df9086611602565b9052949350505050565b6001600160a01b038116600090815260976020526040812054808203610cb45760408051600481526024810182526020810180516001600160e01b031663313ce56760e01b179052905160009182916001600160a01b0387169161114c91611643565b600060405180830381855afa9150503d8060008114611187576040519150601f19603f3d011682016040523d82523d6000602084013e61118c565b606091505b509150915081801561119e5750805115155b6111e05760405162461bcd60e51b815260206004820152601360248201527219d95d08191958da5b585b1cc819985a5b1959606a1b6044820152606401610229565b808060200190518101906111f491906114f9565b95945050505050565b611205611260565b61120d611260565b8251845161121a91611254565b81529392505050565b80518251600091101561123857506001610cb4565b81518351101561124b5750600019610cb4565b50600092915050565b6000610ed0828461167e565b6040518060200160405280600081525090565b6001600160a01b038116811461077857600080fd5b60006020828403121561129a57600080fd5b8135610ed081611273565b60008082840360408112156112b957600080fd5b83356112c481611273565b92506020601f19820112156112d857600080fd5b506020830190509250929050565b6000602082840312156112f857600080fd5b5035919050565b6001600160a01b0391909116815260200190565b6020808252825182820181905260009190848201906040850190845b818110156113545783516001600160a01b03168352928401929184019160010161132f565b50909695505050505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6000602082840312156113a757600080fd5b604051602081016001600160401b03811182821017156113d757634e487b7160e01b600052604160045260246000fd5b6040529135825250919050565b6001600160a01b03929092168252602082015260400190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60008282101561143b5761143b611413565b500390565b634e487b7160e01b600052603160045260246000fd5b60006001820161146857611468611413565b5060010190565b60006020828403121561148157600080fd5b81518015158114610ed057600080fd5b6000602082840312156114a357600080fd5b8151610ed081611273565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60006020828403121561150b57600080fd5b5051919050565b600181815b8085111561154d57816000190482111561153357611533611413565b8085161561154057918102915b93841c9390800290611517565b509250929050565b60008261156457506001610cb4565b8161157157506000610cb4565b81600181146115875760028114611591576115ad565b6001915050610cb4565b60ff8411156115a2576115a2611413565b50506001821b610cb4565b5060208310610133831016604e8410600b84101617156115d0575081810a610cb4565b6115da8383611512565b80600019048211156115ee576115ee611413565b029392505050565b6000610ed08383611555565b600081600019048311821515161561161c5761161c611413565b500290565b60008261163e57634e487b7160e01b600052601260045260246000fd5b500490565b6000825160005b81811015611664576020818601810151858301520161164a565b81811115611673576000828501525b509190910192915050565b6000821982111561169157611691611413565b50019056fea26469706673582212205df75432d86869437ec42d7092665855540db18dc4a22115b8a2ea56686bcbca64736f6c634300080d0033";
const isSuperArgs = (xs) => xs.length > 1;
class InsuranceFund__factory extends ethers_1.ContractFactory {
constructor(...args) {
if (isSuperArgs(args)) {
super(...args);
}
else {
super(_abi, _bytecode, args[0]);
}
}
deploy(overrides) {
return super.deploy(overrides || {});
}
getDeployTransaction(overrides) {
return super.getDeployTransaction(overrides || {});
}
attach(address) {
return super.attach(address);
}
connect(signer) {
return super.connect(signer);
}
static bytecode = _bytecode;
static abi = _abi;

@@ -303,0 +326,0 @@ static createInterface() {

export type { Amm } from "./Amm";
export type { ClearingHouse } from "./ClearingHouse";
export type { ClearingHouseViewer } from "./ClearingHouseViewer";
export type { ERC20 } from "./ERC20";
export type { InsuranceFund } from "./InsuranceFund";
export type { MockWETH } from "./MockWETH";
export * as factories from "./factories";

@@ -10,3 +10,3 @@ export { Amm__factory } from "./factories/Amm__factory";

export { ClearingHouseViewer__factory } from "./factories/ClearingHouseViewer__factory";
export { ERC20__factory } from "./factories/ERC20__factory";
export { InsuranceFund__factory } from "./factories/InsuranceFund__factory";
export { MockWETH__factory } from "./factories/MockWETH__factory";

@@ -26,3 +26,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.MockWETH__factory = exports.InsuranceFund__factory = exports.ClearingHouseViewer__factory = exports.ClearingHouse__factory = exports.Amm__factory = exports.factories = void 0;
exports.InsuranceFund__factory = exports.ERC20__factory = exports.ClearingHouseViewer__factory = exports.ClearingHouse__factory = exports.Amm__factory = exports.factories = void 0;
exports.factories = __importStar(require("./factories"));

@@ -35,5 +35,5 @@ var Amm__factory_1 = require("./factories/Amm__factory");

Object.defineProperty(exports, "ClearingHouseViewer__factory", { enumerable: true, get: function () { return ClearingHouseViewer__factory_1.ClearingHouseViewer__factory; } });
var ERC20__factory_1 = require("./factories/ERC20__factory");
Object.defineProperty(exports, "ERC20__factory", { enumerable: true, get: function () { return ERC20__factory_1.ERC20__factory; } });
var InsuranceFund__factory_1 = require("./factories/InsuranceFund__factory");
Object.defineProperty(exports, "InsuranceFund__factory", { enumerable: true, get: function () { return InsuranceFund__factory_1.InsuranceFund__factory; } });
var MockWETH__factory_1 = require("./factories/MockWETH__factory");
Object.defineProperty(exports, "MockWETH__factory", { enumerable: true, get: function () { return MockWETH__factory_1.MockWETH__factory; } });

@@ -1,21 +0,20 @@

import Big from "big.js";
import { BigNumber } from "ethers";
export * from "./api";
export declare enum Amm {
BAYC = "BAYC",
MOONBIRDS = "MOONBIRDS",
MILADY = "MILADY",
PUNKS = "PUNKS",
AZUKI = "AZUKI",
MAYC = "MAYC",
DOODLES = "DOODLES",
CLONEX = "CLONEX"
MOONBIRDS = "MOONBIRDS",
BGAN = "BGAN",
GOBBLERS = "GOBBLERS"
}
export declare enum Side {
BUY = 0,
SELL = 1
BUY = "BUY",
SELL = "SELL"
}
export declare enum DirectionOfAsset {
ADD_TO_AMM = 0,
REMOVE_FROM_AMM = 1
}
export declare enum Instance {
BETA = "BETA",
HACKATHON = "HACKATHON"
TRADING_COMP = "TRADING_COMP"
}

@@ -34,2 +33,4 @@ export declare type InstanceConfig = {

[key in Instance]: InstanceConfig;
} & {
API_BASE_URL: string;
};

@@ -39,44 +40,1 @@ export declare type Decimal = {

};
export interface Position {
size: Big;
margin: Big;
openNotional: Big;
}
export interface Ratios {
imr: Big;
mmr: Big;
plr: Big;
lfr: Big;
}
export interface PositionDisplay {
size: number;
margin: number;
leverage: number;
notional: number;
pnl: number;
fundingPayment: number;
entryPrice: number | null;
liquidationPrice: number | null;
}
export interface Reserves {
quoteAssetReserve: Big;
baseAssetReserve: Big;
}
export interface OpenInterestInfo {
openInterest: Big;
openInterestLongs: Big;
openInterestShorts: Big;
}
export interface AmmInfo {
amm: Amm;
markPrice: number;
indexPrice: number;
maxLeverage: number;
maintenanceMarginPercent: number;
fullLiquidationPercent: number;
previousFundingPercent: number;
nextFundingTime: number;
openInterest: number;
openInterestLongs: number;
openInterestShorts: number;
}
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Instance = exports.DirectionOfAsset = exports.Side = exports.Amm = void 0;
exports.Instance = exports.Side = exports.Amm = void 0;
__exportStar(require("./api"), exports);
// declare assets here

@@ -8,21 +23,19 @@ var Amm;

Amm["BAYC"] = "BAYC";
Amm["MOONBIRDS"] = "MOONBIRDS";
Amm["MILADY"] = "MILADY";
Amm["PUNKS"] = "PUNKS";
Amm["AZUKI"] = "AZUKI";
Amm["MAYC"] = "MAYC";
Amm["DOODLES"] = "DOODLES";
Amm["CLONEX"] = "CLONEX";
Amm["MOONBIRDS"] = "MOONBIRDS";
Amm["BGAN"] = "BGAN";
Amm["GOBBLERS"] = "GOBBLERS";
})(Amm = exports.Amm || (exports.Amm = {}));
var Side;
(function (Side) {
Side[Side["BUY"] = 0] = "BUY";
Side[Side["SELL"] = 1] = "SELL";
Side["BUY"] = "BUY";
Side["SELL"] = "SELL";
})(Side = exports.Side || (exports.Side = {}));
var DirectionOfAsset;
(function (DirectionOfAsset) {
DirectionOfAsset[DirectionOfAsset["ADD_TO_AMM"] = 0] = "ADD_TO_AMM";
DirectionOfAsset[DirectionOfAsset["REMOVE_FROM_AMM"] = 1] = "REMOVE_FROM_AMM";
})(DirectionOfAsset = exports.DirectionOfAsset || (exports.DirectionOfAsset = {}));
var Instance;
(function (Instance) {
Instance["BETA"] = "BETA";
Instance["HACKATHON"] = "HACKATHON";
Instance["TRADING_COMP"] = "TRADING_COMP";
})(Instance = exports.Instance || (exports.Instance = {}));

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc