Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: automated rKP3R reward distribution #3

Closed
wants to merge 7 commits into from

Conversation

wei3erHase
Copy link

@wei3erHase wei3erHase commented May 18, 2022

Fixed Forex Reward Distribution Job

GaugeProxy contract extracted from https://etherscan.io/address/0x81a8CAb6bb568fC94bCa70C9AdbFCF05592dEd7b

GaugeProxyV2 Changelog

  • Updated min solidity compiler to 0.8.12
  • Created corresponding interfaces
  • Added natspec to IGaugeProxy
  • Added variable and setter for a keeper
  • Changed access control on distribute() from gov to keeper
  • Addded forceDistribute() allowed for gov
  • Added gov parameter in constructor
  • Executes infinite KP3R approval to rKP3R contract on constructor
  constructor(address _gov) {
    gov = _gov;
    _safeApprove(_kp3rV1, _rkp3r, type(uint256).max);
  }
  • Automates KP3R and rKP3R handling into the distribution function
function _distribute() internal {
    uint256 _balance = IKeep3rV1Proxy(_kp3rV1Proxy).draw();
    IrKP3R(_rkp3r).deposit(_balance);
    ...

Registry

Keep3r Governance: 0x0d5dc686d0a2abbfdafdfb4d0533e886517d4e83
GaugeProxyV2: 0xEdA0b82211Bb7e6E7F0415713580ce91A3C41767
RewardDistributionJob: TDB

Gauge Proxy Deployment

  • Defi Wonderland deploys GaugeProxyV2 (with 0x0d5dc686d0a2abbfdafdfb4d0533e886517d4e83 as gov)

Initialization

  • Keep3r Governance adds a reward on Keep3rV1Proxy for the GaugeProxyV2 address Keep3rV1Proxy.addRecipient( GaugeProxyV2.address, WEEKLY_AMOUNT_OF_KP3R )
  • Keep3r Governance registers existing gauges into the contract GaugeProxyV2.addGauge( _pool, _gauge )
  • Keep3r Governance sets contract address as reward_distributor in Curve for the corresponding gauges
  • Keep3r Governance executes first reward distribution using forceDistribute(), initializing the draw mechanism on Keep3rV1Proxy, next distribution will be possible a week after execution timestamp

Upkeep

  • Defi Wonderland deploys RewardDistributionJob (with 0x0d5dc686d0a2abbfdafdfb4d0533e886517d4e83 as gov)
  • Defi Wonderland publishes CLI for job upkeeping
  • Keep3r Governance registers job Keep3rV2.addJob(RewardDistributionJob)
  • Keep3r Governance force liquidity credits on the job / funds the job with kLPs
  • Keep3r Governance registers RewardDistributionJob as keeper address GaugeProxyV2.setKeeper(RewardDistributionJob)

* chore: added hardhat boilerplate

* chore: run linter

* fix: rm legacy code

* feat: added vyper compiler

* feat: added github workflows

* chore: revert linter

* fix: solhint ignore
* chore: added hardhat boilerplate

* chore: run linter

* fix: rm legacy code

* feat: added vyper compiler

* feat: added github workflows

* fix: linter error

* feat: adding basic test structure

* fix: typings bug

* feat: added tests scaffolding

* fix: revert linter

* fix: run prettier
* feat: added reward distribution e2e test

* chore: retrieved latest GaugeProxy version from etherscan

* fix: e2e test importing current contracts

* chore: gaugeProxyV2

* chore: revert unnecessary changes

* fix: run linter
* refactor: separated interfaces

* feat: added draw functionality

* feat: added keeper functionality

* style: renaming
* feat: added keep3r job scaffolding

* feat: added interface to gaugeProxy

* fix: natpsec bug

* test: added job to e2e

* test: added utils unit tests

* fix: run linter

* feat: added job unit test

* feat: added coverage

* feat: fixes and comments in PR

* fix: linter

* fix: rm overrides in job
* feat: added unit test to GaugeProxy distribution

* feat: added deployment script

* feat: added delegate script

* fix: linter

* fix: missing await

* fix: weird bug

* feat: added natspec

* fix: added eth-sdk to postinstall

* chore: returned contracts to original location

* fix: ignoring eth-sdk abis

* feat: added governance in constructor

* fix: linter

* feat: added inheritdoc for natpsec

* fix: remove delgate deployment script

* feat: improved tests

* fix: linter

* fix: typo

* feat: improved unit test
@wei3erHase wei3erHase closed this May 18, 2022
gitbook-com bot pushed a commit to SeaSaltyFunk/ff that referenced this pull request Sep 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant