Sub-Adapters 1
Preview and test each sub adapter.
Loopring (loopring)
Metadata
- ID
- loopring
- icon
- category
"l2"
- name
"Loopring"
- description
"Loopring's zkRollup L2 solution aims to offer the same security guarantees as Ethereum mainnet, with a big scalability boost: throughput increased by 1000x, and cost reduced to just 0.1% of L1."
- l2BeatSlug
"loopring"
- website
"https://loopring.io"
- flagsByQuery
{ "feeSwap": { "info": "Fee for a 0.1 ETH swap. Loopring charges a 0.25% fee on all AMM trades" } }
Queries
Adapter Code
Check the entire code written for the Adapter.
Source code
1export const name = 'Loopring Transaction Fees';
2export const version = '0.1.0';
3export const license = 'MIT';
4
5export function setup(sdk: Context) {
6 const getFeeForTransfer = async () => {
7 const feeData = await sdk.http.get('https://cryptostats-api-proxy.vercel.app/api/v1/loopring/fees');
8
9 for (const feeToken of feeData.fees) {
10 if (feeToken.token === 'USDC') {
11 return feeToken.fee / 1e6;
12 }
13 }
14
15 throw new Error('USDC fee not found');
16 }
17 const getFeeForSwap = async () => {
18 const ethPrice = await sdk.coinGecko.getCurrentPrice('ethereum');
19 return ethPrice * 0.0025 * 0.1;
20 }
21
22 sdk.register({
23 id: 'loopring',
24 queries: {
25 feeTransferEth: getFeeForTransfer,
26 feeTransferERC20: getFeeForTransfer,
27 feeSwap: getFeeForSwap,
28 },
29 metadata: {
30 icon: sdk.ipfs.getDataURILoader('QmZC3WbPX77hYvh6EXuMiBAHBHd3M81EA4BJiKRLyL6vMk', 'image/svg+xml'),
31 category: 'l2',
32 name: 'Loopring',
33 description: 'Loopring\'s zkRollup L2 solution aims to offer the same security guarantees as Ethereum mainnet, with a big scalability boost: throughput increased by 1000x, and cost reduced to just 0.1% of L1.',
34 l2BeatSlug: 'loopring',
35 website: 'https://loopring.io',
36 flagsByQuery: {
37 feeSwap: {
38 info: 'Fee for a 0.1 ETH swap. Loopring charges a 0.25% fee on all AMM trades',
39 },
40 },
41 },
42 });
43}
44
It's something off?
Report it to the discussion board on Discord, we will take care of it.