PoolManager. These contracts are in charge of the investment of part of the reserves owned by a
PoolManager, they only control one type of ERC20 for a single stablecoin as each
PoolManageris dedicated to a stablecoin/collateral pair.
Strategiescan be considered as workers for the corresponding
PoolManager. They have a governance defined allowance from the manager (specified by their
debtRatio), and they are entitled to invest as dictated by the initial strategy agreement.
Strategy. In the first place, Angle Core Team wishes to push for lower risk farming opportunities to limit the composability risk.
Strategyin the code is the first example of strategy implementation.
poolManager: Reference to the
want: Reference to the ERC20 farmed
rewards: Reference to the ERC20 distributed as a reward by the strategy. This ERC20 cannot be equal to
minReportDelay: The minimum number of seconds between harvest calls
maxReportDelay: The maximum number of seconds between harvest calls
minimumAmountMoved: The minimum amount moved for a call to
havestto be "justifiable"
debtThreshold: Used this to adjust the threshold at which running a debt causes a harvest trigger
emergencyExit: In case of emergency, this parameter states that the protocol should withdraw all ERC20 when asked to
rewardAmount: Amount of the reward obtained by calling harvest. A positive
rewardAmountmeans that reward distribution is activated
POOLMANAGER_ROLE: some functions can only be called by accepted
GUARDIAN_ROLE: In this contract, there is no need for a
GOVERNOR_ROLE, all the governor addresses, as well as the
PoolManagercontract associated have this
harvest()is called, the Strategy reports to the Manager (via
manager.report()), so in some cases
harvest()must be called in order to take in profits, to borrow newly available funds from the
PoolManager, or otherwise adjust its position. In other cases
harvest()must be called to report to the
PoolManageron the Strategy's position, especially if any losses have occurred.
_amtInWei(denominated in wei) to
want(using the native decimal characteristics of
want). Care must be taken when working with decimals to assure that the conversion is compatible. As an example: given 1e17 wei (0.1 ETH) as input, and want is USDC (6 decimals), with 1 ETH worth 1800 USDC, this should give back 1800000000 (180 USDC).
_amtInWei: The amount (in wei/1e-18 ETH) to convert to
wanttokens. This total should be "realizable" e.g. the total value that could actually be obtained from this Strategy if it were to divest its entire position based on current on-chain conditions. Care must be taken in using this function, since it relies on external systems, which could be manipulated by the attacker to give an inflated (or reduced) value produced by this function, based on current on-chain conditions (e.g. this function is possible to influence through flashloan attacks, oracle manipulations, or other DeFi attack mechanisms).
harvest()activity, so that Harvest events can be tracked externally by indexing agents.
harvest()should be called. The keeper will provide the estimated gas cost that they would pay to call
harvest(), and this function should use that estimate to make a determination if calling it is "worth it" for the keeper. This is not the only consideration into issuing this trigger, for example if the position would be negatively affected if
harvest()is not called shortly, then this can return
trueeven if the keeper might be "at a loss"
callCostInWeimust be priced in terms of
debtThresholdto adjust thestrategist-controlled parameters that will influence whether this call returns
trueor not. These parameters will be used in conjunction with the parameters reported to the Manager (see
params) to determine if calling
callCostInWei: The keeper's estimated gas cost to call
harvest()should be called,
manager. If the strategy couldn't withdraw
_amountNeeded, then amountFreed (which is inferior to
_amountNeeded) is withdrawn.
_amountNeeded: How much
_loss: Any realized losses
amountFreed: Amount of
PoolManageralso has functions it can call in the
Strategyto propagate changes from the
PoolManagerto all the
Lendersit interacts with.
_newPositions: List of shares to specify the new allocation
governance(). This will fail if an attempt is made to sweep
want, or any tokens that are protected by this Strategy. This may only be called by governance.
_token: The token to transfer out of this manager.
to: Address to send the tokens to.
lender: The address of the adapter to the lending platform to remove
setRewards: Used to change the address to use for pulling rewards
setRewardAmountAndMinimumAmountMoved: Used to change the reward amount given to keepers calling
harvestand the minimum amount moved for this reward to be justifiable.
setOracle: Changes the oracle contract used in the
setMinReportDelay: Used to change
minReportDelayis the minimum number of blocks that should pass for
harvest()to be called.
setMaxReportDelay: Used to change
maxReportDelayis the maximum number of blocks that should pass for
harvest()to be called. For external keepers (such as the Keep3r network), this is the maximum time between jobs to wait.
setDebtThreshold: Sets how far the Strategy can go into loss without a harvest and report being required. By default this is 0, meaning any losses would cause a harvest which will subsequently report the loss to the