Skip to content

Commit

Permalink
Merge pull request #317 from jonathansmirnoff/feat/add-rootstock-flyover
Browse files Browse the repository at this point in the history
Add PowPeg Fast Mode (Flyover)
  • Loading branch information
vrtnd authored Dec 22, 2024
2 parents aa6f0c7 + 488bcc5 commit f15f0c9
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/adapters/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ import wormhole from "./wormhole";
import thresholdnetwork from "./threshold-network";
import zircuit from "./zircuit";
import hyperliquid from "./hyperliquid";
import flyover from "./rootstock-flyover";

export default {
polygon,
Expand Down Expand Up @@ -155,6 +156,7 @@ export default {
thresholdnetwork,
zircuit,
hyperliquid,
flyover
} as {
[bridge: string]: BridgeAdapter | AsyncBridgeAdapter;
};
58 changes: 58 additions & 0 deletions src/adapters/rootstock-flyover/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import { BigNumber, ethers } from "ethers";
import { BridgeAdapter, ContractEventParams } from "../../helpers/bridgeAdapter.type";
import { getTxDataFromEVMEventLogs } from "../../helpers/processTransactions";

const flyoverContract = "0xAA9cAf1e3967600578727F975F283446A3Da6612";
const rbtc = "0x542fDA317318eBF1d3DEAf76E0b632741A7e677d";

const depositPegoutEventParams: ContractEventParams = {
target: flyoverContract,
topic: "PegOutDeposit(bytes32,address,uint256,uint256)",
abi: ["event PegOutDeposit(bytes32 indexed quoteHash, address indexed sender, uint256 amount, uint256 timestamp)"],
logKeys: {
blockNumber: "blockNumber",
txHash: "transactionHash",
},
fixedEventData: {
token: rbtc,
to: flyoverContract,
},
argKeys: {
amount: "amount",
from: "sender",
},
isDeposit: false,
};

const callForUserEventParams: ContractEventParams = {
target: flyoverContract,
topic: "CallForUser(address,address,uint256,uint256,bytes,bool,bytes32)",
abi: ["event CallForUser(address indexed from, address indexed dest, uint256 gasLimit, uint256 value, bytes data, bool success, bytes32 quoteHash)"],
logKeys: {
blockNumber: "blockNumber",
txHash: "transactionHash",
},
fixedEventData: {
token: rbtc,
from: flyoverContract,
},
argKeys: {
amount: "value",
to: "dest",
},
isDeposit: true,
};

const constructParams = () => {
const eventParams = [depositPegoutEventParams, callForUserEventParams];
return async (fromBlock: number, toBlock: number) => {
const logs = await getTxDataFromEVMEventLogs("flyover", "rsk", fromBlock, toBlock, eventParams);
return logs;
};
};

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

export default adapter;
13 changes: 13 additions & 0 deletions src/data/bridgeNetworkData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1791,4 +1791,17 @@ export default [
chains: ["Arbitrum", "Hyperliquid"],
destinationChain: "Hyperliquid",
},
{
id: 81,
displayName: "PowPeg Fast Mode (Flyover)",
bridgeDbName: "flyover",
iconLink: "icons:rsk",
largeTxThreshold: 10000,
url: "https://powpeg.rootstock.io/",
chains: ["Rootstock", "Bitcoin"],
chainMapping: {
rootstock: "rsk",
},
destinationChain: "Bitcoin",
},
] as BridgeNetwork[];

0 comments on commit f15f0c9

Please sign in to comment.