Skip to content

Commit

Permalink
Merge pull request #29 from DefiLlama/base
Browse files Browse the repository at this point in the history
add base bridge
  • Loading branch information
vrtnd authored Aug 4, 2023
2 parents 7b43ed1 + 60171c5 commit 831bdc5
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 15 deletions.
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,24 @@
"@types/node": "^18.6.4",
"@types/node-fetch": "^2.6.2",
"babel-loader": "^8.2.5",
"eslint-config-prettier": "^8.3.0",
"prettier": "^2.5.1",
"serverless": "^3.21.0",
"serverless-offline": "^9.1.6",
"serverless-prune-plugin": "^2.0.1",
"eslint-config-prettier": "^8.3.0",
"prettier": "^2.5.1",
"ts-loader": "^9.3.1"
},
"dependencies": {
"@defillama/sdk": "^4.0.32",
"node-fetch": "^2.6.7",
"postgres": "^3.2.4",
"bignumber.js": "^9.0.1",
"@defillama/sdk": "^4.0.43",
"async-retry": "^1.3.1",
"axios": "^0.21.0",
"axios-rate-limit": "^1.3.0",
"bignumber.js": "^9.0.1",
"dotenv": "^8.2.0",
"serverless-webpack": "^5.8.0",
"graphql": "^16.0.0",
"graphql-request": "^4.0.0"
"graphql-request": "^4.0.0",
"node-fetch": "^2.6.7",
"postgres": "^3.2.4",
"serverless-webpack": "^5.8.0"
}
}
38 changes: 38 additions & 0 deletions src/adapters/base/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { BridgeAdapter, PartialContractEventParams } from "../../helpers/bridgeAdapter.type";
import { getTxDataFromEVMEventLogs } from "../../helpers/processTransactions";
import { constructTransferParams } from "../../helpers/eventParams";

const WETH = "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2";

const ethDepositParams: PartialContractEventParams = {
target: "0x49048044D57e1C92A77f79988d21Fa8fAF74E97e",
topic: "TransactionDeposited(address,address,uint256,bytes)",
abi: [
"event TransactionDeposited(address indexed from,address indexed to, uint256 indexed version, bytes opaqueData)",
],
logKeys: {
blockNumber: "blockNumber",
txHash: "transactionHash",
},
txKeys: {
from: "from",
amount: "value",
},
fixedEventData: {
token: WETH,
to: "0x49048044D57e1C92A77f79988d21Fa8fAF74E97e",
},
isDeposit: true,
};

const constructParams = () => {
const eventParams = [ethDepositParams];
return async (fromBlock: number, toBlock: number) =>
getTxDataFromEVMEventLogs("base", "ethereum", fromBlock, toBlock, eventParams);
};

const adapter: BridgeAdapter = {
ethereum: constructParams(),
};

export default adapter;
2 changes: 2 additions & 0 deletions src/adapters/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import zksync from "./zksync";
import polygon_zkevm from "./polygon_zkevm";
import symbiosis from "./symbiosis";
import meson from "./meson";
import base from "./base";

export default {
polygon,
Expand Down Expand Up @@ -60,6 +61,7 @@ export default {
polygon_zkevm,
symbiosis,
meson,
base,
} as {
[bridge: string]: BridgeAdapter;
};
10 changes: 10 additions & 0 deletions src/data/bridgeNetworkData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -442,4 +442,14 @@ export default [
avalanche: "avax",
},
},
{
id: 29,
displayName: "Base Bridge",
bridgeDbName: "base",
iconLink: "chain:base",
largeTxThreshold: 10000,
url: "",
chains: ["Ethereum", "Base"],
destinationChain: "Base",
},
] as BridgeNetwork[];

0 comments on commit 831bdc5

Please sign in to comment.