This project creates streamable SushiSwap LP tokens. These tokens can be used in Ricochet Exchange's DCA system and they support earning SUSHI and MATIC subsidies.
- SLPx tokens are wrapped SushiSwap LP tokens
- Upgrade: SLP tokens are deposited into the
MiniChef
contract to earn SUSHI and MATIC - Harvest: SLPx tokens have a
harvest
function that harvests the SUSHI/MATIC subsidies fromMiniChef
and wraps them as SUSHIx/MATICx - Downgrade: SLPx tokens are burned, SLP tokens are returned to the user, and any accumulated SUSHIx/MATICx is distributed using Superfluid's
InstantDistributionAgreement
- SLPx inherits from Superfluid's
SuperToken
- SLPx overrides the functionality of
upgrade
anddowngrade
methods onSuperToken
address lpTokenAddress
- The address of the LP token to useaddress maticxAddress
- The address of theMATICx
contractaddress sushixAddress
- The address of theSUSHIx
contractaddress miniChefAddress
- The address of theMiniChef
contractuint256 pid
- The pool ID to use forMiniChef
deposit and harvest function calls
upgrade(uint256 amount)
- Parameters
amount
- the amount of SLP tokens to upgrade
- Pre-conditions
msg.sender
has approvedSLPx
contract to spend their SLPSLPx
contract has approvedMiniChef
to transfer SLP tokens
- Post-conditions
- SLP tokens are transferred to
SLPx
contract - Transferred SLP tokens are deposited into
MiniChef
SLPx
tokens are minted tomsg.sender
- SLP tokens are transferred to
- âšī¸ Also need to override
upgradeTo
method
downgrade(uint256 amount)
- Parameters
amount
- the amount of SLP tokens to downgrade
- Pre-conditions
SLPx
contract has approvedMiniChef
to transfer SLP tokens
- Post-conditions
- Call
harvest
method (not shown in arch. diagram) - SLPx tokens are burned
- SLP tokens are transfered to
msg.sender
- SUSHIx is distributed using an IDA to the
SLPx
holders - MATICx is distributed using an IDA to the
SLPx
holders
- Call
harvest()
- Parameters
- None
- Pre-conditions
- None
- Post-conditions
- Calls
harvest
onMinichef
- Upgrade MATIC and SUSHI received from
MiniChef
- Calls
end