Sub-Adapters 1
Preview and test each sub adapter.
Metis Network (metisnetwork)
Metadata
- ID
- metisnetwork
- icon
- category
"l2"
- name
"Metis Network"
- description
"Metis is an L2 Ethereum Optimistic Chain storing tx data in MEMO distributed storage system. Cheap/fast tx/NFT storage/NOCODE integration/Web3 economy hub (DAC), Builder Mining! Swap/stake/LP, mint NFTs, launch Games & more!"
- l2BeatSlug
"metis"
- website
"https://www.metis.io/"
- flags
{ "warning": "Data availability not provided by Ethereum. Visit L2Beat.com for details." }
Queries
Adapter Code
Check the entire code written for the Adapter.
Source code
1/**
2 * Note:
3 * Metis is a native token and Ethereum is a wrapped ERC20 on Metis L2.
4 *
5 * L2 Gas Cost = Gas price * Gas used
6 * The L1 data fee will be included in gas used
7 */
8export const name = "Metis Layer2 Transaction Fees";
9export const version = "0.0.5";
10export const license = "MIT";
11
12export function setup(sdk: Context) {
13 sdk.ethers.addProvider("metis", "https://andromeda.metis.io/?owner=1088");
14 const provider = sdk.ethers.getProvider("metis");
15
16 const getTransferMetisCost = async () => {
17 const l2GasPrice = await provider.getGasPrice();
18 const l2GasEstimate = await provider.estimateGas({
19 from: "0xdeaDDeADDEaDdeaDdEAddEADDEAdDeadDEADDEaD",
20 to: "0xdeaDDeADDEaDdeaDdEAddEADDEAdDeadDEADDEaD",
21 value: "0x1",
22 });
23 let totalGasCostWei = l2GasPrice.mul(l2GasEstimate).toNumber();
24 const metisPrice = await sdk.coinGecko.getCurrentPrice("metis-token");
25 return (totalGasCostWei * metisPrice) / 1e18;
26 };
27
28 const getTransferEthCost = async () => {
29 const l2GasPrice = await provider.getGasPrice();
30 const l2GasEstimate = await provider.estimateGas({
31 from: "0xdeaDDeADDEaDdeaDdEAddEADDEAdDeadDEADDEaD",
32 to: "0x420000000000000000000000000000000000000A",
33 data: "0xa9059cbb000000000000000000000000deaddeaddeaddeaddeaddeaddeaddeaddeaddead0000000000000000000000000000000000000000000000000000000000000000",
34 });
35 let totalGasCostWei = l2GasPrice.mul(l2GasEstimate).toNumber();
36 const metisPrice = await sdk.coinGecko.getCurrentPrice("metis-token");
37 return (totalGasCostWei * metisPrice) / 1e18;
38 };
39
40 const getTransferTokenCost = async () => {
41 return getTransferEthCost();
42 };
43
44 const getSwapCost = async () => {
45 // Netswap
46 const l2GasPrice = await provider.getGasPrice();
47 const l2GasEstimate = await provider.estimateGas({
48 from: "0xdeaDDeADDEaDdeaDdEAddEADDEAdDeadDEADDEaD",
49 to: "0x1e876cce41b7b844fde09e38fa1cf00f213bff56",
50 value: "0x931eaf56c00",
51 data: "0xd5968e2700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000deaddeaddeaddeaddeaddeaddeaddeaddeaddead00000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000deaddeaddeaddeaddeaddeaddeaddeaddead0000000000000000000000000000bb06dca3ae6887fabf931640f67cab3e3a16f4dc",
52 });
53 let totalGasCostWei = l2GasPrice.mul(l2GasEstimate).toNumber();
54 const metisPrice = await sdk.coinGecko.getCurrentPrice("metis-token");
55 return (totalGasCostWei * metisPrice) / 1e18;
56 };
57
58 sdk.register({
59 id: "metisnetwork",
60 queries: {
61 feeTransferMeits: getTransferMetisCost,
62 feeTransferEth: getTransferEthCost,
63 feeTransferERC20: getTransferTokenCost,
64 feeSwap: getSwapCost,
65 },
66 metadata: {
67 icon: sdk.ipfs.getDataURILoader(
68 "QmcWNT2Hncbp7WUPWW4dDxNCHscN1V8TfZYfFBoyBKEDnc",
69 "image/svg+xml"
70 ),
71 category: "l2",
72 name: "Metis Network",
73 description:
74 "Metis is an L2 Ethereum Optimistic Chain storing tx data in MEMO distributed storage system. Cheap/fast tx/NFT storage/NOCODE integration/Web3 economy hub (DAC), Builder Mining! Swap/stake/LP, mint NFTs, launch Games & more!",
75 l2BeatSlug: "metis",
76 website: "https://www.metis.io/",
77 flags: {
78 warning: 'Data availability not provided by Ethereum. Visit L2Beat.com for details.',
79 },
80 },
81 });
82}
83
It's something off?
Report it to the discussion board on Discord, we will take care of it.