From cf35115827b78a4985f1643a1cb0e4592cded869 Mon Sep 17 00:00:00 2001 From: Bleaker Date: Wed, 23 Feb 2022 12:45:06 -0500 Subject: [PATCH] Integrate BridgeConfigV3 --- package.json | 2 +- scripts/abigen.sh | 1 + src/abis/BridgeConfig.ts | 4 +- src/abis/BridgeConfigV3.ts | 1256 ++++++++++++ src/abis/L1BridgeZap.ts | 39 + src/abis/L2BridgeZap.ts | 39 + src/abis/SynapseBridge.ts | 70 + src/bridge/bridge.ts | 6 +- src/contracts.ts | 3 + src/entities.ts | 13 +- src/internal/gen/BridgeConfigV3.ts | 1809 +++++++++++++++++ src/internal/gen/L1BridgeZap.ts | 81 + src/internal/gen/L2BridgeZap.ts | 81 + src/internal/gen/SynapseBridge.ts | 103 + .../gen/factories/BridgeConfigV3__factory.ts | 1113 ++++++++++ .../gen/factories/L1BridgeZap__factory.ts | 28 + .../gen/factories/L2BridgeZap__factory.ts | 28 + .../gen/factories/SynapseBridge__factory.ts | 59 + src/internal/gen/index.ts | 2 + 19 files changed, 4729 insertions(+), 8 deletions(-) create mode 100644 src/abis/BridgeConfigV3.ts create mode 100644 src/internal/gen/BridgeConfigV3.ts create mode 100644 src/internal/gen/factories/BridgeConfigV3__factory.ts diff --git a/package.json b/package.json index 6c583f23..c941cafe 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "typegen:all": "yarn -s run abigen", "posttypegen:all": "yarn -s run typegen", "abigen": "scripts/abigen.sh", - "typegen": "typechain --target ethers-v5 --out-dir src/contracts/gen src/abis/*.json", + "typegen": "typechain --target ethers-v5 --out-dir src/internal/gen src/abis/*.json", "posttypegen": "yarn -s run typegen:clean", "typegen:clean": "mv src/abis/ERC20.json ./ERC20.json && rm -rf src/abis/*.json && mv ./ERC20.json src/abis/ERC20.json" }, diff --git a/scripts/abigen.sh b/scripts/abigen.sh index f0937f2b..3940827e 100755 --- a/scripts/abigen.sh +++ b/scripts/abigen.sh @@ -45,5 +45,6 @@ process_abi "contracts/bridge/SynapseERC20.sol" "SynapseERC20" process_abi "contracts/bridge/wrappers/L2BridgeZap.sol" "L2BridgeZap" process_abi "contracts/bridge/wrappers/L1BridgeZap.sol" "L1BridgeZap" process_abi "contracts/bridge/BridgeConfig.sol" "BridgeConfig" +process_abi "contracts/bridge/BridgeConfigV3.sol" "BridgeConfigV3" process_abi "contracts/bridge/PoolConfig.sol" "PoolConfig" process_abi "contracts/amm/SwapFlashLoan.sol" "SwapFlashLoan" \ No newline at end of file diff --git a/src/abis/BridgeConfig.ts b/src/abis/BridgeConfig.ts index 910e0903..cfd28ac3 100644 --- a/src/abis/BridgeConfig.ts +++ b/src/abis/BridgeConfig.ts @@ -717,7 +717,7 @@ const ABI = { "minSwapFee": "min swap fee to be charged - in native token decimals - especially useful for mainnet ETH", "swapFee": "percent based swap fee -- 10e6 == 10bps", "tokenAddress": "token address of the token on the given chain", - "tokenDecimals": "decimals of token ", + "tokenDecimals": "decimals of token", "tokenID": "string ID to set the token config object form" } } @@ -738,7 +738,7 @@ const ABI = { "notice": "Returns token config struct, given an address and chainID" }, "getToken(string,uint256)": { - "notice": "Returns the full token config struct " + "notice": "Returns the full token config struct" }, "getTokenID(address,uint256)": { "notice": "Returns the token ID (string) of the cross-chain token inputted" diff --git a/src/abis/BridgeConfigV3.ts b/src/abis/BridgeConfigV3.ts new file mode 100644 index 00000000..3570b7bb --- /dev/null +++ b/src/abis/BridgeConfigV3.ts @@ -0,0 +1,1256 @@ +const ABI = { + "abi": [ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "previousAdminRole", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "newAdminRole", + "type": "bytes32" + } + ], + "name": "RoleAdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleGranted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleRevoked", + "type": "event" + }, + { + "inputs": [], + "name": "BRIDGEMANAGER_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "DEFAULT_ADMIN_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "bridgeConfigVersion", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "tokenAddress", + "type": "string" + }, + { + "internalType": "uint256", + "name": "chainID", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "calculateSwapFee", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "tokenAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "chainID", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "calculateSwapFee", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getAllTokenIDs", + "outputs": [ + { + "internalType": "string[]", + "name": "result", + "type": "string[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "chainID", + "type": "uint256" + } + ], + "name": "getMaxGasPrice", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "tokenAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "chainID", + "type": "uint256" + } + ], + "name": "getPoolConfig", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "tokenAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "chainId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "poolAddress", + "type": "address" + }, + { + "internalType": "bool", + "name": "metaswap", + "type": "bool" + } + ], + "internalType": "struct BridgeConfigV3.Pool", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + } + ], + "name": "getRoleAdmin", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "getRoleMember", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + } + ], + "name": "getRoleMemberCount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "tokenID", + "type": "string" + }, + { + "internalType": "uint256", + "name": "chainID", + "type": "uint256" + } + ], + "name": "getToken", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "chainId", + "type": "uint256" + }, + { + "internalType": "string", + "name": "tokenAddress", + "type": "string" + }, + { + "internalType": "uint8", + "name": "tokenDecimals", + "type": "uint8" + }, + { + "internalType": "uint256", + "name": "maxSwap", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minSwap", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "swapFee", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxSwapFee", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minSwapFee", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "hasUnderlying", + "type": "bool" + }, + { + "internalType": "bool", + "name": "isUnderlying", + "type": "bool" + } + ], + "internalType": "struct BridgeConfigV3.Token", + "name": "token", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "tokenAddress", + "type": "string" + }, + { + "internalType": "uint256", + "name": "chainID", + "type": "uint256" + } + ], + "name": "getTokenByAddress", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "chainId", + "type": "uint256" + }, + { + "internalType": "string", + "name": "tokenAddress", + "type": "string" + }, + { + "internalType": "uint8", + "name": "tokenDecimals", + "type": "uint8" + }, + { + "internalType": "uint256", + "name": "maxSwap", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minSwap", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "swapFee", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxSwapFee", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minSwapFee", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "hasUnderlying", + "type": "bool" + }, + { + "internalType": "bool", + "name": "isUnderlying", + "type": "bool" + } + ], + "internalType": "struct BridgeConfigV3.Token", + "name": "token", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "tokenAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "chainID", + "type": "uint256" + } + ], + "name": "getTokenByEVMAddress", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "chainId", + "type": "uint256" + }, + { + "internalType": "string", + "name": "tokenAddress", + "type": "string" + }, + { + "internalType": "uint8", + "name": "tokenDecimals", + "type": "uint8" + }, + { + "internalType": "uint256", + "name": "maxSwap", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minSwap", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "swapFee", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxSwapFee", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minSwapFee", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "hasUnderlying", + "type": "bool" + }, + { + "internalType": "bool", + "name": "isUnderlying", + "type": "bool" + } + ], + "internalType": "struct BridgeConfigV3.Token", + "name": "token", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "tokenID", + "type": "string" + }, + { + "internalType": "uint256", + "name": "chainID", + "type": "uint256" + } + ], + "name": "getTokenByID", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "chainId", + "type": "uint256" + }, + { + "internalType": "string", + "name": "tokenAddress", + "type": "string" + }, + { + "internalType": "uint8", + "name": "tokenDecimals", + "type": "uint8" + }, + { + "internalType": "uint256", + "name": "maxSwap", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minSwap", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "swapFee", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxSwapFee", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minSwapFee", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "hasUnderlying", + "type": "bool" + }, + { + "internalType": "bool", + "name": "isUnderlying", + "type": "bool" + } + ], + "internalType": "struct BridgeConfigV3.Token", + "name": "token", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "tokenAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "chainID", + "type": "uint256" + } + ], + "name": "getTokenID", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "tokenAddress", + "type": "string" + }, + { + "internalType": "uint256", + "name": "chainID", + "type": "uint256" + } + ], + "name": "getTokenID", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "tokenID", + "type": "string" + } + ], + "name": "getUnderlyingToken", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "chainId", + "type": "uint256" + }, + { + "internalType": "string", + "name": "tokenAddress", + "type": "string" + }, + { + "internalType": "uint8", + "name": "tokenDecimals", + "type": "uint8" + }, + { + "internalType": "uint256", + "name": "maxSwap", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minSwap", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "swapFee", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxSwapFee", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minSwapFee", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "hasUnderlying", + "type": "bool" + }, + { + "internalType": "bool", + "name": "isUnderlying", + "type": "bool" + } + ], + "internalType": "struct BridgeConfigV3.Token", + "name": "token", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "grantRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "hasRole", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "tokenID", + "type": "string" + } + ], + "name": "hasUnderlyingToken", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "tokenID", + "type": "string" + } + ], + "name": "isTokenIDExist", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "tokenID", + "type": "string" + } + ], + "name": "removeTokenMapping", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "renounceRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "revokeRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "chainID", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxPrice", + "type": "uint256" + } + ], + "name": "setMaxGasPrice", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "tokenAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "chainID", + "type": "uint256" + }, + { + "internalType": "address", + "name": "poolAddress", + "type": "address" + }, + { + "internalType": "bool", + "name": "metaswap", + "type": "bool" + } + ], + "name": "setPoolConfig", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "tokenAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "chainId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "poolAddress", + "type": "address" + }, + { + "internalType": "bool", + "name": "metaswap", + "type": "bool" + } + ], + "internalType": "struct BridgeConfigV3.Pool", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "tokenID", + "type": "string" + }, + { + "internalType": "uint256", + "name": "chainID", + "type": "uint256" + }, + { + "internalType": "address", + "name": "tokenAddress", + "type": "address" + }, + { + "internalType": "uint8", + "name": "tokenDecimals", + "type": "uint8" + }, + { + "internalType": "uint256", + "name": "maxSwap", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minSwap", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "swapFee", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxSwapFee", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minSwapFee", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "hasUnderlying", + "type": "bool" + }, + { + "internalType": "bool", + "name": "isUnderlying", + "type": "bool" + } + ], + "name": "setTokenConfig", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "tokenID", + "type": "string" + }, + { + "internalType": "uint256", + "name": "chainID", + "type": "uint256" + }, + { + "internalType": "string", + "name": "tokenAddress", + "type": "string" + }, + { + "internalType": "uint8", + "name": "tokenDecimals", + "type": "uint8" + }, + { + "internalType": "uint256", + "name": "maxSwap", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minSwap", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "swapFee", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxSwapFee", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minSwapFee", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "hasUnderlying", + "type": "bool" + }, + { + "internalType": "bool", + "name": "isUnderlying", + "type": "bool" + } + ], + "name": "setTokenConfig", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "devdoc": { + "kind": "dev", + "methods": { + "calculateSwapFee(address,uint256,uint256)": { + "details": "This means the fee should be calculated based on the chain that the nodes emit a tx on", + "params": { + "amount": "in native token decimals", + "chainID": "destination chain ID to query the token config for", + "tokenAddress": "address of the destination token to query token config for" + }, + "returns": { + "_0": "Fee calculated in token decimals" + } + }, + "calculateSwapFee(string,uint256,uint256)": { + "details": "This means the fee should be calculated based on the chain that the nodes emit a tx on", + "params": { + "amount": "in native token decimals", + "chainID": "destination chain ID to query the token config for", + "tokenAddress": "address of the destination token to query token config for" + }, + "returns": { + "_0": "Fee calculated in token decimals" + } + }, + "getRoleAdmin(bytes32)": { + "details": "Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}." + }, + "getRoleMember(bytes32,uint256)": { + "details": "Returns one of the accounts that have `role`. `index` must be a value between 0 and {getRoleMemberCount}, non-inclusive. Role bearers are not sorted in any particular way, and their ordering may change at any point. WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure you perform all queries on the same block. See the following https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] for more information." + }, + "getRoleMemberCount(bytes32)": { + "details": "Returns the number of accounts that have `role`. Can be used together with {getRoleMember} to enumerate all bearers of a role." + }, + "getToken(string,uint256)": { + "params": { + "chainID": "Chain ID of which token address + config to get", + "tokenID": "String input of the token ID for the token" + } + }, + "getTokenByAddress(string,uint256)": { + "params": { + "chainID": "Chain ID of which token to get config for", + "tokenAddress": "Matches the token ID by using a combo of address + chain ID" + } + }, + "getTokenByID(string,uint256)": { + "params": { + "chainID": "Chain ID of which token address + config to get", + "tokenID": "String input of the token ID for the token" + } + }, + "getTokenID(address,uint256)": { + "params": { + "chainID": "chainID of which to get token ID for", + "tokenAddress": "address of token to get ID for" + } + }, + "getUnderlyingToken(string)": { + "params": { + "tokenID": "string token ID" + } + }, + "grantRole(bytes32,address)": { + "details": "Grants `role` to `account`. If `account` had not been already granted `role`, emits a {RoleGranted} event. Requirements: - the caller must have ``role``'s admin role." + }, + "hasRole(bytes32,address)": { + "details": "Returns `true` if `account` has been granted `role`." + }, + "hasUnderlyingToken(string)": { + "params": { + "tokenID": "String to check if it is a withdraw/underlying token" + } + }, + "renounceRole(bytes32,address)": { + "details": "Revokes `role` from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must be `account`." + }, + "revokeRole(bytes32,address)": { + "details": "Revokes `role` from `account`. If `account` had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must have ``role``'s admin role." + }, + "setTokenConfig(string,uint256,address,uint8,uint256,uint256,uint256,uint256,uint256,bool,bool)": { + "params": { + "chainID": "chain ID to use for the token config object", + "hasUnderlying": "bool which represents whether this is a global mint token or one to withdraw()", + "isUnderlying": "bool which represents if this token is the one to withdraw on the given chain", + "maxSwap": "maximum amount of token allowed to be transferred at once - in native token decimals", + "maxSwapFee": "max swap fee to be charged - in native token decimals", + "minSwap": "minimum amount of token needed to be transferred at once - in native token decimals", + "minSwapFee": "min swap fee to be charged - in native token decimals - especially useful for mainnet ETH", + "swapFee": "percent based swap fee -- 10e6 == 10bps", + "tokenAddress": "token address of the token on the given chain", + "tokenDecimals": "decimals of token", + "tokenID": "string ID to set the token config object form" + } + }, + "setTokenConfig(string,uint256,string,uint8,uint256,uint256,uint256,uint256,uint256,bool,bool)": { + "params": { + "chainID": "chain ID to use for the token config object", + "hasUnderlying": "bool which represents whether this is a global mint token or one to withdraw()", + "isUnderlying": "bool which represents if this token is the one to withdraw on the given chain", + "maxSwap": "maximum amount of token allowed to be transferred at once - in native token decimals", + "maxSwapFee": "max swap fee to be charged - in native token decimals", + "minSwap": "minimum amount of token needed to be transferred at once - in native token decimals", + "minSwapFee": "min swap fee to be charged - in native token decimals - especially useful for mainnet ETH", + "swapFee": "percent based swap fee -- 10e6 == 10bps", + "tokenAddress": "token address of the token on the given chain", + "tokenDecimals": "decimals of token", + "tokenID": "string ID to set the token config object form" + } + } + }, + "title": "BridgeConfig contract", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "calculateSwapFee(address,uint256,uint256)": { + "notice": "Calculates bridge swap fee based on the destination chain's token transfer." + }, + "calculateSwapFee(string,uint256,uint256)": { + "notice": "Calculates bridge swap fee based on the destination chain's token transfer." + }, + "getAllTokenIDs()": { + "notice": "Returns a list of all existing token IDs converted to strings" + }, + "getMaxGasPrice(uint256)": { + "notice": "gets the max gas price for a chain" + }, + "getToken(string,uint256)": { + "notice": "Returns the full token config struct" + }, + "getTokenByAddress(string,uint256)": { + "notice": "Returns token config struct, given an address and chainID" + }, + "getTokenByID(string,uint256)": { + "notice": "Returns the full token config struct" + }, + "getTokenID(address,uint256)": { + "notice": "Returns the token ID (string) of the cross-chain token inputted" + }, + "getUnderlyingToken(string)": { + "notice": "Returns which token is the underlying token to withdraw" + }, + "hasUnderlyingToken(string)": { + "notice": "Returns true if the token has an underlying token -- meaning the token is deposited into the bridge" + }, + "isTokenIDExist(string)": { + "notice": "Public function returning if token ID exists given a string" + }, + "setMaxGasPrice(uint256,uint256)": { + "notice": "sets the max gas price for a chain" + }, + "setTokenConfig(string,uint256,address,uint8,uint256,uint256,uint256,uint256,uint256,bool,bool)": { + "notice": "Main write function of this contract - Handles creating the struct and passing it to the internal logic function" + }, + "setTokenConfig(string,uint256,string,uint8,uint256,uint256,uint256,uint256,uint256,bool,bool)": { + "notice": "Main write function of this contract - Handles creating the struct and passing it to the internal logic function" + } + }, + "notice": "This token is used for configuring different tokens on the bridge and mapping them across chains.*", + "version": 1 + } +} + +export default ABI diff --git a/src/abis/L1BridgeZap.ts b/src/abis/L1BridgeZap.ts index 9d04c774..217e9b86 100644 --- a/src/abis/L1BridgeZap.ts +++ b/src/abis/L1BridgeZap.ts @@ -271,6 +271,34 @@ const ABI = { "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "to", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "chainId", + "type": "uint256" + }, + { + "internalType": "contract IERC20", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "redeemv2", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { @@ -437,6 +465,14 @@ const ABI = { "token": "ERC20 compatible token to redeem into the bridge" } }, + "redeemv2(bytes32,uint256,address,uint256)": { + "params": { + "amount": "Amount in native token decimals to transfer cross-chain pre-fees*", + "chainId": "which chain to bridge assets onto", + "to": "address on other chain to bridge assets to", + "token": "ERC20 compatible token to redeem into the bridge" + } + }, "zapAndDeposit(address,uint256,address,uint256[],uint256,uint256)": { "params": { "chainId": "which chain to bridge assets onto", @@ -490,6 +526,9 @@ const ABI = { "redeem(address,uint256,address,uint256)": { "notice": "Wraps SynapseBridge redeem() function" }, + "redeemv2(bytes32,uint256,address,uint256)": { + "notice": "Wraps SynapseBridge redeemv2() function" + }, "zapAndDeposit(address,uint256,address,uint256[],uint256,uint256)": { "notice": "Combines adding liquidity to the given Swap, and calls deposit() on the bridge using that LP token" }, diff --git a/src/abis/L2BridgeZap.ts b/src/abis/L2BridgeZap.ts index 09dd426b..e8dfaa75 100644 --- a/src/abis/L2BridgeZap.ts +++ b/src/abis/L2BridgeZap.ts @@ -253,6 +253,34 @@ const ABI = { "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "to", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "chainId", + "type": "uint256" + }, + { + "internalType": "contract IERC20", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "redeemv2", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { @@ -650,6 +678,14 @@ const ABI = { "tokenIndexFrom": "the token the user wants to swap from", "tokenIndexTo": "the token the user wants to swap to" } + }, + "redeemv2(bytes32,uint256,address,uint256)": { + "params": { + "amount": "Amount in native token decimals to transfer cross-chain pre-fees*", + "chainId": "which chain to bridge assets onto", + "to": "address on other chain to bridge assets to", + "token": "ERC20 compatible token to redeem into the bridge" + } } }, "version": 1 @@ -674,6 +710,9 @@ const ABI = { }, "redeemAndSwap(address,uint256,address,uint256,uint8,uint8,uint256,uint256)": { "notice": "Wraps redeemAndSwap on SynapseBridge.sol Relays to nodes that (typically) a wrapped synAsset ERC20 token has been burned and the underlying needs to be redeeemed on the native chain. This function indicates to the nodes that they should attempt to redeem the LP token for the underlying assets (E.g \"swap\" out of the LP token)" + }, + "redeemv2(bytes32,uint256,address,uint256)": { + "notice": "Wraps SynapseBridge redeemv2() function" } }, "version": 1 diff --git a/src/abis/SynapseBridge.ts b/src/abis/SynapseBridge.ts index 498f0c1c..e75e90dd 100644 --- a/src/abis/SynapseBridge.ts +++ b/src/abis/SynapseBridge.ts @@ -413,6 +413,37 @@ const ABI = { "name": "TokenRedeemAndSwap", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "to", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "chainId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "contract IERC20", + "name": "token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "TokenRedeemV2", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -1070,6 +1101,34 @@ const ABI = { "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "to", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "chainId", + "type": "uint256" + }, + { + "internalType": "contract ERC20Burnable", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "redeemV2", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { @@ -1358,6 +1417,14 @@ const ABI = { "tokenIndexTo": "the token the user wants to swap to" } }, + "redeemV2(bytes32,uint256,address,uint256)": { + "params": { + "amount": "Amount in native token decimals to transfer cross-chain pre-fees*", + "chainId": "which underlying chain to bridge assets onto", + "to": "address on other chain to redeem underlying assets to", + "token": "ERC20 compatible token to deposit into the bridge" + } + }, "renounceRole(bytes32,address)": { "details": "Revokes `role` from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must be `account`." }, @@ -1419,6 +1486,9 @@ const ABI = { "redeemAndSwap(address,uint256,address,uint256,uint8,uint8,uint256,uint256)": { "notice": "Relays to nodes that (typically) a wrapped synAsset ERC20 token has been burned and the underlying needs to be redeeemed on the native chain. This function indicates to the nodes that they should attempt to redeem the LP token for the underlying assets (E.g \"swap\" out of the LP token)" }, + "redeemV2(bytes32,uint256,address,uint256)": { + "notice": "Relays to nodes that (typically) a wrapped synAsset ERC20 token has been burned and the underlying needs to be redeeemed on the native chain" + }, "withdraw(address,address,uint256,uint256,bytes32)": { "notice": "Function to be called by the node group to withdraw the underlying assets from the contract" }, diff --git a/src/bridge/bridge.ts b/src/bridge/bridge.ts index f947d37a..b413579c 100644 --- a/src/bridge/bridge.ts +++ b/src/bridge/bridge.ts @@ -120,7 +120,7 @@ export namespace Bridge { private readonly zapBridgeAddress: string; - private readonly bridgeConfigInstance = SynapseEntities.bridgeConfig(); + private readonly bridgeConfigInstance = SynapseEntities.bridgeConfigV3(); private readonly zapBridgeInstance = SynapseEntities.l1BridgeZap({ chainId: ChainId.ETH, signerOrProvider: rpcProviderForNetwork(ChainId.ETH), @@ -425,11 +425,11 @@ export namespace Bridge { let {intermediateToken, bridgeConfigIntermediateToken} = TokenSwap.intermediateTokens(chainIdTo, tokenFrom); const bigNumTen = BigNumber.from(10); - const bridgeFeeRequest = this.bridgeConfigInstance.calculateSwapFee( + const bridgeFeeRequest = this.bridgeConfigInstance.functions["calculateSwapFee(address,uint256,uint256)"]( bridgeConfigIntermediateToken.address(chainIdTo), chainIdTo, amountFrom.mul(bigNumTen.pow(18-tokenFrom.decimals(this.chainId))) - ); + ).then((res: [BigNumber]) => res[0] ?? null).catch(rejectPromise); const checkEthy = (c: number, t: Token): boolean => BridgeUtils.isL2ETHChain(c) && t.swapType === SwapType.ETH diff --git a/src/contracts.ts b/src/contracts.ts index 9d39f47b..82bcd4a5 100644 --- a/src/contracts.ts +++ b/src/contracts.ts @@ -5,6 +5,7 @@ import type { SynapseERC20 as SynapseERC20Contract, SwapFlashLoan as SwapContract, BridgeConfig as BridgeConfigContract, + BridgeConfigV3 as BridgeConfigV3Contract, PoolConfig as PoolConfigContract, ERC20 as ERC20Contract } from "@internal/gen/index"; @@ -18,6 +19,7 @@ export type { SynapseERC20Contract, SwapContract, BridgeConfigContract, + BridgeConfigV3Contract, PoolConfigContract, GenericZapBridgeContract, ERC20Contract @@ -30,6 +32,7 @@ export { SynapseERC20__factory as SynapseERC20Factory, SwapFlashLoan__factory as SwapFactory, BridgeConfig__factory as BridgeConfigFactory, + BridgeConfigV3__factory as BridgeConfigV3Factory, PoolConfig__factory as PoolConfigFactory, ERC20__factory as ERC20Factory } from "@internal/gen/index"; \ No newline at end of file diff --git a/src/entities.ts b/src/entities.ts index 64667870..55be50ff 100644 --- a/src/entities.ts +++ b/src/entities.ts @@ -5,6 +5,7 @@ import type { GenericZapBridgeContract, BridgeConfigContract, PoolConfigContract, + BridgeConfigV3Contract, } from "./contracts"; import { @@ -13,6 +14,7 @@ import { L2BridgeZapFactory, BridgeConfigFactory, PoolConfigFactory, + BridgeConfigV3Factory, } from "./contracts"; import {ChainId} from "@chainid"; @@ -40,8 +42,9 @@ export const newL2BridgeZapInstance = (params: { export namespace SynapseEntities { const - bridgeConfigAddress: string = "0x7fd806049608b7d04076b8187dd773343e0589e6", - poolConfigAddress: string = "0xB34C67DB5F0Fd8D3D4238FD0A1cBbfD50a72e177"; + bridgeConfigAddress: string = "0x7fd806049608b7d04076b8187dd773343e0589e6", + bridgeConfigV3Address: string = "0x3ee02f08B801B1990AC844d8CD2F119BA6Fb9bcF", + poolConfigAddress: string = "0xB34C67DB5F0Fd8D3D4238FD0A1cBbfD50a72e177"; export interface NewEntityParams { chainId: number; @@ -77,6 +80,12 @@ export namespace SynapseEntities { rpcProviderForNetwork(ChainId.ETH) ) + export const bridgeConfigV3 = (): BridgeConfigV3Contract => + BridgeConfigV3Factory.connect( + bridgeConfigV3Address, + rpcProviderForNetwork(ChainId.ETH) + ) + export const poolConfig = (): PoolConfigContract => PoolConfigFactory.connect( poolConfigAddress, diff --git a/src/internal/gen/BridgeConfigV3.ts b/src/internal/gen/BridgeConfigV3.ts new file mode 100644 index 00000000..f56cd443 --- /dev/null +++ b/src/internal/gen/BridgeConfigV3.ts @@ -0,0 +1,1809 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +import { + BaseContract, + BigNumber, + BigNumberish, + BytesLike, + CallOverrides, + ContractTransaction, + Overrides, + PopulatedTransaction, + Signer, + utils, +} from "ethers"; +import { FunctionFragment, Result, EventFragment } from "@ethersproject/abi"; +import { Listener, Provider } from "@ethersproject/providers"; +import { TypedEventFilter, TypedEvent, TypedListener, OnEvent } from "./common"; + +export declare namespace BridgeConfigV3 { + export type PoolStruct = { + tokenAddress: string; + chainId: BigNumberish; + poolAddress: string; + metaswap: boolean; + }; + + export type PoolStructOutput = [string, BigNumber, string, boolean] & { + tokenAddress: string; + chainId: BigNumber; + poolAddress: string; + metaswap: boolean; + }; + + export type TokenStruct = { + chainId: BigNumberish; + tokenAddress: string; + tokenDecimals: BigNumberish; + maxSwap: BigNumberish; + minSwap: BigNumberish; + swapFee: BigNumberish; + maxSwapFee: BigNumberish; + minSwapFee: BigNumberish; + hasUnderlying: boolean; + isUnderlying: boolean; + }; + + export type TokenStructOutput = [ + BigNumber, + string, + number, + BigNumber, + BigNumber, + BigNumber, + BigNumber, + BigNumber, + boolean, + boolean + ] & { + chainId: BigNumber; + tokenAddress: string; + tokenDecimals: number; + maxSwap: BigNumber; + minSwap: BigNumber; + swapFee: BigNumber; + maxSwapFee: BigNumber; + minSwapFee: BigNumber; + hasUnderlying: boolean; + isUnderlying: boolean; + }; +} + +export interface BridgeConfigV3Interface extends utils.Interface { + contractName: "BridgeConfigV3"; + functions: { + "BRIDGEMANAGER_ROLE()": FunctionFragment; + "DEFAULT_ADMIN_ROLE()": FunctionFragment; + "bridgeConfigVersion()": FunctionFragment; + "calculateSwapFee(string,uint256,uint256)": FunctionFragment; + "getAllTokenIDs()": FunctionFragment; + "getMaxGasPrice(uint256)": FunctionFragment; + "getPoolConfig(address,uint256)": FunctionFragment; + "getRoleAdmin(bytes32)": FunctionFragment; + "getRoleMember(bytes32,uint256)": FunctionFragment; + "getRoleMemberCount(bytes32)": FunctionFragment; + "getToken(string,uint256)": FunctionFragment; + "getTokenByAddress(string,uint256)": FunctionFragment; + "getTokenByEVMAddress(address,uint256)": FunctionFragment; + "getTokenByID(string,uint256)": FunctionFragment; + "getTokenID(address,uint256)": FunctionFragment; + "getUnderlyingToken(string)": FunctionFragment; + "grantRole(bytes32,address)": FunctionFragment; + "hasRole(bytes32,address)": FunctionFragment; + "hasUnderlyingToken(string)": FunctionFragment; + "isTokenIDExist(string)": FunctionFragment; + "removeTokenMapping(string)": FunctionFragment; + "renounceRole(bytes32,address)": FunctionFragment; + "revokeRole(bytes32,address)": FunctionFragment; + "setMaxGasPrice(uint256,uint256)": FunctionFragment; + "setPoolConfig(address,uint256,address,bool)": FunctionFragment; + "setTokenConfig(string,uint256,address,uint8,uint256,uint256,uint256,uint256,uint256,bool,bool)": FunctionFragment; + }; + + encodeFunctionData( + functionFragment: "BRIDGEMANAGER_ROLE", + values?: undefined + ): string; + encodeFunctionData( + functionFragment: "DEFAULT_ADMIN_ROLE", + values?: undefined + ): string; + encodeFunctionData( + functionFragment: "bridgeConfigVersion", + values?: undefined + ): string; + encodeFunctionData( + functionFragment: "calculateSwapFee", + values: [string, BigNumberish, BigNumberish] + ): string; + encodeFunctionData( + functionFragment: "getAllTokenIDs", + values?: undefined + ): string; + encodeFunctionData( + functionFragment: "getMaxGasPrice", + values: [BigNumberish] + ): string; + encodeFunctionData( + functionFragment: "getPoolConfig", + values: [string, BigNumberish] + ): string; + encodeFunctionData( + functionFragment: "getRoleAdmin", + values: [BytesLike] + ): string; + encodeFunctionData( + functionFragment: "getRoleMember", + values: [BytesLike, BigNumberish] + ): string; + encodeFunctionData( + functionFragment: "getRoleMemberCount", + values: [BytesLike] + ): string; + encodeFunctionData( + functionFragment: "getToken", + values: [string, BigNumberish] + ): string; + encodeFunctionData( + functionFragment: "getTokenByAddress", + values: [string, BigNumberish] + ): string; + encodeFunctionData( + functionFragment: "getTokenByEVMAddress", + values: [string, BigNumberish] + ): string; + encodeFunctionData( + functionFragment: "getTokenByID", + values: [string, BigNumberish] + ): string; + encodeFunctionData( + functionFragment: "getTokenID", + values: [string, BigNumberish] + ): string; + encodeFunctionData( + functionFragment: "getUnderlyingToken", + values: [string] + ): string; + encodeFunctionData( + functionFragment: "grantRole", + values: [BytesLike, string] + ): string; + encodeFunctionData( + functionFragment: "hasRole", + values: [BytesLike, string] + ): string; + encodeFunctionData( + functionFragment: "hasUnderlyingToken", + values: [string] + ): string; + encodeFunctionData( + functionFragment: "isTokenIDExist", + values: [string] + ): string; + encodeFunctionData( + functionFragment: "removeTokenMapping", + values: [string] + ): string; + encodeFunctionData( + functionFragment: "renounceRole", + values: [BytesLike, string] + ): string; + encodeFunctionData( + functionFragment: "revokeRole", + values: [BytesLike, string] + ): string; + encodeFunctionData( + functionFragment: "setMaxGasPrice", + values: [BigNumberish, BigNumberish] + ): string; + encodeFunctionData( + functionFragment: "setPoolConfig", + values: [string, BigNumberish, string, boolean] + ): string; + encodeFunctionData( + functionFragment: "setTokenConfig", + values: [ + string, + BigNumberish, + string, + BigNumberish, + BigNumberish, + BigNumberish, + BigNumberish, + BigNumberish, + BigNumberish, + boolean, + boolean + ] + ): string; + + decodeFunctionResult( + functionFragment: "BRIDGEMANAGER_ROLE", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "DEFAULT_ADMIN_ROLE", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "bridgeConfigVersion", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "calculateSwapFee", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "getAllTokenIDs", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "getMaxGasPrice", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "getPoolConfig", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "getRoleAdmin", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "getRoleMember", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "getRoleMemberCount", + data: BytesLike + ): Result; + decodeFunctionResult(functionFragment: "getToken", data: BytesLike): Result; + decodeFunctionResult( + functionFragment: "getTokenByAddress", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "getTokenByEVMAddress", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "getTokenByID", + data: BytesLike + ): Result; + decodeFunctionResult(functionFragment: "getTokenID", data: BytesLike): Result; + decodeFunctionResult( + functionFragment: "getUnderlyingToken", + data: BytesLike + ): Result; + decodeFunctionResult(functionFragment: "grantRole", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "hasRole", data: BytesLike): Result; + decodeFunctionResult( + functionFragment: "hasUnderlyingToken", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "isTokenIDExist", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "removeTokenMapping", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "renounceRole", + data: BytesLike + ): Result; + decodeFunctionResult(functionFragment: "revokeRole", data: BytesLike): Result; + decodeFunctionResult( + functionFragment: "setMaxGasPrice", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "setPoolConfig", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "setTokenConfig", + data: BytesLike + ): Result; + + events: { + "RoleAdminChanged(bytes32,bytes32,bytes32)": EventFragment; + "RoleGranted(bytes32,address,address)": EventFragment; + "RoleRevoked(bytes32,address,address)": EventFragment; + }; + + getEvent(nameOrSignatureOrTopic: "RoleAdminChanged"): EventFragment; + getEvent(nameOrSignatureOrTopic: "RoleGranted"): EventFragment; + getEvent(nameOrSignatureOrTopic: "RoleRevoked"): EventFragment; +} + +export type RoleAdminChangedEvent = TypedEvent< + [string, string, string], + { role: string; previousAdminRole: string; newAdminRole: string } +>; + +export type RoleAdminChangedEventFilter = + TypedEventFilter; + +export type RoleGrantedEvent = TypedEvent< + [string, string, string], + { role: string; account: string; sender: string } +>; + +export type RoleGrantedEventFilter = TypedEventFilter; + +export type RoleRevokedEvent = TypedEvent< + [string, string, string], + { role: string; account: string; sender: string } +>; + +export type RoleRevokedEventFilter = TypedEventFilter; + +export interface BridgeConfigV3 extends BaseContract { + contractName: "BridgeConfigV3"; + connect(signerOrProvider: Signer | Provider | string): this; + attach(addressOrName: string): this; + deployed(): Promise; + + interface: BridgeConfigV3Interface; + + queryFilter( + event: TypedEventFilter, + fromBlockOrBlockhash?: string | number | undefined, + toBlock?: string | number | undefined + ): Promise>; + + listeners( + eventFilter?: TypedEventFilter + ): Array>; + listeners(eventName?: string): Array; + removeAllListeners( + eventFilter: TypedEventFilter + ): this; + removeAllListeners(eventName?: string): this; + off: OnEvent; + on: OnEvent; + once: OnEvent; + removeListener: OnEvent; + + functions: { + BRIDGEMANAGER_ROLE(overrides?: CallOverrides): Promise<[string]>; + + DEFAULT_ADMIN_ROLE(overrides?: CallOverrides): Promise<[string]>; + + bridgeConfigVersion(overrides?: CallOverrides): Promise<[BigNumber]>; + + /** + * This means the fee should be calculated based on the chain that the nodes emit a tx on + * Calculates bridge swap fee based on the destination chain's token transfer. + * @param amount in native token decimals + * @param chainID destination chain ID to query the token config for + * @param tokenAddress address of the destination token to query token config for + */ + "calculateSwapFee(string,uint256,uint256)"( + tokenAddress: string, + chainID: BigNumberish, + amount: BigNumberish, + overrides?: CallOverrides + ): Promise<[BigNumber]>; + + /** + * This means the fee should be calculated based on the chain that the nodes emit a tx on + * Calculates bridge swap fee based on the destination chain's token transfer. + * @param amount in native token decimals + * @param chainID destination chain ID to query the token config for + * @param tokenAddress address of the destination token to query token config for + */ + "calculateSwapFee(address,uint256,uint256)"( + tokenAddress: string, + chainID: BigNumberish, + amount: BigNumberish, + overrides?: CallOverrides + ): Promise<[BigNumber]>; + + /** + * Returns a list of all existing token IDs converted to strings + */ + getAllTokenIDs( + overrides?: CallOverrides + ): Promise<[string[]] & { result: string[] }>; + + /** + * gets the max gas price for a chain + */ + getMaxGasPrice( + chainID: BigNumberish, + overrides?: CallOverrides + ): Promise<[BigNumber]>; + + getPoolConfig( + tokenAddress: string, + chainID: BigNumberish, + overrides?: CallOverrides + ): Promise<[BridgeConfigV3.PoolStructOutput]>; + + /** + * Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}. + */ + getRoleAdmin(role: BytesLike, overrides?: CallOverrides): Promise<[string]>; + + /** + * Returns one of the accounts that have `role`. `index` must be a value between 0 and {getRoleMemberCount}, non-inclusive. Role bearers are not sorted in any particular way, and their ordering may change at any point. WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure you perform all queries on the same block. See the following https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] for more information. + */ + getRoleMember( + role: BytesLike, + index: BigNumberish, + overrides?: CallOverrides + ): Promise<[string]>; + + /** + * Returns the number of accounts that have `role`. Can be used together with {getRoleMember} to enumerate all bearers of a role. + */ + getRoleMemberCount( + role: BytesLike, + overrides?: CallOverrides + ): Promise<[BigNumber]>; + + /** + * Returns the full token config struct + * @param chainID Chain ID of which token address + config to get + * @param tokenID String input of the token ID for the token + */ + getToken( + tokenID: string, + chainID: BigNumberish, + overrides?: CallOverrides + ): Promise< + [BridgeConfigV3.TokenStructOutput] & { + token: BridgeConfigV3.TokenStructOutput; + } + >; + + /** + * Returns token config struct, given an address and chainID + * @param chainID Chain ID of which token to get config for + * @param tokenAddress Matches the token ID by using a combo of address + chain ID + */ + getTokenByAddress( + tokenAddress: string, + chainID: BigNumberish, + overrides?: CallOverrides + ): Promise< + [BridgeConfigV3.TokenStructOutput] & { + token: BridgeConfigV3.TokenStructOutput; + } + >; + + getTokenByEVMAddress( + tokenAddress: string, + chainID: BigNumberish, + overrides?: CallOverrides + ): Promise< + [BridgeConfigV3.TokenStructOutput] & { + token: BridgeConfigV3.TokenStructOutput; + } + >; + + /** + * Returns the full token config struct + * @param chainID Chain ID of which token address + config to get + * @param tokenID String input of the token ID for the token + */ + getTokenByID( + tokenID: string, + chainID: BigNumberish, + overrides?: CallOverrides + ): Promise< + [BridgeConfigV3.TokenStructOutput] & { + token: BridgeConfigV3.TokenStructOutput; + } + >; + + /** + * Returns the token ID (string) of the cross-chain token inputted + * @param chainID chainID of which to get token ID for + * @param tokenAddress address of token to get ID for + */ + "getTokenID(address,uint256)"( + tokenAddress: string, + chainID: BigNumberish, + overrides?: CallOverrides + ): Promise<[string]>; + + "getTokenID(string,uint256)"( + tokenAddress: string, + chainID: BigNumberish, + overrides?: CallOverrides + ): Promise<[string]>; + + /** + * Returns which token is the underlying token to withdraw + * @param tokenID string token ID + */ + getUnderlyingToken( + tokenID: string, + overrides?: CallOverrides + ): Promise< + [BridgeConfigV3.TokenStructOutput] & { + token: BridgeConfigV3.TokenStructOutput; + } + >; + + /** + * Grants `role` to `account`. If `account` had not been already granted `role`, emits a {RoleGranted} event. Requirements: - the caller must have ``role``'s admin role. + */ + grantRole( + role: BytesLike, + account: string, + overrides?: Overrides & { from?: string | Promise } + ): Promise; + + /** + * Returns `true` if `account` has been granted `role`. + */ + hasRole( + role: BytesLike, + account: string, + overrides?: CallOverrides + ): Promise<[boolean]>; + + /** + * Returns true if the token has an underlying token -- meaning the token is deposited into the bridge + * @param tokenID String to check if it is a withdraw/underlying token + */ + hasUnderlyingToken( + tokenID: string, + overrides?: CallOverrides + ): Promise<[boolean]>; + + /** + * Public function returning if token ID exists given a string + */ + isTokenIDExist( + tokenID: string, + overrides?: CallOverrides + ): Promise<[boolean]>; + + removeTokenMapping( + tokenID: string, + overrides?: Overrides & { from?: string | Promise } + ): Promise; + + /** + * Revokes `role` from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must be `account`. + */ + renounceRole( + role: BytesLike, + account: string, + overrides?: Overrides & { from?: string | Promise } + ): Promise; + + /** + * Revokes `role` from `account`. If `account` had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must have ``role``'s admin role. + */ + revokeRole( + role: BytesLike, + account: string, + overrides?: Overrides & { from?: string | Promise } + ): Promise; + + /** + * sets the max gas price for a chain + */ + setMaxGasPrice( + chainID: BigNumberish, + maxPrice: BigNumberish, + overrides?: Overrides & { from?: string | Promise } + ): Promise; + + setPoolConfig( + tokenAddress: string, + chainID: BigNumberish, + poolAddress: string, + metaswap: boolean, + overrides?: Overrides & { from?: string | Promise } + ): Promise; + + /** + * Main write function of this contract - Handles creating the struct and passing it to the internal logic function + * @param chainID chain ID to use for the token config object + * @param hasUnderlying bool which represents whether this is a global mint token or one to withdraw() + * @param isUnderlying bool which represents if this token is the one to withdraw on the given chain + * @param maxSwap maximum amount of token allowed to be transferred at once - in native token decimals + * @param maxSwapFee max swap fee to be charged - in native token decimals + * @param minSwap minimum amount of token needed to be transferred at once - in native token decimals + * @param minSwapFee min swap fee to be charged - in native token decimals - especially useful for mainnet ETH + * @param swapFee percent based swap fee -- 10e6 == 10bps + * @param tokenAddress token address of the token on the given chain + * @param tokenDecimals decimals of token + * @param tokenID string ID to set the token config object form + */ + "setTokenConfig(string,uint256,address,uint8,uint256,uint256,uint256,uint256,uint256,bool,bool)"( + tokenID: string, + chainID: BigNumberish, + tokenAddress: string, + tokenDecimals: BigNumberish, + maxSwap: BigNumberish, + minSwap: BigNumberish, + swapFee: BigNumberish, + maxSwapFee: BigNumberish, + minSwapFee: BigNumberish, + hasUnderlying: boolean, + isUnderlying: boolean, + overrides?: Overrides & { from?: string | Promise } + ): Promise; + + /** + * Main write function of this contract - Handles creating the struct and passing it to the internal logic function + * @param chainID chain ID to use for the token config object + * @param hasUnderlying bool which represents whether this is a global mint token or one to withdraw() + * @param isUnderlying bool which represents if this token is the one to withdraw on the given chain + * @param maxSwap maximum amount of token allowed to be transferred at once - in native token decimals + * @param maxSwapFee max swap fee to be charged - in native token decimals + * @param minSwap minimum amount of token needed to be transferred at once - in native token decimals + * @param minSwapFee min swap fee to be charged - in native token decimals - especially useful for mainnet ETH + * @param swapFee percent based swap fee -- 10e6 == 10bps + * @param tokenAddress token address of the token on the given chain + * @param tokenDecimals decimals of token + * @param tokenID string ID to set the token config object form + */ + "setTokenConfig(string,uint256,string,uint8,uint256,uint256,uint256,uint256,uint256,bool,bool)"( + tokenID: string, + chainID: BigNumberish, + tokenAddress: string, + tokenDecimals: BigNumberish, + maxSwap: BigNumberish, + minSwap: BigNumberish, + swapFee: BigNumberish, + maxSwapFee: BigNumberish, + minSwapFee: BigNumberish, + hasUnderlying: boolean, + isUnderlying: boolean, + overrides?: Overrides & { from?: string | Promise } + ): Promise; + }; + + BRIDGEMANAGER_ROLE(overrides?: CallOverrides): Promise; + + DEFAULT_ADMIN_ROLE(overrides?: CallOverrides): Promise; + + bridgeConfigVersion(overrides?: CallOverrides): Promise; + + /** + * This means the fee should be calculated based on the chain that the nodes emit a tx on + * Calculates bridge swap fee based on the destination chain's token transfer. + * @param amount in native token decimals + * @param chainID destination chain ID to query the token config for + * @param tokenAddress address of the destination token to query token config for + */ + "calculateSwapFee(string,uint256,uint256)"( + tokenAddress: string, + chainID: BigNumberish, + amount: BigNumberish, + overrides?: CallOverrides + ): Promise; + + /** + * This means the fee should be calculated based on the chain that the nodes emit a tx on + * Calculates bridge swap fee based on the destination chain's token transfer. + * @param amount in native token decimals + * @param chainID destination chain ID to query the token config for + * @param tokenAddress address of the destination token to query token config for + */ + "calculateSwapFee(address,uint256,uint256)"( + tokenAddress: string, + chainID: BigNumberish, + amount: BigNumberish, + overrides?: CallOverrides + ): Promise; + + /** + * Returns a list of all existing token IDs converted to strings + */ + getAllTokenIDs(overrides?: CallOverrides): Promise; + + /** + * gets the max gas price for a chain + */ + getMaxGasPrice( + chainID: BigNumberish, + overrides?: CallOverrides + ): Promise; + + getPoolConfig( + tokenAddress: string, + chainID: BigNumberish, + overrides?: CallOverrides + ): Promise; + + /** + * Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}. + */ + getRoleAdmin(role: BytesLike, overrides?: CallOverrides): Promise; + + /** + * Returns one of the accounts that have `role`. `index` must be a value between 0 and {getRoleMemberCount}, non-inclusive. Role bearers are not sorted in any particular way, and their ordering may change at any point. WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure you perform all queries on the same block. See the following https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] for more information. + */ + getRoleMember( + role: BytesLike, + index: BigNumberish, + overrides?: CallOverrides + ): Promise; + + /** + * Returns the number of accounts that have `role`. Can be used together with {getRoleMember} to enumerate all bearers of a role. + */ + getRoleMemberCount( + role: BytesLike, + overrides?: CallOverrides + ): Promise; + + /** + * Returns the full token config struct + * @param chainID Chain ID of which token address + config to get + * @param tokenID String input of the token ID for the token + */ + getToken( + tokenID: string, + chainID: BigNumberish, + overrides?: CallOverrides + ): Promise; + + /** + * Returns token config struct, given an address and chainID + * @param chainID Chain ID of which token to get config for + * @param tokenAddress Matches the token ID by using a combo of address + chain ID + */ + getTokenByAddress( + tokenAddress: string, + chainID: BigNumberish, + overrides?: CallOverrides + ): Promise; + + getTokenByEVMAddress( + tokenAddress: string, + chainID: BigNumberish, + overrides?: CallOverrides + ): Promise; + + /** + * Returns the full token config struct + * @param chainID Chain ID of which token address + config to get + * @param tokenID String input of the token ID for the token + */ + getTokenByID( + tokenID: string, + chainID: BigNumberish, + overrides?: CallOverrides + ): Promise; + + /** + * Returns the token ID (string) of the cross-chain token inputted + * @param chainID chainID of which to get token ID for + * @param tokenAddress address of token to get ID for + */ + "getTokenID(address,uint256)"( + tokenAddress: string, + chainID: BigNumberish, + overrides?: CallOverrides + ): Promise; + + "getTokenID(string,uint256)"( + tokenAddress: string, + chainID: BigNumberish, + overrides?: CallOverrides + ): Promise; + + /** + * Returns which token is the underlying token to withdraw + * @param tokenID string token ID + */ + getUnderlyingToken( + tokenID: string, + overrides?: CallOverrides + ): Promise; + + /** + * Grants `role` to `account`. If `account` had not been already granted `role`, emits a {RoleGranted} event. Requirements: - the caller must have ``role``'s admin role. + */ + grantRole( + role: BytesLike, + account: string, + overrides?: Overrides & { from?: string | Promise } + ): Promise; + + /** + * Returns `true` if `account` has been granted `role`. + */ + hasRole( + role: BytesLike, + account: string, + overrides?: CallOverrides + ): Promise; + + /** + * Returns true if the token has an underlying token -- meaning the token is deposited into the bridge + * @param tokenID String to check if it is a withdraw/underlying token + */ + hasUnderlyingToken( + tokenID: string, + overrides?: CallOverrides + ): Promise; + + /** + * Public function returning if token ID exists given a string + */ + isTokenIDExist(tokenID: string, overrides?: CallOverrides): Promise; + + removeTokenMapping( + tokenID: string, + overrides?: Overrides & { from?: string | Promise } + ): Promise; + + /** + * Revokes `role` from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must be `account`. + */ + renounceRole( + role: BytesLike, + account: string, + overrides?: Overrides & { from?: string | Promise } + ): Promise; + + /** + * Revokes `role` from `account`. If `account` had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must have ``role``'s admin role. + */ + revokeRole( + role: BytesLike, + account: string, + overrides?: Overrides & { from?: string | Promise } + ): Promise; + + /** + * sets the max gas price for a chain + */ + setMaxGasPrice( + chainID: BigNumberish, + maxPrice: BigNumberish, + overrides?: Overrides & { from?: string | Promise } + ): Promise; + + setPoolConfig( + tokenAddress: string, + chainID: BigNumberish, + poolAddress: string, + metaswap: boolean, + overrides?: Overrides & { from?: string | Promise } + ): Promise; + + /** + * Main write function of this contract - Handles creating the struct and passing it to the internal logic function + * @param chainID chain ID to use for the token config object + * @param hasUnderlying bool which represents whether this is a global mint token or one to withdraw() + * @param isUnderlying bool which represents if this token is the one to withdraw on the given chain + * @param maxSwap maximum amount of token allowed to be transferred at once - in native token decimals + * @param maxSwapFee max swap fee to be charged - in native token decimals + * @param minSwap minimum amount of token needed to be transferred at once - in native token decimals + * @param minSwapFee min swap fee to be charged - in native token decimals - especially useful for mainnet ETH + * @param swapFee percent based swap fee -- 10e6 == 10bps + * @param tokenAddress token address of the token on the given chain + * @param tokenDecimals decimals of token + * @param tokenID string ID to set the token config object form + */ + "setTokenConfig(string,uint256,address,uint8,uint256,uint256,uint256,uint256,uint256,bool,bool)"( + tokenID: string, + chainID: BigNumberish, + tokenAddress: string, + tokenDecimals: BigNumberish, + maxSwap: BigNumberish, + minSwap: BigNumberish, + swapFee: BigNumberish, + maxSwapFee: BigNumberish, + minSwapFee: BigNumberish, + hasUnderlying: boolean, + isUnderlying: boolean, + overrides?: Overrides & { from?: string | Promise } + ): Promise; + + /** + * Main write function of this contract - Handles creating the struct and passing it to the internal logic function + * @param chainID chain ID to use for the token config object + * @param hasUnderlying bool which represents whether this is a global mint token or one to withdraw() + * @param isUnderlying bool which represents if this token is the one to withdraw on the given chain + * @param maxSwap maximum amount of token allowed to be transferred at once - in native token decimals + * @param maxSwapFee max swap fee to be charged - in native token decimals + * @param minSwap minimum amount of token needed to be transferred at once - in native token decimals + * @param minSwapFee min swap fee to be charged - in native token decimals - especially useful for mainnet ETH + * @param swapFee percent based swap fee -- 10e6 == 10bps + * @param tokenAddress token address of the token on the given chain + * @param tokenDecimals decimals of token + * @param tokenID string ID to set the token config object form + */ + "setTokenConfig(string,uint256,string,uint8,uint256,uint256,uint256,uint256,uint256,bool,bool)"( + tokenID: string, + chainID: BigNumberish, + tokenAddress: string, + tokenDecimals: BigNumberish, + maxSwap: BigNumberish, + minSwap: BigNumberish, + swapFee: BigNumberish, + maxSwapFee: BigNumberish, + minSwapFee: BigNumberish, + hasUnderlying: boolean, + isUnderlying: boolean, + overrides?: Overrides & { from?: string | Promise } + ): Promise; + + callStatic: { + BRIDGEMANAGER_ROLE(overrides?: CallOverrides): Promise; + + DEFAULT_ADMIN_ROLE(overrides?: CallOverrides): Promise; + + bridgeConfigVersion(overrides?: CallOverrides): Promise; + + /** + * This means the fee should be calculated based on the chain that the nodes emit a tx on + * Calculates bridge swap fee based on the destination chain's token transfer. + * @param amount in native token decimals + * @param chainID destination chain ID to query the token config for + * @param tokenAddress address of the destination token to query token config for + */ + "calculateSwapFee(string,uint256,uint256)"( + tokenAddress: string, + chainID: BigNumberish, + amount: BigNumberish, + overrides?: CallOverrides + ): Promise; + + /** + * This means the fee should be calculated based on the chain that the nodes emit a tx on + * Calculates bridge swap fee based on the destination chain's token transfer. + * @param amount in native token decimals + * @param chainID destination chain ID to query the token config for + * @param tokenAddress address of the destination token to query token config for + */ + "calculateSwapFee(address,uint256,uint256)"( + tokenAddress: string, + chainID: BigNumberish, + amount: BigNumberish, + overrides?: CallOverrides + ): Promise; + + /** + * Returns a list of all existing token IDs converted to strings + */ + getAllTokenIDs(overrides?: CallOverrides): Promise; + + /** + * gets the max gas price for a chain + */ + getMaxGasPrice( + chainID: BigNumberish, + overrides?: CallOverrides + ): Promise; + + getPoolConfig( + tokenAddress: string, + chainID: BigNumberish, + overrides?: CallOverrides + ): Promise; + + /** + * Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}. + */ + getRoleAdmin(role: BytesLike, overrides?: CallOverrides): Promise; + + /** + * Returns one of the accounts that have `role`. `index` must be a value between 0 and {getRoleMemberCount}, non-inclusive. Role bearers are not sorted in any particular way, and their ordering may change at any point. WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure you perform all queries on the same block. See the following https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] for more information. + */ + getRoleMember( + role: BytesLike, + index: BigNumberish, + overrides?: CallOverrides + ): Promise; + + /** + * Returns the number of accounts that have `role`. Can be used together with {getRoleMember} to enumerate all bearers of a role. + */ + getRoleMemberCount( + role: BytesLike, + overrides?: CallOverrides + ): Promise; + + /** + * Returns the full token config struct + * @param chainID Chain ID of which token address + config to get + * @param tokenID String input of the token ID for the token + */ + getToken( + tokenID: string, + chainID: BigNumberish, + overrides?: CallOverrides + ): Promise; + + /** + * Returns token config struct, given an address and chainID + * @param chainID Chain ID of which token to get config for + * @param tokenAddress Matches the token ID by using a combo of address + chain ID + */ + getTokenByAddress( + tokenAddress: string, + chainID: BigNumberish, + overrides?: CallOverrides + ): Promise; + + getTokenByEVMAddress( + tokenAddress: string, + chainID: BigNumberish, + overrides?: CallOverrides + ): Promise; + + /** + * Returns the full token config struct + * @param chainID Chain ID of which token address + config to get + * @param tokenID String input of the token ID for the token + */ + getTokenByID( + tokenID: string, + chainID: BigNumberish, + overrides?: CallOverrides + ): Promise; + + /** + * Returns the token ID (string) of the cross-chain token inputted + * @param chainID chainID of which to get token ID for + * @param tokenAddress address of token to get ID for + */ + "getTokenID(address,uint256)"( + tokenAddress: string, + chainID: BigNumberish, + overrides?: CallOverrides + ): Promise; + + "getTokenID(string,uint256)"( + tokenAddress: string, + chainID: BigNumberish, + overrides?: CallOverrides + ): Promise; + + /** + * Returns which token is the underlying token to withdraw + * @param tokenID string token ID + */ + getUnderlyingToken( + tokenID: string, + overrides?: CallOverrides + ): Promise; + + /** + * Grants `role` to `account`. If `account` had not been already granted `role`, emits a {RoleGranted} event. Requirements: - the caller must have ``role``'s admin role. + */ + grantRole( + role: BytesLike, + account: string, + overrides?: CallOverrides + ): Promise; + + /** + * Returns `true` if `account` has been granted `role`. + */ + hasRole( + role: BytesLike, + account: string, + overrides?: CallOverrides + ): Promise; + + /** + * Returns true if the token has an underlying token -- meaning the token is deposited into the bridge + * @param tokenID String to check if it is a withdraw/underlying token + */ + hasUnderlyingToken( + tokenID: string, + overrides?: CallOverrides + ): Promise; + + /** + * Public function returning if token ID exists given a string + */ + isTokenIDExist( + tokenID: string, + overrides?: CallOverrides + ): Promise; + + removeTokenMapping( + tokenID: string, + overrides?: CallOverrides + ): Promise; + + /** + * Revokes `role` from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must be `account`. + */ + renounceRole( + role: BytesLike, + account: string, + overrides?: CallOverrides + ): Promise; + + /** + * Revokes `role` from `account`. If `account` had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must have ``role``'s admin role. + */ + revokeRole( + role: BytesLike, + account: string, + overrides?: CallOverrides + ): Promise; + + /** + * sets the max gas price for a chain + */ + setMaxGasPrice( + chainID: BigNumberish, + maxPrice: BigNumberish, + overrides?: CallOverrides + ): Promise; + + setPoolConfig( + tokenAddress: string, + chainID: BigNumberish, + poolAddress: string, + metaswap: boolean, + overrides?: CallOverrides + ): Promise; + + /** + * Main write function of this contract - Handles creating the struct and passing it to the internal logic function + * @param chainID chain ID to use for the token config object + * @param hasUnderlying bool which represents whether this is a global mint token or one to withdraw() + * @param isUnderlying bool which represents if this token is the one to withdraw on the given chain + * @param maxSwap maximum amount of token allowed to be transferred at once - in native token decimals + * @param maxSwapFee max swap fee to be charged - in native token decimals + * @param minSwap minimum amount of token needed to be transferred at once - in native token decimals + * @param minSwapFee min swap fee to be charged - in native token decimals - especially useful for mainnet ETH + * @param swapFee percent based swap fee -- 10e6 == 10bps + * @param tokenAddress token address of the token on the given chain + * @param tokenDecimals decimals of token + * @param tokenID string ID to set the token config object form + */ + "setTokenConfig(string,uint256,address,uint8,uint256,uint256,uint256,uint256,uint256,bool,bool)"( + tokenID: string, + chainID: BigNumberish, + tokenAddress: string, + tokenDecimals: BigNumberish, + maxSwap: BigNumberish, + minSwap: BigNumberish, + swapFee: BigNumberish, + maxSwapFee: BigNumberish, + minSwapFee: BigNumberish, + hasUnderlying: boolean, + isUnderlying: boolean, + overrides?: CallOverrides + ): Promise; + + /** + * Main write function of this contract - Handles creating the struct and passing it to the internal logic function + * @param chainID chain ID to use for the token config object + * @param hasUnderlying bool which represents whether this is a global mint token or one to withdraw() + * @param isUnderlying bool which represents if this token is the one to withdraw on the given chain + * @param maxSwap maximum amount of token allowed to be transferred at once - in native token decimals + * @param maxSwapFee max swap fee to be charged - in native token decimals + * @param minSwap minimum amount of token needed to be transferred at once - in native token decimals + * @param minSwapFee min swap fee to be charged - in native token decimals - especially useful for mainnet ETH + * @param swapFee percent based swap fee -- 10e6 == 10bps + * @param tokenAddress token address of the token on the given chain + * @param tokenDecimals decimals of token + * @param tokenID string ID to set the token config object form + */ + "setTokenConfig(string,uint256,string,uint8,uint256,uint256,uint256,uint256,uint256,bool,bool)"( + tokenID: string, + chainID: BigNumberish, + tokenAddress: string, + tokenDecimals: BigNumberish, + maxSwap: BigNumberish, + minSwap: BigNumberish, + swapFee: BigNumberish, + maxSwapFee: BigNumberish, + minSwapFee: BigNumberish, + hasUnderlying: boolean, + isUnderlying: boolean, + overrides?: CallOverrides + ): Promise; + }; + + filters: { + "RoleAdminChanged(bytes32,bytes32,bytes32)"( + role?: BytesLike | null, + previousAdminRole?: BytesLike | null, + newAdminRole?: BytesLike | null + ): RoleAdminChangedEventFilter; + RoleAdminChanged( + role?: BytesLike | null, + previousAdminRole?: BytesLike | null, + newAdminRole?: BytesLike | null + ): RoleAdminChangedEventFilter; + + "RoleGranted(bytes32,address,address)"( + role?: BytesLike | null, + account?: string | null, + sender?: string | null + ): RoleGrantedEventFilter; + RoleGranted( + role?: BytesLike | null, + account?: string | null, + sender?: string | null + ): RoleGrantedEventFilter; + + "RoleRevoked(bytes32,address,address)"( + role?: BytesLike | null, + account?: string | null, + sender?: string | null + ): RoleRevokedEventFilter; + RoleRevoked( + role?: BytesLike | null, + account?: string | null, + sender?: string | null + ): RoleRevokedEventFilter; + }; + + estimateGas: { + BRIDGEMANAGER_ROLE(overrides?: CallOverrides): Promise; + + DEFAULT_ADMIN_ROLE(overrides?: CallOverrides): Promise; + + bridgeConfigVersion(overrides?: CallOverrides): Promise; + + /** + * This means the fee should be calculated based on the chain that the nodes emit a tx on + * Calculates bridge swap fee based on the destination chain's token transfer. + * @param amount in native token decimals + * @param chainID destination chain ID to query the token config for + * @param tokenAddress address of the destination token to query token config for + */ + "calculateSwapFee(string,uint256,uint256)"( + tokenAddress: string, + chainID: BigNumberish, + amount: BigNumberish, + overrides?: CallOverrides + ): Promise; + + /** + * This means the fee should be calculated based on the chain that the nodes emit a tx on + * Calculates bridge swap fee based on the destination chain's token transfer. + * @param amount in native token decimals + * @param chainID destination chain ID to query the token config for + * @param tokenAddress address of the destination token to query token config for + */ + "calculateSwapFee(address,uint256,uint256)"( + tokenAddress: string, + chainID: BigNumberish, + amount: BigNumberish, + overrides?: CallOverrides + ): Promise; + + /** + * Returns a list of all existing token IDs converted to strings + */ + getAllTokenIDs(overrides?: CallOverrides): Promise; + + /** + * gets the max gas price for a chain + */ + getMaxGasPrice( + chainID: BigNumberish, + overrides?: CallOverrides + ): Promise; + + getPoolConfig( + tokenAddress: string, + chainID: BigNumberish, + overrides?: CallOverrides + ): Promise; + + /** + * Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}. + */ + getRoleAdmin( + role: BytesLike, + overrides?: CallOverrides + ): Promise; + + /** + * Returns one of the accounts that have `role`. `index` must be a value between 0 and {getRoleMemberCount}, non-inclusive. Role bearers are not sorted in any particular way, and their ordering may change at any point. WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure you perform all queries on the same block. See the following https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] for more information. + */ + getRoleMember( + role: BytesLike, + index: BigNumberish, + overrides?: CallOverrides + ): Promise; + + /** + * Returns the number of accounts that have `role`. Can be used together with {getRoleMember} to enumerate all bearers of a role. + */ + getRoleMemberCount( + role: BytesLike, + overrides?: CallOverrides + ): Promise; + + /** + * Returns the full token config struct + * @param chainID Chain ID of which token address + config to get + * @param tokenID String input of the token ID for the token + */ + getToken( + tokenID: string, + chainID: BigNumberish, + overrides?: CallOverrides + ): Promise; + + /** + * Returns token config struct, given an address and chainID + * @param chainID Chain ID of which token to get config for + * @param tokenAddress Matches the token ID by using a combo of address + chain ID + */ + getTokenByAddress( + tokenAddress: string, + chainID: BigNumberish, + overrides?: CallOverrides + ): Promise; + + getTokenByEVMAddress( + tokenAddress: string, + chainID: BigNumberish, + overrides?: CallOverrides + ): Promise; + + /** + * Returns the full token config struct + * @param chainID Chain ID of which token address + config to get + * @param tokenID String input of the token ID for the token + */ + getTokenByID( + tokenID: string, + chainID: BigNumberish, + overrides?: CallOverrides + ): Promise; + + /** + * Returns the token ID (string) of the cross-chain token inputted + * @param chainID chainID of which to get token ID for + * @param tokenAddress address of token to get ID for + */ + "getTokenID(address,uint256)"( + tokenAddress: string, + chainID: BigNumberish, + overrides?: CallOverrides + ): Promise; + + "getTokenID(string,uint256)"( + tokenAddress: string, + chainID: BigNumberish, + overrides?: CallOverrides + ): Promise; + + /** + * Returns which token is the underlying token to withdraw + * @param tokenID string token ID + */ + getUnderlyingToken( + tokenID: string, + overrides?: CallOverrides + ): Promise; + + /** + * Grants `role` to `account`. If `account` had not been already granted `role`, emits a {RoleGranted} event. Requirements: - the caller must have ``role``'s admin role. + */ + grantRole( + role: BytesLike, + account: string, + overrides?: Overrides & { from?: string | Promise } + ): Promise; + + /** + * Returns `true` if `account` has been granted `role`. + */ + hasRole( + role: BytesLike, + account: string, + overrides?: CallOverrides + ): Promise; + + /** + * Returns true if the token has an underlying token -- meaning the token is deposited into the bridge + * @param tokenID String to check if it is a withdraw/underlying token + */ + hasUnderlyingToken( + tokenID: string, + overrides?: CallOverrides + ): Promise; + + /** + * Public function returning if token ID exists given a string + */ + isTokenIDExist( + tokenID: string, + overrides?: CallOverrides + ): Promise; + + removeTokenMapping( + tokenID: string, + overrides?: Overrides & { from?: string | Promise } + ): Promise; + + /** + * Revokes `role` from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must be `account`. + */ + renounceRole( + role: BytesLike, + account: string, + overrides?: Overrides & { from?: string | Promise } + ): Promise; + + /** + * Revokes `role` from `account`. If `account` had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must have ``role``'s admin role. + */ + revokeRole( + role: BytesLike, + account: string, + overrides?: Overrides & { from?: string | Promise } + ): Promise; + + /** + * sets the max gas price for a chain + */ + setMaxGasPrice( + chainID: BigNumberish, + maxPrice: BigNumberish, + overrides?: Overrides & { from?: string | Promise } + ): Promise; + + setPoolConfig( + tokenAddress: string, + chainID: BigNumberish, + poolAddress: string, + metaswap: boolean, + overrides?: Overrides & { from?: string | Promise } + ): Promise; + + /** + * Main write function of this contract - Handles creating the struct and passing it to the internal logic function + * @param chainID chain ID to use for the token config object + * @param hasUnderlying bool which represents whether this is a global mint token or one to withdraw() + * @param isUnderlying bool which represents if this token is the one to withdraw on the given chain + * @param maxSwap maximum amount of token allowed to be transferred at once - in native token decimals + * @param maxSwapFee max swap fee to be charged - in native token decimals + * @param minSwap minimum amount of token needed to be transferred at once - in native token decimals + * @param minSwapFee min swap fee to be charged - in native token decimals - especially useful for mainnet ETH + * @param swapFee percent based swap fee -- 10e6 == 10bps + * @param tokenAddress token address of the token on the given chain + * @param tokenDecimals decimals of token + * @param tokenID string ID to set the token config object form + */ + "setTokenConfig(string,uint256,address,uint8,uint256,uint256,uint256,uint256,uint256,bool,bool)"( + tokenID: string, + chainID: BigNumberish, + tokenAddress: string, + tokenDecimals: BigNumberish, + maxSwap: BigNumberish, + minSwap: BigNumberish, + swapFee: BigNumberish, + maxSwapFee: BigNumberish, + minSwapFee: BigNumberish, + hasUnderlying: boolean, + isUnderlying: boolean, + overrides?: Overrides & { from?: string | Promise } + ): Promise; + + /** + * Main write function of this contract - Handles creating the struct and passing it to the internal logic function + * @param chainID chain ID to use for the token config object + * @param hasUnderlying bool which represents whether this is a global mint token or one to withdraw() + * @param isUnderlying bool which represents if this token is the one to withdraw on the given chain + * @param maxSwap maximum amount of token allowed to be transferred at once - in native token decimals + * @param maxSwapFee max swap fee to be charged - in native token decimals + * @param minSwap minimum amount of token needed to be transferred at once - in native token decimals + * @param minSwapFee min swap fee to be charged - in native token decimals - especially useful for mainnet ETH + * @param swapFee percent based swap fee -- 10e6 == 10bps + * @param tokenAddress token address of the token on the given chain + * @param tokenDecimals decimals of token + * @param tokenID string ID to set the token config object form + */ + "setTokenConfig(string,uint256,string,uint8,uint256,uint256,uint256,uint256,uint256,bool,bool)"( + tokenID: string, + chainID: BigNumberish, + tokenAddress: string, + tokenDecimals: BigNumberish, + maxSwap: BigNumberish, + minSwap: BigNumberish, + swapFee: BigNumberish, + maxSwapFee: BigNumberish, + minSwapFee: BigNumberish, + hasUnderlying: boolean, + isUnderlying: boolean, + overrides?: Overrides & { from?: string | Promise } + ): Promise; + }; + + populateTransaction: { + BRIDGEMANAGER_ROLE( + overrides?: CallOverrides + ): Promise; + + DEFAULT_ADMIN_ROLE( + overrides?: CallOverrides + ): Promise; + + bridgeConfigVersion( + overrides?: CallOverrides + ): Promise; + + /** + * This means the fee should be calculated based on the chain that the nodes emit a tx on + * Calculates bridge swap fee based on the destination chain's token transfer. + * @param amount in native token decimals + * @param chainID destination chain ID to query the token config for + * @param tokenAddress address of the destination token to query token config for + */ + "calculateSwapFee(string,uint256,uint256)"( + tokenAddress: string, + chainID: BigNumberish, + amount: BigNumberish, + overrides?: CallOverrides + ): Promise; + + /** + * This means the fee should be calculated based on the chain that the nodes emit a tx on + * Calculates bridge swap fee based on the destination chain's token transfer. + * @param amount in native token decimals + * @param chainID destination chain ID to query the token config for + * @param tokenAddress address of the destination token to query token config for + */ + "calculateSwapFee(address,uint256,uint256)"( + tokenAddress: string, + chainID: BigNumberish, + amount: BigNumberish, + overrides?: CallOverrides + ): Promise; + + /** + * Returns a list of all existing token IDs converted to strings + */ + getAllTokenIDs(overrides?: CallOverrides): Promise; + + /** + * gets the max gas price for a chain + */ + getMaxGasPrice( + chainID: BigNumberish, + overrides?: CallOverrides + ): Promise; + + getPoolConfig( + tokenAddress: string, + chainID: BigNumberish, + overrides?: CallOverrides + ): Promise; + + /** + * Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}. + */ + getRoleAdmin( + role: BytesLike, + overrides?: CallOverrides + ): Promise; + + /** + * Returns one of the accounts that have `role`. `index` must be a value between 0 and {getRoleMemberCount}, non-inclusive. Role bearers are not sorted in any particular way, and their ordering may change at any point. WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure you perform all queries on the same block. See the following https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] for more information. + */ + getRoleMember( + role: BytesLike, + index: BigNumberish, + overrides?: CallOverrides + ): Promise; + + /** + * Returns the number of accounts that have `role`. Can be used together with {getRoleMember} to enumerate all bearers of a role. + */ + getRoleMemberCount( + role: BytesLike, + overrides?: CallOverrides + ): Promise; + + /** + * Returns the full token config struct + * @param chainID Chain ID of which token address + config to get + * @param tokenID String input of the token ID for the token + */ + getToken( + tokenID: string, + chainID: BigNumberish, + overrides?: CallOverrides + ): Promise; + + /** + * Returns token config struct, given an address and chainID + * @param chainID Chain ID of which token to get config for + * @param tokenAddress Matches the token ID by using a combo of address + chain ID + */ + getTokenByAddress( + tokenAddress: string, + chainID: BigNumberish, + overrides?: CallOverrides + ): Promise; + + getTokenByEVMAddress( + tokenAddress: string, + chainID: BigNumberish, + overrides?: CallOverrides + ): Promise; + + /** + * Returns the full token config struct + * @param chainID Chain ID of which token address + config to get + * @param tokenID String input of the token ID for the token + */ + getTokenByID( + tokenID: string, + chainID: BigNumberish, + overrides?: CallOverrides + ): Promise; + + /** + * Returns the token ID (string) of the cross-chain token inputted + * @param chainID chainID of which to get token ID for + * @param tokenAddress address of token to get ID for + */ + "getTokenID(address,uint256)"( + tokenAddress: string, + chainID: BigNumberish, + overrides?: CallOverrides + ): Promise; + + "getTokenID(string,uint256)"( + tokenAddress: string, + chainID: BigNumberish, + overrides?: CallOverrides + ): Promise; + + /** + * Returns which token is the underlying token to withdraw + * @param tokenID string token ID + */ + getUnderlyingToken( + tokenID: string, + overrides?: CallOverrides + ): Promise; + + /** + * Grants `role` to `account`. If `account` had not been already granted `role`, emits a {RoleGranted} event. Requirements: - the caller must have ``role``'s admin role. + */ + grantRole( + role: BytesLike, + account: string, + overrides?: Overrides & { from?: string | Promise } + ): Promise; + + /** + * Returns `true` if `account` has been granted `role`. + */ + hasRole( + role: BytesLike, + account: string, + overrides?: CallOverrides + ): Promise; + + /** + * Returns true if the token has an underlying token -- meaning the token is deposited into the bridge + * @param tokenID String to check if it is a withdraw/underlying token + */ + hasUnderlyingToken( + tokenID: string, + overrides?: CallOverrides + ): Promise; + + /** + * Public function returning if token ID exists given a string + */ + isTokenIDExist( + tokenID: string, + overrides?: CallOverrides + ): Promise; + + removeTokenMapping( + tokenID: string, + overrides?: Overrides & { from?: string | Promise } + ): Promise; + + /** + * Revokes `role` from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must be `account`. + */ + renounceRole( + role: BytesLike, + account: string, + overrides?: Overrides & { from?: string | Promise } + ): Promise; + + /** + * Revokes `role` from `account`. If `account` had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must have ``role``'s admin role. + */ + revokeRole( + role: BytesLike, + account: string, + overrides?: Overrides & { from?: string | Promise } + ): Promise; + + /** + * sets the max gas price for a chain + */ + setMaxGasPrice( + chainID: BigNumberish, + maxPrice: BigNumberish, + overrides?: Overrides & { from?: string | Promise } + ): Promise; + + setPoolConfig( + tokenAddress: string, + chainID: BigNumberish, + poolAddress: string, + metaswap: boolean, + overrides?: Overrides & { from?: string | Promise } + ): Promise; + + /** + * Main write function of this contract - Handles creating the struct and passing it to the internal logic function + * @param chainID chain ID to use for the token config object + * @param hasUnderlying bool which represents whether this is a global mint token or one to withdraw() + * @param isUnderlying bool which represents if this token is the one to withdraw on the given chain + * @param maxSwap maximum amount of token allowed to be transferred at once - in native token decimals + * @param maxSwapFee max swap fee to be charged - in native token decimals + * @param minSwap minimum amount of token needed to be transferred at once - in native token decimals + * @param minSwapFee min swap fee to be charged - in native token decimals - especially useful for mainnet ETH + * @param swapFee percent based swap fee -- 10e6 == 10bps + * @param tokenAddress token address of the token on the given chain + * @param tokenDecimals decimals of token + * @param tokenID string ID to set the token config object form + */ + "setTokenConfig(string,uint256,address,uint8,uint256,uint256,uint256,uint256,uint256,bool,bool)"( + tokenID: string, + chainID: BigNumberish, + tokenAddress: string, + tokenDecimals: BigNumberish, + maxSwap: BigNumberish, + minSwap: BigNumberish, + swapFee: BigNumberish, + maxSwapFee: BigNumberish, + minSwapFee: BigNumberish, + hasUnderlying: boolean, + isUnderlying: boolean, + overrides?: Overrides & { from?: string | Promise } + ): Promise; + + /** + * Main write function of this contract - Handles creating the struct and passing it to the internal logic function + * @param chainID chain ID to use for the token config object + * @param hasUnderlying bool which represents whether this is a global mint token or one to withdraw() + * @param isUnderlying bool which represents if this token is the one to withdraw on the given chain + * @param maxSwap maximum amount of token allowed to be transferred at once - in native token decimals + * @param maxSwapFee max swap fee to be charged - in native token decimals + * @param minSwap minimum amount of token needed to be transferred at once - in native token decimals + * @param minSwapFee min swap fee to be charged - in native token decimals - especially useful for mainnet ETH + * @param swapFee percent based swap fee -- 10e6 == 10bps + * @param tokenAddress token address of the token on the given chain + * @param tokenDecimals decimals of token + * @param tokenID string ID to set the token config object form + */ + "setTokenConfig(string,uint256,string,uint8,uint256,uint256,uint256,uint256,uint256,bool,bool)"( + tokenID: string, + chainID: BigNumberish, + tokenAddress: string, + tokenDecimals: BigNumberish, + maxSwap: BigNumberish, + minSwap: BigNumberish, + swapFee: BigNumberish, + maxSwapFee: BigNumberish, + minSwapFee: BigNumberish, + hasUnderlying: boolean, + isUnderlying: boolean, + overrides?: Overrides & { from?: string | Promise } + ): Promise; + }; +} diff --git a/src/internal/gen/L1BridgeZap.ts b/src/internal/gen/L1BridgeZap.ts index 057b844c..49f28e74 100644 --- a/src/internal/gen/L1BridgeZap.ts +++ b/src/internal/gen/L1BridgeZap.ts @@ -30,6 +30,7 @@ export interface L1BridgeZapInterface extends utils.Interface { "depositETH(address,uint256,uint256)": FunctionFragment; "depositETHAndSwap(address,uint256,uint256,uint8,uint8,uint256,uint256)": FunctionFragment; "redeem(address,uint256,address,uint256)": FunctionFragment; + "redeemv2(bytes32,uint256,address,uint256)": FunctionFragment; "zapAndDeposit(address,uint256,address,uint256[],uint256,uint256)": FunctionFragment; "zapAndDepositAndSwap(address,uint256,address,uint256[],uint256,uint256,uint8,uint8,uint256,uint256)": FunctionFragment; }; @@ -87,6 +88,10 @@ export interface L1BridgeZapInterface extends utils.Interface { functionFragment: "redeem", values: [string, BigNumberish, string, BigNumberish] ): string; + encodeFunctionData( + functionFragment: "redeemv2", + values: [BytesLike, BigNumberish, string, BigNumberish] + ): string; encodeFunctionData( functionFragment: "zapAndDeposit", values: [ @@ -138,6 +143,7 @@ export interface L1BridgeZapInterface extends utils.Interface { data: BytesLike ): Result; decodeFunctionResult(functionFragment: "redeem", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "redeemv2", data: BytesLike): Result; decodeFunctionResult( functionFragment: "zapAndDeposit", data: BytesLike @@ -295,6 +301,21 @@ export interface L1BridgeZap extends BaseContract { overrides?: Overrides & { from?: string | Promise } ): Promise; + /** + * Wraps SynapseBridge redeemv2() function + * @param amount Amount in native token decimals to transfer cross-chain pre-fees* + * @param chainId which chain to bridge assets onto + * @param to address on other chain to bridge assets to + * @param token ERC20 compatible token to redeem into the bridge + */ + redeemv2( + to: BytesLike, + chainId: BigNumberish, + token: string, + amount: BigNumberish, + overrides?: Overrides & { from?: string | Promise } + ): Promise; + /** * Combines adding liquidity to the given Swap, and calls deposit() on the bridge using that LP token * @param chainId which chain to bridge assets onto @@ -456,6 +477,21 @@ export interface L1BridgeZap extends BaseContract { overrides?: Overrides & { from?: string | Promise } ): Promise; + /** + * Wraps SynapseBridge redeemv2() function + * @param amount Amount in native token decimals to transfer cross-chain pre-fees* + * @param chainId which chain to bridge assets onto + * @param to address on other chain to bridge assets to + * @param token ERC20 compatible token to redeem into the bridge + */ + redeemv2( + to: BytesLike, + chainId: BigNumberish, + token: string, + amount: BigNumberish, + overrides?: Overrides & { from?: string | Promise } + ): Promise; + /** * Combines adding liquidity to the given Swap, and calls deposit() on the bridge using that LP token * @param chainId which chain to bridge assets onto @@ -617,6 +653,21 @@ export interface L1BridgeZap extends BaseContract { overrides?: CallOverrides ): Promise; + /** + * Wraps SynapseBridge redeemv2() function + * @param amount Amount in native token decimals to transfer cross-chain pre-fees* + * @param chainId which chain to bridge assets onto + * @param to address on other chain to bridge assets to + * @param token ERC20 compatible token to redeem into the bridge + */ + redeemv2( + to: BytesLike, + chainId: BigNumberish, + token: string, + amount: BigNumberish, + overrides?: CallOverrides + ): Promise; + /** * Combines adding liquidity to the given Swap, and calls deposit() on the bridge using that LP token * @param chainId which chain to bridge assets onto @@ -784,6 +835,21 @@ export interface L1BridgeZap extends BaseContract { overrides?: Overrides & { from?: string | Promise } ): Promise; + /** + * Wraps SynapseBridge redeemv2() function + * @param amount Amount in native token decimals to transfer cross-chain pre-fees* + * @param chainId which chain to bridge assets onto + * @param to address on other chain to bridge assets to + * @param token ERC20 compatible token to redeem into the bridge + */ + redeemv2( + to: BytesLike, + chainId: BigNumberish, + token: string, + amount: BigNumberish, + overrides?: Overrides & { from?: string | Promise } + ): Promise; + /** * Combines adding liquidity to the given Swap, and calls deposit() on the bridge using that LP token * @param chainId which chain to bridge assets onto @@ -949,6 +1015,21 @@ export interface L1BridgeZap extends BaseContract { overrides?: Overrides & { from?: string | Promise } ): Promise; + /** + * Wraps SynapseBridge redeemv2() function + * @param amount Amount in native token decimals to transfer cross-chain pre-fees* + * @param chainId which chain to bridge assets onto + * @param to address on other chain to bridge assets to + * @param token ERC20 compatible token to redeem into the bridge + */ + redeemv2( + to: BytesLike, + chainId: BigNumberish, + token: string, + amount: BigNumberish, + overrides?: Overrides & { from?: string | Promise } + ): Promise; + /** * Combines adding liquidity to the given Swap, and calls deposit() on the bridge using that LP token * @param chainId which chain to bridge assets onto diff --git a/src/internal/gen/L2BridgeZap.ts b/src/internal/gen/L2BridgeZap.ts index 89cc862c..af10cf1b 100644 --- a/src/internal/gen/L2BridgeZap.ts +++ b/src/internal/gen/L2BridgeZap.ts @@ -28,6 +28,7 @@ export interface L2BridgeZapInterface extends utils.Interface { "redeem(address,uint256,address,uint256)": FunctionFragment; "redeemAndRemove(address,uint256,address,uint256,uint8,uint256,uint256)": FunctionFragment; "redeemAndSwap(address,uint256,address,uint256,uint8,uint8,uint256,uint256)": FunctionFragment; + "redeemv2(bytes32,uint256,address,uint256)": FunctionFragment; "swapAndRedeem(address,uint256,address,uint8,uint8,uint256,uint256,uint256)": FunctionFragment; "swapAndRedeemAndRemove(address,uint256,address,uint8,uint8,uint256,uint256,uint256,uint8,uint256,uint256)": FunctionFragment; "swapAndRedeemAndSwap(address,uint256,address,uint8,uint8,uint256,uint256,uint256,uint8,uint8,uint256,uint256)": FunctionFragment; @@ -82,6 +83,10 @@ export interface L2BridgeZapInterface extends utils.Interface { BigNumberish ] ): string; + encodeFunctionData( + functionFragment: "redeemv2", + values: [BytesLike, BigNumberish, string, BigNumberish] + ): string; encodeFunctionData( functionFragment: "swapAndRedeem", values: [ @@ -183,6 +188,7 @@ export interface L2BridgeZapInterface extends utils.Interface { functionFragment: "redeemAndSwap", data: BytesLike ): Result; + decodeFunctionResult(functionFragment: "redeemv2", data: BytesLike): Result; decodeFunctionResult( functionFragment: "swapAndRedeem", data: BytesLike @@ -343,6 +349,21 @@ export interface L2BridgeZap extends BaseContract { overrides?: Overrides & { from?: string | Promise } ): Promise; + /** + * Wraps SynapseBridge redeemv2() function + * @param amount Amount in native token decimals to transfer cross-chain pre-fees* + * @param chainId which chain to bridge assets onto + * @param to address on other chain to bridge assets to + * @param token ERC20 compatible token to redeem into the bridge + */ + redeemv2( + to: BytesLike, + chainId: BigNumberish, + token: string, + amount: BigNumberish, + overrides?: Overrides & { from?: string | Promise } + ): Promise; + swapAndRedeem( to: string, chainId: BigNumberish, @@ -526,6 +547,21 @@ export interface L2BridgeZap extends BaseContract { overrides?: Overrides & { from?: string | Promise } ): Promise; + /** + * Wraps SynapseBridge redeemv2() function + * @param amount Amount in native token decimals to transfer cross-chain pre-fees* + * @param chainId which chain to bridge assets onto + * @param to address on other chain to bridge assets to + * @param token ERC20 compatible token to redeem into the bridge + */ + redeemv2( + to: BytesLike, + chainId: BigNumberish, + token: string, + amount: BigNumberish, + overrides?: Overrides & { from?: string | Promise } + ): Promise; + swapAndRedeem( to: string, chainId: BigNumberish, @@ -709,6 +745,21 @@ export interface L2BridgeZap extends BaseContract { overrides?: CallOverrides ): Promise; + /** + * Wraps SynapseBridge redeemv2() function + * @param amount Amount in native token decimals to transfer cross-chain pre-fees* + * @param chainId which chain to bridge assets onto + * @param to address on other chain to bridge assets to + * @param token ERC20 compatible token to redeem into the bridge + */ + redeemv2( + to: BytesLike, + chainId: BigNumberish, + token: string, + amount: BigNumberish, + overrides?: CallOverrides + ): Promise; + swapAndRedeem( to: string, chainId: BigNumberish, @@ -895,6 +946,21 @@ export interface L2BridgeZap extends BaseContract { overrides?: Overrides & { from?: string | Promise } ): Promise; + /** + * Wraps SynapseBridge redeemv2() function + * @param amount Amount in native token decimals to transfer cross-chain pre-fees* + * @param chainId which chain to bridge assets onto + * @param to address on other chain to bridge assets to + * @param token ERC20 compatible token to redeem into the bridge + */ + redeemv2( + to: BytesLike, + chainId: BigNumberish, + token: string, + amount: BigNumberish, + overrides?: Overrides & { from?: string | Promise } + ): Promise; + swapAndRedeem( to: string, chainId: BigNumberish, @@ -1079,6 +1145,21 @@ export interface L2BridgeZap extends BaseContract { overrides?: Overrides & { from?: string | Promise } ): Promise; + /** + * Wraps SynapseBridge redeemv2() function + * @param amount Amount in native token decimals to transfer cross-chain pre-fees* + * @param chainId which chain to bridge assets onto + * @param to address on other chain to bridge assets to + * @param token ERC20 compatible token to redeem into the bridge + */ + redeemv2( + to: BytesLike, + chainId: BigNumberish, + token: string, + amount: BigNumberish, + overrides?: Overrides & { from?: string | Promise } + ): Promise; + swapAndRedeem( to: string, chainId: BigNumberish, diff --git a/src/internal/gen/SynapseBridge.ts b/src/internal/gen/SynapseBridge.ts index 78b9632f..f753258c 100644 --- a/src/internal/gen/SynapseBridge.ts +++ b/src/internal/gen/SynapseBridge.ts @@ -44,6 +44,7 @@ export interface SynapseBridgeInterface extends utils.Interface { "redeem(address,uint256,address,uint256)": FunctionFragment; "redeemAndRemove(address,uint256,address,uint256,uint8,uint256,uint256)": FunctionFragment; "redeemAndSwap(address,uint256,address,uint256,uint8,uint8,uint256,uint256)": FunctionFragment; + "redeemV2(bytes32,uint256,address,uint256)": FunctionFragment; "renounceRole(bytes32,address)": FunctionFragment; "revokeRole(bytes32,address)": FunctionFragment; "setChainGasAmount(uint256)": FunctionFragment; @@ -182,6 +183,10 @@ export interface SynapseBridgeInterface extends utils.Interface { BigNumberish ] ): string; + encodeFunctionData( + functionFragment: "redeemV2", + values: [BytesLike, BigNumberish, string, BigNumberish] + ): string; encodeFunctionData( functionFragment: "renounceRole", values: [BytesLike, string] @@ -295,6 +300,7 @@ export interface SynapseBridgeInterface extends utils.Interface { functionFragment: "redeemAndSwap", data: BytesLike ): Result; + decodeFunctionResult(functionFragment: "redeemV2", data: BytesLike): Result; decodeFunctionResult( functionFragment: "renounceRole", data: BytesLike @@ -335,6 +341,7 @@ export interface SynapseBridgeInterface extends utils.Interface { "TokenRedeem(address,uint256,address,uint256)": EventFragment; "TokenRedeemAndRemove(address,uint256,address,uint256,uint8,uint256,uint256)": EventFragment; "TokenRedeemAndSwap(address,uint256,address,uint256,uint8,uint8,uint256,uint256)": EventFragment; + "TokenRedeemV2(bytes32,uint256,address,uint256)": EventFragment; "TokenWithdraw(address,address,uint256,uint256,bytes32)": EventFragment; "TokenWithdrawAndRemove(address,address,uint256,uint256,uint8,uint256,uint256,bool,bytes32)": EventFragment; "Unpaused(address)": EventFragment; @@ -351,6 +358,7 @@ export interface SynapseBridgeInterface extends utils.Interface { getEvent(nameOrSignatureOrTopic: "TokenRedeem"): EventFragment; getEvent(nameOrSignatureOrTopic: "TokenRedeemAndRemove"): EventFragment; getEvent(nameOrSignatureOrTopic: "TokenRedeemAndSwap"): EventFragment; + getEvent(nameOrSignatureOrTopic: "TokenRedeemV2"): EventFragment; getEvent(nameOrSignatureOrTopic: "TokenWithdraw"): EventFragment; getEvent(nameOrSignatureOrTopic: "TokenWithdrawAndRemove"): EventFragment; getEvent(nameOrSignatureOrTopic: "Unpaused"): EventFragment; @@ -489,6 +497,13 @@ export type TokenRedeemAndSwapEvent = TypedEvent< export type TokenRedeemAndSwapEventFilter = TypedEventFilter; +export type TokenRedeemV2Event = TypedEvent< + [string, BigNumber, string, BigNumber], + { to: string; chainId: BigNumber; token: string; amount: BigNumber } +>; + +export type TokenRedeemV2EventFilter = TypedEventFilter; + export type TokenWithdrawEvent = TypedEvent< [string, string, BigNumber, BigNumber, string], { @@ -785,6 +800,21 @@ export interface SynapseBridge extends BaseContract { overrides?: Overrides & { from?: string | Promise } ): Promise; + /** + * Relays to nodes that (typically) a wrapped synAsset ERC20 token has been burned and the underlying needs to be redeeemed on the native chain + * @param amount Amount in native token decimals to transfer cross-chain pre-fees* + * @param chainId which underlying chain to bridge assets onto + * @param to address on other chain to redeem underlying assets to + * @param token ERC20 compatible token to deposit into the bridge + */ + redeemV2( + to: BytesLike, + chainId: BigNumberish, + token: string, + amount: BigNumberish, + overrides?: Overrides & { from?: string | Promise } + ): Promise; + /** * Revokes `role` from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must be `account`. */ @@ -1093,6 +1123,21 @@ export interface SynapseBridge extends BaseContract { overrides?: Overrides & { from?: string | Promise } ): Promise; + /** + * Relays to nodes that (typically) a wrapped synAsset ERC20 token has been burned and the underlying needs to be redeeemed on the native chain + * @param amount Amount in native token decimals to transfer cross-chain pre-fees* + * @param chainId which underlying chain to bridge assets onto + * @param to address on other chain to redeem underlying assets to + * @param token ERC20 compatible token to deposit into the bridge + */ + redeemV2( + to: BytesLike, + chainId: BigNumberish, + token: string, + amount: BigNumberish, + overrides?: Overrides & { from?: string | Promise } + ): Promise; + /** * Revokes `role` from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must be `account`. */ @@ -1394,6 +1439,21 @@ export interface SynapseBridge extends BaseContract { overrides?: CallOverrides ): Promise; + /** + * Relays to nodes that (typically) a wrapped synAsset ERC20 token has been burned and the underlying needs to be redeeemed on the native chain + * @param amount Amount in native token decimals to transfer cross-chain pre-fees* + * @param chainId which underlying chain to bridge assets onto + * @param to address on other chain to redeem underlying assets to + * @param token ERC20 compatible token to deposit into the bridge + */ + redeemV2( + to: BytesLike, + chainId: BigNumberish, + token: string, + amount: BigNumberish, + overrides?: CallOverrides + ): Promise; + /** * Revokes `role` from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must be `account`. */ @@ -1644,6 +1704,19 @@ export interface SynapseBridge extends BaseContract { deadline?: null ): TokenRedeemAndSwapEventFilter; + "TokenRedeemV2(bytes32,uint256,address,uint256)"( + to?: BytesLike | null, + chainId?: null, + token?: null, + amount?: null + ): TokenRedeemV2EventFilter; + TokenRedeemV2( + to?: BytesLike | null, + chainId?: null, + token?: null, + amount?: null + ): TokenRedeemV2EventFilter; + "TokenWithdraw(address,address,uint256,uint256,bytes32)"( to?: string | null, token?: null, @@ -1913,6 +1986,21 @@ export interface SynapseBridge extends BaseContract { overrides?: Overrides & { from?: string | Promise } ): Promise; + /** + * Relays to nodes that (typically) a wrapped synAsset ERC20 token has been burned and the underlying needs to be redeeemed on the native chain + * @param amount Amount in native token decimals to transfer cross-chain pre-fees* + * @param chainId which underlying chain to bridge assets onto + * @param to address on other chain to redeem underlying assets to + * @param token ERC20 compatible token to deposit into the bridge + */ + redeemV2( + to: BytesLike, + chainId: BigNumberish, + token: string, + amount: BigNumberish, + overrides?: Overrides & { from?: string | Promise } + ): Promise; + /** * Revokes `role` from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must be `account`. */ @@ -2230,6 +2318,21 @@ export interface SynapseBridge extends BaseContract { overrides?: Overrides & { from?: string | Promise } ): Promise; + /** + * Relays to nodes that (typically) a wrapped synAsset ERC20 token has been burned and the underlying needs to be redeeemed on the native chain + * @param amount Amount in native token decimals to transfer cross-chain pre-fees* + * @param chainId which underlying chain to bridge assets onto + * @param to address on other chain to redeem underlying assets to + * @param token ERC20 compatible token to deposit into the bridge + */ + redeemV2( + to: BytesLike, + chainId: BigNumberish, + token: string, + amount: BigNumberish, + overrides?: Overrides & { from?: string | Promise } + ): Promise; + /** * Revokes `role` from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must be `account`. */ diff --git a/src/internal/gen/factories/BridgeConfigV3__factory.ts b/src/internal/gen/factories/BridgeConfigV3__factory.ts new file mode 100644 index 00000000..201decd8 --- /dev/null +++ b/src/internal/gen/factories/BridgeConfigV3__factory.ts @@ -0,0 +1,1113 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ + +import { Contract, Signer, utils } from "ethers"; +import { Provider } from "@ethersproject/providers"; +import type { + BridgeConfigV3, + BridgeConfigV3Interface, +} from "../BridgeConfigV3"; + +const _abi = [ + { + inputs: [], + stateMutability: "nonpayable", + type: "constructor", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "role", + type: "bytes32", + }, + { + indexed: true, + internalType: "bytes32", + name: "previousAdminRole", + type: "bytes32", + }, + { + indexed: true, + internalType: "bytes32", + name: "newAdminRole", + type: "bytes32", + }, + ], + name: "RoleAdminChanged", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "role", + type: "bytes32", + }, + { + indexed: true, + internalType: "address", + name: "account", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "sender", + type: "address", + }, + ], + name: "RoleGranted", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "role", + type: "bytes32", + }, + { + indexed: true, + internalType: "address", + name: "account", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "sender", + type: "address", + }, + ], + name: "RoleRevoked", + type: "event", + }, + { + inputs: [], + name: "BRIDGEMANAGER_ROLE", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "DEFAULT_ADMIN_ROLE", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "bridgeConfigVersion", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "string", + name: "tokenAddress", + type: "string", + }, + { + internalType: "uint256", + name: "chainID", + type: "uint256", + }, + { + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "calculateSwapFee", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "tokenAddress", + type: "address", + }, + { + internalType: "uint256", + name: "chainID", + type: "uint256", + }, + { + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "calculateSwapFee", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "getAllTokenIDs", + outputs: [ + { + internalType: "string[]", + name: "result", + type: "string[]", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "chainID", + type: "uint256", + }, + ], + name: "getMaxGasPrice", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "tokenAddress", + type: "address", + }, + { + internalType: "uint256", + name: "chainID", + type: "uint256", + }, + ], + name: "getPoolConfig", + outputs: [ + { + components: [ + { + internalType: "address", + name: "tokenAddress", + type: "address", + }, + { + internalType: "uint256", + name: "chainId", + type: "uint256", + }, + { + internalType: "address", + name: "poolAddress", + type: "address", + }, + { + internalType: "bool", + name: "metaswap", + type: "bool", + }, + ], + internalType: "struct BridgeConfigV3.Pool", + name: "", + type: "tuple", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "role", + type: "bytes32", + }, + ], + name: "getRoleAdmin", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "role", + type: "bytes32", + }, + { + internalType: "uint256", + name: "index", + type: "uint256", + }, + ], + name: "getRoleMember", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "role", + type: "bytes32", + }, + ], + name: "getRoleMemberCount", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "string", + name: "tokenID", + type: "string", + }, + { + internalType: "uint256", + name: "chainID", + type: "uint256", + }, + ], + name: "getToken", + outputs: [ + { + components: [ + { + internalType: "uint256", + name: "chainId", + type: "uint256", + }, + { + internalType: "string", + name: "tokenAddress", + type: "string", + }, + { + internalType: "uint8", + name: "tokenDecimals", + type: "uint8", + }, + { + internalType: "uint256", + name: "maxSwap", + type: "uint256", + }, + { + internalType: "uint256", + name: "minSwap", + type: "uint256", + }, + { + internalType: "uint256", + name: "swapFee", + type: "uint256", + }, + { + internalType: "uint256", + name: "maxSwapFee", + type: "uint256", + }, + { + internalType: "uint256", + name: "minSwapFee", + type: "uint256", + }, + { + internalType: "bool", + name: "hasUnderlying", + type: "bool", + }, + { + internalType: "bool", + name: "isUnderlying", + type: "bool", + }, + ], + internalType: "struct BridgeConfigV3.Token", + name: "token", + type: "tuple", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "string", + name: "tokenAddress", + type: "string", + }, + { + internalType: "uint256", + name: "chainID", + type: "uint256", + }, + ], + name: "getTokenByAddress", + outputs: [ + { + components: [ + { + internalType: "uint256", + name: "chainId", + type: "uint256", + }, + { + internalType: "string", + name: "tokenAddress", + type: "string", + }, + { + internalType: "uint8", + name: "tokenDecimals", + type: "uint8", + }, + { + internalType: "uint256", + name: "maxSwap", + type: "uint256", + }, + { + internalType: "uint256", + name: "minSwap", + type: "uint256", + }, + { + internalType: "uint256", + name: "swapFee", + type: "uint256", + }, + { + internalType: "uint256", + name: "maxSwapFee", + type: "uint256", + }, + { + internalType: "uint256", + name: "minSwapFee", + type: "uint256", + }, + { + internalType: "bool", + name: "hasUnderlying", + type: "bool", + }, + { + internalType: "bool", + name: "isUnderlying", + type: "bool", + }, + ], + internalType: "struct BridgeConfigV3.Token", + name: "token", + type: "tuple", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "tokenAddress", + type: "address", + }, + { + internalType: "uint256", + name: "chainID", + type: "uint256", + }, + ], + name: "getTokenByEVMAddress", + outputs: [ + { + components: [ + { + internalType: "uint256", + name: "chainId", + type: "uint256", + }, + { + internalType: "string", + name: "tokenAddress", + type: "string", + }, + { + internalType: "uint8", + name: "tokenDecimals", + type: "uint8", + }, + { + internalType: "uint256", + name: "maxSwap", + type: "uint256", + }, + { + internalType: "uint256", + name: "minSwap", + type: "uint256", + }, + { + internalType: "uint256", + name: "swapFee", + type: "uint256", + }, + { + internalType: "uint256", + name: "maxSwapFee", + type: "uint256", + }, + { + internalType: "uint256", + name: "minSwapFee", + type: "uint256", + }, + { + internalType: "bool", + name: "hasUnderlying", + type: "bool", + }, + { + internalType: "bool", + name: "isUnderlying", + type: "bool", + }, + ], + internalType: "struct BridgeConfigV3.Token", + name: "token", + type: "tuple", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "string", + name: "tokenID", + type: "string", + }, + { + internalType: "uint256", + name: "chainID", + type: "uint256", + }, + ], + name: "getTokenByID", + outputs: [ + { + components: [ + { + internalType: "uint256", + name: "chainId", + type: "uint256", + }, + { + internalType: "string", + name: "tokenAddress", + type: "string", + }, + { + internalType: "uint8", + name: "tokenDecimals", + type: "uint8", + }, + { + internalType: "uint256", + name: "maxSwap", + type: "uint256", + }, + { + internalType: "uint256", + name: "minSwap", + type: "uint256", + }, + { + internalType: "uint256", + name: "swapFee", + type: "uint256", + }, + { + internalType: "uint256", + name: "maxSwapFee", + type: "uint256", + }, + { + internalType: "uint256", + name: "minSwapFee", + type: "uint256", + }, + { + internalType: "bool", + name: "hasUnderlying", + type: "bool", + }, + { + internalType: "bool", + name: "isUnderlying", + type: "bool", + }, + ], + internalType: "struct BridgeConfigV3.Token", + name: "token", + type: "tuple", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "tokenAddress", + type: "address", + }, + { + internalType: "uint256", + name: "chainID", + type: "uint256", + }, + ], + name: "getTokenID", + outputs: [ + { + internalType: "string", + name: "", + type: "string", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "string", + name: "tokenAddress", + type: "string", + }, + { + internalType: "uint256", + name: "chainID", + type: "uint256", + }, + ], + name: "getTokenID", + outputs: [ + { + internalType: "string", + name: "", + type: "string", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "string", + name: "tokenID", + type: "string", + }, + ], + name: "getUnderlyingToken", + outputs: [ + { + components: [ + { + internalType: "uint256", + name: "chainId", + type: "uint256", + }, + { + internalType: "string", + name: "tokenAddress", + type: "string", + }, + { + internalType: "uint8", + name: "tokenDecimals", + type: "uint8", + }, + { + internalType: "uint256", + name: "maxSwap", + type: "uint256", + }, + { + internalType: "uint256", + name: "minSwap", + type: "uint256", + }, + { + internalType: "uint256", + name: "swapFee", + type: "uint256", + }, + { + internalType: "uint256", + name: "maxSwapFee", + type: "uint256", + }, + { + internalType: "uint256", + name: "minSwapFee", + type: "uint256", + }, + { + internalType: "bool", + name: "hasUnderlying", + type: "bool", + }, + { + internalType: "bool", + name: "isUnderlying", + type: "bool", + }, + ], + internalType: "struct BridgeConfigV3.Token", + name: "token", + type: "tuple", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "role", + type: "bytes32", + }, + { + internalType: "address", + name: "account", + type: "address", + }, + ], + name: "grantRole", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "role", + type: "bytes32", + }, + { + internalType: "address", + name: "account", + type: "address", + }, + ], + name: "hasRole", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "string", + name: "tokenID", + type: "string", + }, + ], + name: "hasUnderlyingToken", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "string", + name: "tokenID", + type: "string", + }, + ], + name: "isTokenIDExist", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "string", + name: "tokenID", + type: "string", + }, + ], + name: "removeTokenMapping", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "role", + type: "bytes32", + }, + { + internalType: "address", + name: "account", + type: "address", + }, + ], + name: "renounceRole", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "role", + type: "bytes32", + }, + { + internalType: "address", + name: "account", + type: "address", + }, + ], + name: "revokeRole", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "chainID", + type: "uint256", + }, + { + internalType: "uint256", + name: "maxPrice", + type: "uint256", + }, + ], + name: "setMaxGasPrice", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "tokenAddress", + type: "address", + }, + { + internalType: "uint256", + name: "chainID", + type: "uint256", + }, + { + internalType: "address", + name: "poolAddress", + type: "address", + }, + { + internalType: "bool", + name: "metaswap", + type: "bool", + }, + ], + name: "setPoolConfig", + outputs: [ + { + components: [ + { + internalType: "address", + name: "tokenAddress", + type: "address", + }, + { + internalType: "uint256", + name: "chainId", + type: "uint256", + }, + { + internalType: "address", + name: "poolAddress", + type: "address", + }, + { + internalType: "bool", + name: "metaswap", + type: "bool", + }, + ], + internalType: "struct BridgeConfigV3.Pool", + name: "", + type: "tuple", + }, + ], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "string", + name: "tokenID", + type: "string", + }, + { + internalType: "uint256", + name: "chainID", + type: "uint256", + }, + { + internalType: "address", + name: "tokenAddress", + type: "address", + }, + { + internalType: "uint8", + name: "tokenDecimals", + type: "uint8", + }, + { + internalType: "uint256", + name: "maxSwap", + type: "uint256", + }, + { + internalType: "uint256", + name: "minSwap", + type: "uint256", + }, + { + internalType: "uint256", + name: "swapFee", + type: "uint256", + }, + { + internalType: "uint256", + name: "maxSwapFee", + type: "uint256", + }, + { + internalType: "uint256", + name: "minSwapFee", + type: "uint256", + }, + { + internalType: "bool", + name: "hasUnderlying", + type: "bool", + }, + { + internalType: "bool", + name: "isUnderlying", + type: "bool", + }, + ], + name: "setTokenConfig", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "string", + name: "tokenID", + type: "string", + }, + { + internalType: "uint256", + name: "chainID", + type: "uint256", + }, + { + internalType: "string", + name: "tokenAddress", + type: "string", + }, + { + internalType: "uint8", + name: "tokenDecimals", + type: "uint8", + }, + { + internalType: "uint256", + name: "maxSwap", + type: "uint256", + }, + { + internalType: "uint256", + name: "minSwap", + type: "uint256", + }, + { + internalType: "uint256", + name: "swapFee", + type: "uint256", + }, + { + internalType: "uint256", + name: "maxSwapFee", + type: "uint256", + }, + { + internalType: "uint256", + name: "minSwapFee", + type: "uint256", + }, + { + internalType: "bool", + name: "hasUnderlying", + type: "bool", + }, + { + internalType: "bool", + name: "isUnderlying", + type: "bool", + }, + ], + name: "setTokenConfig", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "nonpayable", + type: "function", + }, +]; + +export class BridgeConfigV3__factory { + static readonly abi = _abi; + static createInterface(): BridgeConfigV3Interface { + return new utils.Interface(_abi) as BridgeConfigV3Interface; + } + static connect( + address: string, + signerOrProvider: Signer | Provider + ): BridgeConfigV3 { + return new Contract(address, _abi, signerOrProvider) as BridgeConfigV3; + } +} diff --git a/src/internal/gen/factories/L1BridgeZap__factory.ts b/src/internal/gen/factories/L1BridgeZap__factory.ts index d4144137..f3de9599 100644 --- a/src/internal/gen/factories/L1BridgeZap__factory.ts +++ b/src/internal/gen/factories/L1BridgeZap__factory.ts @@ -278,6 +278,34 @@ const _abi = [ stateMutability: "nonpayable", type: "function", }, + { + inputs: [ + { + internalType: "bytes32", + name: "to", + type: "bytes32", + }, + { + internalType: "uint256", + name: "chainId", + type: "uint256", + }, + { + internalType: "contract IERC20", + name: "token", + type: "address", + }, + { + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "redeemv2", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, { inputs: [ { diff --git a/src/internal/gen/factories/L2BridgeZap__factory.ts b/src/internal/gen/factories/L2BridgeZap__factory.ts index a14d0273..ef52ef7a 100644 --- a/src/internal/gen/factories/L2BridgeZap__factory.ts +++ b/src/internal/gen/factories/L2BridgeZap__factory.ts @@ -260,6 +260,34 @@ const _abi = [ stateMutability: "nonpayable", type: "function", }, + { + inputs: [ + { + internalType: "bytes32", + name: "to", + type: "bytes32", + }, + { + internalType: "uint256", + name: "chainId", + type: "uint256", + }, + { + internalType: "contract IERC20", + name: "token", + type: "address", + }, + { + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "redeemv2", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, { inputs: [ { diff --git a/src/internal/gen/factories/SynapseBridge__factory.ts b/src/internal/gen/factories/SynapseBridge__factory.ts index 7682c2bc..b2a40a1e 100644 --- a/src/internal/gen/factories/SynapseBridge__factory.ts +++ b/src/internal/gen/factories/SynapseBridge__factory.ts @@ -420,6 +420,37 @@ const _abi = [ name: "TokenRedeemAndSwap", type: "event", }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "to", + type: "bytes32", + }, + { + indexed: false, + internalType: "uint256", + name: "chainId", + type: "uint256", + }, + { + indexed: false, + internalType: "contract IERC20", + name: "token", + type: "address", + }, + { + indexed: false, + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "TokenRedeemV2", + type: "event", + }, { anonymous: false, inputs: [ @@ -1077,6 +1108,34 @@ const _abi = [ stateMutability: "nonpayable", type: "function", }, + { + inputs: [ + { + internalType: "bytes32", + name: "to", + type: "bytes32", + }, + { + internalType: "uint256", + name: "chainId", + type: "uint256", + }, + { + internalType: "contract ERC20Burnable", + name: "token", + type: "address", + }, + { + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "redeemV2", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, { inputs: [ { diff --git a/src/internal/gen/index.ts b/src/internal/gen/index.ts index b496be46..21be58ff 100644 --- a/src/internal/gen/index.ts +++ b/src/internal/gen/index.ts @@ -2,6 +2,7 @@ /* tslint:disable */ /* eslint-disable */ export type { BridgeConfig } from "./BridgeConfig"; +export type { BridgeConfigV3 } from "./BridgeConfigV3"; export type { ERC20 } from "./ERC20"; export type { L1BridgeZap } from "./L1BridgeZap"; export type { L2BridgeZap } from "./L2BridgeZap"; @@ -11,6 +12,7 @@ export type { SynapseBridge } from "./SynapseBridge"; export type { SynapseERC20 } from "./SynapseERC20"; export { BridgeConfig__factory } from "./factories/BridgeConfig__factory"; +export { BridgeConfigV3__factory } from "./factories/BridgeConfigV3__factory"; export { ERC20__factory } from "./factories/ERC20__factory"; export { L1BridgeZap__factory } from "./factories/L1BridgeZap__factory"; export { L2BridgeZap__factory } from "./factories/L2BridgeZap__factory";