Note that BaseUnipoolDistributor is abstract! Implementations should do the following:
Inherit one of the provided LP Token implementations
MUST override the virtual _distributionHook(address, uint256) internal function - to handle token distribution
MUST override the _balanceOf(address) and _totalSupply() internal functions - to connect with token implementation
If there are changes to the earnings logic from base unipool calculation, SHOULD override the _caculateEarned(address) internal function
SHOULD proscribe a stake and withdraw interface - underlying internal _stake(address, amount) and _withdraw(address, amount) functions can be used to forward calls
The balance and total supply methods are left virtual to allow full decoupling from the LP token implementation.
The _distributionHook(address, uint256) is meant to call the TokenDistro. Likewise, _calculateEarned(address) can reference the TokenDistro implementation.
Stake and withdraw methods are not defined because implementations relying on TokenManager expect a different interface. This should allow maximum decoupling.
NOTE: this is all new stuff to prevent merge conflicts. If we are in agreement and push this, we can start dismantling the UnipoolTokenDistributor and GardenTokenDistributor contracts.
Resolves #34
Note that
BaseUnipoolDistributor
is abstract! Implementations should do the following:_distributionHook(address, uint256)
internal function - to handle token distribution_balanceOf(address)
and_totalSupply()
internal functions - to connect with token implementation_caculateEarned(address)
internal functionstake
andwithdraw
interface - underlying internal_stake(address, amount)
and_withdraw(address, amount)
functions can be used to forward callsThe balance and total supply methods are left virtual to allow full decoupling from the LP token implementation.
The
_distributionHook(address, uint256)
is meant to call the TokenDistro. Likewise,_calculateEarned(address)
can reference the TokenDistro implementation.Stake and withdraw methods are not defined because implementations relying on TokenManager expect a different interface. This should allow maximum decoupling.