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 and ibEUR reward distribution #4

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
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
19 changes: 19 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# network specific node uri: `"ETH_NODE_URI_" + networkName.toUpperCase()`
ETH_NODE_URI_MAINNET=https://eth-mainnet.alchemyapi.io/v2/<apiKey>
# generic node uri (if no specific found):
ETH_NODE_URI=https://eth-{{networkName}}.infura.io/v3/<apiKey>

# network specific mnemonic: `MNEMONIC_${networkName.toUpperCase()}`
MNEMONIC_MAINNET=<mnemonic for mainnet>
# generic mnemonic (if no specific found):
MNEMONIC=<mnemonic>

# Mocha (10 minutes)
MOCHA_TIMEOUT=600000

# Coinmarketcap (optional, only for gas reporting)
COINMARKETCAP_API_KEY=
COINMARKETCAP_DEFAULT_CURRENCY=USD

# Etherscan (optional, only for verifying smart contracts)
ETHERSCAN_API_KEY=
44 changes: 44 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Lint

on: [push]

jobs:
files:
runs-on: ubuntu-latest

steps:
- name: Check out github repository
uses: actions/checkout@v2
with:
fetch-depth: 1

- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
path: "**/node_modules"
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }}

- name: Install node
uses: actions/setup-node@v1
with:
node-version: "16.x"

- name: Install dependencies
run: yarn --frozen-lockfile

- name: Run linter
run: yarn run lint:check

commits:
runs-on: ubuntu-latest

steps:
- name: Check out github repository
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Run commitlint
uses: wagoid/commitlint-github-action@v2
74 changes: 74 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Tests

on:
push:
branches:
- main
pull_request:

jobs:
unit:
runs-on: ubuntu-latest
steps:
- name: Check out github repository
uses: actions/checkout@v2
with:
fetch-depth: 1

- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
path: "**/node_modules"
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }}

- name: Install node
uses: actions/setup-node@v1
with:
node-version: "16.x"

- name: Install dependencies
run: yarn --frozen-lockfile

- name: Run unit tests
run: yarn test:unit
e2e:
runs-on: ubuntu-latest
steps:
- name: Check out github repository
uses: actions/checkout@v2
with:
fetch-depth: 1

- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
path: "**/node_modules"
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }}

- name: Cache hardhat network fork
uses: actions/cache@v2
env:
cache-name: cache-hardhat-network-fork
with:
path: cache/hardhat-network-fork
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('test/e2e/fork-block-numbers.ts') }}

- name: Install node
uses: actions/setup-node@v1
with:
node-version: "16.x"

- name: Install dependencies
run: yarn --frozen-lockfile

- name: Compile eth-sdk
run: yarn eth-sdk

- name: Run e2e tests
run: yarn test:e2e
env:
NODE_URI_ETHEREUM: https://eth-mainnet.alchemyapi.io/v2/${{ secrets.ALCHEMYKEY }}
27 changes: 27 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# General
node_modules
.DS_STORE

# Coverage
coverage.json
coverage

# Hardhat files
cache
artifacts
typechained
deployments/hardhat
deployments/localhost

# Config files
.env

# Local deployments
deployments/localhost
deployments/hardhat

# Not ignore gitkeep
!/**/.gitkeep

# ETH-SDK
eth-sdk/abis
1 change: 1 addition & 0 deletions .husky/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx --no-install commitlint --edit $1
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npm run lint:fix
10 changes: 10 additions & 0 deletions .mocharc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const dotenv = require('dotenv');
dotenv.config();

module.exports = {
require: ['hardhat/register'],
extension: ['.ts'],
ignore: ['./test/utils/**'],
recursive: true,
timeout: process.env.MOCHA_TIMEOUT || 300000,
};
51 changes: 51 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# General
.prettierignore
.solhintignore
.husky
.gitignore
.gitattributes
.env.example
.env
workspace.code-workspace
.DS_STORE
codechecks.yml

