Skip to content

Commit

Permalink
Merge 0ce3647 into 2a0dff3
Browse files Browse the repository at this point in the history
  • Loading branch information
ChiTimesChi authored Dec 17, 2024
2 parents 2a0dff3 + 0ce3647 commit 078d91b
Show file tree
Hide file tree
Showing 34 changed files with 6,484 additions and 51 deletions.
1,203 changes: 1,203 additions & 0 deletions packages/sdk-router/src/abi/FastBridgeV2.json

Large diffs are not rendered by default.

56 changes: 56 additions & 0 deletions packages/sdk-router/src/abi/IDefaultActions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
[
{
"type": "function",
"name": "addLiquidity",
"inputs": [
{ "name": "amounts", "type": "uint256[]", "internalType": "uint256[]" },
{ "name": "minToMint", "type": "uint256", "internalType": "uint256" },
{ "name": "deadline", "type": "uint256", "internalType": "uint256" }
],
"outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "deposit",
"inputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }],
"outputs": [],
"stateMutability": "payable"
},
{
"type": "function",
"name": "removeLiquidityOneToken",
"inputs": [
{ "name": "tokenAmount", "type": "uint256", "internalType": "uint256" },
{ "name": "tokenIndex", "type": "uint8", "internalType": "uint8" },
{ "name": "minAmount", "type": "uint256", "internalType": "uint256" },
{ "name": "deadline", "type": "uint256", "internalType": "uint256" }
],
"outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "swap",
"inputs": [
{ "name": "tokenIndexFrom", "type": "uint8", "internalType": "uint8" },
{ "name": "tokenIndexTo", "type": "uint8", "internalType": "uint8" },
{ "name": "dx", "type": "uint256", "internalType": "uint256" },
{ "name": "minDy", "type": "uint256", "internalType": "uint256" },
{ "name": "deadline", "type": "uint256", "internalType": "uint256" }
],
"outputs": [
{ "name": "amountOut", "type": "uint256", "internalType": "uint256" }
],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "withdraw",
"inputs": [
{ "name": "amount", "type": "uint256", "internalType": "uint256" }
],
"outputs": [],
"stateMutability": "nonpayable"
}
]
47 changes: 47 additions & 0 deletions packages/sdk-router/src/abi/SynapseIntentPreviewer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
[
{
"type": "function",
"name": "NATIVE_GAS_TOKEN",
"inputs": [],
"outputs": [{ "name": "", "type": "address", "internalType": "address" }],
"stateMutability": "view"
},
{
"type": "function",
"name": "previewIntent",
"inputs": [
{ "name": "swapQuoter", "type": "address", "internalType": "address" },
{ "name": "forwardTo", "type": "address", "internalType": "address" },
{ "name": "strictOut", "type": "bool", "internalType": "bool" },
{ "name": "tokenIn", "type": "address", "internalType": "address" },
{ "name": "tokenOut", "type": "address", "internalType": "address" },
{ "name": "amountIn", "type": "uint256", "internalType": "uint256" }
],
"outputs": [
{ "name": "amountOut", "type": "uint256", "internalType": "uint256" },
{
"name": "steps",
"type": "tuple[]",
"internalType": "struct ISynapseIntentRouter.StepParams[]",
"components": [
{ "name": "token", "type": "address", "internalType": "address" },
{ "name": "amount", "type": "uint256", "internalType": "uint256" },
{
"name": "msgValue",
"type": "uint256",
"internalType": "uint256"
},
{ "name": "zapData", "type": "bytes", "internalType": "bytes" }
]
}
],
"stateMutability": "view"
},
{ "type": "error", "name": "SIP__NoOpForwardNotSupported", "inputs": [] },
{ "type": "error", "name": "SIP__PoolTokenMismatch", "inputs": [] },
{ "type": "error", "name": "SIP__PoolZeroAddress", "inputs": [] },
{ "type": "error", "name": "SIP__RawParamsEmpty", "inputs": [] },
{ "type": "error", "name": "SIP__TokenNotNative", "inputs": [] },
{ "type": "error", "name": "ZapDataV1__InvalidEncoding", "inputs": [] },
{ "type": "error", "name": "ZapDataV1__TargetZeroAddress", "inputs": [] }
]
109 changes: 109 additions & 0 deletions packages/sdk-router/src/abi/SynapseIntentRouter.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
[
{
"type": "function",
"name": "NATIVE_GAS_TOKEN",
"inputs": [],
"outputs": [{ "name": "", "type": "address", "internalType": "address" }],
"stateMutability": "view"
},
{
"type": "function",
"name": "completeIntent",
"inputs": [
{
"name": "zapRecipient",
"type": "address",
"internalType": "address"
},
{ "name": "amountIn", "type": "uint256", "internalType": "uint256" },
{
"name": "minLastStepAmountIn",
"type": "uint256",
"internalType": "uint256"
},
{ "name": "deadline", "type": "uint256", "internalType": "uint256" },
{
"name": "steps",
"type": "tuple[]",
"internalType": "struct ISynapseIntentRouter.StepParams[]",
"components": [
{ "name": "token", "type": "address", "internalType": "address" },
{ "name": "amount", "type": "uint256", "internalType": "uint256" },
{
"name": "msgValue",
"type": "uint256",
"internalType": "uint256"
},
{ "name": "zapData", "type": "bytes", "internalType": "bytes" }
]
}
],
"outputs": [],
"stateMutability": "payable"
},
{
"type": "function",
"name": "completeIntentWithBalanceChecks",
"inputs": [
{
"name": "zapRecipient",
"type": "address",
"internalType": "address"
},
{ "name": "amountIn", "type": "uint256", "internalType": "uint256" },
{
"name": "minLastStepAmountIn",
"type": "uint256",
"internalType": "uint256"
},
{ "name": "deadline", "type": "uint256", "internalType": "uint256" },
{
"name": "steps",
"type": "tuple[]",
"internalType": "struct ISynapseIntentRouter.StepParams[]",
"components": [
{ "name": "token", "type": "address", "internalType": "address" },
{ "name": "amount", "type": "uint256", "internalType": "uint256" },
{
"name": "msgValue",
"type": "uint256",
"internalType": "uint256"
},
{ "name": "zapData", "type": "bytes", "internalType": "bytes" }
]
}
],
"outputs": [],
"stateMutability": "payable"
},
{
"type": "error",
"name": "AddressEmptyCode",
"inputs": [
{ "name": "target", "type": "address", "internalType": "address" }
]
},
{
"type": "error",
"name": "AddressInsufficientBalance",
"inputs": [
{ "name": "account", "type": "address", "internalType": "address" }
]
},
{ "type": "error", "name": "FailedInnerCall", "inputs": [] },
{ "type": "error", "name": "SIR__AmountInsufficient", "inputs": [] },
{ "type": "error", "name": "SIR__DeadlineExceeded", "inputs": [] },
{ "type": "error", "name": "SIR__MsgValueIncorrect", "inputs": [] },
{ "type": "error", "name": "SIR__StepsNotProvided", "inputs": [] },
{ "type": "error", "name": "SIR__TokenNotContract", "inputs": [] },
{ "type": "error", "name": "SIR__UnspentFunds", "inputs": [] },
{ "type": "error", "name": "SIR__ZapIncorrectReturnValue", "inputs": [] },
{ "type": "error", "name": "SIR__ZapNoReturnValue", "inputs": [] },
{
"type": "error",
"name": "SafeERC20FailedOperation",
"inputs": [
{ "name": "token", "type": "address", "internalType": "address" }
]
}
]
94 changes: 94 additions & 0 deletions packages/sdk-router/src/abi/TokenZapV1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
[
{ "type": "receive", "stateMutability": "payable" },
{
"type": "function",
"name": "NATIVE_GAS_TOKEN",
"inputs": [],
"outputs": [{ "name": "", "type": "address", "internalType": "address" }],
"stateMutability": "view"
},
{
"type": "function",
"name": "decodeZapData",
"inputs": [
{ "name": "zapData", "type": "bytes", "internalType": "bytes" },
{ "name": "amount", "type": "uint256", "internalType": "uint256" }
],
"outputs": [
{ "name": "target", "type": "address", "internalType": "address" },
{ "name": "payload", "type": "bytes", "internalType": "bytes" }
],
"stateMutability": "pure"
},
{
"type": "function",
"name": "encodeZapData",
"inputs": [
{ "name": "target", "type": "address", "internalType": "address" },
{ "name": "payload", "type": "bytes", "internalType": "bytes" },
{
"name": "amountPosition",
"type": "uint256",
"internalType": "uint256"
},
{ "name": "finalToken", "type": "address", "internalType": "address" },
{ "name": "forwardTo", "type": "address", "internalType": "address" }
],
"outputs": [{ "name": "", "type": "bytes", "internalType": "bytes" }],
"stateMutability": "pure"
},
{
"type": "function",
"name": "zap",
"inputs": [
{ "name": "token", "type": "address", "internalType": "address" },
{ "name": "amount", "type": "uint256", "internalType": "uint256" },
{ "name": "zapData", "type": "bytes", "internalType": "bytes" }
],
"outputs": [{ "name": "", "type": "bytes4", "internalType": "bytes4" }],
"stateMutability": "payable"
},
{
"type": "error",
"name": "AddressEmptyCode",
"inputs": [
{ "name": "target", "type": "address", "internalType": "address" }
]
},
{
"type": "error",
"name": "AddressInsufficientBalance",
"inputs": [
{ "name": "account", "type": "address", "internalType": "address" }
]
},
{ "type": "error", "name": "FailedInnerCall", "inputs": [] },
{
"type": "error",
"name": "SafeERC20FailedOperation",
"inputs": [
{ "name": "token", "type": "address", "internalType": "address" }
]
},
{
"type": "error",
"name": "TokenZapV1__FinalTokenBalanceZero",
"inputs": []
},
{
"type": "error",
"name": "TokenZapV1__PayloadLengthAboveMax",
"inputs": []
},
{ "type": "error", "name": "TokenZapV1__TargetZeroAddress", "inputs": [] },
{ "type": "error", "name": "TokenZapV1__TokenZeroAddress", "inputs": [] },
{ "type": "error", "name": "ZapDataV1__InvalidEncoding", "inputs": [] },
{ "type": "error", "name": "ZapDataV1__TargetZeroAddress", "inputs": [] },
{
"type": "error",
"name": "ZapDataV1__UnsupportedVersion",
"inputs": [
{ "name": "version", "type": "uint16", "internalType": "uint16" }
]
}
]
69 changes: 68 additions & 1 deletion packages/sdk-router/src/constants/addresses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,78 @@ export const CCTP_ROUTER_ADDRESS_MAP: AddressMap = generateAddressMap(

/**
* FastBridgeRouter contract address for all chains except ones from FAST_BRIDGE_ROUTER_EXCEPTION_MAP.
* TODO: this is a temporary Router for FastBridgeV2, revert to FastBridgeV1 when a dedicated Router Set is implemented
*/
const FAST_BRIDGE_ROUTER_ADDRESS = '0x00cD000000003f7F682BE4813200893d4e690000'
const FAST_BRIDGE_ROUTER_ADDRESS = '0x5849dC2fe58EcCB9EA76aA8D77dc127d89dE9b4d'
const FAST_BRIDGE_ROUTER_EXCEPTION_MAP: AddressMap = {}
export const FAST_BRIDGE_ROUTER_ADDRESS_MAP: AddressMap = generateAddressMap(
RFQ_SUPPORTED_CHAIN_IDS,
FAST_BRIDGE_ROUTER_ADDRESS,
FAST_BRIDGE_ROUTER_EXCEPTION_MAP
)

/**
* FastBridgeV2 contract address for all chains except ones from FAST_BRIDGE_V2_EXCEPTION_MAP.
* TODO: this is a staging FastBridgeV2 deployment, update to the production deployment when ready.
*/
const FAST_BRIDGE_V2_ADDRESS = '0xEb1eb846342274d5d652e068DD189EfCEd256332'
const FAST_BRIDGE_V2_EXCEPTION_MAP: AddressMap = {}
export const FAST_BRIDGE_V2_ADDRESS_MAP: AddressMap = generateAddressMap(
RFQ_SUPPORTED_CHAIN_IDS,
FAST_BRIDGE_V2_ADDRESS,
FAST_BRIDGE_V2_EXCEPTION_MAP
)

/**
* TokenZapV1 contract address for all chains except ones from TOKEN_ZAP_V1_EXCEPTION_MAP.
* TODO: this is a staging TokenZapV1 deployment, update to the production deployment when ready.
*/
const TOKEN_ZAP_V1_ADDRESS = '0x6327797F149a75D506aFda46D5fCE6E74fC409D5'
const TOKEN_ZAP_V1_EXCEPTION_MAP: AddressMap = {}
export const TOKEN_ZAP_V1_ADDRESS_MAP: AddressMap = generateAddressMap(
RFQ_SUPPORTED_CHAIN_IDS,
TOKEN_ZAP_V1_ADDRESS,
TOKEN_ZAP_V1_EXCEPTION_MAP
)

/**
* SynapseIntentRouter contract address for all chains except ones from SYNAPSE_INTENT_ROUTER_EXCEPTION_MAP.
* TODO: this is a staging SynapseIntentRouter deployment, update to the production deployment when ready.
*/
const SYNAPSE_INTENT_ROUTER_ADDRESS =
'0x57203c65DeA2ded4EE4E303a9494bee04df030BF'
const SYNAPSE_INTENT_ROUTER_EXCEPTION_MAP: AddressMap = {}
export const SYNAPSE_INTENT_ROUTER_ADDRESS_MAP: AddressMap = generateAddressMap(
RFQ_SUPPORTED_CHAIN_IDS,
SYNAPSE_INTENT_ROUTER_ADDRESS,
SYNAPSE_INTENT_ROUTER_EXCEPTION_MAP
)

/**
* SynapseIntentPreviewer contract address for all chains except ones from SYNAPSE_INTENT_PREVIEWER_EXCEPTION_MAP.
* TODO: this is a staging SynapseIntentPreviewer deployment, update to the production deployment when ready.
*/
const SYNAPSE_INTENT_PREVIEWER_ADDRESS =
'0x89ed77DcEaFBc4F92DAB2e865e11E7885F8daAf9'
const SYNAPSE_INTENT_PREVIEWER_EXCEPTION_MAP: AddressMap = {}
export const SYNAPSE_INTENT_PREVIEWER_ADDRESS_MAP: AddressMap =
generateAddressMap(
RFQ_SUPPORTED_CHAIN_IDS,
SYNAPSE_INTENT_PREVIEWER_ADDRESS,
SYNAPSE_INTENT_PREVIEWER_EXCEPTION_MAP
)

/**
* SwapQuoterV2 contract address on Ethereum. Addresses for other chains are defined in the
* SWAP_QUOTER_V2_EXCEPTION_MAP.
*/
const SWAP_QUOTER_V2_ADDRESS = '0x5682dC851C33adb48F6958a963A5d3Aa31F6f184'
const SWAP_QUOTER_V2_EXCEPTION_MAP: AddressMap = {
[SupportedChainId.ARBITRUM]: '0xE402cC7826dD835FCe5E3cFb61D56703fEbc2642',
[SupportedChainId.OPTIMISM]: '0xd6Bdb96b356F4F51bf491297DF03F25DCd0cBf6D',
}
export const SWAP_QUOTER_V2_ADDRESS_MAP: AddressMap = generateAddressMap(
SUPPORTED_CHAIN_IDS,
SWAP_QUOTER_V2_ADDRESS,
SWAP_QUOTER_V2_EXCEPTION_MAP
)
Loading

0 comments on commit 078d91b

Please sign in to comment.