IFluidLiquidityLogic
Inherits:IFluidLiquidityAdmin
Functions
operate
Single function which handles supply, withdraw, borrow & payback
*to trigger skipping in / out transfers when in&out amounts balance themselves out (gas optimization):
- supply(+) == borrow(+), withdraw(-) == payback(-).
withdrawTo_
/borrowTo_
must be msg.sender (protocol)callbackData_
MUST be encoded so that "from" address is at last 20 bytes (if this optimization is desired), also for native token operations where liquidityCallback is not triggered! from address must come at last position if there is more data. I.e. encode like: abi.encode(otherVar1, otherVar2, FROM_ADDRESS). Note dynamic types used with abi.encode come at the end so if dynamic types are needed, you must use abi.encodePacked to ensure the from address is at the end.*
function operate(
address token_,
int256 supplyAmount_,
int256 borrowAmount_,
address withdrawTo_,
address borrowTo_,
bytes calldata callbackData_
) external payable returns (uint256 memVar3_, uint256 memVar4_);
Parameters
Name | Type | Description |
---|---|---|
token_ | address | address of token (0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE for native) |
supplyAmount_ | int256 | if +ve then supply, if -ve then withdraw, if 0 then nothing |
borrowAmount_ | int256 | if +ve then borrow, if -ve then payback, if 0 then nothing |
withdrawTo_ | address | if withdrawal then to which address |
borrowTo_ | address | if borrow then to which address |
callbackData_ | bytes | callback data passed to liquidityCallback method of protocol |
Returns
Name | Type | Description |
---|---|---|
memVar3_ | uint256 | updated supplyExchangePrice |
memVar4_ | uint256 | updated borrowExchangePrice |