Newer Liquidity Gauges allow the addition of permissionless rewards to a gauge by a distributor. When deploying a gauge through the OwnershipProxy, the deployer is automatically designated as the gauge manager. This address can then call add_rewards within the OwnershipProxy contract to add reward tokens and distributors. These can subsequently be deposited into the gauge.
If the gauge wasn't deployed through the OwnershipProxy, a migration is required first before adding permissionless rewards.
On sidechains, permissionless rewards are directly built into the gauges. Whoever deploys the gauge can call add_rewards on the gauge contract itself (no need to migrate or do it via proxy).
NG Gauges
Gauges for NG (stableswap-ng, tricrypto-ng, or twocrypto-ng) pools offer the possibility to add external rewards unlocked from the start, without deploying the gauge from an OwnershipProxy or doing any migration.
Before being able to deposit rewards, both the reward token and the distributor need to be set using the add_rewards function.
If the gauge was deployed through the old GaugeProxy, there needs to be a migration to the new OwnerProxy through the migrate_gauge_manager function.
Warning
add_reward and migrate_gauge_manager function needs to be called from the OwnerProxy, as these function are only callable by the admin or gauge manager. set_reward_distributor can also be either called from the Proxy or straight from the gauge itself.
MAX_REWARDS:constant(uint256)=8admin:public(address)@externaldefadd_reward(_reward_token:address,_distributor:address):""" @notice Set the active reward contract """assertmsg.sender==self.admin# dev: only ownereward_count:uint256=self.reward_countassertreward_count<MAX_REWARDSassertself.reward_data[_reward_token].distributor==ZERO_ADDRESSself.reward_data[_reward_token].distributor=_distributorself.reward_tokens[reward_count]=_reward_tokenself.reward_count=reward_count+1
Function to deposit _amount of _reward_token into the gauge.
Deposited tokens will be streamed over a period of seven days. If additional rewards from the same token are added before the previous ones have fully ran out, the remaining balance will be rolled into the new seven-day stream.
Input
Type
Description
_reward_token
address
Reward Token
_amount
uint256
Amount of Reward Token
Note
This function can only be called by the distributor of the reward token.
reward_tokens:public(address[MAX_REWARDS])@externaldefadd_reward(_reward_token:address,_distributor:address):""" @notice Set the active reward contract """assertmsg.sender==self.admin# dev: only ownerreward_count:uint256=self.reward_countassertreward_count<MAX_REWARDSassertself.reward_data[_reward_token].distributor==ZERO_ADDRESSself.reward_data[_reward_token].distributor=_distributorself.reward_tokens[reward_count]=_reward_tokenself.reward_count=reward_count+1
reward_count:public(uint256)@externaldefadd_reward(_reward_token:address,_distributor:address):""" @notice Set the active reward contract """assertmsg.sender==self.admin# dev: only ownerreward_count:uint256=self.reward_countassertreward_count<MAX_REWARDSassertself.reward_data[_reward_token].distributor==ZERO_ADDRESSself.reward_data[_reward_token].distributor=_distributorself.reward_tokens[reward_count]=_reward_tokenself.reward_count=reward_count+1