Skip to content

Commit

Permalink
Merge pull request #320 from gemeniteg/master
Browse files Browse the repository at this point in the history
add chains for owlto
  • Loading branch information
vrtnd authored Dec 21, 2024
2 parents eba9ca2 + 080cff4 commit aa6f0c7
Show file tree
Hide file tree
Showing 2 changed files with 116 additions and 49 deletions.
130 changes: 84 additions & 46 deletions src/adapters/owlto/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,34 +9,6 @@ import { getTxsBlockRangeBtrScan } from "../../helpers/btr";

const retry = require("async-retry");

export const bridgesAddress = {
arbitrum: ["0x5e809A85Aa182A9921EDD10a4163745bb3e36284"],
arbitrum_nova: ["0x5e809A85Aa182A9921EDD10a4163745bb3e36284"],
ethereum: ["0x5e809A85Aa182A9921EDD10a4163745bb3e36284"],
bsc: ["0x5e809A85Aa182A9921EDD10a4163745bb3e36284"],
polygon: ["0x5e809A85Aa182A9921EDD10a4163745bb3e36284"],
optimism: ["0x5e809A85Aa182A9921EDD10a4163745bb3e36284"],
era: ["0x5e809A85Aa182A9921EDD10a4163745bb3e36284"],
polygon_zkevm: ["0x5e809A85Aa182A9921EDD10a4163745bb3e36284"],
base: ["0x5e809A85Aa182A9921EDD10a4163745bb3e36284"],
linea: ["0x5e809A85Aa182A9921EDD10a4163745bb3e36284"],
manta: ["0x5e809A85Aa182A9921EDD10a4163745bb3e36284"],
scroll: ["0x5e809A85Aa182A9921EDD10a4163745bb3e36284"],
mantle: ["0x5e809A85Aa182A9921EDD10a4163745bb3e36284"],
metis: ["0x5e809A85Aa182A9921EDD10a4163745bb3e36284"],
mode: ["0x5e809A85Aa182A9921EDD10a4163745bb3e36284"],
blast: ["0x5e809A85Aa182A9921EDD10a4163745bb3e36284"],
merlin: ["0x5e809A85Aa182A9921EDD10a4163745bb3e36284"],
zkfair: ["0x5e809A85Aa182A9921EDD10a4163745bb3e36284"],
"b2-mainnet": ["0x5e809A85Aa182A9921EDD10a4163745bb3e36284"],
btr: ["0x5e809A85Aa182A9921EDD10a4163745bb3e36284"],
xlayer: ["0x5e809A85Aa182A9921EDD10a4163745bb3e36284"],
taiko: ["0x5e809A85Aa182A9921EDD10a4163745bb3e36284"],
zklink: ["0x5e809A85Aa182A9921EDD10a4163745bb3e36284"],
op_bnb: ["0x5e809A85Aa182A9921EDD10a4163745bb3e36284"],
"bouncebit-mainnet": ["0x5e809A85Aa182A9921EDD10a4163745bb3e36284"],
mint: ["0x5e809A85Aa182A9921EDD10a4163745bb3e36284"],
} as const;

export const contractsAddress = {
arbitrum: ["0x0e83DEd9f80e1C92549615D96842F5cB64A08762"],
Expand All @@ -47,56 +19,101 @@ export const contractsAddress = {
optimism: ["0x0e83DEd9f80e1C92549615D96842F5cB64A08762"],
era: ["0x95cDd9632C924d2cb5586168Cf0Ba7640dF30598"],
polygon_zkevm: ["0xC626845BF4E6a5802Ef774dA0B3DfC6707F015F7"],
base: ["0xC626845BF4E6a5802Ef774dA0B3DfC6707F015F7"],
linea: ["0xC626845BF4E6a5802Ef774dA0B3DfC6707F015F7"],
manta: ["0xC626845BF4E6a5802Ef774dA0B3DfC6707F015F7"],
scroll: ["0xC626845BF4E6a5802Ef774dA0B3DfC6707F015F7"],
base: ["0xB5CeDAF172425BdeA4c186f6fCF30b367273DA19", "0xC626845BF4E6a5802Ef774dA0B3DfC6707F015F7"],
linea: ["0xA562e2510ECDACAa1DB482fd287454AD2B979fa6", "0xC626845BF4E6a5802Ef774dA0B3DfC6707F015F7"],
manta: ["0x936223FA057a7c852d5E7462e7E77DBDb137bff8", "0xC626845BF4E6a5802Ef774dA0B3DfC6707F015F7"],
scroll: ["0x575Dbe0023d2602515a73d4f0B5Ee857E8EbA805", "0xC626845BF4E6a5802Ef774dA0B3DfC6707F015F7"],
mantle: ["0xC626845BF4E6a5802Ef774dA0B3DfC6707F015F7"],
metis: ["0xC626845BF4E6a5802Ef774dA0B3DfC6707F015F7"],
mode: ["0xC626845BF4E6a5802Ef774dA0B3DfC6707F015F7"],
blast: ["0xC626845BF4E6a5802Ef774dA0B3DfC6707F015F7"],
merlin: ["0xC626845BF4E6a5802Ef774dA0B3DfC6707F015F7"],
zkfair: ["0xC626845BF4E6a5802Ef774dA0B3DfC6707F015F7"],
"b2-mainnet": ["0xC626845BF4E6a5802Ef774dA0B3DfC6707F015F7"],
bsquared: ["0xC626845BF4E6a5802Ef774dA0B3DfC6707F015F7"],
btr: ["0xC626845BF4E6a5802Ef774dA0B3DfC6707F015F7"],
xlayer: ["0xC626845BF4E6a5802Ef774dA0B3DfC6707F015F7"],
taiko: ["0xC626845BF4E6a5802Ef774dA0B3DfC6707F015F7"],
zklink: ["0xC626845BF4E6a5802Ef774dA0B3DfC6707F015F7"],
op_bnb: ["0xC626845BF4E6a5802Ef774dA0B3DfC6707F015F7"],
"bouncebit-mainnet": ["0xC626845BF4E6a5802Ef774dA0B3DfC6707F015F7"],
bouncebit: ["0xC626845BF4E6a5802Ef774dA0B3DfC6707F015F7"],
mint: ["0xC626845BF4E6a5802Ef774dA0B3DfC6707F015F7"],
avax: ["0x3F0F0E6411F859Da1A1BbF8bD6217cA93820Bb98"],
xdai: ["0x0e38371051912e49Ee139798a93f36b51Ab1D469"],
morph: ["0x3F0F0E6411F859Da1A1BbF8bD6217cA93820Bb98"],
bob: ["0xC626845BF4E6a5802Ef774dA0B3DfC6707F015F7"],
gravity: ["0xC626845BF4E6a5802Ef774dA0B3DfC6707F015F7"],
zora: ["0xC626845BF4E6a5802Ef774dA0B3DfC6707F015F7"],
kroma: ["0xC626845BF4E6a5802Ef774dA0B3DfC6707F015F7"],
zeta: ["0xC626845BF4E6a5802Ef774dA0B3DfC6707F015F7"],
astrzk: ["0x7CFE8Aa0d8E92CCbBDfB12b95AEB7a54ec40f0F5"],
zircuit: ["0x7CFE8Aa0d8E92CCbBDfB12b95AEB7a54ec40f0F5"],
lisk: ["0x3F0F0E6411F859Da1A1BbF8bD6217cA93820Bb98"],
cyeth: ["0xC626845BF4E6a5802Ef774dA0B3DfC6707F015F7"],
fantom:["0x7CFE8Aa0d8E92CCbBDfB12b95AEB7a54ec40f0F5"],
fuse:["0x7CFE8Aa0d8E92CCbBDfB12b95AEB7a54ec40f0F5"],
klaytn:["0x7CFE8Aa0d8E92CCbBDfB12b95AEB7a54ec40f0F5"],
cronos_zkevm:["0x7CFE8Aa0d8E92CCbBDfB12b95AEB7a54ec40f0F5"],
wc: ["0x5b9d8AdCf93557E95902D1d91Bf73d12Becd2cC9"],
rari:["0xC626845BF4E6a5802Ef774dA0B3DfC6707F015F7"],
ink:["0x7CFE8Aa0d8E92CCbBDfB12b95AEB7a54ec40f0F5"],
matchain:["0x3F0F0E6411F859Da1A1BbF8bD6217cA93820Bb98"],
fraxtal:["0xC626845BF4E6a5802Ef774dA0B3DfC6707F015F7"],
shape:["0x7CFE8Aa0d8E92CCbBDfB12b95AEB7a54ec40f0F5"],
} as const;

const nativeTokens: Record<string, string> = {
ethereum: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
polygon: "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270",
bsc: "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c",
avax:"0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7",
fantom:"0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83",
arbitrum: "0x82af49447d8a07e3bd95bd0d56f35241523fbab1",
optimism: "0x4200000000000000000000000000000000000006",
base: "0x4200000000000000000000000000000000000006",
linea: "0xe5D7C2a44FfDDf6b295A15c148167daaAf5Cf34f",
blast: "0x4300000000000000000000000000000000000004",
scroll: "0x5300000000000000000000000000000000000004",
polygon: "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270",
bsc: "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c",
arbitrum_nova: "0x722E8BdD2ce80A4422E880164f2079488e115365",
polygon_zkevm: "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270",
era: "0x5AEa5775959fBC2557Cc8789bC1bf90A239D9a91",
arbitrum_nova: "0x722E8BdD2ce80A4422E880164f2079488e115365",
merlin: "0xF6D226f9Dc15d9bB51182815b320D3fBE324e1bA",
zklink: "0x8280a4e7D5B3B658ec4580d3Bc30f5e50454F169",
taiko: "0xA51894664A773981C6C112C43ce576f315d5b1B6",
mantle:"0x78c1b0C915c4FAA5FffA6CAbf0219DA63d7f4cb8",
merlin: "0xF6D226f9Dc15d9bB51182815b320D3fBE324e1bA",
btr: "0xff204e2681a6fa0e2c3fade68a1b28fb90e4fc5f",
zklink: "0x8280a4e7D5B3B658ec4580d3Bc30f5e50454F169",
};

type SupportedChains = keyof typeof bridgesAddress;
const depositParams: PartialContractEventParams = {
target: "",
topic: "Deposit(address,address,address,string,uint256,uint256,uint256,uint256)",
abi: [
"event Deposit(address user, address token, address maker, string target, uint256 amount, uint256 destination, uint256 channel, uint256 timestamp)",
],
logKeys: {
blockNumber: "blockNumber",
txHash: "transactionHash",
},
argKeys: {
amount: "amount",
to: "maker",
from: "user",
token: "token",
},
isDeposit: true,
};


type SupportedChains = keyof typeof contractsAddress;

const constructParams = (chain: SupportedChains) => {
const bridgeAddress = bridgesAddress[chain];
const bridgeAddress = ["0x5e809A85Aa182A9921EDD10a4163745bb3e36284"]
const contractAddress = contractsAddress[chain];

let eventParams = [] as any;
bridgeAddress.map((address: string) => {
const transferWithdrawalParams: PartialContractEventParams = constructTransferParams(address, false);
const transferDepositParams: PartialContractEventParams = constructTransferParams(address, true);
eventParams.push(transferWithdrawalParams, transferDepositParams);
eventParams.push(transferWithdrawalParams, transferDepositParams, depositParams);
});

if (nativeTokens.hasOwnProperty(chain)) {
Expand Down Expand Up @@ -194,18 +211,39 @@ const adapter: BridgeAdapter = {
mantle: constructParams("mantle"),
zkfair: constructParams("zkfair"),
merlin: constructParams("merlin"),
bsquared: constructParams("b2-mainnet"),
bsquared: constructParams("bsquared"),
bitlayer: constructParams("btr"),
taiko: constructParams("taiko"),
zklink: constructParams("zklink"),
opbnb: constructParams("op_bnb"),
bouncebit: constructParams("bouncebit-mainnet"),
bouncebit: constructParams("bouncebit"),
mint: constructParams("mint"),

avalanche: constructParams("avax"),
gnosis: constructParams("xdai"),
morph: constructParams("morph"),
bob: constructParams("bob"),
gravity: constructParams("gravity"),
zora: constructParams("zora"),
kroma: constructParams("kroma"),
zetachain: constructParams("zeta"),
zircuit: constructParams("zircuit"),
lisk: constructParams("lisk"),
cyber: constructParams("cyeth"),
fantom:constructParams("fantom"),
fuse:constructParams("fuse"),
kaia:constructParams("klaytn"),
rari:constructParams("rari"),
ink:constructParams("ink"),
matchain:constructParams("matchain"),
shape:constructParams("shape"),
fraxtal:constructParams("fraxtal"),
"cronos zkevm": constructParams("cronos_zkevm"),
'x layer': constructParams("xlayer"),
"arbitrum nova": constructParams("arbitrum_nova"),
"polygon zkevm": constructParams("polygon_zkevm"),
"zksync era": constructParams("era"),
"astar zkevm": constructParams("astrzk"),
"zklink nova": constructParams("zklink"),
"world chain":constructParams("wc"),
};

export default adapter;
35 changes: 32 additions & 3 deletions src/data/bridgeNetworkData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1218,23 +1218,52 @@ export default [
"Bitlayer",
"X Layer",
"Taiko",
"ZkLink",
"zkLink Nova",
"Bouncebit",
"opBNB",
"Mint",

"ZKsync Era",
"Polygon zkEVM",
"Avalanche",
"Gnosis",
"Cronos zkEVM",
"Morph",
"BOB",
"World Chain",
"Gravity",
"Zora",
"Kroma",
"ZetaChain",
"Zircuit",
"Astar zkEVM",
"Lisk",
"Cyber",
"Rari",
"Fantom",
"Fuse",
"Kaia",
"Ink",
"Matchain",
"Shape",
"Fraxtal",
],
chainMapping: {
"arbitrum nova": "arbitrum_nova",
"zksync era": "era",
"polygon zkevm": "polygon_zkevm",
bsquared: "b2-mainnet",
"x layer": "xlayer",
bouncebit: "bouncebit-mainnet",
opbnb: "op_bnb",
bitlayer: "btr",
avalanche: "avax",
gnosis: "xdai",
"cronos zkevm": "cronos_zkevm",
"zetachain": "zeta",
"astar zkevm": "astrzk",
"zklink nova": "zklink",
"world chain": "wc",
"cyber":"cyeth",
"kaia":"klaytn",
},
},
{
Expand Down

0 comments on commit aa6f0c7

Please sign in to comment.