{"_id":"@aurora-balancer-labs/v2-liquidity-mining","name":"@aurora-balancer-labs/v2-liquidity-mining","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@aurora-balancer-labs/v2-liquidity-mining","version":"1.0.0","description":"Balancer V2 Liquidity Mining system","license":"GPL-3.0-only","homepage":"","repository":{"type":"git","url":"","directory":"pkg/liquidity-mining"},"scripts":{"build":"yarn compile","compile":"hardhat compile && rm -rf artifacts/build-info","compile:watch":"nodemon --ext sol --exec yarn compile","lint":"yarn lint:typescript && yarn lint:solidity","lint:typescript":"eslint . --ext .ts --ignore-path ../../.eslintignore  --max-warnings 0","lint:solidity":"solhint 'contracts/**/*.sol'","test":"yarn compile && mocha --extension ts --require hardhat/register --require @aurora-balancer-labs/v2-common/setupTests --recursive","test:fast":"yarn compile && mocha --extension ts --require hardhat/register --require @aurora-balancer-labs/v2-common/setupTests --recursive --parallel --exit","test:watch":"nodemon --ext js,ts --watch test --watch lib --exec 'clear && yarn test --no-compile'"},"devDependencies":{"@aurora-balancer-labs/v2-common":"workspace:*","@aurora-balancer-labs/v2-helpers":"workspace:*","@aurora-balancer-labs/v2-interfaces":"workspace:*","@aurora-balancer-labs/v2-solidity-utils":"workspace:*","@nomiclabs/hardhat-ethers":"^2.0.1","@nomiclabs/hardhat-vyper":"^3.0.0","@nomiclabs/hardhat-waffle":"^2.0.0","@types/chai":"^4.2.12","@types/lodash":"^4.14.161","@types/mocha":"^8.0.3","@types/node":"^14.6.0","@typescript-eslint/eslint-plugin":"^4.1.1","@typescript-eslint/parser":"^4.1.1","chai":"^4.2.0","decimal.js":"^10.2.1","eslint":"^7.9.0","eslint-plugin-mocha-no-only":"^1.1.1","eslint-plugin-prettier":"^3.1.4","ethereum-waffle":"^3.0.2","ethers":"^5.4.1","hardhat":"^2.8.3","mocha":"^8.2.1","nodemon":"^2.0.4","prettier":"^2.1.2","prettier-plugin-solidity":"v1.0.0-alpha.59","solhint":"^3.2.0","solhint-plugin-prettier":"^0.0.4","ts-node":"^8.10.2","typescript":"^4.0.2"},"_id":"@aurora-balancer-labs/v2-liquidity-mining@1.0.0","_nodeVersion":"16.15.1","_npmVersion":"8.11.0","dist":{"integrity":"sha512-vbRNiafaqW6DQFel3HsP6ttW9OD3+C+gTmC+KO+7Y1RPMwtp64OAKxT6rUKyftr2sr5zQunFGYHBI/qjM8FqIA==","shasum":"8291faf9f9cd45916e73b480bea78db226d8b37e","tarball":"https://registry.npmjs.org/@aurora-balancer-labs/v2-liquidity-mining/-/v2-liquidity-mining-1.0.0.tgz","fileCount":35,"unpackedSize":304414,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDgCPVco2kP0oKWdk1ykopXUIMt9kHXW0MyhJOPhbbc+QIgLVINB6pdiEtjE9JKsPCRMm9zKnykPuVJU2cE4nUK8Ew="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiwrFlACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmowjg//Tj+gclNPWdbvp8H84AbELSfkHmIZuvViNBcp/o5HydHEuEvu\r\n4td/E13uhLVS449Z1oN3SacjFO94bSueZlBUiXZZ+FhtbocUTOTYXiLDJXAe\r\nos53M/oa6GF9FB72zbUERivUzesyUtLVJILY3+u8wLIa/hu6xDgOYxymm5zA\r\nPRRPk2qQk3m61Ss5/97XQkRi6TVV1Ft+Q2wjJEzDMg7OPDJF5P6Jxytimovn\r\nUyo8tMaNOH7J1Lp/ByPg9/6ES2P5zulB8qL9wn2Mpa4fLbMZHkGjhQWjgQsb\r\nhN1umM781ziOer1asIGOt5Q6PpA8SqX4Fwk54TdLOIZuObkhd/pIlDVdRnuC\r\n0JmAYyN2nhXaZpS6XS3nOs2GiZXBjRumI8l1tGMgTshHeZF42XhI6q51NDb4\r\nBwIXJI3p0TrD4gSXK/l3inv6VxLFybBvKZ9X14KYV1T+LCBNdA8UCcVSBrIZ\r\nNFfgMnFC2x1jELOo4MfcltCSLKSb6hOuM6+yfmP+5tvhqlloMKQhUNJIbuzO\r\nxc97j/Xct7xW8U5xF7daA4hAsvX6zHGHdsJ3jtaLmT9Sp7sjfQ5Be44AtDWj\r\n/5QKgQgl+KOA6UNPWjMJljnCxwNEnuXFAbQjiL3UpIRndO+zNcB+pdcUVIeZ\r\n33m/UVjzvO9bMm77NlpEOWIoL5xbxhgTCUY=\r\n=D1Ta\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"philipptaratuta","email":"philipp.t@blaize.tech"},"directories":{},"maintainers":[{"name":"philipptaratuta","email":"philipp.t@blaize.tech"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/v2-liquidity-mining_1.0.0_1656926565696_0.6642186127080978"},"_hasShrinkwrap":false}},"time":{"created":"2022-07-04T09:22:45.613Z","1.0.0":"2022-07-04T09:22:45.896Z","modified":"2022-07-04T09:22:46.081Z"},"maintainers":[{"name":"philipptaratuta","email":"philipp.t@blaize.tech"}],"description":"Balancer V2 Liquidity Mining system","repository":{"type":"git","url":"","directory":"pkg/liquidity-mining"},"license":"GPL-3.0-only","readme":"# <img src=\"../../logo.svg\" alt=\"Balancer\" height=\"128px\">\n\n# Balancer V2 Liquidity Mining System\n\n[![NPM Package](https://img.shields.io/npm/v/@balancer-labs/v2-liquidity-mining.svg)](https://www.npmjs.org/package/@aurora-balancer-labs/v2-liquidity-mining)\n\nThis package contains the source code of Balancer V2's Liquidity Mining system, which is composed of multiple contracts. Among those stand out the [`VotingEscrow`](./contracts/VotingEscrow.vy), the [`BalancerMinter`](./contracts/BalancerMinter.sol), and the [`GaugeController`](./contracts/GaugeController.vy)., as well as all [core interfaces](./contracts/interfaces).\n\n## Overview\n\nThe Liquidity Mining system is an automated program which governs all minting of the BAL token, based on on-chain voting by holders of the veBAL token. veBAL is obtained by joining the canonical 80/20 BAL/ETH Weighted Pool and then locking the Pool shares token (often called BPT, for 'Balancer Pool Token') for a time duration. The longer the 80/20 BPT is locked for, the more veBAL and voting power is obtained.\n\nThis system very closely mirrors that of Curve DAO: indeed, most of the smart contract source code is either an almost exact copy of the Curve version, or a very close port of the original Vyper code into Solidity. One of the design goals has been to modify Curve's original work as little as possible in order to reduce smart contract risk.\n\n### Balancer Token Admin\n\nAn important job of the Liquidity Mining program is to provide upper bounds on all future minting of the Balancer Token. In Curve's case, these restrictions are embedded in the CRV token itself. The BAL token contract however lacks such constraints, allowing its admins to mint arbitrary amounts of BAL, so the CRV code had to be adapted.\n\nBAL uses OpenZeppelin's `AccessControl` contracts to manage minting permissions over it, which makes it simple to setup a two-contract system that emulates the original CRV behavior. The `BalancerTokenAdmin` acts as the sole account in the entire network with BAL minting permission, creating a thin wrapper around BAL's mechanism with two added behaviors: a minting schedule is put into place, which creates an upper bound on the amount of BAL that can exist at any point in time, and minting authorization is delegated to the Balancer DAO via the `Authorizer` contract. Once `BalancerTokenAdmin` is setup, BAL's admin configuration becomes immutable, locking-in these constraints forever.\n\nThe source code that computes the amount of BAL available to be minted is a direct port of CRV's Vyper code into Solidity, preserving variable names and ABI. The initial minting rate was also adjusted to reflect BAL's.\n\n### Balancer Minter\n\nThe `BalancerMinter` is granted permission by the `Authorizer` to mint BAL (via `BalancerTokenAdmin`, which enforces the minting schedule). It does so by relying on the `GaugeController` to keep a registry of authorized gauge contracts, and then mints whatever token amounts the different gauges report. This means gauges are a single point of failure, since just one faulty gauge can cause for arbitrary amounts of BAL (up to the emissions limit) to be minted. This can only be mitigated through revoking the `BalancerMinter`'s permission to mint BAL, in effect shutting down all gauges.\n\n`BalancerMinter` is generally inspired by `CurveMinter`, although a few extra functions were added for convenience (such as `setMinterApprovalWithSignature`).\n\n### Authorizer Adaptor\n\nCurve relies greatly on contract admin accounts, and so favors a single-admin pattern in all of its contracts. On the other hand, Balancer's access control solution is the `Authorizer` contract, which holds all permissions in the network, and is queried by other contracts when permissioned actions are performed. In order to solve this discrepancy without modifying Curve's source code nor changing how Balancer's authorizations work, the `AuthorizerAdaptor` contract was created.\n\nThis singleton entity is meant to be setup as the admin of all of these single-admin contracts. It adapts their behavior to the `Authorizer` pattern by implementing the `performAction` function, which forwards on arbitrary external calls while enforcing that the caller has permissions on the `Authorizer` to make the provided function call to the target contract. Contracts which have the `AuthorizerAdaptor` set as their admin then inherit the `Authorizer`'s access control mechanism.\n\n### Gauge Controller\n\nThe `GaugeController` serves as the gauge registry, and is also the place where veBAL holders vote to allocate BAL emissions towards gauges of their choosing.\n\nIt is almost an exact copy of Curve's implementation, with the few differences being usage of a newer version of the Vyper compiler, replacement of storage variables for the new `immutable` type, and removal of dummy functions introduced for Aragon compatibility.\n\n### Liquidity Gauge\n\n`LiquidityGaugeV5` is the primary kind of gauge contract on the Ethereum network, letting Liquidity Providers (LPs) deposit their BPT to participate in the Liquidity Mining program. These gauges distribute tokens by both minting BAL for them on demand (via `BalancerMinter`), as well as by having administrators deposit other tokens beforehand.\n\nIt is almost an exact copy of Curve's implementation, with the few differences being usage of a newer version of the Vyper compiler, addition of an initialization function to make Solidity-based gauge factory contracts possible, replacement of storage variables for the new `immutable` type, and removal of dummy functions introduced for Aragon compatibility.\n\n### Voting Escrow\n\n`VotingEscrow` is the veBAL contract, which allows LPs to deposit and lock 80/20 BPT in exchange for veBAL. The maximum lock time has been shortened from 4 years to 1 year.\n\nIt is almost an exact copy of Curve's implementation, with the few differences being usage of a newer version of the Vyper compiler, replacement of storage variables for the new `immutable` type, and removal of dummy functions introduced for Aragon compatibility.\n\n### Voting Escrow Delegation\n\n`VotingEscrowDelegation` lets veBAL holders share their boost factor to other accounts.\n\nIt is almost an exact copy of Curve's implementation, with the few differences being usage of a newer version of the Vyper compiler, replacement of storage variables for the new `immutable` type, and removal of dummy functions introduced for Aragon compatibility.\n\n## Licensing\n\n- All Vyper files are based on the [Curve DAO Contracts](https://github.com/curvefi/curve-dao-contracts), and as such are licensed under the MIT License.\n- All other files are licensed under the [GNU General Public License Version 3 (GPL v3)](../../LICENSE).\n","readmeFilename":"README.md"}