Skip to content

Commit

Permalink
Merge pull request #145 from XY-Finance/feature/xy_finance_withdrawal…
Browse files Browse the repository at this point in the history
…_event

XY Finance: add xy adapter back & withdrawal event
  • Loading branch information
vrtnd authored Mar 3, 2024
2 parents d2b7275 + 198b9c9 commit 525f745
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 35 deletions.
25 changes: 25 additions & 0 deletions src/adapters/xy-finance/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,28 @@ const getYBridgeSwapRequestedEventParams = (chain: Exclude<Chain, Chain.Numbers>
}
}

const getYBridgeSwappedForUserEventParams = (chain: Exclude<Chain, Chain.Numbers>) => {
const contractAddress = YBridgeContractAddress[chain]
return {
target: contractAddress,
topic: 'SwappedForUser(address,address,uint256,address,uint256,address)',
abi: [
"event SwappedForUser(address indexed _aggregatorAdaptor, address indexed _srcToken, uint256 _srcTokenAmount, address _dstToken, uint256 _dstTokenAmountOut, address _receiver)",
],
logKeys: {
blockNumber: "blockNumber",
txHash: "transactionHash",
},
argKeys: {
token: "_dstToken",
amount: "_dstTokenAmountOut",
from: "_srcToken",
to: "_receiver",
},
isDeposit: false,
}
}

export const getXYRouterRequestedEventParams = (chain: Chain) => {
const contractAddress = XYRouterContractAddress[chain]
return {
Expand Down Expand Up @@ -101,7 +123,10 @@ const constructParams = (chain: Chain) => {
const eventParams: (ContractEventParams | PartialContractEventParams)[] = [getXYRouterRequestedEventParams(chain)]

if (chain !== Chain.Numbers) {
/** Deposit */
eventParams.push(getYBridgeSwapRequestedEventParams(chain))
/** Withdrawal */
eventParams.push(getYBridgeSwappedForUserEventParams(chain))
}

return async (fromBlock: number, toBlock: number) =>
Expand Down
70 changes: 35 additions & 35 deletions src/data/bridgeNetworkData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -708,41 +708,41 @@ export default [
},
destinationChain: "ShimmerEVM",
},
// {
// id: 46,
// displayName: "XY Finance",
// bridgeDbName: "xy",
// iconLink: "protocols:xy-finance",
// largeTxThreshold: 10000,
// url: "https://app.xy.finance",
// chains: [
// "Ethereum",
// "Scroll",
// "Mantle",
// "Linea",
// "Base",
// "Arbitrum",
// "zkSync Era",
// "BSC",
// "Polygon",
// "Klaytn",
// "Polygon zkEVM",
// "Avalanche",
// "Optimism",
// "Cronos",
// "Fantom",
// "Astar",
// "KCC",
// "Moonriver",
// "ThunderCore",
// // "Numbers",
// ],
// chainMapping: {
// "zksync era": "era",
// "polygon zkevm": "polygon_zkevm",
// avalanche: "avax",
// },
// },
{
id: 46,
displayName: "XY Finance",
bridgeDbName: "xy",
iconLink: "protocols:xy-finance",
largeTxThreshold: 10000,
url: "https://app.xy.finance",
chains: [
"Ethereum",
"Scroll",
"Mantle",
"Linea",
"Base",
"Arbitrum",
"zkSync Era",
"BSC",
"Polygon",
"Klaytn",
"Polygon zkEVM",
"Avalanche",
"Optimism",
"Cronos",
"Fantom",
"Astar",
"KCC",
"Moonriver",
"ThunderCore",
// "Numbers",
],
chainMapping: {
"zksync era": "era",
"polygon zkevm": "polygon_zkevm",
avalanche: "avax",
},
},
// {
// id: 47,
// displayName: "Butter Network",
Expand Down

0 comments on commit 525f745

Please sign in to comment.