PSMRouter
the PSM router is an ungoverned, non custodial contract that allows user to seamlessly wrap and unwrap their WETH for trading against the PegStabilityModule.
Functions
constructor
Parameters
Name | Type | Description |
---|---|---|
| contract IPegStabilityModule | |
| contract IChi |
getMintAmountOut
view only pass through function to get amount of CHI out with given amount of ETH in
Parameters
Name | Type | Description |
---|---|---|
| uint256 |
getRedeemAmountOut
view only pass through function to get amount of ETH out with given amount of CHI in
Parameters
Name | Type | Description |
---|---|---|
| uint256 |
getMaxMintAmountOut
the maximum mint amount out
getMaxRedeemAmountOut
the maximum redeem amount out
mint
Mints chi to the given address, with a minimum amount required
This wraps ETH and then calls into the PSM to mint the chi. We return the amount of chi minted.
Parameters
Name | Type | Description |
---|---|---|
| address | The address to mint chi to |
| uint256 | The minimum amount of chi to mint |
| uint256 |
mint
Mints chi to the given address, with a minimum amount required and a deadline
This wraps ETH and then calls into the PSM to mint the chi. We return the amount of chi minted.
Parameters
Name | Type | Description |
---|---|---|
| address | The address to mint chi to |
| uint256 | The minimum amount of chi to mint |
| uint256 | The deadline for this order to be filled |
| uint256 |
redeem
Redeems chi for ETH First pull user CHI into this contract Then call redeem on the PSM to turn the CHI into weth Withdraw all weth to eth in the router Send the eth to the specified recipient
Parameters
Name | Type | Description |
---|---|---|
| address | the address to receive the eth |
| uint256 | the amount of CHI to redeem |
| uint256 | the minimum amount of weth to receive |
redeem
Redeems chi for ETH First pull user CHI into this contract Then call redeem on the PSM to turn the CHI into weth Withdraw all weth to eth in the router Send the eth to the specified recipient
Parameters
Name | Type | Description |
---|---|---|
| address | the address to receive the eth |
| uint256 | the amount of CHI to redeem |
| uint256 | the minimum amount of weth to receive |
| uint256 | The deadline for this order to be filled |
fallback
function to receive ether from the weth contract when the redeem function is called will not accept eth unless there is an active redemption.
_mint
helper function to wrap eth and handle mint call to PSM
Parameters
Name | Type | Description |
---|---|---|
| address | |
| uint256 | |
| uint256 |
_redeem
helper function to deposit user CHI, unwrap weth and send eth to the user the PSM router receives the weth, then sends it to the specified recipient.
Parameters
Name | Type | Description |
---|---|---|
| address | |
| uint256 | |
| uint256 |
Last updated