Skip to content

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 ​

solidity
address NATIVE_TOKEN_ADDRESS

address that is mapped to the chain native token

liquidityContract ​

solidity
address liquidityContract

MockProtocol__UnexpectedLiquidityCallback ​

solidity
error MockProtocol__UnexpectedLiquidityCallback()

thrown when liquidity callback is called for a native token operation

transferInsufficientMode ​

solidity
bool transferInsufficientMode

transferExcessMode ​

solidity
bool transferExcessMode

reentrancyFromCallback ​

solidity
bool reentrancyFromCallback

transferFromAddress ​

solidity
address transferFromAddress

constructor ​

solidity
constructor(address liquidityContract_) public

Construct a new MockProtocol

Parameters ​

NameTypeDescription
liquidityContract_addressThe address of the liquidity contract

receive ​

solidity
receive() external payable

setTransferInsufficientMode ​

solidity
function setTransferInsufficientMode(bool transferInsufficientMode_) public

setTransferExcessMode ​

solidity
function setTransferExcessMode(bool transferExcessMode_) public

setReentrancyFromCallback ​

solidity
function setReentrancyFromCallback(bool reentrancyFromCallback_) public

setTransferFromAddress ​

solidity
function setTransferFromAddress(address transferFromAddress_) public

liquidityCallback ​

solidity
function liquidityCallback(address token_, uint256 amount_, bytes data_) external

Mock liquidity callback

Parameters ​

NameTypeDescription
token_addressThe token being transferred
amount_uint256The amount being transferred
data_bytes

operate ​

solidity
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