🏆 ETHAmsterdam 2022 Finalist 👐 Support your favorite projects with yield

Overview

Yieldgate

Yield Gate is a new monetisation tool for anyone to start receiving donations, or to support their favourite public goods projects, creators, and security researchers, with yield. No NFTs or tokens, just good old MATIC! Built with ❤️ on top of Aave, Polygon, and others.

Yieldate


Getting Started

# IMPORTANT: When using Yarn there is a bug that prevents `ts-node` from
#            being installed even though it's in `./packages/hardhat/package.json`.
#            → Solution is to switch back to npm for now.

# Install Dependencies
npm install

# Copy & fill environments
cp packages/frontend/.env.local.example packages/frontend/.env.local && nano packages/frontend/.env.local
cp packages/hardhat/.env.example packages/hardhat/.env && nano packages/hardhat/.env

# Generate types, artifacts & start frontend
npm run dev

# Startup hardhat network and deploy contracts locally
# NOTE: Has to be done in different terminals
npm run chain
npm run deploy

Stack

Based on nextjs-ethereum-starter.

Comments
  • Use hardhat-deploy for contract deployments

    Use hardhat-deploy for contract deployments

    We currently use a self-made script for contract deployment and saving of deployed addresses to files for the frontend. We now found the feature rich hardhat plugin https://github.com/wighawag/hardhat-deploy which does this, including etherscan contract validation. So we should switch to using it.

    enhancement 
    opened by sebastianst 5
  • Pool Parameters (Contracts)

    Pool Parameters (Contracts)

    Currently based on open PR #49 so must not be merged yet.

    • contracts: Emit missing PoolDeployed event
    • contracts: Add minimum stake amount and duration parameters
    opened by sebastianst 4
  • Contracts: Remove implicit deployment of sponsor pools

    Contracts: Remove implicit deployment of sponsor pools

    Currently, the first sponsor to stake for any beneficiary implicitly deploys the sponsor pool. This made sense in the context of the hackathon, but is not good practice. So we make pool deployments explicit. Open question whether to have an explicit deployAndStake function that does both. Might get complicated once we change the public interface so that pool interactions are directly with the pool contracts instead of forwarding functions on the main contract.

    This needs follow-up changes in the frontend. When loading a profile page, it has to be checked whether there's already a pool deployed. It can then show the option "Deploy" and maybe a second option "Deploy & Stake".

    opened by sebastianst 4
  • Fixes #39 (lint-stage/prettier config)

    Fixes #39 (lint-stage/prettier config)

    • chore: add .lintstagedrc.json on package-level
    • chore: add .yaml extension
    • chore: remove eslint-ing from root .lintstagedrc.json
    • chore: renamed format to lint:fix in turbo.json (we forgot that @sebastianst)

    @sebastianst One more thing, that is not related to this particular fix, but that i recognized during my investigations is that solhint currently throws warnings but the pipeline still does not fail. Do we accept that behavior?

    @yieldgate/hardhat:lint: > solhint 'contracts/**/*.sol'
    @yieldgate/hardhat:lint: 
    @yieldgate/hardhat:lint: 
    @yieldgate/hardhat:lint: contracts/YieldGate.sol
    @yieldgate/hardhat:lint:    13:5  warning  Explicitly mark visibility of state                                                                state-visibility
    @yieldgate/hardhat:lint:    21:5  warning  Explicitly mark visibility in function (Set ignoreConstructors to true if using solidity >=0.7.0)  func-visibility
    @yieldgate/hardhat:lint:   105:5  warning  Explicitly mark visibility of state                                                                state-visibility
    @yieldgate/hardhat:lint:   106:5  warning  Explicitly mark visibility of state                                                                state-visibility
    @yieldgate/hardhat:lint: 
    @yieldgate/hardhat:lint: ✖ 4 problems (0 errors, 4 warnings)
    
    opened by wottpal 4
  • Replace wallet connection logic with Rainbow Kit

    Replace wallet connection logic with Rainbow Kit

    I think I replaced all the wallet and chain related components with the Rainbow Kit counterparts. I didn't customize theme and wallet list much because those APIs are flagged as unstable and we still have a while to go to mainnet.

    The stake/unstake controls on the CreatorCard component don't update correctly after staking (even though the staking flow seems to work, but I think this is not related to the Rainbow Kit change. I was able to reproduce on develop. Can you have a look at it and confirm? If so, I'd say we can open a new issue to have a look at it.

    Let me know what you think or if I missed something. Feel free to merge if everything looks good (although keep in mind it might need rebasing if some other PR is merged first). Thanks!

    opened by raulrpearson 4
  • Contract unit tests

    Contract unit tests

    • contracts: Emit missing PoolDeployed event
    • contracts: Fix and configure solhint
    • contracts: Add YieldGate testing setup
    • contracts: Fix unstake: supporter amount must be non-zero
    • contracts: Add stake and unstake test
    • ci: Add contract tests to CI
    opened by sebastianst 3
  • Update monorepo setup & configs

    Update monorepo setup & configs

    Overall I'm pretty satisfied with the new setup. Installing dependencies works faster and more reliably via pnpm and subsequent dev/build tasks, too – thanks to turborepo. Regarding the configuration files I'm fine with the current state even if I found the previous way a little bit more declarative.

    • Switched package manager to pnpm
      • IMPORTANT: I recommend everyone to delete all its node_modules folders, also within the sub-packages, as well as the top-level package-lock.json. Then install pnpm globally via npm i -g pnpm (also see README.md) and install dependencies via pnpm i. Scripts can be run via pnpm [script].
    • Moved prettierrc-configuration to root and let others extend it
    • Moved lint-staged-configuration to top as well as re-configured husky pre-commit script to continue working (it normally assumes the configurations are within the packages but i found a workaround)
    • Created a base eslintrc-configuration within the root where the others extend from (it contains the least common shared configuration of both packages)
    • Set up turborepo and configured pipelines for build, dev, and format in turbo.json (we can do more later).
      • NOTE: For you everything should work the same when starting the global dev/build/format script (e.g. via pnpm dev. Just turborepo is now used under the hood.
    • Fixed some minor issue in packages/frontend/lib/creatorReadHooks.ts that should have been dune while updating wagmi but it just came to light (I'm not 100% sure why, I think npm installed some dependencies/versions it should have not. And now pnpm did it correctly. But now it works as it should)

    ~~Disclaimer: Probably everything breaks when I first try to deploy it to Vercel :D~~

    Update: Deploy is fixed now and works with the new setup. ❤️

    opened by wottpal 3
  • Improve linting and formatting

    Improve linting and formatting

    In summary, this PR:

    • Adds husky pre-commit hook calling lint-staged
    • Configures lint-staged. It's installed in the repo root, but currently only runs for changes in the frontend package.
    • Cleans up ESLint config and updates versions for eslint and @typescript-eslint. I turned most of the rules into warnings because I'd like to have a discussion and reach an agreement on them, in a different PR.
    • Commits reformatted files after running prettier --write.

    Let me know if you have any questions or if I missed something. Some of the things I'm leaving for future PRs:

    • Agreeing on the custom ESLint rules and turning them off or into errors. No point in having a big noisy wall of warnings
    • Update dependencies (Chakra + React 18 is finally available, for example)
    • Extend linting and formatting to the hardhat package
    • Improve the testing situation, we currently have no tests.
    opened by raulrpearson 3
  • Fix overall responsiveness

    Fix overall responsiveness

    Summary of changes:

    • Improved BlockiesAvatar by replacing useState and useEffect with useMemo. I also removed Box and extended ImageProps to make it more reusable/maintainable.
    • Removed the flex order and justifyContent keys in ConnectWallet to fix the swapping of elements in the navbar.
    • Improved ConnectWalletButton to accept all possible button props and forward them to the underlying button. I also set a default of 200px for its width (was 220px) because that was causing some responsiveness issues on narrow screens.
    • Made the avatar size responsive in CreatorCardDetails
    • Made some changes in CreatorCardNumbers to allow wrapping and keep things looking somewhat okay when that happens.
    • Changed CreatorList from the homepage from a flex-based to a grid-based layout that adapts better to different widths. The "iPad range" is not ideal, with a lot of empty space, but that's what we get with the Chakra's default breakpoints without getting too much into the weeds.
    • Changed Layout so that the footer remains at the bottom when a view's content doesn't fill a whole viewport height.
    • Changed the layout of logos on the homepage for better responsiveness.
    • Changed the layout of [walletId] for better responsiveness.

    The diffs include a lot of formatting changes automatically made by Prettier. I think we should probably make sure our Prettier configs are working in the same direction. From the before and afters I think mine is working fine, but let me know if you think otherwise. We would probably benefit from making a big reformatting commit once that is established, so that actual code changes are easier to glean in future PRs.

    The layout is still not worthy of a webby award, specially at some viewport widths, but it's an improvement from what we had and the most painful issues (overflows on narrow screens) should be fixed.

    Let me know if you find any remaining glaring issues and feel free to raise any points with the implementation.

    opened by raulrpearson 3
  • Multichain dApp (Rinkeby & Mumbai) + Some UI Refactorings

    Multichain dApp (Rinkeby & Mumbai) + Some UI Refactorings

    IMPORTANT:

    1. Make sure to check your frontend .env.local again from .env.local.example (a few things have changed)
    2. Make sure to re-install dependencies with npm like described in previous PR (https://github.com/yieldgate/yieldgate/pull/8)

    Changes:

    • frontend: environment variable NEXT_PUBLIC_DEFAULT_CHAIN added (for read-calls w/o wallet/signer connected)
    • frontend: environment variable NEXT_PUBLIC_SUPPORTED_CHAINS is now actually used in wagmiClient.ts
    • frontend: added ChainSwitchMenu
    • frontend: refactored ens-domain fetching into new useEnsDomain hook
    • frontend: made index + creator-page adaptive to different chains
    • frontend: refactored creators-list within index into CreatorsList and CreatorsListItem
    • frontend: made CreatorsList filterable and "paginatable"
    • frontend: refactored CreatorCard into CreatorCardDetails, CreatorCardActions, and CreatorCardNumbers
    • frontend: refactored creator-related read-transactions into new creatorReadHooks
    • frontend: new hook useYieldgateContract always returns the current supported chain, and according contract addresses for read/write calls

    probably forgot some things 🤷‍♂️

    opened by wottpal 3
  • Make Yieldgate available on other testnet chains

    Make Yieldgate available on other testnet chains

    • The frontend currently has the Polygon Mumbai chain hardcoded, including the native token unit MATIC.
    • The hardhat deploy script also has Mumbai hardcoded, including the chain id, Aave contract addresses (WETHGateway, Pool and native aToken).

    It should be easy to make other testnets available.

    • The frontend could query the chain id from the web3 provider and then read the relevant information from a static list. @wottpal feel free to expand on this.
    • Similarly, for the hardhat deploy script, we can define a list of static data and then pass the chain(s) to deploy to via cmdline flags. I'd do that.
    opened by sebastianst 3
  • Testnet mock contracts

    Testnet mock contracts

    • contracts: Add AaveMock for testnets
    • contracts: Add OffsetHelperMock for testnets
    • contracts: Add ERC20AutoMinter and SFETestUSD for testnets
    • contracts: Add missing license headers
    • contracts: Add package lodash.isplainobject
    • contracts: Extend end2end test to work with Mocks on local node
    • contracts: Cleanup deploy scripts in package.json
    • contracts: Redeploy contract YieldGate
    • contracts: Deploy all contracts to Mumbai

    Contracts deployed to Mumbai at (edit: updated):

    • AaveMock (0x3103E87eEDC29fBA8620f21f2Ac40F116e9403fE)
    • OffsetHelperMock (0xb3E8E4050d83095E21E7B64Fa00EA1a8aB221ddf)
    • SFETestUSD (0x7ab4fCFCd4F108cdC43D591C0546aC7cfC36fd6B)
    • TokenPoolWithApproval (0xC5150aE1962c80522B7cb98a9Edcd43C6B063F93)
    • ToucanOffsetter (0x6B11165C455BbEa3FF1BcC2f3821701fb31b60Bb)
    • YieldGate (0xd4C90eD0954a85629Bf272616fA55c0Af7B5D55C)

    All contracts got verified on Mumbai polygonscan.

    opened by sebastianst 2
  • Use shared revert string constants in Solidity

    Use shared revert string constants in Solidity

    It would be nice to use the shared solidity revert strings from packages/contracts/shared/revertReasons.ts in Solidity source files instead of having duplicate definitions.

    One solution could be to use the solpp preprocessor together with the hardhat plugin. However, solpp seems unmaintained so I'd like to avoid this dependency at this point.

    opened by sebastianst 0
  • Try coveralls again

    Try coveralls again

    In https://github.com/yieldgate/yieldgate/pull/52 commit https://github.com/yieldgate/yieldgate/pull/52/commits/89c1eae93787d9f78d5f2f6fd61c7814d6a8dd50 adds coverall reporting, but it seems to be broken right now. Codecov works. But Coveralls apparently has better branch coverage reporting for Solidity, so it might be worth giving Coveralls a try at some point in the future.

    opened by sebastianst 0
  • Contracts: Use custom Solidity errors?

    Contracts: Use custom Solidity errors?

    Since 0.8.4 Solidity supports custom errors. We might consider using them. First need to check how well it is supported in our tooling etc though. E.g. error catching is not yet supported (https://github.com/ethereum/solidity/issues/11278).

    opened by sebastianst 1
Query for CSS brower support data, combined from caniuse and MDN, including version support started and global support percentages.

css-browser-support Query for CSS browser support data, combined from caniuse and MDN, including version support started and global support percentage

Stephanie Eckles 65 Nov 2, 2022
A SPW (Single Page Website) that can track your favorite books on your browser! Made with ES6 modules,JavaScript, HTML 5 and CSS 3.

awesome-books It is a project for Microverse's JavaScript Module to be done using pair-programming. Desktop Version Mobile Version In this website you

TOFANA SILVIA 10 Aug 22, 2022
A web app which help you to save you a list of your favorite books, they will be saved on your local storage to never loose them even if you close the page. Built wiht JavaScript

Awesome Books In this project I build a page to save a list of your favorites books, you can add new books, delete it and they will be saved in the lo

Williams Colmenares 9 Dec 17, 2022
Write "hello world" in your native language, code "hello world" in your favorite programming language!

Hello World, All languages! ?? ?? Write "hello world" in your native language, code "hello world" in your favorite language! #hacktoberfest2022 How to

Carolina Calixto 6 Dec 13, 2022
Persistent key/value data storage for your Browser and/or PWA, promisified, including file support and service worker support, all with IndexedDB. Perfectly suitable for your next (PWA) app.

BrowstorJS ?? ?? ?? Persistent key/value data storage for your Browser and/or PWA, promisified, including file support and service worker support, all

Nullix 8 Aug 5, 2022
If you want to know more about your favorite TV show then you've come to the right place!

Ultimate Show Guide We want to introduce you this web page that will help you to manage all your favourite TV series from place. ??️ Desktop version H

William Morales 6 Jun 23, 2022
A hub of all Marvel comics featuring your favorite heroes created with NextJS.

A hub of all Marvel comics featuring your favorite heroes created with NextJS. marvel-hub.vercel.app Stack Front-end: NextJs, Jest, Styled Components

Felipe Barcelos 28 May 1, 2022
This project is a single-page application (SPA) about Booklist in which you can add your favorite books.

AWESOME BOOKS This website Awesome Books Library provides users a convenient way to keep track of their books or reading lists. Users can add and remo

Omar Salem 10 Feb 25, 2022
A simple to use Harmony Extension that notifies you, when your favorite streamers go live!

THE Twitch Extension for your Deno-based Harmony Discord Bot Notifies you if your favorite streamers go live Usage In order to use this extension it i

null 1 Apr 1, 2022
A list of EVM-based chains that also allows you to add chains to your favorite Web3 wallet

A list of EVM-based chains that also allows you to add chains to your favorite Web3 wallet. An alternative to the closing chainlist.org

Frederik Bolding 108 Jan 5, 2023
Save your favorite GitHub Repos/Profiles Live

Save your favorite GitHub Repos/Profiles Live Getting Started by Fork and clone this repository or simply git clone https://github.com/ttran293/useful

Thanh Nam Tran 3 May 2, 2022
Find your new favorite Scratch service.

Welcome to scratch-explorer ?? Like ocular and ScratchStats? You'll love some lesser-known sites like Itinerary and Aviate. Just browse the collection

null 8 Oct 3, 2022
Browse a list of your favorite movies and tv shows on the Steam-It Movie Database.

Preview Desktop view Stream-It The website allows users to browse a list of movies, like a movie, view and add comments to a movie Built With HTML and

Ben Kiarie 10 Sep 30, 2022
Cryptostat is a Node.js based CLI that gets you the real-time stats of your favorite cryptocurrency.

Cryptostat-CLI Cryptostat is a Node.js based CLI that gets you the real-time stats of your favorite cryptocurrency. Installation Use the npm package m

Kunal Rohitas 5 Dec 15, 2022
Awesome Books project with ES6 is an application that was built using Vanilla JavaScript with ES6 features like using arrow functions. This application allows you to keep records of your favorite books.

Javascript Project Awesome Books with ES6 Using Javascript to create a simple Awesome Books project. Populating the books list and then removing one b

Ghazanfar Ali 8 Sep 28, 2022
Less clicking, more creating. Navigate to your favorite actions on the websites you love with just one click.

Navigate to your favorite actions on the websites you love with just one click Web https://irtaza9.github.io/awesome-shortcuts/ Available Shortcuts Go

Irtaza Hussain 9 Aug 25, 2022
🏎See how your favorite F1 team is progressing in the Constructors Championship

F1 Championship Stats ?? See how your favorite F1 team is progressing in the Constructors Championship using the PlanetScale serverless driver for Jav

PlanetScale 102 Dec 20, 2022
Readavocado obsidian plugin to sync your favorite highlights.

Readavocado Sync Plugin This plugin automatically export your Readavocado highlights into your Obsidian vault. Usage Install the Readavocado Sync Plug

Sarat Limawongpranee 9 Oct 31, 2022