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

first pass at yPools updates #473

Draft
wants to merge 14 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALCHEMY_API_KEY=yourApiKeyHere
68 changes: 68 additions & 0 deletions .github/workflows/addressChecks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Address Checks

on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *' # Runs daily at midnight

jobs:
update-data:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '18.x'

- name: Install dependencies
run: |
if [ -e yarn.lock ]; then
yarn install
yarn global add ts-node
elif [ -e package-lock.json ]; then
npm ci
npm install -g ts-node
else
npm install
npm install -g ts-node
fi
npm run build

- name: Run checks and update data
env:
ALCHEMY_API_KEY: ${{ secrets.ALCHEMY_API_KEY }}
run: |
ts-node scripts/runAddressChecks.ts

- name: Check if all checks passed
id: check_all_passed
run: |
ALL_CHECKS_PASSED=$(jq -r '.addressChecks.allChecksPassed' scripts/fetchedAddressData.json)
echo "All checks passed: $ALL_CHECKS_PASSED"
echo "all_checks_passed=$ALL_CHECKS_PASSED" >> $GITHUB_ENV
if [ "$ALL_CHECKS_PASSED" != "true" ]; then
echo "Generating issue content..."
echo "Automatic Address Checks have failed. The following contracts have changed:" > issue_body.md
jq -r '.addressChecks.failedChecks[]' scripts/fetchedAddressData.json | while read CHECK; do
echo "- $CHECK" >> issue_body.md
done
echo "The addresses shown above should be the updated, correct addresses. Please review and change the values in \`src/ethereum/constants.ts\`." >> issue_body.md
echo "" >> issue_body.md
echo "Updated fetchedAddressData.json content:" >> issue_body.md
cat scripts/fetchedAddressData.json >> issue_body.md
fi

- name: Create an issue if checks failed
if: env.all_checks_passed != 'true'
uses: peter-evans/create-issue-from-file@v4
with:
token: ${{ secrets.RG_ISSUES_TOKEN }}
title: 'Address Checks Failed'
content-filepath: 'issue_body.md'
labels: 'address-checks, alert'
assignees: 'rossgalloway'
42 changes: 6 additions & 36 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
name: documentation
name: Documentation Workflow

on:
pull_request:
branches: [master]
push:
branches: [master]
on: [push, pull_request]

jobs:
checks:
if: github.event_name != 'push'
build-and-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '18.x'
- name: Test Build
Expand All @@ -25,33 +20,8 @@ jobs:
npm i
fi
npm run build
gh-release:
if: github.event_name != 'pull_request'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: '18.x'
- uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.GH_PAGES_DEPLOY }}
- name: Release to GitHub Pages
env:
USE_SSH: true
GIT_USER: git
run: |
git config --global user.email "[email protected]"
git config --global user.name "gh-actions"
if [ -e yarn.lock ]; then
yarn install
elif [ -e package-lock.json ]; then
npm ci
else
npm i
fi
npm run deploy
- name: Trigger Algolia Recrawl
if: github.event_name != 'pull_request'
run: |
curl -H "Content-Type: application/json" \
-X POST \
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ yarn-error.log*
.markdownlint.json

.branch-name
.github/copilot-instructions.md

# Use yarn.lock
package-lock.json
Expand Down
87 changes: 85 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,14 @@ This command generates static content into the `build` directory and can be serv
yarn build
```

## Configure .env

The docs site pulls data from on-chain smart contracts, so an API key is necessary. The default is an Alchemy API key so the easiest thing to do is get a free api key from them at https://www.alchemy.com/pricing.

Rename the `.env.example` file in the root directory to `.env` and add your API key where it says "yourApiKeyHere" without any quotes or backticks.

If you would like to use a different RPC service, or your own node to pull blockchain data, you can edit the publicClient in `/src/context/PublicClientContext`.

## Deployment

Generally you should not need to use this as there is a github actions script that builds and deploys the site when a pull request is merged to the `master` branch of the upstream Yearn Github Repo.
Expand Down Expand Up @@ -307,7 +315,7 @@ The PrettyLink element makes your links into button-like elements with subtle an

#### Yearn Admonition

There is a custom informational Yearn-styled admonition that can be used like any other admonition.
There are custom informational Yearn-styled admonitions that can be used like any other admonition.

```markdown
:::yearn[title-goes-here]
Expand All @@ -317,6 +325,14 @@ text content
:::
```

```markdown
:::yearn-data[title-goes-here]

