Skip to main content

SimpleRouter

SimpleRouter​

Maker contracts using this router must make sure that the reserve approves the router for all asset that will be pulled (outbound tokens) Thus a maker contract using a vault that is not an EOA must make sure this vault has approval capacities.

pull​

function __pull__(contract IERC20 token, address owner, uint256 amount, bool strict) internal virtual returns (uint256 pulled)

transfers an amount of tokens from the reserve to the maker.

requires approval from owner for this to transfer token.

Parameters​

NameTypeDescription
tokencontract IERC20Token to be transferred
owneraddressThe account from which the tokens will be transferred.
amountuint256The amount of tokens to be transferred
strictboolwether the caller maker contract wishes to pull at most amount tokens of owner.

Return Values​

NameTypeDescription
pulleduint256The amount pulled if successful (will be equal to amount); otherwise, 0.

push​

function __push__(contract IERC20 token, address owner, uint256 amount) internal virtual returns (uint256)

transfers an amount of tokens from the maker to the reserve.

Parameters​

NameTypeDescription
tokencontract IERC20Token to be transferred
owneraddress
amountuint256The amount of tokens to be transferred

Return Values​

NameTypeDescription
[0]uint256

balanceOfReserve​

function balanceOfReserve(contract IERC20 token, address owner) public view returns (uint256)

Balance of a reserve

Parameters​

NameTypeDescription
tokencontract IERC20the asset one wishes to know the balance of
owneraddress

Return Values​

NameTypeDescription
[0]uint256the balance of the reserve

checkList​

function __checkList__(contract IERC20 token, address owner) internal view virtual

router-dependent implementation of the checkList function verifies all required approval involving this router (either as a spender or owner)

checkList returns normally if all needed approval are strictly positive. It reverts otherwise with a reason.

Parameters​

NameTypeDescription
tokencontract IERC20is the asset whose approval must be checked
owneraddressthe account that requires asset pulling/pushing