Implements the BarnBridge Decentralized Autonomous Organization (DAO) Governance contracts, allowing token holders to create proposals, vote upon them, and queues up for execution those proposals that have passed with quorum. Includes an Abrogation mechanism to cancel queued transactions.
Any questions? Please contact us on Discord or read our Developer Guides for more information.
Implements DAO logic Creating proposals, voting, queuing, canceling, executing and abrogating.
Overview
Check out more detailed smart contract Slither graphs with all the dependencies: Yield Farming Slither Graphs.
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
# Restart terminal and/or run commands given at the end of the installation script
nvm install 12
nvm use 12
git clone https://github.com/BarnBridge/BarnBridge-DAO.git
cd BarnBridge-YieldFarming
cp config.sample.ts config.ts
Create an API key with Infura to deploy to Ethereum Public Testnet. In this guide, we are using Kovan.
- Navigate to Infura.io and create an account
- Log in and select "Get started and create your first project to access the Ethereum network"
- Create a project and name it appropriately
- Then, switch the endpoint to Rinkeby, copy the https URL and paste it into the section named
rinkeby
- Finally, insert the mnemonic phrase for your testing wallet. You can use a MetaMask instance, and switch the network to Rinkeby on the upper right. DO NOT USE YOUR PERSONAL METAMASK SEED PHRASE; USE A DIFFERENT BROWSER WITH AN INDEPENDENT METAMASK INSTALLATION
- You'll need some Kovan-ETH (it is free) in order to pay the gas costs of deploying the contracts on the TestNet; you can use your GitHub account to authenticate to the KovanFaucet and receive 2 Kovan-ETH for free every 24 hours
- Navigate to EtherScan and create an account
- Log in and navigate to MyAPIKey
- Use the Add button to create an API key, and paste it into the indicated section towards the bottom of the
config.ts
file
import { NetworksUserConfig } from "hardhat/types";
import { EtherscanConfig } from "@nomiclabs/hardhat-etherscan/dist/src/types";
export const networks: NetworksUserConfig = {
// Needed for `solidity-coverage`
coverage: {
url: "http://localhost:8555"
},
// Kovan
kovan: {
url: "https://kovan.infura.io/v3/INFURA-API-KEY",
chainId: 42,
accounts: {
mnemonic: "YourKovanTestWalletMnemonicPhrase",
path: "m/44'/60'/0'/0",
initialIndex: 0,
count: 10
},
gas: 3716887,
gasPrice: 20000000000, // 20 gwei
gasMultiplier: 1.5
},
// Mainnet
mainnet: {
url: "https://mainnet.infura.io/v3/YOUR-INFURA-KEY",
chainId: 1,
accounts: ["0xaaaa"],
gas: "auto",
gasPrice: 50000000000,
gasMultiplier: 1.5
}
};
// Use to verify contracts on Etherscan
// https://buidler.dev/plugins/nomiclabs-buidler-etherscan.html
export const etherscan: EtherscanConfig = {
apiKey: "YourEtherscanAPIKey"
};
npm install
npm run compile
npm run test
Note: The result of tests is readily available here.
npm run coverage
npx hardhat run --network kovan scripts/kovan-deploy.js # outputs governance contract address
NOTE: You can update kovan-init.js with the Governance contract address created in the previous step or keep the BarnBridge Kovan address NOTE: You can update kovan-init.js with your own deployment of Barn from BarnBridge-Barn/scripts/kovan-deploy-barn.ts or keep the BarnBridge Kovan address
npx hardhat run --network kovan scripts/kovan-init.js
For any concerns with the platform, open an issue on GitHub or visit us on Discord to discuss. For security concerns, please email [email protected].
Copyright 2021 BarnBridge DAO