LiquidityGaugeV4.sol
LiquidityGaugeV4
allows to stake an ERC20 token to receive as a reward another ERC20 token. The contract used at Angle was forked from Curve, with some modifications from the Angle Core Team.LiquidityGaugeV4
contracts are connected to the AngleDistributor
which automatically and every week distributes ANGLE rewards to these contracts based on how veANGLE holders voted in gauges. People staking in liquidity gauges can then directly claim their ANGLE tokens (and potentially other reward tokens in the contract).ERC20
. This contract is upgradeable (note that this is one of the main differences with respect to Curve's contract).LiquidityGaugeV4
contract, Angle contract is upgradeable.__init__
function (the constructor), putting it in the initialize
function and having a boolean initialized
variable set to true once initialize
is called. To avoid hostile takeovers of the implementation, the same initialized
boolean is modified in the __init__
function.total_supply
of staked tokens, and the user_balance
which corresponds to the amount of tokens staked.total_supply
is equal to the working_supply
of the contract, that is the supply modified by considering that people staking veANGLE tokens are staking more tokens.LiquidityGaugeV4
contract that queries directly the GaugeController
to know the relative weight. This is no longer needed with Angle, as the AngleDistributor
can use this deposit_reward_token
function to send each week the ANGLE rewards voted in the GaugeController
._checkpoint
function from Curve contract which called the GaugeController
was therefore removed as the logic of it is now included in the new version of the _checkpoint_rewards
and in the new architecture routing ANGLE tokens to gauges.