From 9d5a36171173cb0c962c9d2f581223be257f3466 Mon Sep 17 00:00:00 2001 From: Trisome-Bedrock Date: Wed, 7 Aug 2024 18:31:01 +0800 Subject: [PATCH 1/6] add uniBTC adapter --- projects/unibtc/index.js | 43 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 projects/unibtc/index.js diff --git a/projects/unibtc/index.js b/projects/unibtc/index.js new file mode 100644 index 000000000000..7a9834b5ac81 --- /dev/null +++ b/projects/unibtc/index.js @@ -0,0 +1,43 @@ +const { nullAddress } = require("../helper/tokenMapping"); + +const uniBTCAddresses = new Map(); + +uniBTCAddresses.set('bsquared', '0x93919784C523f39CACaa98Ee0a9d96c3F32b593e'); +uniBTCAddresses.set('bitlayer', '0x93919784C523f39CACaa98Ee0a9d96c3F32b593e'); +uniBTCAddresses.set('merlin', '0x93919784C523f39CACaa98Ee0a9d96c3F32b593e'); +uniBTCAddresses.set('ethereum', '0x004E9C3EF86bc1ca1f0bB5C7662861Ee93350568'); +uniBTCAddresses.set('mantle', '0x93919784C523f39CACaa98Ee0a9d96c3F32b593e'); +uniBTCAddresses.set('optimism', '0x93919784C523f39CACaa98Ee0a9d96c3F32b593e'); + + +function chainTvl(chain) { + return async (api) => { + const totalSupply = await api.call({ + abi: 'erc20:totalSupply', + target: uniBTCAddresses.get(chain), + }); + + api.add(nullAddress, totalSupply) + } +} + +module.exports = { + bsquared: { + tvl: chainTvl('bsquared'), + }, + btr: { + tvl: chainTvl('bitlayer'), + }, + merlin: { + tvl: chainTvl('merlin'), + }, + ethereum: { + tvl: chainTvl('ethereum'), + }, + mantle: { + tvl: chainTvl('mantle'), + }, + optimism: { + tvl: chainTvl('optimism'), + } +}; \ No newline at end of file From 5bde5ec8198006c83af343869f8be54f22bf07ac Mon Sep 17 00:00:00 2001 From: 0xpeluche <0xpeluche@protonmail.com> Date: Thu, 8 Aug 2024 11:24:14 +0200 Subject: [PATCH 2/6] sum underlyings tokens in vault instead of uniBTC --- projects/unibtc/index.js | 70 +++++++++++++++++++--------------------- 1 file changed, 34 insertions(+), 36 deletions(-) diff --git a/projects/unibtc/index.js b/projects/unibtc/index.js index 7a9834b5ac81..bd013aa1e752 100644 --- a/projects/unibtc/index.js +++ b/projects/unibtc/index.js @@ -1,43 +1,41 @@ -const { nullAddress } = require("../helper/tokenMapping"); +const ADDRESSES = require('../helper/coreAssets.json') +const defaultVault = '0xF9775085d726E782E83585033B58606f7731AB18' -const uniBTCAddresses = new Map(); - -uniBTCAddresses.set('bsquared', '0x93919784C523f39CACaa98Ee0a9d96c3F32b593e'); -uniBTCAddresses.set('bitlayer', '0x93919784C523f39CACaa98Ee0a9d96c3F32b593e'); -uniBTCAddresses.set('merlin', '0x93919784C523f39CACaa98Ee0a9d96c3F32b593e'); -uniBTCAddresses.set('ethereum', '0x004E9C3EF86bc1ca1f0bB5C7662861Ee93350568'); -uniBTCAddresses.set('mantle', '0x93919784C523f39CACaa98Ee0a9d96c3F32b593e'); -uniBTCAddresses.set('optimism', '0x93919784C523f39CACaa98Ee0a9d96c3F32b593e'); - - -function chainTvl(chain) { - return async (api) => { - const totalSupply = await api.call({ - abi: 'erc20:totalSupply', - target: uniBTCAddresses.get(chain), - }); - - api.add(nullAddress, totalSupply) - } -} - -module.exports = { - bsquared: { - tvl: chainTvl('bsquared'), +const config = { + ethereum: { + vault: '0x047D41F2544B7F63A8e991aF2068a363d210d6Da', + tokens: [ADDRESSES['ethereum'].WBTC, '0xc96de26018a54d51c097160568752c4e3bd6c364'] }, - btr: { - tvl: chainTvl('bitlayer'), + optimism: { + vault: defaultVault, + tokens: [ADDRESSES['optimism'].WBTC] }, - merlin: { - tvl: chainTvl('merlin'), + mantle: { + vault: defaultVault, + tokens: ['0xC96dE26018A54D51c097160568752c4E3BD6C364'] }, - ethereum: { - tvl: chainTvl('ethereum'), + bsquared: { + vault: defaultVault, + tokens: ["0x4200000000000000000000000000000000000006"] }, - mantle: { - tvl: chainTvl('mantle'), + merlin: { + vault: defaultVault, + tokens: ['0xB880fd278198bd590252621d4CD071b1842E9Bcd', '0xF6D226f9Dc15d9bB51182815b320D3fBE324e1bA'] }, - optimism: { - tvl: chainTvl('optimism'), + btr: { + vault: defaultVault, + tokens: ['0xff204e2681a6fa0e2c3fade68a1b28fb90e4fc5f'] + }, +} + +const tvl = (chainConfig) => { + return async (api) => { + return api.sumTokens({ tokens: chainConfig.tokens, owner: chainConfig.vault }) + } +} + +Object.keys(config).forEach(chain => { + module.exports[chain] = { + tvl: tvl(config[chain]) } -}; \ No newline at end of file +}) From 27e2cc3ec2d9950436168614e3e5f82d59197b0a Mon Sep 17 00:00:00 2001 From: 0xpeluche <0xpeluche@protonmail.com> Date: Thu, 8 Aug 2024 12:22:54 +0200 Subject: [PATCH 3/6] add native btc addresses --- projects/unibtc/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/projects/unibtc/index.js b/projects/unibtc/index.js index bd013aa1e752..015135b5c1df 100644 --- a/projects/unibtc/index.js +++ b/projects/unibtc/index.js @@ -16,15 +16,15 @@ const config = { }, bsquared: { vault: defaultVault, - tokens: ["0x4200000000000000000000000000000000000006"] + tokens: ['0x0000000000000000000000000000000000000000',"0x4200000000000000000000000000000000000006"] }, merlin: { vault: defaultVault, - tokens: ['0xB880fd278198bd590252621d4CD071b1842E9Bcd', '0xF6D226f9Dc15d9bB51182815b320D3fBE324e1bA'] + tokens: ["0x0000000000000000000000000000000000000000",'0xB880fd278198bd590252621d4CD071b1842E9Bcd', '0xF6D226f9Dc15d9bB51182815b320D3fBE324e1bA'] }, btr: { vault: defaultVault, - tokens: ['0xff204e2681a6fa0e2c3fade68a1b28fb90e4fc5f'] + tokens: ["0x0000000000000000000000000000000000000000", '0xff204e2681a6fa0e2c3fade68a1b28fb90e4fc5f'] }, } From 01f03e0c928d4bdaf644e018b05038c2005d49fc Mon Sep 17 00:00:00 2001 From: 0xpeluche <0xpeluche@protonmail.com> Date: Thu, 8 Aug 2024 12:28:45 +0200 Subject: [PATCH 4/6] rm address on merlin --- projects/unibtc/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/unibtc/index.js b/projects/unibtc/index.js index 015135b5c1df..8366cb59d117 100644 --- a/projects/unibtc/index.js +++ b/projects/unibtc/index.js @@ -20,7 +20,7 @@ const config = { }, merlin: { vault: defaultVault, - tokens: ["0x0000000000000000000000000000000000000000",'0xB880fd278198bd590252621d4CD071b1842E9Bcd', '0xF6D226f9Dc15d9bB51182815b320D3fBE324e1bA'] + tokens: ["0x0000000000000000000000000000000000000000",'0xB880fd278198bd590252621d4CD071b1842E9Bcd'] }, btr: { vault: defaultVault, From 75b5110fbb0a5958dc08e3244de4586627ed179b Mon Sep 17 00:00:00 2001 From: 0xpeluche <0xpeluche@protonmail.com> Date: Thu, 8 Aug 2024 12:37:10 +0200 Subject: [PATCH 5/6] add native + wbtc tokens coreAssets --- projects/helper/coreAssets.json | 7 ++++++- projects/unibtc/index.js | 6 +++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index 9fd47702a747..439d5911ea56 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -1702,6 +1702,7 @@ "USDC_1": "0x1e3769bd5fb2e9e9e7d4ed8667c947661f9a82e3" }, "merlin": { + "BTC": "0x0000000000000000000000000000000000000000", "SATS": "0x4dcb91cc19aadfe5a6672781eb09abad00c19e4c", "RATS": "0x69181a1f082ea83a152621e4fa527c936abfa501", "ORDI": "0x0726523eba12edad467c55a962842ef358865559", @@ -1780,6 +1781,7 @@ "WETH": "0x4200000000000000000000000000000000000006" }, "bsquared": { + "BTC": "0x0000000000000000000000000000000000000000", "WBTC": "0x4200000000000000000000000000000000000006", "USDT": "0x681202351a488040fa4fdcc24188afb582c9dd62", "USDC": "0xe544e8a38add9b1abf21922090445ba93f74b9e5", @@ -1810,7 +1812,10 @@ "TBTC": "0xbba2ef945d523c4e2608c9e1214c2cc64d4fc2e2" }, "btr": { - "ETH": "0xef63d4e178b3180beec9b0e143e0f37f4c93f4c2" + "ETH": "0xef63d4e178b3180beec9b0e143e0f37f4c93f4c2", + "BTC": "0x0000000000000000000000000000000000000000", + "WBTC": "0xff204e2681a6fa0e2c3fade68a1b28fb90e4fc5f" + }, "taiko": { "USDC": "0x07d83526730c7438048D55A4fc0b850e2aaB6f0b", diff --git a/projects/unibtc/index.js b/projects/unibtc/index.js index 8366cb59d117..85e74143dc24 100644 --- a/projects/unibtc/index.js +++ b/projects/unibtc/index.js @@ -16,15 +16,15 @@ const config = { }, bsquared: { vault: defaultVault, - tokens: ['0x0000000000000000000000000000000000000000',"0x4200000000000000000000000000000000000006"] + tokens: [[ADDRESSES['bsquared'].BTC],[ADDRESSES['bsquared'].WBTC]] }, merlin: { vault: defaultVault, - tokens: ["0x0000000000000000000000000000000000000000",'0xB880fd278198bd590252621d4CD071b1842E9Bcd'] + tokens: [[ADDRESSES['merlin'].BTC],[ADDRESSES['merlin'].WBTC_1]] }, btr: { vault: defaultVault, - tokens: ["0x0000000000000000000000000000000000000000", '0xff204e2681a6fa0e2c3fade68a1b28fb90e4fc5f'] + tokens: [[ADDRESSES['btr'].BTC], [ADDRESSES['btr'].WBTC]] }, } From a2cde18e4f45b1063ce0c9e5b757ea7a18a393c3 Mon Sep 17 00:00:00 2001 From: 0xpeluche <0xpeluche@protonmail.com> Date: Thu, 8 Aug 2024 17:23:55 +0200 Subject: [PATCH 6/6] use address null --- projects/helper/coreAssets.json | 3 --- projects/unibtc/index.js | 6 +++--- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index 439d5911ea56..c8ae320a158a 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -1702,7 +1702,6 @@ "USDC_1": "0x1e3769bd5fb2e9e9e7d4ed8667c947661f9a82e3" }, "merlin": { - "BTC": "0x0000000000000000000000000000000000000000", "SATS": "0x4dcb91cc19aadfe5a6672781eb09abad00c19e4c", "RATS": "0x69181a1f082ea83a152621e4fa527c936abfa501", "ORDI": "0x0726523eba12edad467c55a962842ef358865559", @@ -1781,7 +1780,6 @@ "WETH": "0x4200000000000000000000000000000000000006" }, "bsquared": { - "BTC": "0x0000000000000000000000000000000000000000", "WBTC": "0x4200000000000000000000000000000000000006", "USDT": "0x681202351a488040fa4fdcc24188afb582c9dd62", "USDC": "0xe544e8a38add9b1abf21922090445ba93f74b9e5", @@ -1813,7 +1811,6 @@ }, "btr": { "ETH": "0xef63d4e178b3180beec9b0e143e0f37f4c93f4c2", - "BTC": "0x0000000000000000000000000000000000000000", "WBTC": "0xff204e2681a6fa0e2c3fade68a1b28fb90e4fc5f" }, diff --git a/projects/unibtc/index.js b/projects/unibtc/index.js index 85e74143dc24..20043400c140 100644 --- a/projects/unibtc/index.js +++ b/projects/unibtc/index.js @@ -16,15 +16,15 @@ const config = { }, bsquared: { vault: defaultVault, - tokens: [[ADDRESSES['bsquared'].BTC],[ADDRESSES['bsquared'].WBTC]] + tokens: [ADDRESSES.null,ADDRESSES['bsquared'].WBTC] }, merlin: { vault: defaultVault, - tokens: [[ADDRESSES['merlin'].BTC],[ADDRESSES['merlin'].WBTC_1]] + tokens: [ADDRESSES.null,ADDRESSES['merlin'].WBTC_1] }, btr: { vault: defaultVault, - tokens: [[ADDRESSES['btr'].BTC], [ADDRESSES['btr'].WBTC]] + tokens: [ADDRESSES.null, ADDRESSES['btr'].WBTC] }, }