Skip to content

Commit

Permalink
migrate all files and code to v2
Browse files Browse the repository at this point in the history
  • Loading branch information
hzhu committed Jul 17, 2024
1 parent fb218e5 commit a6254e2
Show file tree
Hide file tree
Showing 34 changed files with 897 additions and 10,283 deletions.
6,831 changes: 0 additions & 6,831 deletions src/abi/ExchangeProxyAbi.ts

This file was deleted.

16 changes: 0 additions & 16 deletions src/abi/MinimalERC20.ts

This file was deleted.

177 changes: 0 additions & 177 deletions src/abi/PermitAndCall.ts

This file was deleted.

136 changes: 60 additions & 76 deletions src/constants.ts
Original file line number Diff line number Diff line change
@@ -1,76 +1,60 @@
export const EVENT_SIGNATURES = {
LimitOrderFilled:
"0xab614d2b738543c0ea21f56347cf696a3a0c42a7cbec3212a5ca22a4dcff2124",
LiquidityProviderSwap:
"0x40a6ba9513d09e3488135e0e0d10e2d4382b792720155b144cbea89ac9db6d34",
OtcOrderFilled:
"0xac75f773e3a92f1a02b12134d65e1f47f8a14eabe4eaf1e24624918e6a8b269f",
MetaTransactionExecuted:
"0x7f4fe3ff8ae440e1570c558da08440b26f89fb1c1f2910cd91ca6452955f121a",
Transfer:
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
TransformedERC20:
"0x0f6672f78a59ba8e5e5b5d38df3ebc67f3c792e2c9259b8d97d7f00dd78ba1b3",
} as const;

export const FUNCTION_SELECTORS = {
permitAndCall: {
IERC2612: "0x34b4d153", // Canonical permit
IERC20PermitAllowed: "0x7f9cb4d7", // Dai permit
IERC20MetaTransaction: "0x9d50b5e4", // Meta Transaction permit
}
} as const

export const EXCHANGE_PROXY_ABI_URL =
"https://raw.githubusercontent.com/0xProject/protocol/development/packages/contract-artifacts/artifacts/IZeroEx.json";

const CANONICAL_EXCHANGE_PROXY = "0xDef1C0ded9bec7F1a1670819833240f027b25EfF";

export const MULTICALL3 = "0xcA11bde05977b3631167028862bE2a173976CA11";

export const PERMIT_AND_CALL_BY_CHAIN_ID = {
1: "0x1291C02D288de3De7dC25353459489073D11E1Ae",
137: "0x2Ddd30fE5c12FC4CD497526F14Bf3d1fcd3D5Db4",
8453: "0x3CA53031Ad0B86a304845e83644983Be3340895f",
} as const;

export const EXCHANGE_PROXY_BY_CHAIN_ID = {
1: CANONICAL_EXCHANGE_PROXY,
5: "0xF91bB752490473B8342a3E964E855b9f9a2A668e",
10: "0xDEF1ABE32c034e558Cdd535791643C58a13aCC10",
56: CANONICAL_EXCHANGE_PROXY,
137: CANONICAL_EXCHANGE_PROXY,
250: "0xDEF189DeAEF76E379df891899eb5A00a94cBC250",
8453: CANONICAL_EXCHANGE_PROXY,
42161: CANONICAL_EXCHANGE_PROXY,
42220: CANONICAL_EXCHANGE_PROXY,
43114: CANONICAL_EXCHANGE_PROXY,
} as const;

export const CONTRACTS = {
weth: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
} as const;

export const NATIVE_ASSET = {
symbol: "ETH",
decimals: 18,
address: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
} as const;

export const NATIVE_SYMBOL_BY_CHAIN_ID = {
1: "ETH", // Ethereum
5: "ETH", // Goerli
10: "ETH", // Optimism
56: "BNB", // BNB Chain
137: "MATIC", // Polygon
250: "FTM", // Fantom
8453: "ETH", // Base
42161: "ETH", // Arbitrum One
42220: "CELO", // Celo
43114: "AVAX", // Avalanche
} as const;

export enum TRANSACTION_STATUS {
REVERTED = "reverted",
SUCCESS = "success",
}
import type { SupportedChainId } from "./types";

export const SETTLER_ABI = [
{
inputs: [
{
components: [
{ internalType: "address", name: "recipient", type: "address" },
{
internalType: "contract IERC20",
name: "buyToken",
type: "address",
},
{ internalType: "uint256", name: "minAmountOut", type: "uint256" },
],
internalType: "struct SettlerBase.AllowedSlippage",
name: "slippage",
type: "tuple",
},
{ internalType: "bytes[]", name: "actions", type: "bytes[]" },
{ internalType: "bytes32", name: "", type: "bytes32" },
{ internalType: "address", name: "msgSender", type: "address" },
{ internalType: "bytes", name: "sig", type: "bytes" },
],
name: "executeMetaTxn",
outputs: [{ internalType: "bool", name: "", type: "bool" }],
stateMutability: "nonpayable",
type: "function",
},
];

export const NATIVE_TOKEN_ADDRESS =
"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";

export const NATIVE_SYMBOL_BY_CHAIN_ID: { [key in SupportedChainId]: string } =
{
1: "ETH", // Ethereum
10: "ETH", // Optimism
56: "BNB", // BNB Chain
137: "MATIC", // Polygon
8453: "ETH", // Base
42161: "ETH", // Arbitrum One
43114: "AVAX", // Avalanche
};

export const SETTLER_META_TXN_BY_CHAIN_ID: {
[key in SupportedChainId]: string;
} = {
1: "0x7C39a136EA20B3483e402EA031c1f3C019bAb24b",
10: "0x4069560a180EbD76bB1aF947f5119Fe555BB4eA0",
56: "0x73C25Ef091Ce3F2451946Be3f982549776bFED31",
137: "0xF9332450385291b6dcE301917aF6905e28E8f35f",
8453: "0x5CE929DDB01804bfF35B2F5c77b735bdB094AAc8",
42161: "0x1aa84EB5cb62f686FC0D908AFd85864f4A05d5Ee",
43114: "0x2adb2cE26848B94E13d2f7fE0fF7E945050D741c",
};

export const MULTICALL3_ADDRESS = "0xcA11bde05977b3631167028862bE2a173976CA11";

export const NATIVE_ETH_ADDRESS = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
Loading

0 comments on commit a6254e2

Please sign in to comment.