# Hardhat
coverage
coverage.json
artifacts
cache
typechained
deployments

# Vyper
contracts/*.vy

# JS
node_modules
package-lock.json
yarn.lock

# Solidity
contracts/mock
contracts/*.vy
contracts/GaugeProxy.sol
contracts/claim.sol
contracts/distribution.sol
contracts/faucet.sol
contracts/FeeDistributionLookup.sol
contracts/ffregistry.sol
contracts/FixedForex.sol
contracts/ibff.sol
contracts/kp3rv1-5.sol
contracts/Migrations.sol
contracts/stabilizer.sol

# ETH-SDK
eth-sdk/abis

# Deployments
deployments

# Audits
audits
32 changes: 32 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"overrides": [
{
"files": "**.sol",
"options": {
"printWidth": 145,
"tabWidth": 2,
"useTabs": false,
"singleQuote": true,
"bracketSpacing": false
}
},
{
"files": ["**.ts", "**.js"],
"options": {
"printWidth": 145,
"tabWidth": 2,
"semi": true,
"singleQuote": true,
"useTabs": false,
"endOfLine": "auto"
}
},
{
"files": "**.json",
"options": {
"tabWidth": 2,
"printWidth": 200
}
}
]
}
8 changes: 8 additions & 0 deletions .solcover.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module.exports = {
skipFiles: ['for-test', 'legacy', 'interfaces', 'external'],
mocha: {
forbidOnly: true,
grep: '@skip-on-coverage',
invert: true,
},
};
14 changes: 14 additions & 0 deletions .solhint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"extends": "solhint:recommended",
"plugins": ["prettier", "wonderland"],
"rules": {
"prettier/prettier": "warn",
"compiler-version": ["off"],
"constructor-syntax": "warn",
"quotes": ["error", "single"],
"func-visibility": ["warn", { "ignoreConstructors": true }],
"not-rely-on-time": "off",
"private-vars-leading-underscore": ["warn", { "strict": false }],
"wonderland/non-state-vars-leading-underscore": ["warn"]
}
}
15 changes: 15 additions & 0 deletions .solhintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
node_modules
contracts/mock
contracts/for-test

contracts/GaugeProxy.sol
contracts/claim.sol
contracts/distribution.sol
contracts/faucet.sol
contracts/FeeDistributionLookup.sol
contracts/ffregistry.sol
contracts/FixedForex.sol
contracts/ibff.sol
contracts/kp3rv1-5.sol
contracts/Migrations.sol
contracts/stabilizer.sol
15 changes: 8 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@ Fixed Forex is the collective name for USD, EUR, ZAR, JPY, CNY, AUD, AED, CAD, I

The first available options can be minted via yearn.fi/lend

* ibEUR
* ibKRW
* ibJPY
* ibAUD
* ibCHF
* ibGBP
- ibEUR
- ibKRW
- ibJPY
- ibAUD
- ibCHF
- ibGBP

All forex options can be minted via any of the accepted collateral on yearn.fi

For up to date collateral factors, you can visit the Fixed Forex [documentation](https://docs.fixedforex.fi/)

Each forex pair will target 2 liquidity pools;
ib*/* (curve.fi)
ib*/stable (uni v3)
ib\*/stable (uni v3)

For each asset, liquidity providers will have four available yield options;

Expand All @@ -29,6 +29,7 @@ Provide ib*/* to curve.fi
Stake in Iron Bank Fixed Forex and earn the native token KP3R (vested, vKP3R)

# vKP3R

The KP3R mechanism is complex, and should be carefully understood before participating.

The system’s true native token is vKP3R, or vested KP3R, vKP3R earns protocol fees, these fees are dynamic based on supply and demand. Currently, these fees are 10.15% of TVL.
Expand Down
1 change: 1 addition & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = { extends: ['@commitlint/config-conventional'] };
Loading