Function: create(TokenType tokenType, uint256 depositAmount, uint256 minAmount, uint256 deadline, address onBehalfOf)
This function is used to create bond or leverage tokens by depositing reserve tokens. The function calculates the amount of new tokens to create based on the current pool state and oracle price. The function also allows for additional parameters for the deadline and onBehalfOf
for router support.
Inputs
tokenType
Control: Arbitrary.
Constraints: Bond or leverage token.
Impact: Type of token to create.
depositAmount
Control: Arbitrary.
Constraints: None.
Impact: The amount of reserve tokens to deposit.
minAmount
Control: Arbitrary.
Constraints: None.
Impact: The minimum amount of output tokens to receive.
deadline
Control: Arbitrary.
Constraints: Bigger than the current block timestamp.
Impact: The deadline timestamp.
onBehalfOf
Control: Arbitrary.
Constraints: None.
Impact: Address to receive the new tokens.
Branches and code coverage
Intended branches
Invoke the
_create
function.
Negative behavior
Revert if the contract is paused.
Revert if the function is reentrant.
Revert if the deadline has passed.