IOfferLogic
It is an IMaker for Mangrove.
LogIncident
Log incident (during post trade execution) By emitting this data, an indexer can keep track of what incidents has happened.
Parameters
olKeyHash
bytes32
the hash of the offer list key. This is indexed so that RPC calls can filter on it.
offerId
uint256
the Mangrove offer id. This is indexed so that RPC calls can filter on it.
makerData
bytes32
from the maker.
mgvData
bytes32
from Mangrove.
SetRouter
Logging change of router address By emitting this an indexer can keep track of what router is used.
Parameters
router
contract AbstractRouter
the new router address.
setRouter
sets a new router to pull outbound tokens from contract's reserve to this
and push inbound tokens to reserve.
new router needs to be approved by this
to push funds to reserve (see activate
function). It also needs to be approved by reserve to pull from it.
Parameters
router_
contract AbstractRouter
the new router contract that this contract should use. Use NO_ROUTER
for no router.
approve
Approves a spender to transfer a certain amount of tokens on behalf of this
.
admin may use this function to revoke specific approvals of this
that are set after a call to activate
.
Parameters
token
contract IERC20
the ERC20 token contract
spender
address
the approved spender
amount
uint256
the spending amount
Return Values
[0]
bool
result of token approval.
provisionOf
computes the amount of native tokens that can be redeemed when deprovisioning a given offer.
Parameters
olKey
struct OLKey
the offer list key.
offerId
uint256
the identifier of the offer in the offer list
Return Values
provision
uint256
the amount of native tokens that can be redeemed when deprovisioning the offer
checkList
verifies that this contract's current state is ready to be used to post offers on Mangrove
throws with a reason if something (e.g. an approval) is missing.
Parameters
tokens
contract IERC20[]
the list of tokens that are traded by this contract
activate
performs the required approvals so as to allow this
to interact with Mangrove on a set of assets.
Parameters
tokens
contract IERC20[]
the ERC20 this
will approve to be able to trade on Mangrove's corresponding markets.
withdrawFromMangrove
withdraws native tokens from this
balance on Mangrove.
Since a call is made to the receiver
, this function is subject to reentrancy.
Parameters
amount
uint256
the amount of WEI one wishes to withdraw.
receiver
address payable
the address of the receiver of the funds.
OfferArgs
Memory allocation for _new/updateOffer
's arguments.
owner
is required in Forwarder
logics, when _newOffer
or _updateOffer
in called in a hook (msg.sender==MGV
).
Parameters
router
Contract's router getter.
if contract has a no router, function returns NO_ROUTER
.
Return Values
[0]
contract AbstractRouter
the router.
MGV
Contract's Mangrove getter
Return Values
[0]
contract IMangrove
the Mangrove contract.