text content

:::
```

If you create a new docs plugin in `docusaurus.config` you will need to initialize this admonition in that plugin instance like this:

```js
Expand All @@ -328,11 +344,78 @@ If you create a new docs plugin in `docusaurus.config` you will need to initiali
id: 'new docs section',
//other vars
admonitions: {
keywords: ['yearn'],
keywords: ['yearn', 'yearn-data'],
extendDefaults: true,
},
},
],
]

```

### Blockchain RPC Calls

You can make RPC calls to read contract data from on-chain sources and display them within the docs. This is done using the Viem ethereum library. But if all you are doing is writing docs, you don't need to worry about the details here. You can add the information for all the read calls you want within the front-matter of a markdown document. [Front-matter](https://docusaurus.io/docs/markdown-features#front-matter) is metadata that docusaurus reads when serving pages.

To make a blockchain call you need to structure your data in the following format:

```yml
---
rpcCalls:

- name: 'dYFI Redemption' <-- descriptive name of contract to be called for use in component
chain: '1' <--chainID
address: '0x7dC3A74F0684fc026f9163C6D5c3C99fda2cf60a' <--the contract address
abiName: 'dyfiRedemptionABI' <--name of exported ABI object from src/ethereum/ABIs
methods:
- 'discount' <-- name of call (if no arguments needed)
- 'get_latest_price'
- name: 'eth_required' <-- name of call (if arguments are needed)
args: ['1000000000000000000'] <--comma separated arguments of call as an array (square brackets)

- name: 'YFI token'
chain: '1'
address: '0x0bc529c00C6401aEF6D220BE8C6Ea1667F6Ad93e'
abiName: 'yfiTokenABI'
methods:
- totalSupply
- symbol
---
```

- Each element in rpcCalls creates an object that is exported from the front-matter.
- Each object can contain calls to different functions in the same contract if you add them into the methods field.
- If the method doesn't require args (the function doesn't require any input) then you only need to list the name. This is the name you see on etherscan, without the number.
- If the method does require an argument then you need to add it with a name parameter and an args parameter, with the values for the arguments separated by commas and in square brackets.

![name on etherscan](static/img/guides/readme/etherscan1.png)

![name and args on etherscan](static/img/guides/readme/etherscan2.png)

⚠️ When adding a new contract to call, you need to add the ABI to "src/ethereum/ABIs". Create a new typescript file with the name of your ABI. The convention is to name it in camelCase and end it with ABI (i.e. yfiTokenABI.ts). Then paste the ABI into the file (you can copy it from etherscan. It is in the contract->code section.). You need to export it and add `as const` at the end.

```js
// src/ethereum/ABIs/yourContractABI.ts
export const yourContractABI = [
{
// abi data here
}
] as const

