Skip to content

Commit

Permalink
Merge pull request #171 from lolieatapple/master
Browse files Browse the repository at this point in the history
Add mappingToken events for WanBridge
  • Loading branch information
vrtnd committed Apr 21, 2024
2 parents f3449e2 + d5e9cf1 commit e04f6d8
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
50 changes: 50 additions & 0 deletions src/adapters/wanbridge/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,24 @@ const userLockPortalEventParams: ContractEventParams = {
isDeposit: true,
};

const userBurnPortalEventParams: ContractEventParams = {
target: "",
topic: "UserBurnLogger(bytes32,uint256,address,uint256,uint256,uint,bytes)",
abi: [
"event UserBurnLogger(bytes32 indexed smgID, uint indexed tokenPairID, address indexed tokenAccount, uint value, uint contractFee, uint fee, bytes userAccount)",
],
logKeys: {
blockNumber: "blockNumber",
txHash: "transactionHash",
},
argKeys: {
from: "userAccount",
amount: "value",
token: "tokenAccount",
},
isDeposit: true,
};

const smgReleasePortalEventParams: ContractEventParams = {
target: "",
topic: "SmgReleaseLogger(bytes32,bytes32,uint256,uint256,address,address)",
Expand All @@ -127,6 +145,24 @@ const smgReleasePortalEventParams: ContractEventParams = {
isDeposit: false,
};

const smgMintPortalEventParams: ContractEventParams = {
target: "",
topic: "SmgMintLogger(bytes32,bytes32,uint256,uint256,address,address)",
abi: [
"event SmgMintLogger(bytes32 indexed uniqueID, bytes32 indexed smgID, uint indexed tokenPairID, uint value, address tokenAccount, address userAccount)",
],
logKeys: {
blockNumber: "blockNumber",
txHash: "transactionHash",
},
argKeys: {
to: "userAccount",
amount: "value",
token: "tokenAccount",
},
isDeposit: false,
};

const constructParams = (chain: Chains) => {
const { portal } = contractAddresses[chain];
const eventParams: ContractEventParams[] = [
Expand All @@ -137,13 +173,27 @@ const constructParams = (chain: Chains) => {
to: portal,
},
},
{
...userBurnPortalEventParams,
target: portal,
fixedEventData: {
to: portal,
},
},
{
...smgReleasePortalEventParams,
target: portal,
fixedEventData: {
from: portal,
},
},
{
...smgMintPortalEventParams,
target: portal,
fixedEventData: {
from: portal,
},
},
];
return async (fromBlock: number, toBlock: number) =>
getTxDataFromEVMEventLogs("wanbridge", chain, fromBlock, toBlock, eventParams);
Expand Down
1 change: 1 addition & 0 deletions src/data/bridgeNetworkData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,7 @@ export default [
largeTxThreshold: 10000,
url: "https://bridge.wanchain.org",
chains: [
"Bitcoin",
"Ethereum",
"Polygon",
"Fantom",
Expand Down

0 comments on commit e04f6d8

Please sign in to comment.