Sub-Adapters 1
Preview and test each sub adapter.
Wrapped Bitcoin (wbtc)
Metadata
- ID
- wbtc
- name
"Wrapped Bitcoin"
- icon
- chainA
"bitcoin"
- chainB
"ethereum"
- category
"multisig"
Queries
Adapter Code
Check the entire code written for the Adapter.
Source code
Showing TS source.
1export const name = 'Wrapped Bitcoin';
2export const version = '0.0.2';
3export const license = 'MIT';
4
5export function setup(sdk: Context) {
6 const getSupply = async () => {
7 const [supply, price] = await Promise.all([
8 sdk.ethers.getERC20Contract('0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599').totalSupply(),
9 sdk.coinGecko.getCurrentPrice('bitcoin'),
10 ]);
11
12 return supply / 1e8 * price;
13 }
14
15 sdk.registerBundle('wbtc', {
16 name: 'Wrapped Bitcoin',
17 icon: sdk.ipfs.getDataURILoader('QmUug1bUQxp1uHvCQkjyj8dc8kahGbGmrvMAAd1whpwP1P', 'image/svg+xml'),
18 category: 'multisig',
19 });
20
21 sdk.register({
22 id: 'wbtc',
23 bundle: 'wbtc',
24 queries: {
25 currentValueBridgedAToB: getSupply,
26 currentValueBridgedBToA: async () => 0,
27 },
28 metadata: {
29 name: 'Wrapped Bitcoin',
30 icon: sdk.ipfs.getDataURILoader('QmUug1bUQxp1uHvCQkjyj8dc8kahGbGmrvMAAd1whpwP1P', 'image/svg+xml'),
31
32 chainA: 'bitcoin',
33 chainB: 'ethereum',
34 category: 'multisig',
35 },
36 });
37}
38
It's something off?
Report it to the discussion board on Discord, we will take care of it.