-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add support for swap events (#389)
- Loading branch information
Showing
7 changed files
with
307 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { MigrationInterface, QueryRunner } from "typeorm"; | ||
|
||
export class Deposit1714647751484 implements MigrationInterface { | ||
name = "Deposit1714647751484"; | ||
|
||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`ALTER TABLE "deposit" ADD "swapTokenAddress" character varying`); | ||
await queryRunner.query(`ALTER TABLE "deposit" ADD "swapTokenId" integer`); | ||
await queryRunner.query(`ALTER TABLE "deposit" ADD "swapTokenAmount" numeric`); | ||
await queryRunner.query(` | ||
ALTER TABLE "deposit" | ||
ADD CONSTRAINT "FK_deposit_swapTokenId" | ||
FOREIGN KEY ("swapTokenId") REFERENCES "token"("id") ON DELETE NO ACTION ON UPDATE NO ACTION | ||
`); | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`ALTER TABLE "deposit" DROP CONSTRAINT "FK_deposit_swapTokenId"`); | ||
await queryRunner.query(`ALTER TABLE "deposit" DROP COLUMN "swapTokenAmount"`); | ||
await queryRunner.query(`ALTER TABLE "deposit" DROP COLUMN "swapTokenId"`); | ||
await queryRunner.query(`ALTER TABLE "deposit" DROP COLUMN "swapTokenAddress"`); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { BigNumber, Event } from "ethers"; | ||
|
||
export interface SwapBeforeBridgeEvent extends Event { | ||
args: [string, string, string, BigNumber, BigNumber, string, BigNumber] & { | ||
exchange: string; | ||
swapToken: string; | ||
acrossInputToken: string; | ||
swapTokenAmount: BigNumber; | ||
acrossInputAmount: BigNumber; | ||
acrossOutputToken: string; | ||
acrossOutputAmount: BigNumber; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,218 @@ | ||
[ | ||
{ | ||
"inputs": [ | ||
{ | ||
"internalType": "contract V3SpokePoolInterface", | ||
"name": "_spokePool", | ||
"type": "address" | ||
}, | ||
{ | ||
"internalType": "address", | ||
"name": "_exchange", | ||
"type": "address" | ||
}, | ||
{ | ||
"internalType": "bytes4[]", | ||
"name": "_allowedSelectors", | ||
"type": "bytes4[]" | ||
}, | ||
{ | ||
"internalType": "contract IERC20", | ||
"name": "_swapToken", | ||
"type": "address" | ||
}, | ||
{ | ||
"internalType": "contract IERC20", | ||
"name": "_acrossInputToken", | ||
"type": "address" | ||
} | ||
], | ||
"stateMutability": "nonpayable", | ||
"type": "constructor" | ||
}, | ||
{ | ||
"inputs": [], | ||
"name": "InvalidFunctionSelector", | ||
"type": "error" | ||
}, | ||
{ | ||
"inputs": [], | ||
"name": "LeftoverSrcTokens", | ||
"type": "error" | ||
}, | ||
{ | ||
"inputs": [], | ||
"name": "MinimumExpectedInputAmount", | ||
"type": "error" | ||
}, | ||
{ | ||
"inputs": [], | ||
"name": "ACROSS_INPUT_TOKEN", | ||
"outputs": [ | ||
{ | ||
"internalType": "contract IERC20", | ||
"name": "", | ||
"type": "address" | ||
} | ||
], | ||
"stateMutability": "view", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [], | ||
"name": "EXCHANGE", | ||
"outputs": [ | ||
{ | ||
"internalType": "address", | ||
"name": "", | ||
"type": "address" | ||
} | ||
], | ||
"stateMutability": "view", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [], | ||
"name": "SPOKE_POOL", | ||
"outputs": [ | ||
{ | ||
"internalType": "contract V3SpokePoolInterface", | ||
"name": "", | ||
"type": "address" | ||
} | ||
], | ||
"stateMutability": "view", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [], | ||
"name": "SWAP_TOKEN", | ||
"outputs": [ | ||
{ | ||
"internalType": "contract IERC20", | ||
"name": "", | ||
"type": "address" | ||
} | ||
], | ||
"stateMutability": "view", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [ | ||
{ | ||
"internalType": "bytes4", | ||
"name": "", | ||
"type": "bytes4" | ||
} | ||
], | ||
"name": "allowedSelectors", | ||
"outputs": [ | ||
{ | ||
"internalType": "bool", | ||
"name": "", | ||
"type": "bool" | ||
} | ||
], | ||
"stateMutability": "view", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [ | ||
{ | ||
"internalType": "bytes[]", | ||
"name": "data", | ||
"type": "bytes[]" | ||
} | ||
], | ||
"name": "multicall", | ||
"outputs": [ | ||
{ | ||
"internalType": "bytes[]", | ||
"name": "results", | ||
"type": "bytes[]" | ||
} | ||
], | ||
"stateMutability": "nonpayable", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [ | ||
{ | ||
"internalType": "bytes", | ||
"name": "routerCalldata", | ||
"type": "bytes" | ||
}, | ||
{ | ||
"internalType": "uint256", | ||
"name": "swapTokenAmount", | ||
"type": "uint256" | ||
}, | ||
{ | ||
"internalType": "uint256", | ||
"name": "minExpectedInputTokenAmount", | ||
"type": "uint256" | ||
}, | ||
{ | ||
"components": [ | ||
{ | ||
"internalType": "address", | ||
"name": "outputToken", | ||
"type": "address" | ||
}, | ||
{ | ||
"internalType": "uint256", | ||
"name": "outputAmount", | ||
"type": "uint256" | ||
}, | ||
{ | ||
"internalType": "address", | ||
"name": "depositor", | ||
"type": "address" | ||
}, | ||
{ | ||
"internalType": "address", | ||
"name": "recipient", | ||
"type": "address" | ||
}, | ||
{ | ||
"internalType": "uint256", | ||
"name": "destinationChainid", | ||
"type": "uint256" | ||
}, | ||
{ | ||
"internalType": "address", | ||
"name": "exclusiveRelayer", | ||
"type": "address" | ||
}, | ||
{ | ||
"internalType": "uint32", | ||
"name": "quoteTimestamp", | ||
"type": "uint32" | ||
}, | ||
{ | ||
"internalType": "uint32", | ||
"name": "fillDeadline", | ||
"type": "uint32" | ||
}, | ||
{ | ||
"internalType": "uint32", | ||
"name": "exclusivityDeadline", | ||
"type": "uint32" | ||
}, | ||
{ | ||
"internalType": "bytes", | ||
"name": "message", | ||
"type": "bytes" | ||
} | ||
], | ||
"internalType": "struct SwapAndBridgeBase.DepositData", | ||
"name": "depositData", | ||
"type": "tuple" | ||
} | ||
], | ||
"name": "swapAndBridge", | ||
"outputs": [], | ||
"stateMutability": "nonpayable", | ||
"type": "function" | ||
} | ||
] |