0 txs
1.29m calls
constructor
No constructor.
functions
correctSl
purefunction correctSl(uint192 openPrice, uint192 sl, uint32 leverage, uint32 initialLeverage, bool buy, uint8 maxSl_P) pure returns (uint192)
correctToNullSl
purefunction correctToNullSl(uint192 openPrice, uint192 sl, uint32 leverage, uint32 initialLeverage, bool buy, uint8 maxSl_P) pure returns (uint192)
correctTp
purefunction correctTp(uint192 openPrice, uint192 tp, uint32 leverage, uint32 initialLeverage, bool buy) pure returns (uint192)
currentPercentProfit
purefunction currentPercentProfit(int256 openPrice, int256 currentPrice, bool buy, int32 leverage, int32 initialLeverage) pure returns (int256 p, int256 maxPnlP)
getAutomationCloseOrderCancelReason
purefunction getAutomationCloseOrderCancelReason(IOstiumTradingStorage.LimitOrder orderType, tuple t, uint256 priceAfterImpact, uint256 usdcSentToTrader, bool isDayTradeClosed) pure returns (IOstiumTradingCallbacks.CancelReason)
getAutomationOpenOrderCancelReason
viewfunction getAutomationOpenOrderCancelReason(tuple o, uint256 priceAfterImpact, uint256 a_price, uint256 priceImpactP, IOstiumPairInfos pairInfos, IOstiumPairsStorage pairsStorage, IOstiumTradingStorage tradingStorage) view returns (IOstiumTradingCallbacks.CancelReason)
getHandleRemoveCollateralCancelReason
purefunction getHandleRemoveCollateralCancelReason(tuple trade, uint32 maxLeverage, uint256 usdcSentToTrader, bool isMaxPnlP) pure returns (IOstiumTradingCallbacks.CancelReason)
getOpenTradeMarketCancelReason
viewfunction getOpenTradeMarketCancelReason(bool isPaused, uint256 wantedPrice, uint256 slippageP, uint192 a_price, tuple trade, uint256 priceImpactP, IOstiumPairInfos pairInfos, IOstiumPairsStorage pairsStorage, IOstiumTradingStorage tradingStorage) view returns (IOstiumTradingCallbacks.CancelReason)
getTradePriceImpact
purefunction getTradePriceImpact(int192 price, int192 ask, int192 bid, bool isOpen, bool isLong) pure returns (uint256 priceImpactP, uint256 priceAfterImpact)
withinExposureLimits
viewfunction withinExposureLimits(uint16 pairIndex, bool buy, uint256 collateral, uint32 leverage, uint256 price, IOstiumPairsStorage pairsStorage, IOstiumTradingStorage tradingStorage) view returns (bool)
withinMaxLeverage
viewfunction withinMaxLeverage(uint16 pairIndex, uint256 leverage, IOstiumPairsStorage pairsStorage) view returns (bool)
events
No events.
errors
SafeCastOverflowedUintDowncast
error SafeCastOverflowedUintDowncast(uint8 bits, uint256 value)
SafeCastOverflowedUintToInt
error SafeCastOverflowedUintToInt(uint256 value)
creation bytecode
0x6080806040523461001a576114b49081610020823930815050f35b600080fdfe6040608081526004908136101561001557600080fd5b600060e0928135841c8063020b1393146106dc57806315080578146105885780634aaf6a5a1461054d5780634d200c05146104e057806356718c46146104c55780636f641d8f14610464578063750e52c7146103ff578063a02efcd51461030f578063d6abd207146102e3578063ddb6b9a6146101d45763f13646bc1461009b57600080fd5b6102203660031901126101cc57359283151584036101cc576100bb6107b2565b936101203660831901126101d0578351926100d584610747565b60843584526001600160c01b0360a43581811681036101d057602086015260c43581811681036101d0578686015260e43590811681036101cc5760608501526001600160a01b03926101043584811681036101d05760808601526101243563ffffffff811681036101d05760a08601526101443561ffff811681036101d05760c0860152610164359060ff821682036101d0578501526101843580151581036101cc576101008501526101c43592831683036101c95750916101c594916101ba9361019e6107ec565b926101a7610803565b946101a4359260443590602435906111de565b90519182918261081a565b0390f35b80fd5b5080fd5b8280fd5b509092906101a03660031901126102df573560068110156102df576101203660231901126102df5782519161020883610747565b60243583526001600160c01b0360443581811681036102db57602085015260643581811681036102db578585015260843590811681036102d757606084015260a4356001600160a01b03811681036102d757608084015260c43563ffffffff811681036102d75760a084015260e43561ffff811681036102d75760c0840152610104359060ff821682036102d7578301526101243580151581036102d357610100830152610184359384151585036101c95750926101ba916101c594610164359161014435916110ed565b8480fd5b8580fd5b8680fd5b8380fd5b6020846102fe6102f236610843565b94939093929192611031565b90516001600160c01b039091168152f35b5090366003190161018081126101cc57610120136101c95782519161033383610747565b3582526001600160c01b0360243581811681036101d057602084015260443581811681036101d0578484015260643590811681036101cc5760608301526084356001600160a01b03811681036101cc57608083015263ffffffff9360a43585811681036101d05760a084015260c43561ffff811681036101d05760c084015260e4359060ff821682036101d0578301526101043580151581036101cc576101008301526101243593841684036101c957506101c5926101ba916103f4610723565b916101443591610ffb565b50829060a03660031901126101d05735916001600160c01b039081841684036101c95761042a61079c565b906044359063ffffffff821682036101c957509361045c9160209561044d6107c8565b91610456610738565b93610f35565b915191168152f35b50829060a03660031901126101d057358060170b81036101d0576024358060170b81036102df576044358060170b81036102d3576064359182151583036102d7576104b99495506104b3610738565b93610e44565b82519182526020820152f35b6020846102fe6104d436610843565b94939093929192610dc4565b5050916003193601126101cc576104f56107db565b60243580151581036102df576105096107c8565b6001600160a01b039460a435939086851685036101c95760c43596871687036101c95750916105449391602096936084359260443591610b46565b90519015158152f35b828460603660031901126101cc576105636107db565b604435926001600160a01b03841684036101c957506020926105449160243590610aab565b5036600319019061024082126101d0576101808092126101d057835191820182811067ffffffffffffffff8211176106c95784523581526105c761079c565b60208201526044356001600160c01b03811681036101d057838201526105eb6107b2565b60608201526001600160a01b039360843585811681036102df57608083015263ffffffff9060a43582811681036102d35760a084015260c43582811681036102d35760c084015260e43591821682036102df578201526101043561ffff811681036101d0576101008201526101243560038110156101d0576101208201526101443560ff811681036101d057610140820152610685610723565b6101608201526106936107ec565b9061069c610803565b926102243595861686036101c95750916101c594916101ba936101c435906101a435906101843590610911565b634e487b7160e01b845260418252602484fd5b50829060a03660031901126101d05760443580151581036102df57606435908160030b82036102d357608435928360030b84036102d7576104b99495506024359035611367565b6101643590811515820361073357565b600080fd5b60843590811515820361073357565b610120810190811067ffffffffffffffff82111761076457604052565b634e487b7160e01b600052604160045260246000fd5b90601f8019910116810190811067ffffffffffffffff82111761076457604052565b602435906001600160c01b038216820361073357565b606435906001600160c01b038216820361073357565b6064359063ffffffff8216820361073357565b6004359061ffff8216820361073357565b6101e435906001600160a01b038216820361073357565b61020435906001600160a01b038216820361073357565b91906020830192600f82101561082d5752565b634e487b7160e01b600052602160045260246000fd5b60c0906003190112610733576001600160c01b0390600435828116810361073357916024359081168103610733579063ffffffff9060443582811681036107335791606435908116810361073357906084358015158103610733579060a43560ff811681036107335790565b818102929181159184041417156108c257565b634e487b7160e01b600052601160045260246000fd5b81156108e2570490565b634e487b7160e01b600052601260045260246000fd5b90816020910312610733575160ff811681036107335790565b939095919295610120850151600381101561082d57600103610a6d5761016085015115610a595760208501516001600160c01b0316105b610a4e5761010084019561098761ffff9387858a511661016089015115159760a08a519a019963ffffffff998a8c51169260018060c01b031693610b46565b15610a42576020670de0b6b3a764000060646109a9600494888a5116906108af565b0404926040519283809263407b67e160e11b825260018060a01b03165afa8015610a365760ff91600091610a07575b5016106109fd576109ee94511691511690610aab565b156109f857600090565b600890565b5050505050600790565b610a29915060203d602011610a2f575b610a21818361077a565b8101906108f8565b386109d8565b503d610a17565b6040513d6000823e3d90fd5b50505050505050600690565b505050505050600b90565b60208501516001600160c01b031611610948565b5061016084015115610a925760208401516001600160c01b0390811690841610610948565b60208401516001600160c01b0390811690841611610948565b604051630bdf25df60e01b815261ffff9190911660048201529091602090829060249082906001600160a01b03165afa908115610a3657600091610af6575b5063ffffffff16101590565b6020813d602011610b31575b81610b0f6020938361077a565b810103126101cc57519063ffffffff821682036101c9575063ffffffff610aea565b3d9150610b02565b919082018092116108c257565b9495939493909291906001600160a01b039081168415610d91576000955b60409788519560ff61ffff637a52327360e01b94858a5216998a60048a01521660248801526020968781604481885afa908115610d865790889291600091610d53575b50610bd963ffffffff64e8d4a51000670de0b6b3a7640000610bcf610be097986064966108af565b04049316896108af565b0490610b39565b9160448a518095819382528b6004830152600260248301525afa918215610d4857600092610d19575b5011159687610c1d575b5050505050505090565b9091929394959650169285519063daf84c9f60e01b8252856004830152151560248201528281604481875afa908115610d0e5790839291600091610cdb575b5090610c6791610b39565b93602486518095819363e958d48960e01b835260048301525afa938415610cd15750600093610ca1575b5050111538808080808080610c13565b9080929350813d8311610cca575b610cb9818361077a565b810103126107335751903880610c91565b503d610caf565b513d6000823e3d90fd5b8381939492503d8311610d07575b610cf3818361077a565b810103126107335751829190610c67610c5c565b503d610ce9565b86513d6000823e3d90fd5b9091508481813d8311610d41575b610d31818361077a565b8101031261073357519038610c09565b503d610d27565b88513d6000823e3d90fd5b83819492503d8311610d7f575b610d6a818361077a565b81010312610733579051879190610bd9610ba7565b503d610d60565b8b513d6000823e3d90fd5b600195610b64565b620f42409060030b02908160030b9182036108c257565b60030b600003908160030b9182036108c257565b909493610e0592916001600160c01b039190610de1908316611411565b91871694610dee86611411565b9063ffffffff80911660030b941660030b92611367565b509015159182610e1f575b5050610e195790565b50600090565b610e3991925060ff610e34911660000b610d99565b610db0565b60030b133880610e10565b9291909493946000916000938560170b978815610f1c57151590151514600014610f145750945b601786900b90036001600160bf1b031981126001600160bf1b03821317610f0057610e989060170b61143a565b670de0b6b3a764000090818102918183041490151715610f00576001600160c01b0393610ec891908516906108d8565b91606483029280840460641490151715610eec575090610ee791610b39565b921690565b634e487b7160e01b81526011600452602490fd5b634e487b7160e01b83526011600452602483fd5b905094610e6b565b50505050509250508190565b919082039182116108c257565b9093926001600160c01b0391821692909190610f7b90610f5485611411565b9287169286610f6285611411565b9263ffffffff809116961660030b928660030b92611367565b809215918215610ff1575b5050610f93575050505090565b610fb692939450610fb0610faa620f42409261143a565b856108af565b046108d8565b9115610fd157610fce91610fc991610b39565b61144b565b90565b808211610fe557610fce91610fc991610f28565b5050610fce600061144b565b1490508138610f86565b9091156110295760a0015163ffffffff9081169116106110235761101e57600090565b600c90565b50600890565b505050600a90565b909492936001600160c01b0391821693909261107761104f86611411565b91848916928661105e85611411565b9263ffffffff8091169a1660030b928a60030b92611367565b5090151590816110cf575b5061108f57505050505090565b60ff919293949550169381858502169484860414841517156108c25780156108e257610fce94041690156110c657610fc991610f28565b610fc991610b39565b90506110e3610e3460ff841660000b610d99565b60030b1338611082565b919091600681101561082d5760048103611116575050505060001461111157600090565b600e90565b9293509091600281036111345750505061112f57600090565b600b90565b9192509080611188575060408201516001600160c01b03168015159290919083611168575b50505060001461112f57600090565b610100015191925090156111815710155b388080611159565b1115611179565b600114611196575050600b90565b60608201516001600160c01b031680151592909190836111bf5750505060001461112f57600090565b610100015191925090156111d7571115388080611159565b1015611179565b949160646111f281929895939698876108af565b040494611326576001600160c01b039081169384156113185761010087018051909690156113015761122b908360208a01511692610b39565b105b6112f4578060408701511680151590816112cc575b506112bf57806060870151168015159182611297575b505061128b5761098760c08601978761ffff95868b5116975115159760a08a519a019963ffffffff998a8c511692610b46565b50505050505050600590565b865191925090156112b25760208701511611155b3880611258565b60208701511610156112ab565b5050505050505050600490565b8651909150156112e6578160208801511610155b38611242565b8160208801511611156112e0565b5050505050505050600390565b611312908360208a01511692610f28565b1161122d565b505050505050505050600290565b5050505050505050600190565b81156108e257600160ff1b81146000198314166108c2570590565b818103929160001380158285131691841216176108c257565b9193928060030b936335a4e90085810290810586036108c257849261139e928060030b881360001461140a57505b60030b90611333565b94156113fb576113ad9161134e565b620f4240808202918083058214811517156108c2578402029260008212600160ff1b8214166108c25781840514901517156108c2576113eb91611333565b818113156113f857508091565b91565b906114059161134e565b6113ad565b9050611395565b6001600160ff1b0381116114225790565b6024906040519063123baf0360e11b82526004820152fd5b600081126114455790565b60000390565b6001600160c01b039081811161145f571690565b604490604051906306dfcc6560e41b825260c060048301526024820152fdfea2646970667358221220e30185e5ac4f02869e5628ced23aa6aa3a19f631bd44885e2a792f3c859a6b4464736f6c63430008180033