ADD: Yield Collector Module
Current
Currently affiliate fees are collected in RUNE and held in a key-value store, then once a cycle swapped to preferred_asset and sent out. eg: https://thornode.ninerealms.com/thorchain/thorname/ti
Desired
We want to create single yield-streaming module for:
- yield streaming services (scoop up WBTC yield and stream back to BTC)
- affiliate fees (nominate USDC for all fees)
- TC Active Yield LPs (receive yield as real asset)
Components
- Yield Handler
- Yield Endpoint
- Auto-redeem on some default gas multiplier (100)
- Allow to claim
Implementation
Yield Handler
Yield Handler is with yield+:{bridge-asset}:{l1Address}:{affiliate}:{fee}
memo
Swap to the asset will put it into the yield module, attributed to the L1 address.
Note: the asset is a Bridged Asset, but it is held in a module and attributed to an L1 address, not a THOR address balance, because the user may not have a THOR address
Verify the L1 address is correct for the bridge-asset else could get locked up forever Verify that only bridged-assets are nominated to be swapped to and held
Yield Endpoint
/yield/{address}
https://thornode.ninerealms.com/thorchain/yield/0xb00E81207bcDA63c9E290E0b748252418818c869
{
asset: "ETH-ETH", //bridge asset
balance: "1040077124",
owner: "0xb00E81207bcDA63c9E290E0b748252418818c869",
redemption_outbound_gas_multiplier: "100",
last_withdraw_height: 17111060
}
Auto-redeem
Every block, TC will choose one address, check to see if higher than redemption_outbound_gas_multiplier
and process the withdrawal
Stream Fees
Set a new fee that allows TC to charge more than normal for handling:
autoStreamFeeBasisPoints = 100 //1% fees
Claim
User can do memo yield-:asset:BASIS:?multiplier:affiliate:fee
to claim their yield and set a specific multiplier if they wish
y-:ETH-ETH:10000:0 //claim all of it and set 0 as the multiple
0: never redeem, wait till user collects
1: 1x the gas
100: 100x the gas
Note this will wrap the
bridge-
memo handler to redeem to the user Bridge asset is redeemed to L1 asset
Affiliate Fees
To make work for affiliate fees, simply swap the affiliate fees with the yield+:{preferredAsset}:{preferredAsset.chain.address}
memo, it will place in the yield account for the affiliate and auto-redeem on the default 100x cycle.