DAI payout (26/06/2022-25/07/2022) - luzzifoss

As per the original worker proposal’s terms (visible here) I’m asking for 9000 DAI in total to be sent to DevX’s wallet (DevX.eth).

Proof of work


On the v1 smart contracts I have:

  • Implemented a lot of tests across all contracts.
  • Indexed certain event parameters to make it easier to read onchain data.
  • Used constant instead of immutable wherever possible to save gas.
  • Removed some pointless use of struct to wrap parameters in order to avoid stack too deep errors that never verified anymore after previous changes to the codebase.
  • Made sure to use upgradeable version of Openzeppelin contracts on proxied templates (with manual initialization in initializer).
  • Made the initial template id 1 instead of 0 in order to simplify logic around non existing templates (as a direct result of this, the exists key in the template struct has been deleted, saving gas in the addition function).
  • Removed the “initialized” flag from the ERC20 template’s storage due to redundancy.
  • Removed duplicated oracle finalization check in oracle finalize function.
  • Used the correct final oracle progress value in cases where the end result is greater than or equal to the higher bound in the ERC20 KPI token template.
  • Cleaned up unused custom errors and imports.
  • Included the KPI token creator in the salt of the CREATE2 opcode in order to avoid frequent address collisions between KPI token instances.
  • Made the enumerable template sets more efficient by having an array of templates enumerated by a mapping (instead of doing the opposite).
  • Made the factory addresses immutable in both oracles and KPI tokens managers (saves gas).
  • Used onlyOwner modifier where possible instead of a manual check.
  • Added an expiration feature to the ERC20 KPI token template in order to avoid funds being stuck in case an oracle becomes (maliciously or not) unresponsive.
  • Changed the factory logic to only have a single call to an initialize function on the KPI token template instead of 3 different ones (to initialize state, oracles and collect fees). All of these features are now handled by the initialize function, leading to a substantial gas consumption reduction.
  • Made sure that oracle creations can only be done by KPI tokens that are currently “under construction” (by implementing a factory call check in the oracles manager).
  • Added a zero address check on template upgrades in both template manager contracts (and related tests).
  • Fixed a scenario in which after an upgrade, a KPI token created with an old template returned the upgraded instance instead of the one actually used when creating the token.
  • Implement graceful handling of oracle finalization in a scenario where and and relationship is used, an oracle reports a failure of a condition, but the other oracles still have to finalize.
  • Added information in README.md and CONTRIBUTING.md.
  • Patched a reentrancy vulnerability in the redeem function of the ERC20 KPI token template.
  • Updated some function implementations to make sure the checks-effects-interactions pattern was followed.
  • Made it possible to send value to both KPI tokens and oracles for additional use cases that require the native currency (as a side effect, a bit of gas was saved).
  • Made the oracles manager upgradeable to make it possible to add automation in a later version.
  • Added Slither config to conduct static analysis of the code.
  • To protect users from malicious/non standard implementation tokens, added a redemption logic through which the user can burn and redeem their KPI tokens in different transactions (also specifying the collateral they want to redeem).
  • Implement a logic that ALWAYS pays out the minimum amount (if specified) to the KPI token holders even if the KPI token expires.
  • Fixed deployment and creation scripts.

Proof here.

On the v1 SDK I have:

  • Updated the various contract ABIs and addresses after the above updates.
  • Added the decoder dependency to correctly decode KPI token specific data fetched from the chain, and use it to expose a decoding function.
  • Added an utility expired getter in the KPI token entity.

Proof here.

I’ve created a new decoder library the role of which is to decode the data returned by KPI token and oracle templates to value displayable in frontends. Proof here.

On the alpha frontend I have:

  • Upgraded the dependencies (React 18 and Webpack 5 in React scripts being notable upgrades).
  • Implemented a new token liquidty widget that tracks a specific token’s liquidity across all pairs of a dex (implementation details were actually added to the core SDK and “only” imported and used in the frontend).
  • Added 3 new featured campaigns (2 of which incentivizing Swapr TVL on Gnosis chain with SWPR and GNO respectively, while the other tracking COW liquidity in Swapr).
  • Implemented code splitting and suspense to provide a snappier experience with loading times.
  • Prepared the alpha 14 release with the above changes.

Proof here.

On the core SDK I have implemented the logic for fetching data points to show in the new token liquidity widget mentioned above (proof here).