{"id":18705034,"url":"https://github.com/aave/aave-token-v2","last_synced_at":"2025-10-15T03:34:49.854Z","repository":{"id":49243309,"uuid":"320343387","full_name":"aave/aave-token-v2","owner":"aave","description":"V2 implementation of the AAVE token","archived":false,"fork":false,"pushed_at":"2021-07-22T15:04:04.000Z","size":1870,"stargazers_count":23,"open_issues_count":2,"forks_count":18,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-19T15:19:49.433Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aave.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":"audits/AaveTokenReport_CertiK.pdf","citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-12-10T17:31:04.000Z","updated_at":"2025-04-14T17:52:23.000Z","dependencies_parsed_at":"2022-09-07T16:52:27.498Z","dependency_job_id":null,"html_url":"https://github.com/aave/aave-token-v2","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/aave/aave-token-v2","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aave%2Faave-token-v2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aave%2Faave-token-v2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aave%2Faave-token-v2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aave%2Faave-token-v2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aave","download_url":"https://codeload.github.com/aave/aave-token-v2/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aave%2Faave-token-v2/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279043436,"owners_count":26091457,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-15T02:00:07.814Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-07T12:09:29.837Z","updated_at":"2025-10-15T03:34:49.841Z","avatar_url":"https://github.com/aave.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Aave Token design\n\nAAVE is an ERC-20 compatible token. It implements governance-inspired features, and will allow Aave to bootstrap the rewards program for safety and ecosystem growth.\nThe following document explains the main features of AAVE, it’s monetary policy, and the redemption process from LEND.\n\n## Roles\n\nThe initial AAVE token implementation does not have any admin roles configured. The contract will be proxied using the Openzeppelin implementation of the EIP-1967 Transparent Proxy pattern. The proxy has an Admin role, and the Admin of the proxy contract will be set upon deployment to the Aave governance contracts.\n\n## ERC-20\n\nThe AAVE token implements the standard methods of the ERC-20 interface. A balance snapshot feature has been added to keep track of the balances of the users at specific block heights. This will help with the Aave governance integration of AAVE.\nAAVE also integrates the EIP 2612 `permit` function, that will allow gasless transaction and one tx approval/transfer.\n\n# LendToAaveMigrator\n\nSmart contract for LEND token holders to execute the migration to the AAVE token, using part of the initial emission of AAVE for it.\n\nThe contract is covered by a proxy, whose owner will be the AAVE governance. Once the governance passes the corresponding proposal, the proxy will be connected to the implementation and LEND holders will be able to call the `migrateFromLend()` function, which, after LEND approval, will pull LEND from the holder wallet and transfer back an equivalent AAVE amount defined by the `LEND_AAVE_RATIO` constant.\n\nOne tradeOff of `migrateFromLend()` is that, as the AAVE total supply will be lower than LEND, the `LEND_AAVE_RATIO` will be always \u003e 1, causing a loss of precision for amounts of LEND that are not multiple of `LEND_AAVE_RATIO`. E.g. a person sending 1.000000000000000022 LEND, with a `LEND_AAVE_RATIO` == 100, will receive 0.01 AAVE, losing the value of the last 22 small units of LEND.\nTaking into account the current value of LEND and the future value of AAVE, a lack of precision for less than LEND_AAVE_RATIO small units represents a value several orders of magnitude smaller than 0.01\\$. We evaluated some potential solutions for this, specifically:\n\n1. Rounding half up the amount of AAVE returned from the migration. This opens up to potential attacks where users might purposely migrate less than LEND_AAVE_RATIO to obtain more AAVE as a result of the round up.\n2. Returning back the excess LEND: this would leave LEND in circulation forever, which is not the expected end result of the migration.\n3. Require the users to migrate only amounts that are multiple of LEND_AAVE_RATIO: This presents considerable UX friction.\n\nNone of those present a better outcome than the implemented solution.\n\n## The Redemption process\n\nThe first step to bootstrap the AAVE emission is to deploy the AAVE token contract and the  LendToAaveMigrator contract. This task will be performed by the Aave team. Upon deployment, the ownership of the Proxy of the AAVE contract and the LendToAaveMigrator will be set to the Aave Governance. To start the LEND redemption process at that point, the Aave team will create an AIP (Aave Improvement Proposal) and submit a proposal to the Aave governance. The proposal will, once approved, activate the LEND/AAVE redemption process and the ecosystem incentives, which will mark the initial emission of AAVE on the market.\nThe result of the migration procedure will see the supply of LEND being progressively locked within the new AAVE smart contract, while at the same time an equivalent amount of AAVE is being issued.  \nThe amount of AAVE equivalent to the LEND tokens burned in the initial phase of the AAVE protocol will remain locked in the LendToAaveMigrator contract.\n\n## Technical implementation\n\n### Changes to the Openzeppelin original contracts\n\nIn the context of this implementation, we needed apply the following changes to the OpenZepplin implementation:\n\n- In `/contracts/open-zeppelin/ERC20.sol`, line 44 and 45, `_name` and `_symbol` have been changed from `private` to `internal`\n- We extended the original `Initializable` class from the Openzeppelin contracts and created a `VersionedInitializable` contract. The main differences compared to the `Initializable` are:\n\n1. The boolean `initialized` has been replaced with a `uint256 latestInitializedRevision`.\n2. The `initializer()` modifier fetch the revision of the implementation using a `getRevision()` function defined in the implementation contract. The `initializer` modifier forces that an implementation\n3. with a bigger revision number than the current one is being initialized\n\nThe change allows us to call `initialize()` on multiple implementations, that was not possible with the original `Initializable` implementation from OZ.\n\n### \\_beforeTokenTransfer hook\n\nWe override the \\_beforeTokenTransfer function on the OZ base ERC20 implementation in order to include the following features:\n\n1. Snapshotting of balances every time an action involved a transfer happens (mint, burn, transfer or transferFrom). If the account does a transfer to itself, no new snapshot is done.\n2. Call to the Aave governance contract forwarding the same input parameters of the `_beforeTokenTransfer` hook. Its an assumption that the Aave governance contract is a trustable party, being its responsibility to control all potential reentrancies if calling back the AaveToken. If the account does a transfer to itself, no interaction with the Aave governance contract should happen.\n\n## Development deployment\n\nFor development purposes, you can deploy AaveToken and LendToAaveMigrator to a local network via the following command:\n\n```\nnpm run dev:deployment\n```\n\nFor any other network, you can run the deployment in the following way\n\n```\nnpm run ropsten:deployment\n```\n\nYou can also set an optional `$AAVE_ADMIN` enviroment variable to set an ETH address as the admin of the AaveToken and LendToAaveMigrator proxies. If not set, the deployment will set the second account of the `accounts` network configuration at `buidler.config.ts`.\n\n## Mainnet deployment\n\nYou can deploy AaveToken and LendToAaveMigrator to the mainnet network via the following command:\n\n```\nAAVE_ADMIN=governance_or_ETH_address\nLEND_TOKEN=lend_token_address\nnpm run main:deployment\n```\n\nThe `$AAVE_ADMIN` enviroment variable is required to run, set an ETH address as the admin of the AaveToken and LendToAaveMigrator proxies. Check `buidler.config.ts` for more required enviroment variables for Mainnet deployment.\n\nThe proxies will be initialized during the deployment with the `$AAVE_ADMIN` address, but the smart contracts implementations will not be initialized.\n\n## Enviroment Variables\n\n| Variable                | Description                                                                         |\n| ----------------------- | ----------------------------------------------------------------------------------- |\n| \\$AAVE_ADMIN            | ETH Address of the admin of Proxy contracts. Optional for development.              |\n| \\$LEND_TOKEN            | ETH Address of the LEND token. Optional for development.                            |\n| \\$INFURA_KEY            | Infura key, only required when using a network different than local network.        |\n| \\$MNEMONIC\\_\\\u003cNETWORK\\\u003e | Mnemonic phrase, only required when using a network different than local network.   |\n| \\$ETHERESCAN_KEY        | Etherscan key, not currently used, but will be required for contracts verification. |\n\n## Audits v1\n\nThe Solidity code in this repository has undergone 2 traditional smart contracts' audits by Consensys Diligence and Certik, and properties' verification process by Certora. The reports are:\n- [Consensys Diligence](https://diligence.consensys.net/audits/2020/07/aave-token/)\n- [Certik](audits/AaveTokenReport_CertiK.pdf)\n- [Certora](audits/AaveTokenVerification_by_Certora.pdf)\n\n## Audits v2\n\nThe new StakedAaveV2 implementation has been audited by Peckshield and property checked by Certora.\n\n## Credits\n\nFor the proxy-related contracts, we have used the implementation of our friend from [OpenZeppelin](https://github.com/OpenZeppelin/openzeppelin-sdk/).\n\n## License\n\nThe contents of this repository are under the AGPLv3 license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faave%2Faave-token-v2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faave%2Faave-token-v2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faave%2Faave-token-v2/lists"}