๐ฅ๏ธDevelopment of New Adapters
Technical contributions to the Alchemix ecosystem can come in many forms, including:
Token adapters for new yield sources
Integration with other DeFi protocols
Alchemix-specific tools and utilities
However, to integrate any new smart contracts into an AlchemixV2 debt system, some governance actions will be required. Contributors should use the following procedures to guide them as they prepare to build and integrate code into the Alchemix ecosystem.
Token Adapters
Alchemix token adapters are standardized methods used to interact with different yield-bearing assets or vaults. Alchemix uses token adapters to integrate and manage the various assets seamlessly.
The following details the steps are necessary for integrating a new adapter into the Alchemix V2 protocol.
Token Adapter Governance Process
There are three steps, including 2 separate AIPs (Alchemix Improvement Proposals), needed to get an adapter approved and connected in an Alchemix V2 debt system. The first AIP is technically optional, as both AIPs could be condensed into a single AIP if the integration developer is comfortable putting in the development work upfront without pre-approval.
The Community Governance Process details the general governance steps that should be followed for each AIP.
Step 1 - Propose the new yield source for integration, and request grant funding.
The purpose of this step is for the integrator/proposer to verify that the Alchemix DAO wants to integrate the proposed yield strategy. Additionally, the integrator/proposer can request a pre-approved grant of ALCX tokens, to be paid out when the Adapter is deployed in step 2.
A template for Step 1 proposals will be provided in the future.
Step 2 - Write, deploy, and verify the ITokenAdapter compliant adapter. See Technical Requirements below at the end of section.
Step 3 - Propose integration of the new yield source using the new adapter.
The following parameters need to be approved in at least one of the two AIPs:
Target network (eg. ETH Mainnet, Optimism, etcโฆ)
Yield bearing asset name & address (include Etherscan & Github links)
Collateral asset name & address (include Etherscan & Github links)
Maximum Loss is expressed in basis points (eg., 50 for 0.5%) more info
Deposit cap (expressed in units of underlying collateral) more info
Credit unlock blocks (how long after a harvest does it take for the yield to be distributed to depositors) more info
The following needs to be approved as well, once development and deployment are complete:
Adapter name & address
include Etherscan link
include Github link to solidity code in the v2-foundry repo
include Github link to deployment artifacts in deployments repo
Multisig transaction details that should be executed by the Alchemix dev multisig, detailed here
NOTE: To be clear, all of the above bullet points only need to be approved ONCE by governance. It is up to the builder whether or not they want pre-approval before creating and deploying the new adapter, or if they want to make a single AIP for approval once the adapter is built, deployed, and verified.
Technical Requirements
Build a token adapter that is compliant with the ITokenAdapter interface, along with a set of unit & integration tests, and make a PR against the master branch of the Alchemix V2 Repo.
Once the Pull Request is approved and merged by the core team, you can deploy the contract to the target network.
Make a pr against the master branch of the deployments repo that includes the artifacts from the deployment (.json file containing, at a minimum, the abi & address of the deployed adapter).
Dev Multisig Transactions
Relevant addresses for already-deployed Alchemix contracts can be found in the deployments repo.
Enable a new adapter
TARGET_ALCHEMIST_ADDRESS.addYieldToken(YIELD_TOKEN_ADDRESS, (ADAPTER_ADDRESS, MAXIMUM_LOSS, MAXIMUM_EXPECTED_VALUE, CREDIT_UNLOCK_BLOCKS));
YIELD_TOKEN_ADDRESS = the address of the yield token being integrated
ADAPTER_ADDRESS = the address of the newly deployed adapter
MAXIMUM_LOSS = the maximum loss value (in bps) from the AIP
MAXIMUM_EXPECTED_VALUE = the deposit cap value (in units of underlying collateral) from the AIP
CREDIT_UNLOCK_BLOCKS = the credit unlock blocks value from the AIP
TARGET_ALCHEMIST_ADDRESS.setYieldTokenEnabled(YIELD_TOKEN_ADDRESS, true);
YIELD_TOKEN_ADDRESS = the address of the yield token being integrated
Upgrade an adapter
(If the newly deployed adapter is an upgraded adapter for an existing yield token)
TARGET_ALCHEMIST_ADDRESS.setTokenAdapter(YIELD_TOKEN_ADDRESS, ADAPTER_ADDRESS);
YIELD_TOKEN_ADDRESS = the address of the yield token being integrated
ADAPTER_ADDRESS = the address of the newly deployed adapter
Create a harvest job for the Alchemix Keeper
HARVEST_RESOLVER_ADDRESS.addHarvestJob(true, YIELD_TOKEN_ADDRESS, ALCHEMIST_ADDRESS, MINIMUM_HARVEST_AMOUNT, MINIMUM_DELAY, SLIPPAGE_BPS);
details on these parameters can be found here
MINIMUM_HARVEST_AMOUNT should be set to a value that can be expected to be harvested every 1-2 days
MINIMUM_DELAY should be set to 1-2 days
Last updated