Enable LINK as a collateral for DAI and USDC
LINK has a $24,840,000,000.00 USD fully diluted market cap and 628,222 holders.
To enable LINK as a collateral we will be using the LINK/ETH chainlink price feed as a source of price data.
The addChainlinkCollateral-1.ts and addChainlinkCollateral-2.ts scripts will be used, with this input:
export const assets: Map<number, Map<string, string>> = new Map([
[1, new Map([
[ETH, '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2'],
[DAI, '0x6B175474E89094C44Da98b954EedeAC495271d0F'],
[USDC, '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48'],
[LINK, '0x514910771af9ca656af840dff83e8264ecf986ca'],
])],
[42, new Map([
[ETH, '0x55C0458edF1D8E07DF9FB44B8960AecC515B4492'],
[DAI, '0xaFCdc724EB8781Ee721863db1B15939675996484'],
[USDC, '0xeaCB3AAB4CA68F1e6f38D56bC5FCc499B76B4e2D'],
[LINK, '0xB62FCB2ef1d1819aED135F567859b080ddFe1008'],
])],
])
export const chainlinkSources: Map<number, Array<[string, string, string, string, string]>> = new Map([
[1, [
[LINK, (assets.get(1) as Map<string, string>).get(LINK) as string, ETH, (assets.get(1) as Map<string, string>).get(ETH) as string, '0xDC530D9457755926550b59e8ECcdaE7624181557'],
]],
[42, [
[LINK, (assets.get(42) as Map<string, string>).get(LINK) as string, ETH, (assets.get(42) as Map<string, string>).get(ETH) as string, '0x3Af8C569ab77af5230596Acf0E8c2F9351d24C38'],
]],
])
export const whale: Map<number, string> = new Map([
[1, '0x0d4f1ff895d12c34994d6b65fabbeefdc1a9fb39'],
[42, '0x5AD7799f02D5a829B2d6FA085e6bd69A872619D5'],
])
// Assets for which we will have a Join
export const assetToAdd: Map<number, [string, string]> = new Map([
[1, [LINK, (assets.get(1) as Map<string, string>).get(LINK) as string]],
[42, [LINK, (assets.get(42) as Map<string, string>).get(LINK) as string]],
])
// Input data: baseId, ilkId, oracle name, ratio (1000000 == 100%), inv(ratio), line, dust, dec
export const limits: Array<[string, string, string, number, number, number, number, number]> = [
[DAI, LINK, CHAINLINK, 1670000, 1000000, 1000000, 100, 18],
[USDC, LINK, CHAINLINK, 1670000, 1000000, 1000000, 100, 6],
]
// Input data: seriesId, [ilkId]
export const seriesIlks: Array<[string, string[]]> = [
[FYDAI2112, [LINK]],
[FYDAI2203, [LINK]],
[FYUSDC2112, [LINK]],
[FYUSDC2203, [LINK]],
]
- Deploy a Join for UNI using the Wand
- Orchestrate and configure oracles
- Permission the UNIJoin
- Make LINK into an Ilk
- Approve LINK as collateral for all series
# Testing
The change has been tested on a mainnet fork by posting LINK to all series, borrowing, repaying and wthdrawing. [Script](https://github.com/yieldprotocol/environments-v2/tree/feat/add-chainlink-collateral/scripts/governance/addChainlinkCollateral/addChainlinkCollateral.test.ts).
alberto@alberto-laptop:~/Code/Yield/environments-v2$ npx hardhat run --network localhost scripts/governance/addChainlinkCollateral/addChainlinkCollateral.test.ts Creating Typechain artifacts in directory typechain for target ethers-v5 Successfully generated Typechain artifacts! ChainId: 1 Running on a fork, impersonating 0xC7aE076086623ecEA2450e364C838916a043F9a8 24679867136918000000000000 UNI available series: 0x303130340000 vault: 0x1d25679657c550a823332384 posted and borrowed repaid and withdrawn series: 0x303130350000 vault: 0x9f888385ed574463c9e909e5 posted and borrowed repaid and withdrawn series: 0x303230340000 vault: 0x6b5f6b084071e62665bc8352 posted and borrowed repaid and withdrawn series: 0x303230350000 vault: 0xfde5d42a23ef18623d39c152 posted and borrowed repaid and withdrawn