Badger-Finance / gitcoin

Repo for gitcoin hack-a-thons,bonunties and code snippets.
7 stars 0 forks source link

Badger onChain GuestList Factory Bounty #47

Open GalloDaSballo opened 2 years ago

GalloDaSballo commented 2 years ago

Context

BadgerDAO uses guestlists for guarded launches. These are simple contracts that ensure deposits cannot go above a certain threshold.

The process of deploying and setting guestLists can be improved by deploying a factory that automatically allows to set all the values in one go.

This can be further improved by adding logic that calculates the want token values for each guestlist and converts it from Dollars to Want, making it easier for the developers to quickly set them up.

Video Version

https://drive.google.com/file/d/1Tpn-d2YQh0oYdWhgYjrutVYc71r90dC-/view?usp=sharing

Requirements

A Smart Contract that:

A brownie project with:

Further Details

Deployment and initial settings

The deployment of guestlist can be done via OZ clones

Code for the guestlist can be found here: https://github.com/Badger-Finance/badger-sett-1.5/blob/main/contracts/test/TestVipCappedGuestListBbtcUpgradeable.sol

Usual setup of gueslist (done manually) https://ftmscan.com/address/0x1dcc9af206137378e0654b5c7d509491e461fffb

These are the steps we want to automate away

You can see our scripts (off-chain) are here: https://github.com/Badger-Finance/badger-vaults-mix-v1.5/blob/main/scripts/2_production_guestlist.py

Pricing and setting of guestlist

Given the Vault the guestList is for, take the Vault Want, and figure out it's market value. If it's an LP token you probably need to follow this guide: https://cmichel.io/pricing-lp-tokens/ If instead it's a base token you will need to price it by getting either a price feed (very hard to scale, remember this has to work for any random token) or get a quote from a supporting smart contract which checks multiple AMMs for the best quote.

To get an approximation (an approx with 10/20% margin of error is completely fine) you can write a supporting smart contract with a function similar to this one: https://github.com/GalloDaSballo/strategy-ftm-solidex-DCA-templatized/blob/af10111d0b5c0acb167ced7999960b6c0fbc138d/contracts/StrategyGenericSolidexDCA.sol#L329

Obviously this would need to be customized by chain, so writing generizeable: getUniV2Quote, getSolidlyQuote, getCurveQuote functions, where we specify the Pool or Registry addresses would be ideal.

Post Bounty Offers

We understand that this is a sizeable bounty, and will pursue the few developers that are able to undertake this challenge and succeed by offering 1-1 tailored bounties with the goal of onboarding them into Core Tech at BadgerDAO (Full time Contributor Positions)

Dev Discord

Feel free to join us on our Dev Discord: https://discord.gg/Tf2PucrXcE

gitcoinbot commented 2 years ago

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


Work has been started.

These users each claimed they can complete the work by 8 hours from now. Please review their action plans below:

1) sunnyrk has started work.

Badger-GuestList-Factory 2) 0xdhan has started work.

Will work on the contracts and the test 3) 0xparashar has started work.

Badger guest list factory 4) jack-the-pug has started work.

Just some simple contracts that ensure deposits cannot go above a certain threshold. 5) twpony has started work.

Badge Guestlist Factory with minimal proxy, including contract deployment, the setting of user and total cap limit. 6) pa6212 has started work.

Badger Guest List Factory 7) christopherdancy has started work.

Welcome to Remi Colin and Christopher Dancy's submission to GR-13 Badger-Factory bounty.

We took the the time to create a factory for the Guestlist contract utilizing the OpenZeppelin clones factory. We also included the ability to initialize the deployed proxy(min)/ clone atomically. After this was completed, we took the time to add the ability to pass in a USD denominated max value and the contracts will convert the USD value to the want_token value. 8) daviddrob has started work.

I will create a smart contract that deploys guest lists.

Learn more on the Gitcoin Issue Details page.

gitcoinbot commented 2 years ago

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


Work for 1912.2479 BADGER (21704.04 USD @ $11.35/BADGER) has been submitted by:

  1. @sunnyrk
  2. @jack-the-pug
  3. @christopherdancy
  4. @0xdhan
  5. @daviddrob

@gallodasballo please take a look at the submitted work: