Skip to content

Commit

Permalink
Merge pull request #296 from CrowdSwap/BLOC-3482
Browse files Browse the repository at this point in the history
BLOC-3482: update withdraw event
  • Loading branch information
vrtnd authored Oct 16, 2024
2 parents 29355c0 + 9607b0f commit 95d08e9
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 15 deletions.
37 changes: 24 additions & 13 deletions src/adapters/crowdswap/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ const gatewayAddresses = {
polygon: "0x9092fCF5Ea1E22f2922eEa132D2931CDd795ab53",
optimism: "0x1B3aE33ff0241999854C05B0CdF821DE55A4404A",
arbitrum: "0x99a68649E927774680e9D3387BF8cCbF93B45230",
defi: "0x9092fCF5Ea1E22f2922eEa132D2931CDd795ab53",
rsk: "0x9Ff74eEA1e7f0f8eE437b70d68F7Cdc1a1030642"
} as {
[chain: string]: string;
};
Expand All @@ -18,7 +20,15 @@ let routerAddresses = {} as {
[chain: string]: string[];
};

const activeChains = ["ethereum", "bsc", "polygon", "optimism", "arbitrum"];
const activeChains = [
"ethereum",
"bsc",
"polygon",
"optimism",
"arbitrum",
// "defi",
// "rsk"
];

for(const chain of activeChains){
if(!routerAddresses[chain]){
Expand All @@ -34,11 +44,11 @@ const constructParams = (chain: string) => {
for (const router of Object.values(routers)) {
const deposit :PartialContractEventParams = {
target: router,
topic: "MessageSent(bytes32,uint256,uint256,uint256,address,address,uint64)",
abi: ["event MessageSent(bytes32 indexed messageId, uint256 sourceAmount, uint256 destinationAmount, uint256 destinationMinAmount, address sourceTokenAddress, address destinationTokenAddress, uint64 indexed destinationChainId)"],
topic: "MessageSent(bytes32,uint256,uint256,uint256,address,address,address,uint64)",
abi: ["event MessageSent(bytes32 indexed messageId, uint256 sourceAmount, uint256 destinationAmount, uint256 destinationMinAmount, address sourceTokenAddress, address destinationTokenAddress, address sender, uint64 indexed destinationChainId)"],
isDeposit: true,
logKeys: {
blockNumber: "blockNumber",
blockNumber: "blockNumber",
txHash: "transactionHash",
},
argKeys: {
Expand All @@ -50,20 +60,19 @@ const constructParams = (chain: string) => {
from: router,
},
};

const withdraw :PartialContractEventParams = {
target: router,
topic: "Sold(bytes32,address,uint256,uint256,address,uint256,uint256,address,uint256,uint256)",
abi: ["event Sold(bytes32 indexed messageId, address sourceTokenAddress, uint256 sourceAmount, uint256 usdValue, address crowdAddress, uint256 crowdAmount, uint256 crowdPrice, address tokenXAddress, uint256 tokenXAmount, uint256 tokenXPrice)"],
isDeposit: false, // event type
topic: "MessageCompleted(bytes32,uint256,address,address)",
abi: ["event MessageCompleted(bytes32 indexed messageId, uint256 destinationAmount, address destinationTokenAddress, address receiver)"],
isDeposit: false, // event type
logKeys: {
blockNumber: "blockNumber",
txHash: "transactionHash",
blockNumber: "blockNumber",
txHash: "transactionHash",
},
argKeys: {
amount: "tokenXAmount",
token: "tokenXAddress",

amount: "destinationAmount",
token: "destinationTokenAddress",
},
fixedEventData: {
from: router,
Expand All @@ -83,6 +92,8 @@ const adapter: BridgeAdapter = {
ethereum: constructParams("ethereum"),
arbitrum: constructParams("arbitrum"),
optimism: constructParams("optimism"),
// defi: constructParams("Defichain"),
// rsk: constructParams("rsk"),
};

export default adapter;
2 changes: 1 addition & 1 deletion src/data/bridgeNetworkData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1509,7 +1509,7 @@ export default [
iconLink: "icons:crowdswap",
largeTxThreshold: 10000,
url: "https://scanner.crowdswap.org/",
chains: ["Ethereum", "Arbitrum", "Optimism", "BSC", "Polygon"],
chains: ["Ethereum", "Arbitrum", "Optimism", "BSC", "Polygon", "DeFi", "RootStock"],
},
{
id: 72,
Expand Down
4 changes: 3 additions & 1 deletion src/utils/recordedBlocks.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,5 +77,7 @@
"crowdswap:polygon": { "startBlock": 56713222, "endBlock": 61657366 },
"crowdswap:bsc": { "startBlock": 40878700, "endBlock": 42133978 },
"crowdswap:arbitrum": { "startBlock": 237073033, "endBlock": 252086093 },
"crowdswap:optimism": { "startBlock": 123302167, "endBlock": 125190128 }
"crowdswap:optimism": { "startBlock": 123302167, "endBlock": 125190128 },
"crowdswap:defi": { "startBlock": 863892, "endBlock": 125190128 },
"crowdswap:rootstock": { "startBlock": 6795853, "endBlock": 125190128 }
}

0 comments on commit 95d08e9

Please sign in to comment.