MockProtocol
Mock protocol for testing, implements: function liquidityCallback(address token*, uint256 amount*, bytes calldata data*) external; This callback method MUST transferFrom data* decoded from address to the liquidity contract
NATIVE_TOKEN_ADDRESS
address NATIVE_TOKEN_ADDRESS
address that is mapped to the chain native token
liquidityContract
address liquidityContract
MockProtocol__UnexpectedLiquidityCallback
error MockProtocol__UnexpectedLiquidityCallback()
thrown when liquidity callback is called for a native token operation
transferInsufficientMode
bool transferInsufficientMode
transferExcessMode
bool transferExcessMode
reentrancyFromCallback
bool reentrancyFromCallback
transferFromAddress
address transferFromAddress
constructor
constructor(address liquidityContract_) public
Construct a new MockProtocol
Parameters
Name | Type | Description |
---|---|---|
liquidityContract_ | address | The address of the liquidity contract |
receive
receive() external payable
setTransferInsufficientMode
function setTransferInsufficientMode(bool transferInsufficientMode_) public
setTransferExcessMode
function setTransferExcessMode(bool transferExcessMode_) public
setReentrancyFromCallback
function setReentrancyFromCallback(bool reentrancyFromCallback_) public
setTransferFromAddress
function setTransferFromAddress(address transferFromAddress_) public
liquidityCallback
function liquidityCallback(address token_, uint256 amount_, bytes data_) external
Mock liquidity callback
Parameters
Name | Type | Description |
---|---|---|
token_ | address | The token being transferred |
amount_ | uint256 | The amount being transferred |
data_ | bytes |
operate
function operate(address token_, int256 supplyAmount_, int256 borrowAmount_, address withdrawTo_, address borrowTo_, bytes callbackData_) external payable returns (uint256 supplyExchangePrice_, uint256 borrowExchangePrice_)
Proxy method for executing operate
on the liquidity contract