```

You then need to export this element from the index.ts file in the same directory. Add a line exporting your ABI as shown below.

```js
export * from './yourContractABI'
```

To display the data from the calls, use the \<ContractData> component. It takes the following arguments:

- `contractName` which reads the name field in the rpcCall defined in the front-matter
- `methodName` which reads from the methods in the rpcCall defined in the front-matter
- `decimals` which is an optional argument to format your output to display with human readable decimals. It should be wrapped in curly brackets \{\}.

```markdown
The current redemption discount is: <ContractData contractName='dYFI Redemption' methodName='discount' decimals={18} />
```
6 changes: 3 additions & 3 deletions docs/contributing/contribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ You can see our progress on the [Github Project Board](https://github.com/orgs/y

We use a combination of HackMD, Docusaurus, and Github for our [Documentation](https://docs.yearn.fi/) and we use [DrawIO](https://draw.io) with Google Drive for our diagrams & schemas. If you are a grammar stickler, you can see our [Reviewer Guide](https://hackmd.io/juTKNn3xTpKJgFDo2AglLw).

Last but not least, join the #documentation channel in [Discord](https://discord.gg/freT6YRNSX) and introduce yourself.
Last but not least, join the #documentation channel in [Discord](https://discord.gg/yearn) and introduce yourself.

If this sounds confusing, please let us know what we can clear up. In the meantime: You can begin contributing to our HackMD docs immediately via the Github issues — we'll guide you through the rest.

Expand All @@ -48,7 +48,7 @@ If this sounds confusing, please let us know what we can clear up. In the meanti

If you're a developer, we need your help! Before you begin: Familiarize yourself with Yearn, its products, and its infrastructure by reading our [Documentation](https://docs.yearn.fi/).

You can see our progress on our [Github Project Board](https://contribute.yearn.farm/good-first-issue.html), and you can immediately begin contributing where you see fit. We recommend checking out issues tagged as `help wanted` and recommend sticking to the respective repository's coding guidelines (linting, formatting, PRs, etc). It's that simple 🙂. You can also join us on the #dev channel in [Discord](https://discord.gg/w89vVxeV9h).
You can see our progress on our [Github Project Board](https://contribute.yearn.farm/good-first-issue.html), and you can immediately begin contributing where you see fit. We recommend checking out issues tagged as `help wanted` and recommend sticking to the respective repository's coding guidelines (linting, formatting, PRs, etc). It's that simple 🙂. You can also join us on the #dev channel in [Discord](https://discord.gg/yearn).

If you are interested in working on a specific project, check out the list of Yearn products in the [General Resources](#general-resources) section below or check out our list of repos [here](https://github.com/orgs/yearn/repositories).

Expand All @@ -60,7 +60,7 @@ If you want to integrate with Yearn, please visit our [Integration Guide](https:

#### Designers

We invite designers, animators, artists, and more to share your skills with the Yearn ecosystem! If you're interested in creating graphics that describe Yearn's systems, creating video explainers, fixing Yearn's UI/UX, or any other combination of things — hop into the #ui-ux channel or #media-resources channels in [Discord](https://discord.gg/H8AVhpz63R).
We invite designers, animators, artists, and more to share your skills with the Yearn ecosystem! If you're interested in creating graphics that describe Yearn's systems, creating video explainers, fixing Yearn's UI/UX, or any other combination of things — hop into the #ui-ux channel or #media-resources channels in [Discord](https://discord.gg/yearn).

#### Creating Strategies

Expand Down
4 changes: 4 additions & 0 deletions docs/contributing/governance/proposal-process.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,7 @@ The default template for proposals can be found on [Github](https://github.com/y
## Implementation

Once a Snapshot votes have passed, changes will be implemented by Yearn's protocol or operations team and signed by the multi-sig, if necessary.

## Guardian Role

Per [YIP-81](https://snapshot.box/#/s:veyfi.eth/proposal/0x6f3082db2cef3e0c254e569580d063cb14130a92d0bf1729bef342a386e419f2), the [Yearn Multisig](/developers/security/multisig) (AKA yChad) serves in the Guardian role to steward and protect the Yearn Protocol and its participants. The Guardian role is defined as being able to **"nullify a proposal or governance decision but cannot make proposals"**.
23 changes: 23 additions & 0 deletions docs/contributing/governance/veYFI-comp-summary.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
---
rpcCalls:
- name: 'dYFI Redemption'
chain: '1'
address: '0x7dC3A74F0684fc026f9163C6D5c3C99fda2cf60a'
abiName: 'dyfiRedemptionABI'
methods:
- 'discount'
- 'get_latest_price'
- name: 'eth_required'
args: ['1000000000000000000']
---

# Comprehensive veYFI Guide

Yearn has implemented a sophisticated governance and rewards system centered around **veYFI** and **dYFI** tokens. This system is designed to empower active community members, incentivize long-term participation, and align the interests of YFI holders with the protocol's success. This document provides a comprehensive synthesis of the veYFI and dYFI mechanisms, incorporating detailed specifications and complexities for a thorough understanding.
Expand Down Expand Up @@ -176,6 +189,16 @@ Boost = 10 * BoostedBalance / AmountDepositedInGauge
- **High veYFI Supply**: Lower discount, as more YFI is locked, indicating strong commitment.
- **Low veYFI Supply**: Higher discount, incentivizing users to lock more YFI.

<br />

:::yearnData

- The current redemption discount is: <ContractData contractName='dYFI Redemption' methodName='discount' decimals={18} />
- Current Spot Price of YFI/ETH: <ContractData contractName='dYFI Redemption' methodName='get_latest_price' decimals={18} />
- ETH required to redeem 1 dYFI: <ContractData contractName='dYFI Redemption' methodName='eth_required' decimals={18} />

:::

---

## Epochs and Voting
Expand Down
26 changes: 25 additions & 1 deletion docs/contributing/governance/veyfi.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
---
rpcCalls:
- name: 'dYFI Redemption'
chain: '1'
address: '0x7dC3A74F0684fc026f9163C6D5c3C99fda2cf60a'
abi: 'dyfiRedemptionABI'
methods:
- 'discount'
- 'get_latest_price'
- name: 'eth_required'
args: ['1000000000000000000']
---

# Specification

veYFI incorporates [YIP-56: Buyback and Build](https://gov.yearn.fi/t/yip-56-buyback-and-build/8929) funds into YFI tokenomics. Users can lock YFI tokens and receive veYFI, which allows them to boost vault rewards and vote on where bought-back YFI will be sent.
Expand All @@ -8,7 +21,7 @@ veYFI incorporates [YIP-56: Buyback and Build](https://gov.yearn.fi/t/yip-56-buy
- YFI can be locked into veYFI, which is non-transferable.
- Lock duration can be decided on deposit: from 1 week to 4 years.
- You can actually lock up to 10 years, but anything above 4 years doesn’t give you more veYFI. This way you don't have to relock every week. If you set it to longer than 4 years, you can always reset it to 4 years so it starts decaying.
- A user must have a veYFI lock to earn boosted rewards. No lock leads to no boosted rewards. A Maximum lock, continuously renewed, maximizes rewards.
- A user must have a veYFI lock earn boosted rewards. No lock leads to no boosted rewards. A Maximum lock, continuously renewed, maximizes rewards.
- Just like with Curve, even without a veYFI lock, you can still deposit into a vault and stake the vault token into a gauge which will give you the base boost. With the minimum boost, you get to keep 10% of the dYFI you farm. The other 90% goes to veYFI lockers.
- It’s possible to exit the lock early, in exchange for paying a penalty that gets allocated to the other veYFI holders.
- The penalty is up to 75% locked amount and decays over time:
Expand All @@ -29,13 +42,24 @@ veYFI incorporates [YIP-56: Buyback and Build](https://gov.yearn.fi/t/yip-56-buy
- The circulating supply of dYFI must not exceed the amount of YFI available to be redeemed as part of the tokenomics program.
- The amount of ETH required for redemption is at a discount to the current spot price of YFI/ETH.
- ETH received from dYFI redemption is redirected to automated YFI buybacks handled by an immutable smart contract that runs Dutch auctions.

- Discount calculation is a function of the veYFI and YFI supply with the following formula:
- discount = `c / (1 + a * e^k(s * x − 1))`, where:
- **c** = `1`
- **a** = `10`
- **k** = `4.7`
- **s** = `configurable scaling factor` (currently set to 10)
- **x** = `veYFI_supply / YFI_supply`
<br />

:::yearn[Current On-Chain Values]

- The current redemption discount is: <ContractData contract='dYFI Redemption' methodName='discount' decimals={18} />
- Current Spot Price of YFI/ETH: <ContractData contract='dYFI Redemption' methodName='get_latest_price' decimals={18} />
- ETH required to redeem 1 dYFI: <ContractData contract='dYFI Redemption' methodName='eth_required' decimals={18} />

:::

![image](/img/charts/dyfi-redemption-chart.png)

## Vault Gauges + Voting
Expand Down
Loading