ソースを参照

complete basic bridge management

Shawn Lu 1 年間 前
コミット
9c652491dc

+ 0 - 39
__tests__/main.test.ts

@@ -1,39 +0,0 @@
-import { Delays, greeter } from '../src/main.js'
-
-describe('greeter function', () => {
-  const name = 'John'
-  let hello: string
-
-  let timeoutSpy: jest.SpyInstance
-
-  // Act before assertions
-  beforeAll(async () => {
-    // Read more about fake timers
-    // http://facebook.github.io/jest/docs/en/timer-mocks.html#content
-    // Jest 27 now uses "modern" implementation of fake timers
-    // https://jestjs.io/blog/2021/05/25/jest-27#flipping-defaults
-    // https://github.com/facebook/jest/pull/5171
-    jest.useFakeTimers()
-    timeoutSpy = jest.spyOn(global, 'setTimeout')
-
-    const p: Promise<string> = greeter(name)
-    jest.runOnlyPendingTimers()
-    hello = await p
-  })
-
-  // Teardown (cleanup) after assertions
-  afterAll(() => {
-    timeoutSpy.mockRestore()
-  })
-
-  // Assert if setTimeout was called properly
-  it('delays the greeting by 2 seconds', () => {
-    expect(setTimeout).toHaveBeenCalledTimes(1)
-    expect(setTimeout).toHaveBeenLastCalledWith(expect.any(Function), Delays.Long)
-  })
-
-  // Assert greeter result
-  it('greets a user with `Hello, {name}` message', () => {
-    expect(hello).toBe(`Hello, ${name}`)
-  })
-})

+ 1341 - 0
abis/Router.json

@@ -0,0 +1,1341 @@
+[
+  {
+    "inputs": [],
+    "stateMutability": "nonpayable",
+    "type": "constructor"
+  },
+  {
+    "anonymous": false,
+    "inputs": [
+      {
+        "indexed": false,
+        "internalType": "uint16",
+        "name": "chainId",
+        "type": "uint16"
+      },
+      {
+        "indexed": false,
+        "internalType": "bytes",
+        "name": "srcAddress",
+        "type": "bytes"
+      },
+      {
+        "indexed": false,
+        "internalType": "uint256",
+        "name": "nonce",
+        "type": "uint256"
+      },
+      {
+        "indexed": false,
+        "internalType": "address",
+        "name": "token",
+        "type": "address"
+      },
+      {
+        "indexed": false,
+        "internalType": "uint256",
+        "name": "amountLD",
+        "type": "uint256"
+      },
+      {
+        "indexed": false,
+        "internalType": "address",
+        "name": "to",
+        "type": "address"
+      },
+      {
+        "indexed": false,
+        "internalType": "bytes",
+        "name": "payload",
+        "type": "bytes"
+      },
+      {
+        "indexed": false,
+        "internalType": "bytes",
+        "name": "reason",
+        "type": "bytes"
+      }
+    ],
+    "name": "CachedSwapSaved",
+    "type": "event"
+  },
+  {
+    "anonymous": false,
+    "inputs": [
+      {
+        "indexed": true,
+        "internalType": "address",
+        "name": "previousOwner",
+        "type": "address"
+      },
+      {
+        "indexed": true,
+        "internalType": "address",
+        "name": "newOwner",
+        "type": "address"
+      }
+    ],
+    "name": "OwnershipTransferred",
+    "type": "event"
+  },
+  {
+    "anonymous": false,
+    "inputs": [
+      {
+        "indexed": false,
+        "internalType": "uint16",
+        "name": "srcChainId",
+        "type": "uint16"
+      },
+      {
+        "indexed": true,
+        "internalType": "bytes",
+        "name": "srcAddress",
+        "type": "bytes"
+      },
+      {
+        "indexed": true,
+        "internalType": "uint256",
+        "name": "nonce",
+        "type": "uint256"
+      },
+      {
+        "indexed": false,
+        "internalType": "uint256",
+        "name": "srcPoolId",
+        "type": "uint256"
+      },
+      {
+        "indexed": false,
+        "internalType": "uint256",
+        "name": "dstPoolId",
+        "type": "uint256"
+      },
+      {
+        "indexed": false,
+        "internalType": "address",
+        "name": "to",
+        "type": "address"
+      },
+      {
+        "indexed": false,
+        "internalType": "uint256",
+        "name": "amountSD",
+        "type": "uint256"
+      },
+      {
+        "indexed": false,
+        "internalType": "uint256",
+        "name": "mintAmountSD",
+        "type": "uint256"
+      }
+    ],
+    "name": "RedeemLocalCallback",
+    "type": "event"
+  },
+  {
+    "anonymous": false,
+    "inputs": [
+      {
+        "indexed": false,
+        "internalType": "uint8",
+        "name": "bridgeFunctionType",
+        "type": "uint8"
+      },
+      {
+        "indexed": false,
+        "internalType": "uint16",
+        "name": "chainId",
+        "type": "uint16"
+      },
+      {
+        "indexed": false,
+        "internalType": "bytes",
+        "name": "srcAddress",
+        "type": "bytes"
+      },
+      {
+        "indexed": false,
+        "internalType": "uint256",
+        "name": "nonce",
+        "type": "uint256"
+      }
+    ],
+    "name": "Revert",
+    "type": "event"
+  },
+  {
+    "anonymous": false,
+    "inputs": [
+      {
+        "indexed": false,
+        "internalType": "uint16",
+        "name": "srcChainId",
+        "type": "uint16"
+      },
+      {
+        "indexed": false,
+        "internalType": "uint256",
+        "name": "_srcPoolId",
+        "type": "uint256"
+      },
+      {
+        "indexed": false,
+        "internalType": "uint256",
+        "name": "_dstPoolId",
+        "type": "uint256"
+      },
+      {
+        "indexed": false,
+        "internalType": "bytes",
+        "name": "to",
+        "type": "bytes"
+      },
+      {
+        "indexed": false,
+        "internalType": "uint256",
+        "name": "redeemAmountSD",
+        "type": "uint256"
+      },
+      {
+        "indexed": false,
+        "internalType": "uint256",
+        "name": "mintAmountSD",
+        "type": "uint256"
+      },
+      {
+        "indexed": true,
+        "internalType": "uint256",
+        "name": "nonce",
+        "type": "uint256"
+      },
+      {
+        "indexed": true,
+        "internalType": "bytes",
+        "name": "srcAddress",
+        "type": "bytes"
+      }
+    ],
+    "name": "RevertRedeemLocal",
+    "type": "event"
+  },
+  {
+    "inputs": [
+      {
+        "internalType": "uint256",
+        "name": "_poolId",
+        "type": "uint256"
+      },
+      {
+        "internalType": "uint16",
+        "name": "_dstChainId",
+        "type": "uint16"
+      },
+      {
+        "internalType": "uint256",
+        "name": "_dstPoolId",
+        "type": "uint256"
+      }
+    ],
+    "name": "activateChainPath",
+    "outputs": [],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      {
+        "internalType": "uint256",
+        "name": "_poolId",
+        "type": "uint256"
+      },
+      {
+        "internalType": "uint256",
+        "name": "_amountLD",
+        "type": "uint256"
+      },
+      {
+        "internalType": "address",
+        "name": "_to",
+        "type": "address"
+      }
+    ],
+    "name": "addLiquidity",
+    "outputs": [],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
+    "inputs": [],
+    "name": "bridge",
+    "outputs": [
+      {
+        "internalType": "contract Bridge",
+        "name": "",
+        "type": "address"
+      }
+    ],
+    "stateMutability": "view",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      {
+        "internalType": "uint16",
+        "name": "",
+        "type": "uint16"
+      },
+      {
+        "internalType": "bytes",
+        "name": "",
+        "type": "bytes"
+      },
+      {
+        "internalType": "uint256",
+        "name": "",
+        "type": "uint256"
+      }
+    ],
+    "name": "cachedSwapLookup",
+    "outputs": [
+      {
+        "internalType": "address",
+        "name": "token",
+        "type": "address"
+      },
+      {
+        "internalType": "uint256",
+        "name": "amountLD",
+        "type": "uint256"
+      },
+      {
+        "internalType": "address",
+        "name": "to",
+        "type": "address"
+      },
+      {
+        "internalType": "bytes",
+        "name": "payload",
+        "type": "bytes"
+      }
+    ],
+    "stateMutability": "view",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      {
+        "internalType": "uint256",
+        "name": "_poolId",
+        "type": "uint256"
+      },
+      {
+        "internalType": "bool",
+        "name": "_fullMode",
+        "type": "bool"
+      }
+    ],
+    "name": "callDelta",
+    "outputs": [],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      {
+        "internalType": "uint16",
+        "name": "_srcChainId",
+        "type": "uint16"
+      },
+      {
+        "internalType": "bytes",
+        "name": "_srcAddress",
+        "type": "bytes"
+      },
+      {
+        "internalType": "uint256",
+        "name": "_nonce",
+        "type": "uint256"
+      }
+    ],
+    "name": "clearCachedSwap",
+    "outputs": [],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      {
+        "internalType": "uint256",
+        "name": "_poolId",
+        "type": "uint256"
+      },
+      {
+        "internalType": "uint16",
+        "name": "_dstChainId",
+        "type": "uint16"
+      },
+      {
+        "internalType": "uint256",
+        "name": "_dstPoolId",
+        "type": "uint256"
+      },
+      {
+        "internalType": "uint256",
+        "name": "_weight",
+        "type": "uint256"
+      }
+    ],
+    "name": "createChainPath",
+    "outputs": [],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      {
+        "internalType": "uint256",
+        "name": "_poolId",
+        "type": "uint256"
+      },
+      {
+        "internalType": "address",
+        "name": "_token",
+        "type": "address"
+      },
+      {
+        "internalType": "uint8",
+        "name": "_sharedDecimals",
+        "type": "uint8"
+      },
+      {
+        "internalType": "uint8",
+        "name": "_localDecimals",
+        "type": "uint8"
+      },
+      {
+        "internalType": "string",
+        "name": "_name",
+        "type": "string"
+      },
+      {
+        "internalType": "string",
+        "name": "_symbol",
+        "type": "string"
+      }
+    ],
+    "name": "createPool",
+    "outputs": [
+      {
+        "internalType": "address",
+        "name": "",
+        "type": "address"
+      }
+    ],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      {
+        "internalType": "uint16",
+        "name": "_dstChainId",
+        "type": "uint16"
+      },
+      {
+        "internalType": "uint256",
+        "name": "_dstPoolId",
+        "type": "uint256"
+      },
+      {
+        "internalType": "uint256",
+        "name": "_srcPoolId",
+        "type": "uint256"
+      },
+      {
+        "components": [
+          {
+            "internalType": "uint256",
+            "name": "credits",
+            "type": "uint256"
+          },
+          {
+            "internalType": "uint256",
+            "name": "idealBalance",
+            "type": "uint256"
+          }
+        ],
+        "internalType": "struct Pool.CreditObj",
+        "name": "_c",
+        "type": "tuple"
+      }
+    ],
+    "name": "creditChainPath",
+    "outputs": [],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
+    "inputs": [],
+    "name": "factory",
+    "outputs": [
+      {
+        "internalType": "contract Factory",
+        "name": "",
+        "type": "address"
+      }
+    ],
+    "stateMutability": "view",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      {
+        "internalType": "uint16",
+        "name": "_srcPoolId",
+        "type": "uint16"
+      },
+      {
+        "internalType": "uint256",
+        "name": "_amountLP",
+        "type": "uint256"
+      },
+      {
+        "internalType": "address",
+        "name": "_to",
+        "type": "address"
+      }
+    ],
+    "name": "instantRedeemLocal",
+    "outputs": [
+      {
+        "internalType": "uint256",
+        "name": "amountSD",
+        "type": "uint256"
+      }
+    ],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
+    "inputs": [],
+    "name": "mintFeeOwner",
+    "outputs": [
+      {
+        "internalType": "address",
+        "name": "",
+        "type": "address"
+      }
+    ],
+    "stateMutability": "view",
+    "type": "function"
+  },
+  {
+    "inputs": [],
+    "name": "owner",
+    "outputs": [
+      {
+        "internalType": "address",
+        "name": "",
+        "type": "address"
+      }
+    ],
+    "stateMutability": "view",
+    "type": "function"
+  },
+  {
+    "inputs": [],
+    "name": "protocolFeeOwner",
+    "outputs": [
+      {
+        "internalType": "address",
+        "name": "",
+        "type": "address"
+      }
+    ],
+    "stateMutability": "view",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      {
+        "internalType": "uint16",
+        "name": "_dstChainId",
+        "type": "uint16"
+      },
+      {
+        "internalType": "uint8",
+        "name": "_functionType",
+        "type": "uint8"
+      },
+      {
+        "internalType": "bytes",
+        "name": "_toAddress",
+        "type": "bytes"
+      },
+      {
+        "internalType": "bytes",
+        "name": "_transferAndCallPayload",
+        "type": "bytes"
+      },
+      {
+        "components": [
+          {
+            "internalType": "uint256",
+            "name": "dstGasForCall",
+            "type": "uint256"
+          },
+          {
+            "internalType": "uint256",
+            "name": "dstNativeAmount",
+            "type": "uint256"
+          },
+          {
+            "internalType": "bytes",
+            "name": "dstNativeAddr",
+            "type": "bytes"
+          }
+        ],
+        "internalType": "struct IStargateRouter.lzTxObj",
+        "name": "_lzTxParams",
+        "type": "tuple"
+      }
+    ],
+    "name": "quoteLayerZeroFee",
+    "outputs": [
+      {
+        "internalType": "uint256",
+        "name": "",
+        "type": "uint256"
+      },
+      {
+        "internalType": "uint256",
+        "name": "",
+        "type": "uint256"
+      }
+    ],
+    "stateMutability": "view",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      {
+        "internalType": "uint16",
+        "name": "_dstChainId",
+        "type": "uint16"
+      },
+      {
+        "internalType": "uint256",
+        "name": "_srcPoolId",
+        "type": "uint256"
+      },
+      {
+        "internalType": "uint256",
+        "name": "_dstPoolId",
+        "type": "uint256"
+      },
+      {
+        "internalType": "address payable",
+        "name": "_refundAddress",
+        "type": "address"
+      },
+      {
+        "internalType": "uint256",
+        "name": "_amountLP",
+        "type": "uint256"
+      },
+      {
+        "internalType": "bytes",
+        "name": "_to",
+        "type": "bytes"
+      },
+      {
+        "components": [
+          {
+            "internalType": "uint256",
+            "name": "dstGasForCall",
+            "type": "uint256"
+          },
+          {
+            "internalType": "uint256",
+            "name": "dstNativeAmount",
+            "type": "uint256"
+          },
+          {
+            "internalType": "bytes",
+            "name": "dstNativeAddr",
+            "type": "bytes"
+          }
+        ],
+        "internalType": "struct IStargateRouter.lzTxObj",
+        "name": "_lzTxParams",
+        "type": "tuple"
+      }
+    ],
+    "name": "redeemLocal",
+    "outputs": [],
+    "stateMutability": "payable",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      {
+        "internalType": "uint16",
+        "name": "_srcChainId",
+        "type": "uint16"
+      },
+      {
+        "internalType": "bytes",
+        "name": "_srcAddress",
+        "type": "bytes"
+      },
+      {
+        "internalType": "uint256",
+        "name": "_nonce",
+        "type": "uint256"
+      },
+      {
+        "internalType": "uint256",
+        "name": "_srcPoolId",
+        "type": "uint256"
+      },
+      {
+        "internalType": "uint256",
+        "name": "_dstPoolId",
+        "type": "uint256"
+      },
+      {
+        "internalType": "address",
+        "name": "_to",
+        "type": "address"
+      },
+      {
+        "internalType": "uint256",
+        "name": "_amountSD",
+        "type": "uint256"
+      },
+      {
+        "internalType": "uint256",
+        "name": "_mintAmountSD",
+        "type": "uint256"
+      }
+    ],
+    "name": "redeemLocalCallback",
+    "outputs": [],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      {
+        "internalType": "uint16",
+        "name": "_srcChainId",
+        "type": "uint16"
+      },
+      {
+        "internalType": "bytes",
+        "name": "_srcAddress",
+        "type": "bytes"
+      },
+      {
+        "internalType": "uint256",
+        "name": "_nonce",
+        "type": "uint256"
+      },
+      {
+        "internalType": "uint256",
+        "name": "_srcPoolId",
+        "type": "uint256"
+      },
+      {
+        "internalType": "uint256",
+        "name": "_dstPoolId",
+        "type": "uint256"
+      },
+      {
+        "internalType": "uint256",
+        "name": "_amountSD",
+        "type": "uint256"
+      },
+      {
+        "internalType": "bytes",
+        "name": "_to",
+        "type": "bytes"
+      }
+    ],
+    "name": "redeemLocalCheckOnRemote",
+    "outputs": [],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      {
+        "internalType": "uint16",
+        "name": "_dstChainId",
+        "type": "uint16"
+      },
+      {
+        "internalType": "uint256",
+        "name": "_srcPoolId",
+        "type": "uint256"
+      },
+      {
+        "internalType": "uint256",
+        "name": "_dstPoolId",
+        "type": "uint256"
+      },
+      {
+        "internalType": "address payable",
+        "name": "_refundAddress",
+        "type": "address"
+      },
+      {
+        "internalType": "uint256",
+        "name": "_amountLP",
+        "type": "uint256"
+      },
+      {
+        "internalType": "uint256",
+        "name": "_minAmountLD",
+        "type": "uint256"
+      },
+      {
+        "internalType": "bytes",
+        "name": "_to",
+        "type": "bytes"
+      },
+      {
+        "components": [
+          {
+            "internalType": "uint256",
+            "name": "dstGasForCall",
+            "type": "uint256"
+          },
+          {
+            "internalType": "uint256",
+            "name": "dstNativeAmount",
+            "type": "uint256"
+          },
+          {
+            "internalType": "bytes",
+            "name": "dstNativeAddr",
+            "type": "bytes"
+          }
+        ],
+        "internalType": "struct IStargateRouter.lzTxObj",
+        "name": "_lzTxParams",
+        "type": "tuple"
+      }
+    ],
+    "name": "redeemRemote",
+    "outputs": [],
+    "stateMutability": "payable",
+    "type": "function"
+  },
+  {
+    "inputs": [],
+    "name": "renounceOwnership",
+    "outputs": [],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      {
+        "internalType": "uint16",
+        "name": "_srcChainId",
+        "type": "uint16"
+      },
+      {
+        "internalType": "bytes",
+        "name": "_srcAddress",
+        "type": "bytes"
+      },
+      {
+        "internalType": "uint256",
+        "name": "_nonce",
+        "type": "uint256"
+      }
+    ],
+    "name": "retryRevert",
+    "outputs": [],
+    "stateMutability": "payable",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      {
+        "internalType": "uint16",
+        "name": "",
+        "type": "uint16"
+      },
+      {
+        "internalType": "bytes",
+        "name": "",
+        "type": "bytes"
+      },
+      {
+        "internalType": "uint256",
+        "name": "",
+        "type": "uint256"
+      }
+    ],
+    "name": "revertLookup",
+    "outputs": [
+      {
+        "internalType": "bytes",
+        "name": "",
+        "type": "bytes"
+      }
+    ],
+    "stateMutability": "view",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      {
+        "internalType": "uint16",
+        "name": "_dstChainId",
+        "type": "uint16"
+      },
+      {
+        "internalType": "bytes",
+        "name": "_srcAddress",
+        "type": "bytes"
+      },
+      {
+        "internalType": "uint256",
+        "name": "_nonce",
+        "type": "uint256"
+      },
+      {
+        "internalType": "address payable",
+        "name": "_refundAddress",
+        "type": "address"
+      },
+      {
+        "components": [
+          {
+            "internalType": "uint256",
+            "name": "dstGasForCall",
+            "type": "uint256"
+          },
+          {
+            "internalType": "uint256",
+            "name": "dstNativeAmount",
+            "type": "uint256"
+          },
+          {
+            "internalType": "bytes",
+            "name": "dstNativeAddr",
+            "type": "bytes"
+          }
+        ],
+        "internalType": "struct IStargateRouter.lzTxObj",
+        "name": "_lzTxParams",
+        "type": "tuple"
+      }
+    ],
+    "name": "revertRedeemLocal",
+    "outputs": [],
+    "stateMutability": "payable",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      {
+        "internalType": "uint16",
+        "name": "_dstChainId",
+        "type": "uint16"
+      },
+      {
+        "internalType": "uint256",
+        "name": "_srcPoolId",
+        "type": "uint256"
+      },
+      {
+        "internalType": "uint256",
+        "name": "_dstPoolId",
+        "type": "uint256"
+      },
+      {
+        "internalType": "address payable",
+        "name": "_refundAddress",
+        "type": "address"
+      }
+    ],
+    "name": "sendCredits",
+    "outputs": [],
+    "stateMutability": "payable",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      {
+        "internalType": "contract Bridge",
+        "name": "_bridge",
+        "type": "address"
+      },
+      {
+        "internalType": "contract Factory",
+        "name": "_factory",
+        "type": "address"
+      }
+    ],
+    "name": "setBridgeAndFactory",
+    "outputs": [],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      {
+        "internalType": "uint256",
+        "name": "_poolId",
+        "type": "uint256"
+      },
+      {
+        "internalType": "bool",
+        "name": "_batched",
+        "type": "bool"
+      },
+      {
+        "internalType": "uint256",
+        "name": "_swapDeltaBP",
+        "type": "uint256"
+      },
+      {
+        "internalType": "uint256",
+        "name": "_lpDeltaBP",
+        "type": "uint256"
+      },
+      {
+        "internalType": "bool",
+        "name": "_defaultSwapMode",
+        "type": "bool"
+      },
+      {
+        "internalType": "bool",
+        "name": "_defaultLPMode",
+        "type": "bool"
+      }
+    ],
+    "name": "setDeltaParam",
+    "outputs": [],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      {
+        "internalType": "uint256",
+        "name": "_poolId",
+        "type": "uint256"
+      },
+      {
+        "internalType": "address",
+        "name": "_feeLibraryAddr",
+        "type": "address"
+      }
+    ],
+    "name": "setFeeLibrary",
+    "outputs": [],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      {
+        "internalType": "uint256",
+        "name": "_poolId",
+        "type": "uint256"
+      },
+      {
+        "internalType": "uint256",
+        "name": "_mintFeeBP",
+        "type": "uint256"
+      }
+    ],
+    "name": "setFees",
+    "outputs": [],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      {
+        "internalType": "address",
+        "name": "_owner",
+        "type": "address"
+      }
+    ],
+    "name": "setMintFeeOwner",
+    "outputs": [],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      {
+        "internalType": "address",
+        "name": "_owner",
+        "type": "address"
+      }
+    ],
+    "name": "setProtocolFeeOwner",
+    "outputs": [],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      {
+        "internalType": "uint256",
+        "name": "_poolId",
+        "type": "uint256"
+      },
+      {
+        "internalType": "bool",
+        "name": "_swapStop",
+        "type": "bool"
+      }
+    ],
+    "name": "setSwapStop",
+    "outputs": [],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      {
+        "internalType": "uint256",
+        "name": "_poolId",
+        "type": "uint256"
+      },
+      {
+        "internalType": "uint16",
+        "name": "_dstChainId",
+        "type": "uint16"
+      },
+      {
+        "internalType": "uint256",
+        "name": "_dstPoolId",
+        "type": "uint256"
+      },
+      {
+        "internalType": "uint16",
+        "name": "_weight",
+        "type": "uint16"
+      }
+    ],
+    "name": "setWeightForChainPath",
+    "outputs": [],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      {
+        "internalType": "uint16",
+        "name": "_dstChainId",
+        "type": "uint16"
+      },
+      {
+        "internalType": "uint256",
+        "name": "_srcPoolId",
+        "type": "uint256"
+      },
+      {
+        "internalType": "uint256",
+        "name": "_dstPoolId",
+        "type": "uint256"
+      },
+      {
+        "internalType": "address payable",
+        "name": "_refundAddress",
+        "type": "address"
+      },
+      {
+        "internalType": "uint256",
+        "name": "_amountLD",
+        "type": "uint256"
+      },
+      {
+        "internalType": "uint256",
+        "name": "_minAmountLD",
+        "type": "uint256"
+      },
+      {
+        "components": [
+          {
+            "internalType": "uint256",
+            "name": "dstGasForCall",
+            "type": "uint256"
+          },
+          {
+            "internalType": "uint256",
+            "name": "dstNativeAmount",
+            "type": "uint256"
+          },
+          {
+            "internalType": "bytes",
+            "name": "dstNativeAddr",
+            "type": "bytes"
+          }
+        ],
+        "internalType": "struct IStargateRouter.lzTxObj",
+        "name": "_lzTxParams",
+        "type": "tuple"
+      },
+      {
+        "internalType": "bytes",
+        "name": "_to",
+        "type": "bytes"
+      },
+      {
+        "internalType": "bytes",
+        "name": "_payload",
+        "type": "bytes"
+      }
+    ],
+    "name": "swap",
+    "outputs": [],
+    "stateMutability": "payable",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      {
+        "internalType": "uint16",
+        "name": "_srcChainId",
+        "type": "uint16"
+      },
+      {
+        "internalType": "bytes",
+        "name": "_srcAddress",
+        "type": "bytes"
+      },
+      {
+        "internalType": "uint256",
+        "name": "_nonce",
+        "type": "uint256"
+      },
+      {
+        "internalType": "uint256",
+        "name": "_srcPoolId",
+        "type": "uint256"
+      },
+      {
+        "internalType": "uint256",
+        "name": "_dstPoolId",
+        "type": "uint256"
+      },
+      {
+        "internalType": "uint256",
+        "name": "_dstGasForCall",
+        "type": "uint256"
+      },
+      {
+        "internalType": "address",
+        "name": "_to",
+        "type": "address"
+      },
+      {
+        "components": [
+          {
+            "internalType": "uint256",
+            "name": "amount",
+            "type": "uint256"
+          },
+          {
+            "internalType": "uint256",
+            "name": "eqFee",
+            "type": "uint256"
+          },
+          {
+            "internalType": "uint256",
+            "name": "eqReward",
+            "type": "uint256"
+          },
+          {
+            "internalType": "uint256",
+            "name": "lpFee",
+            "type": "uint256"
+          },
+          {
+            "internalType": "uint256",
+            "name": "protocolFee",
+            "type": "uint256"
+          },
+          {
+            "internalType": "uint256",
+            "name": "lkbRemove",
+            "type": "uint256"
+          }
+        ],
+        "internalType": "struct Pool.SwapObj",
+        "name": "_s",
+        "type": "tuple"
+      },
+      {
+        "internalType": "bytes",
+        "name": "_payload",
+        "type": "bytes"
+      }
+    ],
+    "name": "swapRemote",
+    "outputs": [],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      {
+        "internalType": "address",
+        "name": "newOwner",
+        "type": "address"
+      }
+    ],
+    "name": "transferOwnership",
+    "outputs": [],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      {
+        "internalType": "uint256",
+        "name": "_poolId",
+        "type": "uint256"
+      },
+      {
+        "internalType": "address",
+        "name": "_to",
+        "type": "address"
+      }
+    ],
+    "name": "withdrawMintFee",
+    "outputs": [],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      {
+        "internalType": "uint256",
+        "name": "_poolId",
+        "type": "uint256"
+      },
+      {
+        "internalType": "address",
+        "name": "_to",
+        "type": "address"
+      }
+    ],
+    "name": "withdrawProtocolFee",
+    "outputs": [],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  }
+]

+ 106 - 0
abis/RouterETH.json

@@ -0,0 +1,106 @@
+[
+  {
+    "inputs": [
+      {
+        "internalType": "address",
+        "name": "_stargateEthVault",
+        "type": "address"
+      },
+      {
+        "internalType": "address",
+        "name": "_stargateRouter",
+        "type": "address"
+      },
+      {
+        "internalType": "uint16",
+        "name": "_poolId",
+        "type": "uint16"
+      }
+    ],
+    "stateMutability": "nonpayable",
+    "type": "constructor"
+  },
+  {
+    "inputs": [],
+    "name": "addLiquidityETH",
+    "outputs": [],
+    "stateMutability": "payable",
+    "type": "function"
+  },
+  {
+    "inputs": [],
+    "name": "poolId",
+    "outputs": [
+      {
+        "internalType": "uint16",
+        "name": "",
+        "type": "uint16"
+      }
+    ],
+    "stateMutability": "view",
+    "type": "function"
+  },
+  {
+    "inputs": [],
+    "name": "stargateEthVault",
+    "outputs": [
+      {
+        "internalType": "address",
+        "name": "",
+        "type": "address"
+      }
+    ],
+    "stateMutability": "view",
+    "type": "function"
+  },
+  {
+    "inputs": [],
+    "name": "stargateRouter",
+    "outputs": [
+      {
+        "internalType": "contract IStargateRouter",
+        "name": "",
+        "type": "address"
+      }
+    ],
+    "stateMutability": "view",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      {
+        "internalType": "uint16",
+        "name": "_dstChainId",
+        "type": "uint16"
+      },
+      {
+        "internalType": "address payable",
+        "name": "_refundAddress",
+        "type": "address"
+      },
+      {
+        "internalType": "bytes",
+        "name": "_toAddress",
+        "type": "bytes"
+      },
+      {
+        "internalType": "uint256",
+        "name": "_amountLD",
+        "type": "uint256"
+      },
+      {
+        "internalType": "uint256",
+        "name": "_minAmountLD",
+        "type": "uint256"
+      }
+    ],
+    "name": "swapETH",
+    "outputs": [],
+    "stateMutability": "payable",
+    "type": "function"
+  },
+  {
+    "stateMutability": "payable",
+    "type": "receive"
+  }
+]

+ 1225 - 0
abis/StargateFeeLibraryV07.json

@@ -0,0 +1,1225 @@
+[
+  {
+    "inputs": [
+      {
+        "internalType": "address",
+        "name": "_factory",
+        "type": "address"
+      },
+      {
+        "internalType": "address",
+        "name": "_endpoint",
+        "type": "address"
+      }
+    ],
+    "stateMutability": "nonpayable",
+    "type": "constructor"
+  },
+  {
+    "anonymous": false,
+    "inputs": [
+      {
+        "indexed": true,
+        "internalType": "address",
+        "name": "previousOwner",
+        "type": "address"
+      },
+      {
+        "indexed": true,
+        "internalType": "address",
+        "name": "newOwner",
+        "type": "address"
+      }
+    ],
+    "name": "OwnershipTransferred",
+    "type": "event"
+  },
+  {
+    "anonymous": false,
+    "inputs": [
+      {
+        "indexed": true,
+        "internalType": "uint256",
+        "name": "poolId",
+        "type": "uint256"
+      },
+      {
+        "indexed": false,
+        "internalType": "uint256",
+        "name": "priceSD",
+        "type": "uint256"
+      }
+    ],
+    "name": "PriceUpdated",
+    "type": "event"
+  },
+  {
+    "anonymous": false,
+    "inputs": [
+      {
+        "indexed": false,
+        "internalType": "uint16",
+        "name": "_dstChainId",
+        "type": "uint16"
+      },
+      {
+        "indexed": false,
+        "internalType": "uint16",
+        "name": "_type",
+        "type": "uint16"
+      },
+      {
+        "indexed": false,
+        "internalType": "uint256",
+        "name": "_minDstGas",
+        "type": "uint256"
+      }
+    ],
+    "name": "SetMinDstGas",
+    "type": "event"
+  },
+  {
+    "anonymous": false,
+    "inputs": [
+      {
+        "indexed": false,
+        "internalType": "address",
+        "name": "precrime",
+        "type": "address"
+      }
+    ],
+    "name": "SetPrecrime",
+    "type": "event"
+  },
+  {
+    "anonymous": false,
+    "inputs": [
+      {
+        "indexed": false,
+        "internalType": "uint16",
+        "name": "_remoteChainId",
+        "type": "uint16"
+      },
+      {
+        "indexed": false,
+        "internalType": "bytes",
+        "name": "_path",
+        "type": "bytes"
+      }
+    ],
+    "name": "SetTrustedRemote",
+    "type": "event"
+  },
+  {
+    "anonymous": false,
+    "inputs": [
+      {
+        "indexed": false,
+        "internalType": "uint16",
+        "name": "_remoteChainId",
+        "type": "uint16"
+      },
+      {
+        "indexed": false,
+        "internalType": "bytes",
+        "name": "_remoteAddress",
+        "type": "bytes"
+      }
+    ],
+    "name": "SetTrustedRemoteAddress",
+    "type": "event"
+  },
+  {
+    "inputs": [],
+    "name": "DELTA_1",
+    "outputs": [
+      {
+        "internalType": "uint256",
+        "name": "",
+        "type": "uint256"
+      }
+    ],
+    "stateMutability": "view",
+    "type": "function"
+  },
+  {
+    "inputs": [],
+    "name": "DELTA_2",
+    "outputs": [
+      {
+        "internalType": "uint256",
+        "name": "",
+        "type": "uint256"
+      }
+    ],
+    "stateMutability": "view",
+    "type": "function"
+  },
+  {
+    "inputs": [],
+    "name": "DENOMINATOR",
+    "outputs": [
+      {
+        "internalType": "uint256",
+        "name": "",
+        "type": "uint256"
+      }
+    ],
+    "stateMutability": "view",
+    "type": "function"
+  },
+  {
+    "inputs": [],
+    "name": "EQ_REWARD_THRESHOLD",
+    "outputs": [
+      {
+        "internalType": "uint256",
+        "name": "",
+        "type": "uint256"
+      }
+    ],
+    "stateMutability": "view",
+    "type": "function"
+  },
+  {
+    "inputs": [],
+    "name": "LAMBDA_1",
+    "outputs": [
+      {
+        "internalType": "uint256",
+        "name": "",
+        "type": "uint256"
+      }
+    ],
+    "stateMutability": "view",
+    "type": "function"
+  },
+  {
+    "inputs": [],
+    "name": "LAMBDA_2",
+    "outputs": [
+      {
+        "internalType": "uint256",
+        "name": "",
+        "type": "uint256"
+      }
+    ],
+    "stateMutability": "view",
+    "type": "function"
+  },
+  {
+    "inputs": [],
+    "name": "LP_FEE",
+    "outputs": [
+      {
+        "internalType": "uint256",
+        "name": "",
+        "type": "uint256"
+      }
+    ],
+    "stateMutability": "view",
+    "type": "function"
+  },
+  {
+    "inputs": [],
+    "name": "ONE_BPS_PRICE_CHANGE_THRESHOLD",
+    "outputs": [
+      {
+        "internalType": "uint256",
+        "name": "",
+        "type": "uint256"
+      }
+    ],
+    "stateMutability": "view",
+    "type": "function"
+  },
+  {
+    "inputs": [],
+    "name": "PRICE_DEPEG_THRESHOLD",
+    "outputs": [
+      {
+        "internalType": "uint256",
+        "name": "",
+        "type": "uint256"
+      }
+    ],
+    "stateMutability": "view",
+    "type": "function"
+  },
+  {
+    "inputs": [],
+    "name": "PRICE_DRIFT_THRESHOLD",
+    "outputs": [
+      {
+        "internalType": "uint256",
+        "name": "",
+        "type": "uint256"
+      }
+    ],
+    "stateMutability": "view",
+    "type": "function"
+  },
+  {
+    "inputs": [],
+    "name": "PRICE_SHARED_DECIMALS",
+    "outputs": [
+      {
+        "internalType": "uint8",
+        "name": "",
+        "type": "uint8"
+      }
+    ],
+    "stateMutability": "view",
+    "type": "function"
+  },
+  {
+    "inputs": [],
+    "name": "PROTOCOL_FEE",
+    "outputs": [
+      {
+        "internalType": "uint256",
+        "name": "",
+        "type": "uint256"
+      }
+    ],
+    "stateMutability": "view",
+    "type": "function"
+  },
+  {
+    "inputs": [],
+    "name": "PROTOCOL_FEE_FOR_SAME_TOKEN",
+    "outputs": [
+      {
+        "internalType": "uint256",
+        "name": "",
+        "type": "uint256"
+      }
+    ],
+    "stateMutability": "view",
+    "type": "function"
+  },
+  {
+    "inputs": [],
+    "name": "PROTOCOL_SUBSIDY",
+    "outputs": [
+      {
+        "internalType": "uint256",
+        "name": "",
+        "type": "uint256"
+      }
+    ],
+    "stateMutability": "view",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      {
+        "internalType": "uint16",
+        "name": "",
+        "type": "uint16"
+      }
+    ],
+    "name": "defaultAdapterParams",
+    "outputs": [
+      {
+        "internalType": "bytes",
+        "name": "",
+        "type": "bytes"
+      }
+    ],
+    "stateMutability": "view",
+    "type": "function"
+  },
+  {
+    "inputs": [],
+    "name": "factory",
+    "outputs": [
+      {
+        "internalType": "contract Factory",
+        "name": "",
+        "type": "address"
+      }
+    ],
+    "stateMutability": "view",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      {
+        "internalType": "uint16",
+        "name": "_srcChainId",
+        "type": "uint16"
+      },
+      {
+        "internalType": "bytes",
+        "name": "_srcAddress",
+        "type": "bytes"
+      }
+    ],
+    "name": "forceResumeReceive",
+    "outputs": [],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      {
+        "internalType": "uint16",
+        "name": "_version",
+        "type": "uint16"
+      },
+      {
+        "internalType": "uint16",
+        "name": "_chainId",
+        "type": "uint16"
+      },
+      {
+        "internalType": "address",
+        "name": "",
+        "type": "address"
+      },
+      {
+        "internalType": "uint256",
+        "name": "_configType",
+        "type": "uint256"
+      }
+    ],
+    "name": "getConfig",
+    "outputs": [
+      {
+        "internalType": "bytes",
+        "name": "",
+        "type": "bytes"
+      }
+    ],
+    "stateMutability": "view",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      {
+        "internalType": "uint256",
+        "name": "_srcPoolId",
+        "type": "uint256"
+      },
+      {
+        "internalType": "uint256",
+        "name": "_dstPoolId",
+        "type": "uint256"
+      },
+      {
+        "internalType": "uint256",
+        "name": "_amountSD",
+        "type": "uint256"
+      },
+      {
+        "internalType": "bool",
+        "name": "_whitelisted",
+        "type": "bool"
+      }
+    ],
+    "name": "getDriftFee",
+    "outputs": [
+      {
+        "internalType": "uint256",
+        "name": "",
+        "type": "uint256"
+      }
+    ],
+    "stateMutability": "view",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      {
+        "internalType": "uint256",
+        "name": "_srcPoolId",
+        "type": "uint256"
+      },
+      {
+        "internalType": "uint256",
+        "name": "_amountSD",
+        "type": "uint256"
+      },
+      {
+        "internalType": "bool",
+        "name": "_whitelisted",
+        "type": "bool"
+      }
+    ],
+    "name": "getEqReward",
+    "outputs": [
+      {
+        "internalType": "uint256",
+        "name": "",
+        "type": "uint256"
+      }
+    ],
+    "stateMutability": "view",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      {
+        "internalType": "uint256",
+        "name": "srcPoolId",
+        "type": "uint256"
+      },
+      {
+        "internalType": "uint256",
+        "name": "dstPoolId",
+        "type": "uint256"
+      },
+      {
+        "internalType": "uint16",
+        "name": "dstChainId",
+        "type": "uint16"
+      },
+      {
+        "internalType": "uint256",
+        "name": "amountSD",
+        "type": "uint256"
+      },
+      {
+        "internalType": "bool",
+        "name": "whitelisted",
+        "type": "bool"
+      },
+      {
+        "internalType": "bool",
+        "name": "hasEqReward",
+        "type": "bool"
+      }
+    ],
+    "name": "getEquilibriumFee",
+    "outputs": [
+      {
+        "internalType": "uint256",
+        "name": "",
+        "type": "uint256"
+      },
+      {
+        "internalType": "uint256",
+        "name": "",
+        "type": "uint256"
+      }
+    ],
+    "stateMutability": "view",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      {
+        "internalType": "uint256",
+        "name": "_srcPoolId",
+        "type": "uint256"
+      },
+      {
+        "internalType": "uint256",
+        "name": "_dstPoolId",
+        "type": "uint256"
+      },
+      {
+        "internalType": "uint16",
+        "name": "_dstChainId",
+        "type": "uint16"
+      },
+      {
+        "internalType": "address",
+        "name": "_from",
+        "type": "address"
+      },
+      {
+        "internalType": "uint256",
+        "name": "_amountSD",
+        "type": "uint256"
+      }
+    ],
+    "name": "getFees",
+    "outputs": [
+      {
+        "components": [
+          {
+            "internalType": "uint256",
+            "name": "amount",
+            "type": "uint256"
+          },
+          {
+            "internalType": "uint256",
+            "name": "eqFee",
+            "type": "uint256"
+          },
+          {
+            "internalType": "uint256",
+            "name": "eqReward",
+            "type": "uint256"
+          },
+          {
+            "internalType": "uint256",
+            "name": "lpFee",
+            "type": "uint256"
+          },
+          {
+            "internalType": "uint256",
+            "name": "protocolFee",
+            "type": "uint256"
+          },
+          {
+            "internalType": "uint256",
+            "name": "lkbRemove",
+            "type": "uint256"
+          }
+        ],
+        "internalType": "struct Pool.SwapObj",
+        "name": "s",
+        "type": "tuple"
+      }
+    ],
+    "stateMutability": "view",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      {
+        "internalType": "uint256",
+        "name": "_srcPoolId",
+        "type": "uint256"
+      },
+      {
+        "internalType": "uint256",
+        "name": "_dstPoolId",
+        "type": "uint256"
+      },
+      {
+        "internalType": "uint16",
+        "name": "",
+        "type": "uint16"
+      },
+      {
+        "internalType": "uint256",
+        "name": "_amountSD",
+        "type": "uint256"
+      },
+      {
+        "internalType": "uint256",
+        "name": "_protocolSubsidy",
+        "type": "uint256"
+      },
+      {
+        "internalType": "bool",
+        "name": "_whitelisted",
+        "type": "bool"
+      }
+    ],
+    "name": "getProtocolAndLpFee",
+    "outputs": [
+      {
+        "internalType": "uint256",
+        "name": "",
+        "type": "uint256"
+      },
+      {
+        "internalType": "uint256",
+        "name": "",
+        "type": "uint256"
+      }
+    ],
+    "stateMutability": "view",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      {
+        "internalType": "uint256",
+        "name": "_poolId1",
+        "type": "uint256"
+      },
+      {
+        "internalType": "uint256",
+        "name": "_poolId2",
+        "type": "uint256"
+      }
+    ],
+    "name": "getRemoteChains",
+    "outputs": [
+      {
+        "internalType": "uint16[]",
+        "name": "",
+        "type": "uint16[]"
+      }
+    ],
+    "stateMutability": "view",
+    "type": "function"
+  },
+  {
+    "inputs": [],
+    "name": "getVersion",
+    "outputs": [
+      {
+        "internalType": "string",
+        "name": "",
+        "type": "string"
+      }
+    ],
+    "stateMutability": "pure",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      {
+        "internalType": "uint256",
+        "name": "_poolId",
+        "type": "uint256"
+      },
+      {
+        "internalType": "uint256",
+        "name": "_priceSD",
+        "type": "uint256"
+      }
+    ],
+    "name": "initTokenPrice",
+    "outputs": [],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      {
+        "internalType": "uint16",
+        "name": "_srcChainId",
+        "type": "uint16"
+      },
+      {
+        "internalType": "bytes",
+        "name": "_srcAddress",
+        "type": "bytes"
+      }
+    ],
+    "name": "isTrustedRemote",
+    "outputs": [
+      {
+        "internalType": "bool",
+        "name": "",
+        "type": "bool"
+      }
+    ],
+    "stateMutability": "view",
+    "type": "function"
+  },
+  {
+    "inputs": [],
+    "name": "lzEndpoint",
+    "outputs": [
+      {
+        "internalType": "contract ILayerZeroEndpoint",
+        "name": "",
+        "type": "address"
+      }
+    ],
+    "stateMutability": "view",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      {
+        "internalType": "uint16",
+        "name": "_srcChainId",
+        "type": "uint16"
+      },
+      {
+        "internalType": "bytes",
+        "name": "_srcAddress",
+        "type": "bytes"
+      },
+      {
+        "internalType": "uint64",
+        "name": "_nonce",
+        "type": "uint64"
+      },
+      {
+        "internalType": "bytes",
+        "name": "_payload",
+        "type": "bytes"
+      }
+    ],
+    "name": "lzReceive",
+    "outputs": [],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      {
+        "internalType": "uint16",
+        "name": "",
+        "type": "uint16"
+      },
+      {
+        "internalType": "uint16",
+        "name": "",
+        "type": "uint16"
+      }
+    ],
+    "name": "minDstGasLookup",
+    "outputs": [
+      {
+        "internalType": "uint256",
+        "name": "",
+        "type": "uint256"
+      }
+    ],
+    "stateMutability": "view",
+    "type": "function"
+  },
+  {
+    "inputs": [],
+    "name": "owner",
+    "outputs": [
+      {
+        "internalType": "address",
+        "name": "",
+        "type": "address"
+      }
+    ],
+    "stateMutability": "view",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      {
+        "internalType": "uint256",
+        "name": "",
+        "type": "uint256"
+      }
+    ],
+    "name": "poolIdToLpId",
+    "outputs": [
+      {
+        "internalType": "uint256",
+        "name": "",
+        "type": "uint256"
+      }
+    ],
+    "stateMutability": "view",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      {
+        "internalType": "uint256",
+        "name": "",
+        "type": "uint256"
+      }
+    ],
+    "name": "poolIdToPriceFeed",
+    "outputs": [
+      {
+        "internalType": "address",
+        "name": "",
+        "type": "address"
+      }
+    ],
+    "stateMutability": "view",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      {
+        "internalType": "uint256",
+        "name": "",
+        "type": "uint256"
+      }
+    ],
+    "name": "poolIdToPriceSD",
+    "outputs": [
+      {
+        "internalType": "uint256",
+        "name": "",
+        "type": "uint256"
+      }
+    ],
+    "stateMutability": "view",
+    "type": "function"
+  },
+  {
+    "inputs": [],
+    "name": "precrime",
+    "outputs": [
+      {
+        "internalType": "address",
+        "name": "",
+        "type": "address"
+      }
+    ],
+    "stateMutability": "view",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      {
+        "internalType": "uint256",
+        "name": "_poolId1",
+        "type": "uint256"
+      },
+      {
+        "internalType": "uint256",
+        "name": "_poolId2",
+        "type": "uint256"
+      }
+    ],
+    "name": "quoteFeeForPriceUpdate",
+    "outputs": [
+      {
+        "internalType": "uint256",
+        "name": "",
+        "type": "uint256"
+      }
+    ],
+    "stateMutability": "view",
+    "type": "function"
+  },
+  {
+    "inputs": [],
+    "name": "renounceOwnership",
+    "outputs": [],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      {
+        "internalType": "uint16",
+        "name": "_version",
+        "type": "uint16"
+      },
+      {
+        "internalType": "uint16",
+        "name": "_chainId",
+        "type": "uint16"
+      },
+      {
+        "internalType": "uint256",
+        "name": "_configType",
+        "type": "uint256"
+      },
+      {
+        "internalType": "bytes",
+        "name": "_config",
+        "type": "bytes"
+      }
+    ],
+    "name": "setConfig",
+    "outputs": [],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      {
+        "internalType": "uint16",
+        "name": "_remoteChainId",
+        "type": "uint16"
+      },
+      {
+        "internalType": "bytes",
+        "name": "_adapterParams",
+        "type": "bytes"
+      }
+    ],
+    "name": "setDefaultAdapterParams",
+    "outputs": [],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      {
+        "internalType": "uint16",
+        "name": "_dstChainId",
+        "type": "uint16"
+      },
+      {
+        "internalType": "uint16",
+        "name": "_packetType",
+        "type": "uint16"
+      },
+      {
+        "internalType": "uint256",
+        "name": "_minGas",
+        "type": "uint256"
+      }
+    ],
+    "name": "setMinDstGas",
+    "outputs": [],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      {
+        "internalType": "uint256",
+        "name": "_poolId",
+        "type": "uint256"
+      },
+      {
+        "internalType": "uint256",
+        "name": "_lpId",
+        "type": "uint256"
+      }
+    ],
+    "name": "setPoolToLpId",
+    "outputs": [],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      {
+        "internalType": "address",
+        "name": "_precrime",
+        "type": "address"
+      }
+    ],
+    "name": "setPrecrime",
+    "outputs": [],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      {
+        "internalType": "uint16",
+        "name": "_version",
+        "type": "uint16"
+      }
+    ],
+    "name": "setReceiveVersion",
+    "outputs": [],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      {
+        "internalType": "uint256",
+        "name": "_poolId1",
+        "type": "uint256"
+      },
+      {
+        "internalType": "uint256",
+        "name": "_poolId2",
+        "type": "uint256"
+      },
+      {
+        "internalType": "uint16[]",
+        "name": "_remoteChainIds",
+        "type": "uint16[]"
+      }
+    ],
+    "name": "setRemoteChains",
+    "outputs": [],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      {
+        "internalType": "uint16",
+        "name": "_version",
+        "type": "uint16"
+      }
+    ],
+    "name": "setSendVersion",
+    "outputs": [],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      {
+        "internalType": "uint256",
+        "name": "_poolId",
+        "type": "uint256"
+      },
+      {
+        "internalType": "address",
+        "name": "_lpStaking",
+        "type": "address"
+      }
+    ],
+    "name": "setStargatePoolIdToLPStakingAddress",
+    "outputs": [],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      {
+        "internalType": "uint256",
+        "name": "_poolId",
+        "type": "uint256"
+      },
+      {
+        "internalType": "address",
+        "name": "_priceFeedAddress",
+        "type": "address"
+      }
+    ],
+    "name": "setTokenPriceFeed",
+    "outputs": [],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      {
+        "internalType": "uint16",
+        "name": "_srcChainId",
+        "type": "uint16"
+      },
+      {
+        "internalType": "bytes",
+        "name": "_path",
+        "type": "bytes"
+      }
+    ],
+    "name": "setTrustedRemote",
+    "outputs": [],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      {
+        "internalType": "uint256",
+        "name": "_poolId1",
+        "type": "uint256"
+      },
+      {
+        "internalType": "uint256",
+        "name": "_poolId2",
+        "type": "uint256"
+      }
+    ],
+    "name": "shouldCallUpdateTokenPrices",
+    "outputs": [
+      {
+        "internalType": "bool",
+        "name": "",
+        "type": "bool"
+      }
+    ],
+    "stateMutability": "view",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      {
+        "internalType": "uint256",
+        "name": "",
+        "type": "uint256"
+      }
+    ],
+    "name": "stargatePoolIdToLPStaking",
+    "outputs": [
+      {
+        "internalType": "address",
+        "name": "",
+        "type": "address"
+      }
+    ],
+    "stateMutability": "view",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      {
+        "internalType": "address",
+        "name": "newOwner",
+        "type": "address"
+      }
+    ],
+    "name": "transferOwnership",
+    "outputs": [],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      {
+        "internalType": "uint16",
+        "name": "",
+        "type": "uint16"
+      }
+    ],
+    "name": "trustedRemoteLookup",
+    "outputs": [
+      {
+        "internalType": "bytes",
+        "name": "",
+        "type": "bytes"
+      }
+    ],
+    "stateMutability": "view",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      {
+        "internalType": "uint256",
+        "name": "_poolId1",
+        "type": "uint256"
+      },
+      {
+        "internalType": "uint256",
+        "name": "_poolId2",
+        "type": "uint256"
+      }
+    ],
+    "name": "updateTokenPrices",
+    "outputs": [],
+    "stateMutability": "payable",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      {
+        "internalType": "address",
+        "name": "_from",
+        "type": "address"
+      },
+      {
+        "internalType": "bool",
+        "name": "_whiteListed",
+        "type": "bool"
+      }
+    ],
+    "name": "whiteList",
+    "outputs": [],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
+    "inputs": [
+      {
+        "internalType": "address",
+        "name": "",
+        "type": "address"
+      }
+    ],
+    "name": "whitelist",
+    "outputs": [
+      {
+        "internalType": "bool",
+        "name": "",
+        "type": "bool"
+      }
+    ],
+    "stateMutability": "view",
+    "type": "function"
+  },
+  {
+    "stateMutability": "payable",
+    "type": "receive"
+  }
+]

+ 18 - 3
package.json

@@ -7,9 +7,11 @@
     "node": ">= 18.12 <19"
   },
   "devDependencies": {
+    "@types/express": "^4.17.21",
     "@types/jest": "~29.5",
     "@types/node": "~18",
-    "@typescript-eslint/eslint-plugin": "~6.2",
+    "@types/node-cron": "^3.0.11",
+    "@typescript-eslint/eslint-plugin": "^7.1.0",
     "@typescript-eslint/parser": "~6.2",
     "eslint": "~8.46",
     "eslint-config-prettier": "~9.0",
@@ -21,11 +23,14 @@
     "ts-api-utils": "~1.0",
     "ts-jest": "~29.1",
     "tsc-alias": "1.8.8",
-    "typescript": "~5.1.0"
+    "typescript": "~5.1.0",
+    "typescript-eslint": "^7.1.0"
   },
   "scripts": {
     "prestart": "npm run build",
+    "start:test": "yarn build && node build/src/test/test.js",
     "start": "node build/src/main.js",
+    "typechain-generate": "yarn typechain --target=ethers-v6 abis/*.json --out-dir src/contract",
     "clean": "rimraf coverage build tmp",
     "build": "tsc -p tsconfig.json && tsc-alias",
     "build:watch": "tsc -w -p tsconfig.json && tsc-alias",
@@ -37,7 +42,17 @@
   },
   "license": "Apache-2.0",
   "dependencies": {
-    "tslib": "~2.6.2"
+    "@prisma/client": "5.10.2",
+    "@typechain/ethers-v6": "^0.5.1",
+    "axios": "^1.6.7",
+    "ethers": "^6.11.1",
+    "express": "^4.18.3",
+    "node-cron": "^3.0.3",
+    "polly-js": "^1.8.3",
+    "prisma": "^5.10.2",
+    "tslib": "~2.6.2",
+    "tslog": "^4.9.2",
+    "typechain": "^8.3.2"
   },
   "volta": {
     "node": "18.12.1"

+ 46 - 0
prisma/schema.prisma

@@ -0,0 +1,46 @@
+// This is your Prisma schema file,
+// learn more about it in the docs: https://pris.ly/d/prisma-schema
+
+// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?
+// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init
+
+generator client {
+  provider = "prisma-client-js"
+}
+
+datasource db {
+  provider = "mysql"
+  url      = env("DATABASE_URL")
+}
+
+model Account {
+  address        String   @id @db.VarChar(42)
+  currentChainId Int
+  bridgeCount    Int      @default(0)
+  lastUpdate     DateTime
+  Task           Task[]
+
+  @@index([lastUpdate])
+}
+
+model Task {
+  id           Int        @id @default(autoincrement())
+  address      String     @db.VarChar(42)
+  scheduleTime DateTime
+  executeTime  DateTime?
+  fromChain    Int
+  toChain      Int
+  status       TaskStatus @default(AWAITING)
+  txHash       String?
+  description  String?    @db.Text
+  account      Account    @relation(fields: [address], references: [address])
+
+  @@index([status, scheduleTime(sort: Asc)])
+}
+
+enum TaskStatus {
+  AWAITING
+  IN_PROGRESS
+  SUCCESS
+  FAILED
+}

+ 56 - 0
src/bridge/OwltoClient.ts

@@ -0,0 +1,56 @@
+import { ethers } from 'ethers'
+import { ChainId, chainInfoMap } from '../config/chain'
+import axios from 'axios'
+import polly from 'polly-js'
+import { newLogger } from '../utils/logger'
+
+export class OwltoClient {
+  wallet: ethers.Wallet
+  chainId: number
+  provider: ethers.JsonRpcProvider
+  static logger = newLogger('OwltoClient')
+
+  constructor(privateKey: string, chainId: number) {
+    this.chainId = chainId
+    this.provider = new ethers.JsonRpcProvider(chainInfoMap[chainId].rpcUrl)
+    this.wallet = new ethers.Wallet(privateKey, this.provider)
+  }
+
+  async bridge(toChainId: number = ChainId.ZKSYNC) {
+    const fromInfo = chainInfoMap[this.chainId].owltoInfo
+    const toInfo = chainInfoMap[toChainId].owltoInfo
+    const lpRes = await axios.get(
+      `https://owlto.finance/api/lp-info?token=ETH&from_chainid=${fromInfo.owltoChainId}&to_chainid=${toInfo.owltoChainId}&user=${this.wallet.address}`,
+    )
+    const makerAddress = lpRes.data.msg.maker_address
+    const currentBalance = await this.provider.getBalance(this.wallet.address)
+    return await polly()
+      .retry(5)
+      .executeForPromise(async info => {
+        if (info.count > 0) {
+          OwltoClient.logger.info(`${this.wallet.address}: Retry ${info.count} times`)
+        }
+        try {
+          const estimatedGasCost = (ethers.parseEther('0.00015') * (100n + 10n * BigInt(info.count))) / 100n
+          const value = currentBalance - estimatedGasCost
+          // const dtcRes = await axios.get(
+          //   `https://owlto.finance/api/dynamic-dtc?amount=${ethers.formatEther(amount)}&token=ETH&from=${
+          //     fromInfo.owltoChainName
+          //   }&to=${toInfo.owltoChainName}`,
+          // )
+          // const dtcValue = dtcRes.data.msg
+          // add network code to padded value
+          const valueWithNetworkCode = (value / 10000n) * 10000n + BigInt(chainInfoMap[toChainId].owltoInfo.networkCode)
+          const res = await this.wallet.sendTransaction({
+            to: makerAddress,
+            value: valueWithNetworkCode,
+          })
+          OwltoClient.logger.info(`Bridge from ${fromInfo.owltoChainName} to ${toInfo.owltoChainName}, tx: ${res.hash}`)
+          return res.hash
+        } catch (e) {
+          OwltoClient.logger.error(e.message, `Failed to bridge to ${toChainId}`)
+          throw e
+        }
+      })
+  }
+}

+ 98 - 0
src/bridge/StargateClient.ts

@@ -0,0 +1,98 @@
+import { ethers } from 'ethers'
+import { Router__factory, RouterETH, RouterETH__factory, StargateFeeLibraryV07__factory } from '../contract'
+import { chainInfoMap } from '../config/chain'
+import polly from 'polly-js'
+import { newLogger } from '../utils/logger'
+
+export class StargateClient {
+  static logger = newLogger('StargateClient')
+
+  wallet: ethers.Wallet
+  chainId: number
+  provider: ethers.JsonRpcProvider
+
+  constructor(privateKey: string, chainId: number) {
+    this.chainId = chainId
+    this.provider = new ethers.JsonRpcProvider(chainInfoMap[chainId].rpcUrl)
+    this.wallet = new ethers.Wallet(privateKey, this.provider)
+  }
+
+  async getFeeInfo(fromChainId: number, toChainId: number, sendAmount: bigint) {
+    const dummyAddress = '0x0000000000000000000000000000000000000001'
+    const fee = StargateFeeLibraryV07__factory.connect(chainInfoMap[fromChainId].feeAddress, this.wallet)
+    const { amount, eqFee, eqReward, lpFee, protocolFee, lkbRemove } = await fee.getFees(
+      13n,
+      13n,
+      toChainId,
+      dummyAddress,
+      sendAmount,
+    )
+
+    const finalFee = eqFee - eqReward + lpFee + protocolFee + lkbRemove
+    console.log('fee', ethers.formatEther(finalFee))
+  }
+
+  async getL0GasCost(toChainId: number) {
+    const dummyAddress = '0x0000000000000000000000000000000000000001'
+    const router = Router__factory.connect(chainInfoMap[this.chainId].routerAddress, this.wallet)
+
+    const [gasCost] = await router.quoteLayerZeroFee(toChainId, 1, dummyAddress, '0x', {
+      dstGasForCall: 0n,
+      dstNativeAmount: 0n,
+      dstNativeAddr: dummyAddress,
+    })
+    return gasCost
+  }
+
+  async bridge(toChainId: number) {
+    const routerEth = RouterETH__factory.connect(chainInfoMap[this.chainId].ethRouterAddress, this.wallet)
+    const balance = await this.provider.getBalance(this.wallet.address)
+    const lzGasCost = await this.getL0GasCost(toChainId)
+    // the cost is not precisely calculated, should be sufficient for common L2s
+    const { gasCost, gasPrice, gasLimit } = await this.calculateGasCost(toChainId, routerEth, lzGasCost)
+    if (balance < gasCost + lzGasCost) throw new Error('Insufficient balance')
+    return await polly()
+      .retry(5)
+      .executeForPromise(async info => {
+        try {
+          if (info.count > 0) {
+            StargateClient.logger.info(`${this.wallet.address}: Retry ${info.count} times`)
+          }
+          // add 10% gas cost for each retry
+          const sendAmount = balance - lzGasCost - (gasCost * (100n + BigInt(info.count * 20))) / 100n
+          // const sendAmount = ethers.parseEther('0.01')
+          const minReceiveAmount = (sendAmount * 995n) / 1000n
+          const res = await routerEth.swapETH(
+            toChainId,
+            this.wallet.address,
+            this.wallet.address,
+            sendAmount,
+            minReceiveAmount,
+            { value: sendAmount + lzGasCost, gasLimit, gasPrice },
+          )
+          return res.hash
+        } catch (e) {
+          StargateClient.logger.error(e.message, `Failed to bridge to ${toChainId}`)
+          throw e
+        }
+      })
+  }
+
+  async calculateGasCost(toChainId: number, routerEth: RouterETH, lzGasCost: bigint) {
+    const feeData = await this.provider.getFeeData()
+    const gasPrice = feeData.gasPrice
+    const amount = ethers.parseEther('0.001')
+    const gasLimit = await routerEth.swapETH.estimateGas(
+      toChainId,
+      this.wallet.address,
+      this.wallet.address,
+      amount,
+      0n,
+      {
+        value: amount + lzGasCost,
+      },
+    )
+    const gasCost = ((this.chainId === 110 ? gasPrice : ethers.parseUnits('0.5', 'gwei')) * gasLimit * 110n) / 100n
+    return { gasCost, gasPrice, gasLimit }
+  }
+}

+ 74 - 0
src/config/chain.ts

@@ -0,0 +1,74 @@
+declare interface ChainInfo {
+  name: string
+  chainId: number
+  rpcUrl: string
+  feeAddress?: string
+  routerAddress?: string
+  ethRouterAddress?: string
+  owltoInfo?: OwltoInfo
+}
+
+declare interface OwltoInfo {
+  owltoChainId: number
+  owltoChainName: string
+  networkCode: number
+}
+
+export enum ChainId {
+  ARBITRUM = 110,
+  OPTIMISM = 111,
+  BASE = 184,
+  ZKSYNC = 324,
+}
+
+export const chainInfoMap: { [chainId: number]: ChainInfo } = {
+  [ChainId.ARBITRUM]: {
+    name: 'Arbitrum',
+    chainId: 110,
+    rpcUrl: 'https://arbitrum-one.publicnode.com',
+    feeAddress: '0x1cf31666c06ac3401ed0c1c6346c4a9425dd7de4',
+    routerAddress: '0x53Bf833A5d6c4ddA888F69c22C88C9f356a41614',
+    ethRouterAddress: '0xbf22f0f184bCcbeA268dF387a49fF5238dD23E40',
+    owltoInfo: {
+      owltoChainId: 42161,
+      owltoChainName: 'ArbitrumOneMainnet',
+      networkCode: 4,
+    },
+  },
+  [ChainId.OPTIMISM]: {
+    name: 'Optimism',
+    chainId: 111,
+    rpcUrl: 'https://optimism-rpc.publicnode.com',
+    feeAddress: '0x505ecdf2f14cd4f1f413d04624b009a449d38d7e',
+    routerAddress: '0xB0D502E938ed5f4df2E681fE6E419ff29631d62b',
+    ethRouterAddress: '0xb49c4e680174e331cb0a7ff3ab58afc9738d5f8b',
+    owltoInfo: {
+      owltoChainId: 10,
+      owltoChainName: 'OptimismMainnet',
+      networkCode: 3,
+    },
+  },
+  [ChainId.BASE]: {
+    name: 'Base',
+    chainId: 184,
+    rpcUrl: 'https://base-rpc.publicnode.com',
+    feeAddress: '0x9d1b1669c73b033dfe47ae5a0164ab96df25b944',
+    routerAddress: '0x45f1a95a4d3f3836523f5c83673c797f4d4d263b',
+    ethRouterAddress: '0x50B6EbC2103BFEc165949CC946d739d5650d7ae4',
+    owltoInfo: {
+      owltoChainId: 8453,
+      owltoChainName: 'BaseMainnet',
+      networkCode: 12,
+    },
+  },
+  [ChainId.ZKSYNC]: {
+    name: 'zkSync',
+    chainId: 324,
+    rpcUrl: 'https://mainnet.era.zksync.io',
+    owltoInfo: {
+      owltoChainId: 324,
+      owltoChainName: 'ZksyncMainnet',
+      networkCode: 2,
+    },
+  },
+}

+ 1406 - 0
src/contract/Router.ts

@@ -0,0 +1,1406 @@
+/* Autogenerated file. Do not edit manually. */
+/* tslint:disable */
+/* eslint-disable */
+import type {
+  BaseContract,
+  BigNumberish,
+  BytesLike,
+  FunctionFragment,
+  Result,
+  Interface,
+  EventFragment,
+  AddressLike,
+  ContractRunner,
+  ContractMethod,
+  Listener,
+} from "ethers";
+import type {
+  TypedContractEvent,
+  TypedDeferredTopicFilter,
+  TypedEventLog,
+  TypedLogDescription,
+  TypedListener,
+  TypedContractMethod,
+} from "./common";
+
+export declare namespace Pool {
+  export type CreditObjStruct = {
+    credits: BigNumberish;
+    idealBalance: BigNumberish;
+  };
+
+  export type CreditObjStructOutput = [
+    credits: bigint,
+    idealBalance: bigint
+  ] & { credits: bigint; idealBalance: bigint };
+
+  export type SwapObjStruct = {
+    amount: BigNumberish;
+    eqFee: BigNumberish;
+    eqReward: BigNumberish;
+    lpFee: BigNumberish;
+    protocolFee: BigNumberish;
+    lkbRemove: BigNumberish;
+  };
+
+  export type SwapObjStructOutput = [
+    amount: bigint,
+    eqFee: bigint,
+    eqReward: bigint,
+    lpFee: bigint,
+    protocolFee: bigint,
+    lkbRemove: bigint
+  ] & {
+    amount: bigint;
+    eqFee: bigint;
+    eqReward: bigint;
+    lpFee: bigint;
+    protocolFee: bigint;
+    lkbRemove: bigint;
+  };
+}
+
+export declare namespace IStargateRouter {
+  export type LzTxObjStruct = {
+    dstGasForCall: BigNumberish;
+    dstNativeAmount: BigNumberish;
+    dstNativeAddr: BytesLike;
+  };
+
+  export type LzTxObjStructOutput = [
+    dstGasForCall: bigint,
+    dstNativeAmount: bigint,
+    dstNativeAddr: string
+  ] & { dstGasForCall: bigint; dstNativeAmount: bigint; dstNativeAddr: string };
+}
+
+export interface RouterInterface extends Interface {
+  getFunction(
+    nameOrSignature:
+      | "activateChainPath"
+      | "addLiquidity"
+      | "bridge"
+      | "cachedSwapLookup"
+      | "callDelta"
+      | "clearCachedSwap"
+      | "createChainPath"
+      | "createPool"
+      | "creditChainPath"
+      | "factory"
+      | "instantRedeemLocal"
+      | "mintFeeOwner"
+      | "owner"
+      | "protocolFeeOwner"
+      | "quoteLayerZeroFee"
+      | "redeemLocal"
+      | "redeemLocalCallback"
+      | "redeemLocalCheckOnRemote"
+      | "redeemRemote"
+      | "renounceOwnership"
+      | "retryRevert"
+      | "revertLookup"
+      | "revertRedeemLocal"
+      | "sendCredits"
+      | "setBridgeAndFactory"
+      | "setDeltaParam"
+      | "setFeeLibrary"
+      | "setFees"
+      | "setMintFeeOwner"
+      | "setProtocolFeeOwner"
+      | "setSwapStop"
+      | "setWeightForChainPath"
+      | "swap"
+      | "swapRemote"
+      | "transferOwnership"
+      | "withdrawMintFee"
+      | "withdrawProtocolFee"
+  ): FunctionFragment;
+
+  getEvent(
+    nameOrSignatureOrTopic:
+      | "CachedSwapSaved"
+      | "OwnershipTransferred"
+      | "RedeemLocalCallback"
+      | "Revert"
+      | "RevertRedeemLocal"
+  ): EventFragment;
+
+  encodeFunctionData(
+    functionFragment: "activateChainPath",
+    values: [BigNumberish, BigNumberish, BigNumberish]
+  ): string;
+  encodeFunctionData(
+    functionFragment: "addLiquidity",
+    values: [BigNumberish, BigNumberish, AddressLike]
+  ): string;
+  encodeFunctionData(functionFragment: "bridge", values?: undefined): string;
+  encodeFunctionData(
+    functionFragment: "cachedSwapLookup",
+    values: [BigNumberish, BytesLike, BigNumberish]
+  ): string;
+  encodeFunctionData(
+    functionFragment: "callDelta",
+    values: [BigNumberish, boolean]
+  ): string;
+  encodeFunctionData(
+    functionFragment: "clearCachedSwap",
+    values: [BigNumberish, BytesLike, BigNumberish]
+  ): string;
+  encodeFunctionData(
+    functionFragment: "createChainPath",
+    values: [BigNumberish, BigNumberish, BigNumberish, BigNumberish]
+  ): string;
+  encodeFunctionData(
+    functionFragment: "createPool",
+    values: [
+      BigNumberish,
+      AddressLike,
+      BigNumberish,
+      BigNumberish,
+      string,
+      string
+    ]
+  ): string;
+  encodeFunctionData(
+    functionFragment: "creditChainPath",
+    values: [BigNumberish, BigNumberish, BigNumberish, Pool.CreditObjStruct]
+  ): string;
+  encodeFunctionData(functionFragment: "factory", values?: undefined): string;
+  encodeFunctionData(
+    functionFragment: "instantRedeemLocal",
+    values: [BigNumberish, BigNumberish, AddressLike]
+  ): string;
+  encodeFunctionData(
+    functionFragment: "mintFeeOwner",
+    values?: undefined
+  ): string;
+  encodeFunctionData(functionFragment: "owner", values?: undefined): string;
+  encodeFunctionData(
+    functionFragment: "protocolFeeOwner",
+    values?: undefined
+  ): string;
+  encodeFunctionData(
+    functionFragment: "quoteLayerZeroFee",
+    values: [
+      BigNumberish,
+      BigNumberish,
+      BytesLike,
+      BytesLike,
+      IStargateRouter.LzTxObjStruct
+    ]
+  ): string;
+  encodeFunctionData(
+    functionFragment: "redeemLocal",
+    values: [
+      BigNumberish,
+      BigNumberish,
+      BigNumberish,
+      AddressLike,
+      BigNumberish,
+      BytesLike,
+      IStargateRouter.LzTxObjStruct
+    ]
+  ): string;
+  encodeFunctionData(
+    functionFragment: "redeemLocalCallback",
+    values: [
+      BigNumberish,
+      BytesLike,
+      BigNumberish,
+      BigNumberish,
+      BigNumberish,
+      AddressLike,
+      BigNumberish,
+      BigNumberish
+    ]
+  ): string;
+  encodeFunctionData(
+    functionFragment: "redeemLocalCheckOnRemote",
+    values: [
+      BigNumberish,
+      BytesLike,
+      BigNumberish,
+      BigNumberish,
+      BigNumberish,
+      BigNumberish,
+      BytesLike
+    ]
+  ): string;
+  encodeFunctionData(
+    functionFragment: "redeemRemote",
+    values: [
+      BigNumberish,
+      BigNumberish,
+      BigNumberish,
+      AddressLike,
+      BigNumberish,
+      BigNumberish,
+      BytesLike,
+      IStargateRouter.LzTxObjStruct
+    ]
+  ): string;
+  encodeFunctionData(
+    functionFragment: "renounceOwnership",
+    values?: undefined
+  ): string;
+  encodeFunctionData(
+    functionFragment: "retryRevert",
+    values: [BigNumberish, BytesLike, BigNumberish]
+  ): string;
+  encodeFunctionData(
+    functionFragment: "revertLookup",
+    values: [BigNumberish, BytesLike, BigNumberish]
+  ): string;
+  encodeFunctionData(
+    functionFragment: "revertRedeemLocal",
+    values: [
+      BigNumberish,
+      BytesLike,
+      BigNumberish,
+      AddressLike,
+      IStargateRouter.LzTxObjStruct
+    ]
+  ): string;
+  encodeFunctionData(
+    functionFragment: "sendCredits",
+    values: [BigNumberish, BigNumberish, BigNumberish, AddressLike]
+  ): string;
+  encodeFunctionData(
+    functionFragment: "setBridgeAndFactory",
+    values: [AddressLike, AddressLike]
+  ): string;
+  encodeFunctionData(
+    functionFragment: "setDeltaParam",
+    values: [
+      BigNumberish,
+      boolean,
+      BigNumberish,
+      BigNumberish,
+      boolean,
+      boolean
+    ]
+  ): string;
+  encodeFunctionData(
+    functionFragment: "setFeeLibrary",
+    values: [BigNumberish, AddressLike]
+  ): string;
+  encodeFunctionData(
+    functionFragment: "setFees",
+    values: [BigNumberish, BigNumberish]
+  ): string;
+  encodeFunctionData(
+    functionFragment: "setMintFeeOwner",
+    values: [AddressLike]
+  ): string;
+  encodeFunctionData(
+    functionFragment: "setProtocolFeeOwner",
+    values: [AddressLike]
+  ): string;
+  encodeFunctionData(
+    functionFragment: "setSwapStop",
+    values: [BigNumberish, boolean]
+  ): string;
+  encodeFunctionData(
+    functionFragment: "setWeightForChainPath",
+    values: [BigNumberish, BigNumberish, BigNumberish, BigNumberish]
+  ): string;
+  encodeFunctionData(
+    functionFragment: "swap",
+    values: [
+      BigNumberish,
+      BigNumberish,
+      BigNumberish,
+      AddressLike,
+      BigNumberish,
+      BigNumberish,
+      IStargateRouter.LzTxObjStruct,
+      BytesLike,
+      BytesLike
+    ]
+  ): string;
+  encodeFunctionData(
+    functionFragment: "swapRemote",
+    values: [
+      BigNumberish,
+      BytesLike,
+      BigNumberish,
+      BigNumberish,
+      BigNumberish,
+      BigNumberish,
+      AddressLike,
+      Pool.SwapObjStruct,
+      BytesLike
+    ]
+  ): string;
+  encodeFunctionData(
+    functionFragment: "transferOwnership",
+    values: [AddressLike]
+  ): string;
+  encodeFunctionData(
+    functionFragment: "withdrawMintFee",
+    values: [BigNumberish, AddressLike]
+  ): string;
+  encodeFunctionData(
+    functionFragment: "withdrawProtocolFee",
+    values: [BigNumberish, AddressLike]
+  ): string;
+
+  decodeFunctionResult(
+    functionFragment: "activateChainPath",
+    data: BytesLike
+  ): Result;
+  decodeFunctionResult(
+    functionFragment: "addLiquidity",
+    data: BytesLike
+  ): Result;
+  decodeFunctionResult(functionFragment: "bridge", data: BytesLike): Result;
+  decodeFunctionResult(
+    functionFragment: "cachedSwapLookup",
+    data: BytesLike
+  ): Result;
+  decodeFunctionResult(functionFragment: "callDelta", data: BytesLike): Result;
+  decodeFunctionResult(
+    functionFragment: "clearCachedSwap",
+    data: BytesLike
+  ): Result;
+  decodeFunctionResult(
+    functionFragment: "createChainPath",
+    data: BytesLike
+  ): Result;
+  decodeFunctionResult(functionFragment: "createPool", data: BytesLike): Result;
+  decodeFunctionResult(
+    functionFragment: "creditChainPath",
+    data: BytesLike
+  ): Result;
+  decodeFunctionResult(functionFragment: "factory", data: BytesLike): Result;
+  decodeFunctionResult(
+    functionFragment: "instantRedeemLocal",
+    data: BytesLike
+  ): Result;
+  decodeFunctionResult(
+    functionFragment: "mintFeeOwner",
+    data: BytesLike
+  ): Result;
+  decodeFunctionResult(functionFragment: "owner", data: BytesLike): Result;
+  decodeFunctionResult(
+    functionFragment: "protocolFeeOwner",
+    data: BytesLike
+  ): Result;
+  decodeFunctionResult(
+    functionFragment: "quoteLayerZeroFee",
+    data: BytesLike
+  ): Result;
+  decodeFunctionResult(
+    functionFragment: "redeemLocal",
+    data: BytesLike
+  ): Result;
+  decodeFunctionResult(
+    functionFragment: "redeemLocalCallback",
+    data: BytesLike
+  ): Result;
+  decodeFunctionResult(
+    functionFragment: "redeemLocalCheckOnRemote",
+    data: BytesLike
+  ): Result;
+  decodeFunctionResult(
+    functionFragment: "redeemRemote",
+    data: BytesLike
+  ): Result;
+  decodeFunctionResult(
+    functionFragment: "renounceOwnership",
+    data: BytesLike
+  ): Result;
+  decodeFunctionResult(
+    functionFragment: "retryRevert",
+    data: BytesLike
+  ): Result;
+  decodeFunctionResult(
+    functionFragment: "revertLookup",
+    data: BytesLike
+  ): Result;
+  decodeFunctionResult(
+    functionFragment: "revertRedeemLocal",
+    data: BytesLike
+  ): Result;
+  decodeFunctionResult(
+    functionFragment: "sendCredits",
+    data: BytesLike
+  ): Result;
+  decodeFunctionResult(
+    functionFragment: "setBridgeAndFactory",
+    data: BytesLike
+  ): Result;
+  decodeFunctionResult(
+    functionFragment: "setDeltaParam",
+    data: BytesLike
+  ): Result;
+  decodeFunctionResult(
+    functionFragment: "setFeeLibrary",
+    data: BytesLike
+  ): Result;
+  decodeFunctionResult(functionFragment: "setFees", data: BytesLike): Result;
+  decodeFunctionResult(
+    functionFragment: "setMintFeeOwner",
+    data: BytesLike
+  ): Result;
+  decodeFunctionResult(
+    functionFragment: "setProtocolFeeOwner",
+    data: BytesLike
+  ): Result;
+  decodeFunctionResult(
+    functionFragment: "setSwapStop",
+    data: BytesLike
+  ): Result;
+  decodeFunctionResult(
+    functionFragment: "setWeightForChainPath",
+    data: BytesLike
+  ): Result;
+  decodeFunctionResult(functionFragment: "swap", data: BytesLike): Result;
+  decodeFunctionResult(functionFragment: "swapRemote", data: BytesLike): Result;
+  decodeFunctionResult(
+    functionFragment: "transferOwnership",
+    data: BytesLike
+  ): Result;
+  decodeFunctionResult(
+    functionFragment: "withdrawMintFee",
+    data: BytesLike
+  ): Result;
+  decodeFunctionResult(
+    functionFragment: "withdrawProtocolFee",
+    data: BytesLike
+  ): Result;
+}
+
+export namespace CachedSwapSavedEvent {
+  export type InputTuple = [
+    chainId: BigNumberish,
+    srcAddress: BytesLike,
+    nonce: BigNumberish,
+    token: AddressLike,
+    amountLD: BigNumberish,
+    to: AddressLike,
+    payload: BytesLike,
+    reason: BytesLike
+  ];
+  export type OutputTuple = [
+    chainId: bigint,
+    srcAddress: string,
+    nonce: bigint,
+    token: string,
+    amountLD: bigint,
+    to: string,
+    payload: string,
+    reason: string
+  ];
+  export interface OutputObject {
+    chainId: bigint;
+    srcAddress: string;
+    nonce: bigint;
+    token: string;
+    amountLD: bigint;
+    to: string;
+    payload: string;
+    reason: string;
+  }
+  export type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>;
+  export type Filter = TypedDeferredTopicFilter<Event>;
+  export type Log = TypedEventLog<Event>;
+  export type LogDescription = TypedLogDescription<Event>;
+}
+
+export namespace OwnershipTransferredEvent {
+  export type InputTuple = [previousOwner: AddressLike, newOwner: AddressLike];
+  export type OutputTuple = [previousOwner: string, newOwner: string];
+  export interface OutputObject {
+    previousOwner: string;
+    newOwner: string;
+  }
+  export type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>;
+  export type Filter = TypedDeferredTopicFilter<Event>;
+  export type Log = TypedEventLog<Event>;
+  export type LogDescription = TypedLogDescription<Event>;
+}
+
+export namespace RedeemLocalCallbackEvent {
+  export type InputTuple = [
+    srcChainId: BigNumberish,
+    srcAddress: BytesLike,
+    nonce: BigNumberish,
+    srcPoolId: BigNumberish,
+    dstPoolId: BigNumberish,
+    to: AddressLike,
+    amountSD: BigNumberish,
+    mintAmountSD: BigNumberish
+  ];
+  export type OutputTuple = [
+    srcChainId: bigint,
+    srcAddress: string,
+    nonce: bigint,
+    srcPoolId: bigint,
+    dstPoolId: bigint,
+    to: string,
+    amountSD: bigint,
+    mintAmountSD: bigint
+  ];
+  export interface OutputObject {
+    srcChainId: bigint;
+    srcAddress: string;
+    nonce: bigint;
+    srcPoolId: bigint;
+    dstPoolId: bigint;
+    to: string;
+    amountSD: bigint;
+    mintAmountSD: bigint;
+  }
+  export type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>;
+  export type Filter = TypedDeferredTopicFilter<Event>;
+  export type Log = TypedEventLog<Event>;
+  export type LogDescription = TypedLogDescription<Event>;
+}
+
+export namespace RevertEvent {
+  export type InputTuple = [
+    bridgeFunctionType: BigNumberish,
+    chainId: BigNumberish,
+    srcAddress: BytesLike,
+    nonce: BigNumberish
+  ];
+  export type OutputTuple = [
+    bridgeFunctionType: bigint,
+    chainId: bigint,
+    srcAddress: string,
+    nonce: bigint
+  ];
+  export interface OutputObject {
+    bridgeFunctionType: bigint;
+    chainId: bigint;
+    srcAddress: string;
+    nonce: bigint;
+  }
+  export type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>;
+  export type Filter = TypedDeferredTopicFilter<Event>;
+  export type Log = TypedEventLog<Event>;
+  export type LogDescription = TypedLogDescription<Event>;
+}
+
+export namespace RevertRedeemLocalEvent {
+  export type InputTuple = [
+    srcChainId: BigNumberish,
+    _srcPoolId: BigNumberish,
+    _dstPoolId: BigNumberish,
+    to: BytesLike,
+    redeemAmountSD: BigNumberish,
+    mintAmountSD: BigNumberish,
+    nonce: BigNumberish,
+    srcAddress: BytesLike
+  ];
+  export type OutputTuple = [
+    srcChainId: bigint,
+    _srcPoolId: bigint,
+    _dstPoolId: bigint,
+    to: string,
+    redeemAmountSD: bigint,
+    mintAmountSD: bigint,
+    nonce: bigint,
+    srcAddress: string
+  ];
+  export interface OutputObject {
+    srcChainId: bigint;
+    _srcPoolId: bigint;
+    _dstPoolId: bigint;
+    to: string;
+    redeemAmountSD: bigint;
+    mintAmountSD: bigint;
+    nonce: bigint;
+    srcAddress: string;
+  }
+  export type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>;
+  export type Filter = TypedDeferredTopicFilter<Event>;
+  export type Log = TypedEventLog<Event>;
+  export type LogDescription = TypedLogDescription<Event>;
+}
+
+export interface Router extends BaseContract {
+  connect(runner?: ContractRunner | null): Router;
+  waitForDeployment(): Promise<this>;
+
+  interface: RouterInterface;
+
+  queryFilter<TCEvent extends TypedContractEvent>(
+    event: TCEvent,
+    fromBlockOrBlockhash?: string | number | undefined,
+    toBlock?: string | number | undefined
+  ): Promise<Array<TypedEventLog<TCEvent>>>;
+  queryFilter<TCEvent extends TypedContractEvent>(
+    filter: TypedDeferredTopicFilter<TCEvent>,
+    fromBlockOrBlockhash?: string | number | undefined,
+    toBlock?: string | number | undefined
+  ): Promise<Array<TypedEventLog<TCEvent>>>;
+
+  on<TCEvent extends TypedContractEvent>(
+    event: TCEvent,
+    listener: TypedListener<TCEvent>
+  ): Promise<this>;
+  on<TCEvent extends TypedContractEvent>(
+    filter: TypedDeferredTopicFilter<TCEvent>,
+    listener: TypedListener<TCEvent>
+  ): Promise<this>;
+
+  once<TCEvent extends TypedContractEvent>(
+    event: TCEvent,
+    listener: TypedListener<TCEvent>
+  ): Promise<this>;
+  once<TCEvent extends TypedContractEvent>(
+    filter: TypedDeferredTopicFilter<TCEvent>,
+    listener: TypedListener<TCEvent>
+  ): Promise<this>;
+
+  listeners<TCEvent extends TypedContractEvent>(
+    event: TCEvent
+  ): Promise<Array<TypedListener<TCEvent>>>;
+  listeners(eventName?: string): Promise<Array<Listener>>;
+  removeAllListeners<TCEvent extends TypedContractEvent>(
+    event?: TCEvent
+  ): Promise<this>;
+
+  activateChainPath: TypedContractMethod<
+    [
+      _poolId: BigNumberish,
+      _dstChainId: BigNumberish,
+      _dstPoolId: BigNumberish
+    ],
+    [void],
+    "nonpayable"
+  >;
+
+  addLiquidity: TypedContractMethod<
+    [_poolId: BigNumberish, _amountLD: BigNumberish, _to: AddressLike],
+    [void],
+    "nonpayable"
+  >;
+
+  bridge: TypedContractMethod<[], [string], "view">;
+
+  cachedSwapLookup: TypedContractMethod<
+    [arg0: BigNumberish, arg1: BytesLike, arg2: BigNumberish],
+    [
+      [string, bigint, string, string] & {
+        token: string;
+        amountLD: bigint;
+        to: string;
+        payload: string;
+      }
+    ],
+    "view"
+  >;
+
+  callDelta: TypedContractMethod<
+    [_poolId: BigNumberish, _fullMode: boolean],
+    [void],
+    "nonpayable"
+  >;
+
+  clearCachedSwap: TypedContractMethod<
+    [_srcChainId: BigNumberish, _srcAddress: BytesLike, _nonce: BigNumberish],
+    [void],
+    "nonpayable"
+  >;
+
+  createChainPath: TypedContractMethod<
+    [
+      _poolId: BigNumberish,
+      _dstChainId: BigNumberish,
+      _dstPoolId: BigNumberish,
+      _weight: BigNumberish
+    ],
+    [void],
+    "nonpayable"
+  >;
+
+  createPool: TypedContractMethod<
+    [
+      _poolId: BigNumberish,
+      _token: AddressLike,
+      _sharedDecimals: BigNumberish,
+      _localDecimals: BigNumberish,
+      _name: string,
+      _symbol: string
+    ],
+    [string],
+    "nonpayable"
+  >;
+
+  creditChainPath: TypedContractMethod<
+    [
+      _dstChainId: BigNumberish,
+      _dstPoolId: BigNumberish,
+      _srcPoolId: BigNumberish,
+      _c: Pool.CreditObjStruct
+    ],
+    [void],
+    "nonpayable"
+  >;
+
+  factory: TypedContractMethod<[], [string], "view">;
+
+  instantRedeemLocal: TypedContractMethod<
+    [_srcPoolId: BigNumberish, _amountLP: BigNumberish, _to: AddressLike],
+    [bigint],
+    "nonpayable"
+  >;
+
+  mintFeeOwner: TypedContractMethod<[], [string], "view">;
+
+  owner: TypedContractMethod<[], [string], "view">;
+
+  protocolFeeOwner: TypedContractMethod<[], [string], "view">;
+
+  quoteLayerZeroFee: TypedContractMethod<
+    [
+      _dstChainId: BigNumberish,
+      _functionType: BigNumberish,
+      _toAddress: BytesLike,
+      _transferAndCallPayload: BytesLike,
+      _lzTxParams: IStargateRouter.LzTxObjStruct
+    ],
+    [[bigint, bigint]],
+    "view"
+  >;
+
+  redeemLocal: TypedContractMethod<
+    [
+      _dstChainId: BigNumberish,
+      _srcPoolId: BigNumberish,
+      _dstPoolId: BigNumberish,
+      _refundAddress: AddressLike,
+      _amountLP: BigNumberish,
+      _to: BytesLike,
+      _lzTxParams: IStargateRouter.LzTxObjStruct
+    ],
+    [void],
+    "payable"
+  >;
+
+  redeemLocalCallback: TypedContractMethod<
+    [
+      _srcChainId: BigNumberish,
+      _srcAddress: BytesLike,
+      _nonce: BigNumberish,
+      _srcPoolId: BigNumberish,
+      _dstPoolId: BigNumberish,
+      _to: AddressLike,
+      _amountSD: BigNumberish,
+      _mintAmountSD: BigNumberish
+    ],
+    [void],
+    "nonpayable"
+  >;
+
+  redeemLocalCheckOnRemote: TypedContractMethod<
+    [
+      _srcChainId: BigNumberish,
+      _srcAddress: BytesLike,
+      _nonce: BigNumberish,
+      _srcPoolId: BigNumberish,
+      _dstPoolId: BigNumberish,
+      _amountSD: BigNumberish,
+      _to: BytesLike
+    ],
+    [void],
+    "nonpayable"
+  >;
+
+  redeemRemote: TypedContractMethod<
+    [
+      _dstChainId: BigNumberish,
+      _srcPoolId: BigNumberish,
+      _dstPoolId: BigNumberish,
+      _refundAddress: AddressLike,
+      _amountLP: BigNumberish,
+      _minAmountLD: BigNumberish,
+      _to: BytesLike,
+      _lzTxParams: IStargateRouter.LzTxObjStruct
+    ],
+    [void],
+    "payable"
+  >;
+
+  renounceOwnership: TypedContractMethod<[], [void], "nonpayable">;
+
+  retryRevert: TypedContractMethod<
+    [_srcChainId: BigNumberish, _srcAddress: BytesLike, _nonce: BigNumberish],
+    [void],
+    "payable"
+  >;
+
+  revertLookup: TypedContractMethod<
+    [arg0: BigNumberish, arg1: BytesLike, arg2: BigNumberish],
+    [string],
+    "view"
+  >;
+
+  revertRedeemLocal: TypedContractMethod<
+    [
+      _dstChainId: BigNumberish,
+      _srcAddress: BytesLike,
+      _nonce: BigNumberish,
+      _refundAddress: AddressLike,
+      _lzTxParams: IStargateRouter.LzTxObjStruct
+    ],
+    [void],
+    "payable"
+  >;
+
+  sendCredits: TypedContractMethod<
+    [
+      _dstChainId: BigNumberish,
+      _srcPoolId: BigNumberish,
+      _dstPoolId: BigNumberish,
+      _refundAddress: AddressLike
+    ],
+    [void],
+    "payable"
+  >;
+
+  setBridgeAndFactory: TypedContractMethod<
+    [_bridge: AddressLike, _factory: AddressLike],
+    [void],
+    "nonpayable"
+  >;
+
+  setDeltaParam: TypedContractMethod<
+    [
+      _poolId: BigNumberish,
+      _batched: boolean,
+      _swapDeltaBP: BigNumberish,
+      _lpDeltaBP: BigNumberish,
+      _defaultSwapMode: boolean,
+      _defaultLPMode: boolean
+    ],
+    [void],
+    "nonpayable"
+  >;
+
+  setFeeLibrary: TypedContractMethod<
+    [_poolId: BigNumberish, _feeLibraryAddr: AddressLike],
+    [void],
+    "nonpayable"
+  >;
+
+  setFees: TypedContractMethod<
+    [_poolId: BigNumberish, _mintFeeBP: BigNumberish],
+    [void],
+    "nonpayable"
+  >;
+
+  setMintFeeOwner: TypedContractMethod<
+    [_owner: AddressLike],
+    [void],
+    "nonpayable"
+  >;
+
+  setProtocolFeeOwner: TypedContractMethod<
+    [_owner: AddressLike],
+    [void],
+    "nonpayable"
+  >;
+
+  setSwapStop: TypedContractMethod<
+    [_poolId: BigNumberish, _swapStop: boolean],
+    [void],
+    "nonpayable"
+  >;
+
+  setWeightForChainPath: TypedContractMethod<
+    [
+      _poolId: BigNumberish,
+      _dstChainId: BigNumberish,
+      _dstPoolId: BigNumberish,
+      _weight: BigNumberish
+    ],
+    [void],
+    "nonpayable"
+  >;
+
+  swap: TypedContractMethod<
+    [
+      _dstChainId: BigNumberish,
+      _srcPoolId: BigNumberish,
+      _dstPoolId: BigNumberish,
+      _refundAddress: AddressLike,
+      _amountLD: BigNumberish,
+      _minAmountLD: BigNumberish,
+      _lzTxParams: IStargateRouter.LzTxObjStruct,
+      _to: BytesLike,
+      _payload: BytesLike
+    ],
+    [void],
+    "payable"
+  >;
+
+  swapRemote: TypedContractMethod<
+    [
+      _srcChainId: BigNumberish,
+      _srcAddress: BytesLike,
+      _nonce: BigNumberish,
+      _srcPoolId: BigNumberish,
+      _dstPoolId: BigNumberish,
+      _dstGasForCall: BigNumberish,
+      _to: AddressLike,
+      _s: Pool.SwapObjStruct,
+      _payload: BytesLike
+    ],
+    [void],
+    "nonpayable"
+  >;
+
+  transferOwnership: TypedContractMethod<
+    [newOwner: AddressLike],
+    [void],
+    "nonpayable"
+  >;
+
+  withdrawMintFee: TypedContractMethod<
+    [_poolId: BigNumberish, _to: AddressLike],
+    [void],
+    "nonpayable"
+  >;
+
+  withdrawProtocolFee: TypedContractMethod<
+    [_poolId: BigNumberish, _to: AddressLike],
+    [void],
+    "nonpayable"
+  >;
+
+  getFunction<T extends ContractMethod = ContractMethod>(
+    key: string | FunctionFragment
+  ): T;
+
+  getFunction(
+    nameOrSignature: "activateChainPath"
+  ): TypedContractMethod<
+    [
+      _poolId: BigNumberish,
+      _dstChainId: BigNumberish,
+      _dstPoolId: BigNumberish
+    ],
+    [void],
+    "nonpayable"
+  >;
+  getFunction(
+    nameOrSignature: "addLiquidity"
+  ): TypedContractMethod<
+    [_poolId: BigNumberish, _amountLD: BigNumberish, _to: AddressLike],
+    [void],
+    "nonpayable"
+  >;
+  getFunction(
+    nameOrSignature: "bridge"
+  ): TypedContractMethod<[], [string], "view">;
+  getFunction(
+    nameOrSignature: "cachedSwapLookup"
+  ): TypedContractMethod<
+    [arg0: BigNumberish, arg1: BytesLike, arg2: BigNumberish],
+    [
+      [string, bigint, string, string] & {
+        token: string;
+        amountLD: bigint;
+        to: string;
+        payload: string;
+      }
+    ],
+    "view"
+  >;
+  getFunction(
+    nameOrSignature: "callDelta"
+  ): TypedContractMethod<
+    [_poolId: BigNumberish, _fullMode: boolean],
+    [void],
+    "nonpayable"
+  >;
+  getFunction(
+    nameOrSignature: "clearCachedSwap"
+  ): TypedContractMethod<
+    [_srcChainId: BigNumberish, _srcAddress: BytesLike, _nonce: BigNumberish],
+    [void],
+    "nonpayable"
+  >;
+  getFunction(
+    nameOrSignature: "createChainPath"
+  ): TypedContractMethod<
+    [
+      _poolId: BigNumberish,
+      _dstChainId: BigNumberish,
+      _dstPoolId: BigNumberish,
+      _weight: BigNumberish
+    ],
+    [void],
+    "nonpayable"
+  >;
+  getFunction(
+    nameOrSignature: "createPool"
+  ): TypedContractMethod<
+    [
+      _poolId: BigNumberish,
+      _token: AddressLike,
+      _sharedDecimals: BigNumberish,
+      _localDecimals: BigNumberish,
+      _name: string,
+      _symbol: string
+    ],
+    [string],
+    "nonpayable"
+  >;
+  getFunction(
+    nameOrSignature: "creditChainPath"
+  ): TypedContractMethod<
+    [
+      _dstChainId: BigNumberish,
+      _dstPoolId: BigNumberish,
+      _srcPoolId: BigNumberish,
+      _c: Pool.CreditObjStruct
+    ],
+    [void],
+    "nonpayable"
+  >;
+  getFunction(
+    nameOrSignature: "factory"
+  ): TypedContractMethod<[], [string], "view">;
+  getFunction(
+    nameOrSignature: "instantRedeemLocal"
+  ): TypedContractMethod<
+    [_srcPoolId: BigNumberish, _amountLP: BigNumberish, _to: AddressLike],
+    [bigint],
+    "nonpayable"
+  >;
+  getFunction(
+    nameOrSignature: "mintFeeOwner"
+  ): TypedContractMethod<[], [string], "view">;
+  getFunction(
+    nameOrSignature: "owner"
+  ): TypedContractMethod<[], [string], "view">;
+  getFunction(
+    nameOrSignature: "protocolFeeOwner"
+  ): TypedContractMethod<[], [string], "view">;
+  getFunction(
+    nameOrSignature: "quoteLayerZeroFee"
+  ): TypedContractMethod<
+    [
+      _dstChainId: BigNumberish,
+      _functionType: BigNumberish,
+      _toAddress: BytesLike,
+      _transferAndCallPayload: BytesLike,
+      _lzTxParams: IStargateRouter.LzTxObjStruct
+    ],
+    [[bigint, bigint]],
+    "view"
+  >;
+  getFunction(
+    nameOrSignature: "redeemLocal"
+  ): TypedContractMethod<
+    [
+      _dstChainId: BigNumberish,
+      _srcPoolId: BigNumberish,
+      _dstPoolId: BigNumberish,
+      _refundAddress: AddressLike,
+      _amountLP: BigNumberish,
+      _to: BytesLike,
+      _lzTxParams: IStargateRouter.LzTxObjStruct
+    ],
+    [void],
+    "payable"
+  >;
+  getFunction(
+    nameOrSignature: "redeemLocalCallback"
+  ): TypedContractMethod<
+    [
+      _srcChainId: BigNumberish,
+      _srcAddress: BytesLike,
+      _nonce: BigNumberish,
+      _srcPoolId: BigNumberish,
+      _dstPoolId: BigNumberish,
+      _to: AddressLike,
+      _amountSD: BigNumberish,
+      _mintAmountSD: BigNumberish
+    ],
+    [void],
+    "nonpayable"
+  >;
+  getFunction(
+    nameOrSignature: "redeemLocalCheckOnRemote"
+  ): TypedContractMethod<
+    [
+      _srcChainId: BigNumberish,
+      _srcAddress: BytesLike,
+      _nonce: BigNumberish,
+      _srcPoolId: BigNumberish,
+      _dstPoolId: BigNumberish,
+      _amountSD: BigNumberish,
+      _to: BytesLike
+    ],
+    [void],
+    "nonpayable"
+  >;
+  getFunction(
+    nameOrSignature: "redeemRemote"
+  ): TypedContractMethod<
+    [
+      _dstChainId: BigNumberish,
+      _srcPoolId: BigNumberish,
+      _dstPoolId: BigNumberish,
+      _refundAddress: AddressLike,
+      _amountLP: BigNumberish,
+      _minAmountLD: BigNumberish,
+      _to: BytesLike,
+      _lzTxParams: IStargateRouter.LzTxObjStruct
+    ],
+    [void],
+    "payable"
+  >;
+  getFunction(
+    nameOrSignature: "renounceOwnership"
+  ): TypedContractMethod<[], [void], "nonpayable">;
+  getFunction(
+    nameOrSignature: "retryRevert"
+  ): TypedContractMethod<
+    [_srcChainId: BigNumberish, _srcAddress: BytesLike, _nonce: BigNumberish],
+    [void],
+    "payable"
+  >;
+  getFunction(
+    nameOrSignature: "revertLookup"
+  ): TypedContractMethod<
+    [arg0: BigNumberish, arg1: BytesLike, arg2: BigNumberish],
+    [string],
+    "view"
+  >;
+  getFunction(
+    nameOrSignature: "revertRedeemLocal"
+  ): TypedContractMethod<
+    [
+      _dstChainId: BigNumberish,
+      _srcAddress: BytesLike,
+      _nonce: BigNumberish,
+      _refundAddress: AddressLike,
+      _lzTxParams: IStargateRouter.LzTxObjStruct
+    ],
+    [void],
+    "payable"
+  >;
+  getFunction(
+    nameOrSignature: "sendCredits"
+  ): TypedContractMethod<
+    [
+      _dstChainId: BigNumberish,
+      _srcPoolId: BigNumberish,
+      _dstPoolId: BigNumberish,
+      _refundAddress: AddressLike
+    ],
+    [void],
+    "payable"
+  >;
+  getFunction(
+    nameOrSignature: "setBridgeAndFactory"
+  ): TypedContractMethod<
+    [_bridge: AddressLike, _factory: AddressLike],
+    [void],
+    "nonpayable"
+  >;
+  getFunction(
+    nameOrSignature: "setDeltaParam"
+  ): TypedContractMethod<
+    [
+      _poolId: BigNumberish,
+      _batched: boolean,
+      _swapDeltaBP: BigNumberish,
+      _lpDeltaBP: BigNumberish,
+      _defaultSwapMode: boolean,
+      _defaultLPMode: boolean
+    ],
+    [void],
+    "nonpayable"
+  >;
+  getFunction(
+    nameOrSignature: "setFeeLibrary"
+  ): TypedContractMethod<
+    [_poolId: BigNumberish, _feeLibraryAddr: AddressLike],
+    [void],
+    "nonpayable"
+  >;
+  getFunction(
+    nameOrSignature: "setFees"
+  ): TypedContractMethod<
+    [_poolId: BigNumberish, _mintFeeBP: BigNumberish],
+    [void],
+    "nonpayable"
+  >;
+  getFunction(
+    nameOrSignature: "setMintFeeOwner"
+  ): TypedContractMethod<[_owner: AddressLike], [void], "nonpayable">;
+  getFunction(
+    nameOrSignature: "setProtocolFeeOwner"
+  ): TypedContractMethod<[_owner: AddressLike], [void], "nonpayable">;
+  getFunction(
+    nameOrSignature: "setSwapStop"
+  ): TypedContractMethod<
+    [_poolId: BigNumberish, _swapStop: boolean],
+    [void],
+    "nonpayable"
+  >;
+  getFunction(
+    nameOrSignature: "setWeightForChainPath"
+  ): TypedContractMethod<
+    [
+      _poolId: BigNumberish,
+      _dstChainId: BigNumberish,
+      _dstPoolId: BigNumberish,
+      _weight: BigNumberish
+    ],
+    [void],
+    "nonpayable"
+  >;
+  getFunction(
+    nameOrSignature: "swap"
+  ): TypedContractMethod<
+    [
+      _dstChainId: BigNumberish,
+      _srcPoolId: BigNumberish,
+      _dstPoolId: BigNumberish,
+      _refundAddress: AddressLike,
+      _amountLD: BigNumberish,
+      _minAmountLD: BigNumberish,
+      _lzTxParams: IStargateRouter.LzTxObjStruct,
+      _to: BytesLike,
+      _payload: BytesLike
+    ],
+    [void],
+    "payable"
+  >;
+  getFunction(
+    nameOrSignature: "swapRemote"
+  ): TypedContractMethod<
+    [
+      _srcChainId: BigNumberish,
+      _srcAddress: BytesLike,
+      _nonce: BigNumberish,
+      _srcPoolId: BigNumberish,
+      _dstPoolId: BigNumberish,
+      _dstGasForCall: BigNumberish,
+      _to: AddressLike,
+      _s: Pool.SwapObjStruct,
+      _payload: BytesLike
+    ],
+    [void],
+    "nonpayable"
+  >;
+  getFunction(
+    nameOrSignature: "transferOwnership"
+  ): TypedContractMethod<[newOwner: AddressLike], [void], "nonpayable">;
+  getFunction(
+    nameOrSignature: "withdrawMintFee"
+  ): TypedContractMethod<
+    [_poolId: BigNumberish, _to: AddressLike],
+    [void],
+    "nonpayable"
+  >;
+  getFunction(
+    nameOrSignature: "withdrawProtocolFee"
+  ): TypedContractMethod<
+    [_poolId: BigNumberish, _to: AddressLike],
+    [void],
+    "nonpayable"
+  >;
+
+  getEvent(
+    key: "CachedSwapSaved"
+  ): TypedContractEvent<
+    CachedSwapSavedEvent.InputTuple,
+    CachedSwapSavedEvent.OutputTuple,
+    CachedSwapSavedEvent.OutputObject
+  >;
+  getEvent(
+    key: "OwnershipTransferred"
+  ): TypedContractEvent<
+    OwnershipTransferredEvent.InputTuple,
+    OwnershipTransferredEvent.OutputTuple,
+    OwnershipTransferredEvent.OutputObject
+  >;
+  getEvent(
+    key: "RedeemLocalCallback"
+  ): TypedContractEvent<
+    RedeemLocalCallbackEvent.InputTuple,
+    RedeemLocalCallbackEvent.OutputTuple,
+    RedeemLocalCallbackEvent.OutputObject
+  >;
+  getEvent(
+    key: "Revert"
+  ): TypedContractEvent<
+    RevertEvent.InputTuple,
+    RevertEvent.OutputTuple,
+    RevertEvent.OutputObject
+  >;
+  getEvent(
+    key: "RevertRedeemLocal"
+  ): TypedContractEvent<
+    RevertRedeemLocalEvent.InputTuple,
+    RevertRedeemLocalEvent.OutputTuple,
+    RevertRedeemLocalEvent.OutputObject
+  >;
+
+  filters: {
+    "CachedSwapSaved(uint16,bytes,uint256,address,uint256,address,bytes,bytes)": TypedContractEvent<
+      CachedSwapSavedEvent.InputTuple,
+      CachedSwapSavedEvent.OutputTuple,
+      CachedSwapSavedEvent.OutputObject
+    >;
+    CachedSwapSaved: TypedContractEvent<
+      CachedSwapSavedEvent.InputTuple,
+      CachedSwapSavedEvent.OutputTuple,
+      CachedSwapSavedEvent.OutputObject
+    >;
+
+    "OwnershipTransferred(address,address)": TypedContractEvent<
+      OwnershipTransferredEvent.InputTuple,
+      OwnershipTransferredEvent.OutputTuple,
+      OwnershipTransferredEvent.OutputObject
+    >;
+    OwnershipTransferred: TypedContractEvent<
+      OwnershipTransferredEvent.InputTuple,
+      OwnershipTransferredEvent.OutputTuple,
+      OwnershipTransferredEvent.OutputObject
+    >;
+
+    "RedeemLocalCallback(uint16,bytes,uint256,uint256,uint256,address,uint256,uint256)": TypedContractEvent<
+      RedeemLocalCallbackEvent.InputTuple,
+      RedeemLocalCallbackEvent.OutputTuple,
+      RedeemLocalCallbackEvent.OutputObject
+    >;
+    RedeemLocalCallback: TypedContractEvent<
+      RedeemLocalCallbackEvent.InputTuple,
+      RedeemLocalCallbackEvent.OutputTuple,
+      RedeemLocalCallbackEvent.OutputObject
+    >;
+
+    "Revert(uint8,uint16,bytes,uint256)": TypedContractEvent<
+      RevertEvent.InputTuple,
+      RevertEvent.OutputTuple,
+      RevertEvent.OutputObject
+    >;
+    Revert: TypedContractEvent<
+      RevertEvent.InputTuple,
+      RevertEvent.OutputTuple,
+      RevertEvent.OutputObject
+    >;
+
+    "RevertRedeemLocal(uint16,uint256,uint256,bytes,uint256,uint256,uint256,bytes)": TypedContractEvent<
+      RevertRedeemLocalEvent.InputTuple,
+      RevertRedeemLocalEvent.OutputTuple,
+      RevertRedeemLocalEvent.OutputObject
+    >;
+    RevertRedeemLocal: TypedContractEvent<
+      RevertRedeemLocalEvent.InputTuple,
+      RevertRedeemLocalEvent.OutputTuple,
+      RevertRedeemLocalEvent.OutputObject
+    >;
+  };
+}

+ 162 - 0
src/contract/RouterETH.ts

@@ -0,0 +1,162 @@
+/* Autogenerated file. Do not edit manually. */
+/* tslint:disable */
+/* eslint-disable */
+import type {
+  BaseContract,
+  BigNumberish,
+  BytesLike,
+  FunctionFragment,
+  Result,
+  Interface,
+  AddressLike,
+  ContractRunner,
+  ContractMethod,
+  Listener,
+} from "ethers";
+import type {
+  TypedContractEvent,
+  TypedDeferredTopicFilter,
+  TypedEventLog,
+  TypedListener,
+  TypedContractMethod,
+} from "./common";
+
+export interface RouterETHInterface extends Interface {
+  getFunction(
+    nameOrSignature:
+      | "addLiquidityETH"
+      | "poolId"
+      | "stargateEthVault"
+      | "stargateRouter"
+      | "swapETH"
+  ): FunctionFragment;
+
+  encodeFunctionData(
+    functionFragment: "addLiquidityETH",
+    values?: undefined
+  ): string;
+  encodeFunctionData(functionFragment: "poolId", values?: undefined): string;
+  encodeFunctionData(
+    functionFragment: "stargateEthVault",
+    values?: undefined
+  ): string;
+  encodeFunctionData(
+    functionFragment: "stargateRouter",
+    values?: undefined
+  ): string;
+  encodeFunctionData(
+    functionFragment: "swapETH",
+    values: [BigNumberish, AddressLike, BytesLike, BigNumberish, BigNumberish]
+  ): string;
+
+  decodeFunctionResult(
+    functionFragment: "addLiquidityETH",
+    data: BytesLike
+  ): Result;
+  decodeFunctionResult(functionFragment: "poolId", data: BytesLike): Result;
+  decodeFunctionResult(
+    functionFragment: "stargateEthVault",
+    data: BytesLike
+  ): Result;
+  decodeFunctionResult(
+    functionFragment: "stargateRouter",
+    data: BytesLike
+  ): Result;
+  decodeFunctionResult(functionFragment: "swapETH", data: BytesLike): Result;
+}
+
+export interface RouterETH extends BaseContract {
+  connect(runner?: ContractRunner | null): RouterETH;
+  waitForDeployment(): Promise<this>;
+
+  interface: RouterETHInterface;
+
+  queryFilter<TCEvent extends TypedContractEvent>(
+    event: TCEvent,
+    fromBlockOrBlockhash?: string | number | undefined,
+    toBlock?: string | number | undefined
+  ): Promise<Array<TypedEventLog<TCEvent>>>;
+  queryFilter<TCEvent extends TypedContractEvent>(
+    filter: TypedDeferredTopicFilter<TCEvent>,
+    fromBlockOrBlockhash?: string | number | undefined,
+    toBlock?: string | number | undefined
+  ): Promise<Array<TypedEventLog<TCEvent>>>;
+
+  on<TCEvent extends TypedContractEvent>(
+    event: TCEvent,
+    listener: TypedListener<TCEvent>
+  ): Promise<this>;
+  on<TCEvent extends TypedContractEvent>(
+    filter: TypedDeferredTopicFilter<TCEvent>,
+    listener: TypedListener<TCEvent>
+  ): Promise<this>;
+
+  once<TCEvent extends TypedContractEvent>(
+    event: TCEvent,
+    listener: TypedListener<TCEvent>
+  ): Promise<this>;
+  once<TCEvent extends TypedContractEvent>(
+    filter: TypedDeferredTopicFilter<TCEvent>,
+    listener: TypedListener<TCEvent>
+  ): Promise<this>;
+
+  listeners<TCEvent extends TypedContractEvent>(
+    event: TCEvent
+  ): Promise<Array<TypedListener<TCEvent>>>;
+  listeners(eventName?: string): Promise<Array<Listener>>;
+  removeAllListeners<TCEvent extends TypedContractEvent>(
+    event?: TCEvent
+  ): Promise<this>;
+
+  addLiquidityETH: TypedContractMethod<[], [void], "payable">;
+
+  poolId: TypedContractMethod<[], [bigint], "view">;
+
+  stargateEthVault: TypedContractMethod<[], [string], "view">;
+
+  stargateRouter: TypedContractMethod<[], [string], "view">;
+
+  swapETH: TypedContractMethod<
+    [
+      _dstChainId: BigNumberish,
+      _refundAddress: AddressLike,
+      _toAddress: BytesLike,
+      _amountLD: BigNumberish,
+      _minAmountLD: BigNumberish
+    ],
+    [void],
+    "payable"
+  >;
+
+  getFunction<T extends ContractMethod = ContractMethod>(
+    key: string | FunctionFragment
+  ): T;
+
+  getFunction(
+    nameOrSignature: "addLiquidityETH"
+  ): TypedContractMethod<[], [void], "payable">;
+  getFunction(
+    nameOrSignature: "poolId"
+  ): TypedContractMethod<[], [bigint], "view">;
+  getFunction(
+    nameOrSignature: "stargateEthVault"
+  ): TypedContractMethod<[], [string], "view">;
+  getFunction(
+    nameOrSignature: "stargateRouter"
+  ): TypedContractMethod<[], [string], "view">;
+  getFunction(
+    nameOrSignature: "swapETH"
+  ): TypedContractMethod<
+    [
+      _dstChainId: BigNumberish,
+      _refundAddress: AddressLike,
+      _toAddress: BytesLike,
+      _amountLD: BigNumberish,
+      _minAmountLD: BigNumberish
+    ],
+    [void],
+    "payable"
+  >;
+
+  filters: {};
+}

+ 1356 - 0
src/contract/StargateFeeLibraryV07.ts

@@ -0,0 +1,1356 @@
+/* Autogenerated file. Do not edit manually. */
+/* tslint:disable */
+/* eslint-disable */
+import type {
+  BaseContract,
+  BigNumberish,
+  BytesLike,
+  FunctionFragment,
+  Result,
+  Interface,
+  EventFragment,
+  AddressLike,
+  ContractRunner,
+  ContractMethod,
+  Listener,
+} from "ethers";
+import type {
+  TypedContractEvent,
+  TypedDeferredTopicFilter,
+  TypedEventLog,
+  TypedLogDescription,
+  TypedListener,
+  TypedContractMethod,
+} from "./common";
+
+export declare namespace Pool {
+  export type SwapObjStruct = {
+    amount: BigNumberish;
+    eqFee: BigNumberish;
+    eqReward: BigNumberish;
+    lpFee: BigNumberish;
+    protocolFee: BigNumberish;
+    lkbRemove: BigNumberish;
+  };
+
+  export type SwapObjStructOutput = [
+    amount: bigint,
+    eqFee: bigint,
+    eqReward: bigint,
+    lpFee: bigint,
+    protocolFee: bigint,
+    lkbRemove: bigint
+  ] & {
+    amount: bigint;
+    eqFee: bigint;
+    eqReward: bigint;
+    lpFee: bigint;
+    protocolFee: bigint;
+    lkbRemove: bigint;
+  };
+}
+
+export interface StargateFeeLibraryV07Interface extends Interface {
+  getFunction(
+    nameOrSignature:
+      | "DELTA_1"
+      | "DELTA_2"
+      | "DENOMINATOR"
+      | "EQ_REWARD_THRESHOLD"
+      | "LAMBDA_1"
+      | "LAMBDA_2"
+      | "LP_FEE"
+      | "ONE_BPS_PRICE_CHANGE_THRESHOLD"
+      | "PRICE_DEPEG_THRESHOLD"
+      | "PRICE_DRIFT_THRESHOLD"
+      | "PRICE_SHARED_DECIMALS"
+      | "PROTOCOL_FEE"
+      | "PROTOCOL_FEE_FOR_SAME_TOKEN"
+      | "PROTOCOL_SUBSIDY"
+      | "defaultAdapterParams"
+      | "factory"
+      | "forceResumeReceive"
+      | "getConfig"
+      | "getDriftFee"
+      | "getEqReward"
+      | "getEquilibriumFee"
+      | "getFees"
+      | "getProtocolAndLpFee"
+      | "getRemoteChains"
+      | "getVersion"
+      | "initTokenPrice"
+      | "isTrustedRemote"
+      | "lzEndpoint"
+      | "lzReceive"
+      | "minDstGasLookup"
+      | "owner"
+      | "poolIdToLpId"
+      | "poolIdToPriceFeed"
+      | "poolIdToPriceSD"
+      | "precrime"
+      | "quoteFeeForPriceUpdate"
+      | "renounceOwnership"
+      | "setConfig"
+      | "setDefaultAdapterParams"
+      | "setMinDstGas"
+      | "setPoolToLpId"
+      | "setPrecrime"
+      | "setReceiveVersion"
+      | "setRemoteChains"
+      | "setSendVersion"
+      | "setStargatePoolIdToLPStakingAddress"
+      | "setTokenPriceFeed"
+      | "setTrustedRemote"
+      | "shouldCallUpdateTokenPrices"
+      | "stargatePoolIdToLPStaking"
+      | "transferOwnership"
+      | "trustedRemoteLookup"
+      | "updateTokenPrices"
+      | "whiteList"
+      | "whitelist"
+  ): FunctionFragment;
+
+  getEvent(
+    nameOrSignatureOrTopic:
+      | "OwnershipTransferred"
+      | "PriceUpdated"
+      | "SetMinDstGas"
+      | "SetPrecrime"
+      | "SetTrustedRemote"
+      | "SetTrustedRemoteAddress"
+  ): EventFragment;
+
+  encodeFunctionData(functionFragment: "DELTA_1", values?: undefined): string;
+  encodeFunctionData(functionFragment: "DELTA_2", values?: undefined): string;
+  encodeFunctionData(
+    functionFragment: "DENOMINATOR",
+    values?: undefined
+  ): string;
+  encodeFunctionData(
+    functionFragment: "EQ_REWARD_THRESHOLD",
+    values?: undefined
+  ): string;
+  encodeFunctionData(functionFragment: "LAMBDA_1", values?: undefined): string;
+  encodeFunctionData(functionFragment: "LAMBDA_2", values?: undefined): string;
+  encodeFunctionData(functionFragment: "LP_FEE", values?: undefined): string;
+  encodeFunctionData(
+    functionFragment: "ONE_BPS_PRICE_CHANGE_THRESHOLD",
+    values?: undefined
+  ): string;
+  encodeFunctionData(
+    functionFragment: "PRICE_DEPEG_THRESHOLD",
+    values?: undefined
+  ): string;
+  encodeFunctionData(
+    functionFragment: "PRICE_DRIFT_THRESHOLD",
+    values?: undefined
+  ): string;
+  encodeFunctionData(
+    functionFragment: "PRICE_SHARED_DECIMALS",
+    values?: undefined
+  ): string;
+  encodeFunctionData(
+    functionFragment: "PROTOCOL_FEE",
+    values?: undefined
+  ): string;
+  encodeFunctionData(
+    functionFragment: "PROTOCOL_FEE_FOR_SAME_TOKEN",
+    values?: undefined
+  ): string;
+  encodeFunctionData(
+    functionFragment: "PROTOCOL_SUBSIDY",
+    values?: undefined
+  ): string;
+  encodeFunctionData(
+    functionFragment: "defaultAdapterParams",
+    values: [BigNumberish]
+  ): string;
+  encodeFunctionData(functionFragment: "factory", values?: undefined): string;
+  encodeFunctionData(
+    functionFragment: "forceResumeReceive",
+    values: [BigNumberish, BytesLike]
+  ): string;
+  encodeFunctionData(
+    functionFragment: "getConfig",
+    values: [BigNumberish, BigNumberish, AddressLike, BigNumberish]
+  ): string;
+  encodeFunctionData(
+    functionFragment: "getDriftFee",
+    values: [BigNumberish, BigNumberish, BigNumberish, boolean]
+  ): string;
+  encodeFunctionData(
+    functionFragment: "getEqReward",
+    values: [BigNumberish, BigNumberish, boolean]
+  ): string;
+  encodeFunctionData(
+    functionFragment: "getEquilibriumFee",
+    values: [
+      BigNumberish,
+      BigNumberish,
+      BigNumberish,
+      BigNumberish,
+      boolean,
+      boolean
+    ]
+  ): string;
+  encodeFunctionData(
+    functionFragment: "getFees",
+    values: [
+      BigNumberish,
+      BigNumberish,
+      BigNumberish,
+      AddressLike,
+      BigNumberish
+    ]
+  ): string;
+  encodeFunctionData(
+    functionFragment: "getProtocolAndLpFee",
+    values: [
+      BigNumberish,
+      BigNumberish,
+      BigNumberish,
+      BigNumberish,
+      BigNumberish,
+      boolean
+    ]
+  ): string;
+  encodeFunctionData(
+    functionFragment: "getRemoteChains",
+    values: [BigNumberish, BigNumberish]
+  ): string;
+  encodeFunctionData(
+    functionFragment: "getVersion",
+    values?: undefined
+  ): string;
+  encodeFunctionData(
+    functionFragment: "initTokenPrice",
+    values: [BigNumberish, BigNumberish]
+  ): string;
+  encodeFunctionData(
+    functionFragment: "isTrustedRemote",
+    values: [BigNumberish, BytesLike]
+  ): string;
+  encodeFunctionData(
+    functionFragment: "lzEndpoint",
+    values?: undefined
+  ): string;
+  encodeFunctionData(
+    functionFragment: "lzReceive",
+    values: [BigNumberish, BytesLike, BigNumberish, BytesLike]
+  ): string;
+  encodeFunctionData(
+    functionFragment: "minDstGasLookup",
+    values: [BigNumberish, BigNumberish]
+  ): string;
+  encodeFunctionData(functionFragment: "owner", values?: undefined): string;
+  encodeFunctionData(
+    functionFragment: "poolIdToLpId",
+    values: [BigNumberish]
+  ): string;
+  encodeFunctionData(
+    functionFragment: "poolIdToPriceFeed",
+    values: [BigNumberish]
+  ): string;
+  encodeFunctionData(
+    functionFragment: "poolIdToPriceSD",
+    values: [BigNumberish]
+  ): string;
+  encodeFunctionData(functionFragment: "precrime", values?: undefined): string;
+  encodeFunctionData(
+    functionFragment: "quoteFeeForPriceUpdate",
+    values: [BigNumberish, BigNumberish]
+  ): string;
+  encodeFunctionData(
+    functionFragment: "renounceOwnership",
+    values?: undefined
+  ): string;
+  encodeFunctionData(
+    functionFragment: "setConfig",
+    values: [BigNumberish, BigNumberish, BigNumberish, BytesLike]
+  ): string;
+  encodeFunctionData(
+    functionFragment: "setDefaultAdapterParams",
+    values: [BigNumberish, BytesLike]
+  ): string;
+  encodeFunctionData(
+    functionFragment: "setMinDstGas",
+    values: [BigNumberish, BigNumberish, BigNumberish]
+  ): string;
+  encodeFunctionData(
+    functionFragment: "setPoolToLpId",
+    values: [BigNumberish, BigNumberish]
+  ): string;
+  encodeFunctionData(
+    functionFragment: "setPrecrime",
+    values: [AddressLike]
+  ): string;
+  encodeFunctionData(
+    functionFragment: "setReceiveVersion",
+    values: [BigNumberish]
+  ): string;
+  encodeFunctionData(
+    functionFragment: "setRemoteChains",
+    values: [BigNumberish, BigNumberish, BigNumberish[]]
+  ): string;
+  encodeFunctionData(
+    functionFragment: "setSendVersion",
+    values: [BigNumberish]
+  ): string;
+  encodeFunctionData(
+    functionFragment: "setStargatePoolIdToLPStakingAddress",
+    values: [BigNumberish, AddressLike]
+  ): string;
+  encodeFunctionData(
+    functionFragment: "setTokenPriceFeed",
+    values: [BigNumberish, AddressLike]
+  ): string;
+  encodeFunctionData(
+    functionFragment: "setTrustedRemote",
+    values: [BigNumberish, BytesLike]
+  ): string;
+  encodeFunctionData(
+    functionFragment: "shouldCallUpdateTokenPrices",
+    values: [BigNumberish, BigNumberish]
+  ): string;
+  encodeFunctionData(
+    functionFragment: "stargatePoolIdToLPStaking",
+    values: [BigNumberish]
+  ): string;
+  encodeFunctionData(
+    functionFragment: "transferOwnership",
+    values: [AddressLike]
+  ): string;
+  encodeFunctionData(
+    functionFragment: "trustedRemoteLookup",
+    values: [BigNumberish]
+  ): string;
+  encodeFunctionData(
+    functionFragment: "updateTokenPrices",
+    values: [BigNumberish, BigNumberish]
+  ): string;
+  encodeFunctionData(
+    functionFragment: "whiteList",
+    values: [AddressLike, boolean]
+  ): string;
+  encodeFunctionData(
+    functionFragment: "whitelist",
+    values: [AddressLike]
+  ): string;
+
+  decodeFunctionResult(functionFragment: "DELTA_1", data: BytesLike): Result;
+  decodeFunctionResult(functionFragment: "DELTA_2", data: BytesLike): Result;
+  decodeFunctionResult(
+    functionFragment: "DENOMINATOR",
+    data: BytesLike
+  ): Result;
+  decodeFunctionResult(
+    functionFragment: "EQ_REWARD_THRESHOLD",
+    data: BytesLike
+  ): Result;
+  decodeFunctionResult(functionFragment: "LAMBDA_1", data: BytesLike): Result;
+  decodeFunctionResult(functionFragment: "LAMBDA_2", data: BytesLike): Result;
+  decodeFunctionResult(functionFragment: "LP_FEE", data: BytesLike): Result;
+  decodeFunctionResult(
+    functionFragment: "ONE_BPS_PRICE_CHANGE_THRESHOLD",
+    data: BytesLike
+  ): Result;
+  decodeFunctionResult(
+    functionFragment: "PRICE_DEPEG_THRESHOLD",
+    data: BytesLike
+  ): Result;
+  decodeFunctionResult(
+    functionFragment: "PRICE_DRIFT_THRESHOLD",
+    data: BytesLike
+  ): Result;
+  decodeFunctionResult(
+    functionFragment: "PRICE_SHARED_DECIMALS",
+    data: BytesLike
+  ): Result;
+  decodeFunctionResult(
+    functionFragment: "PROTOCOL_FEE",
+    data: BytesLike
+  ): Result;
+  decodeFunctionResult(
+    functionFragment: "PROTOCOL_FEE_FOR_SAME_TOKEN",
+    data: BytesLike
+  ): Result;
+  decodeFunctionResult(
+    functionFragment: "PROTOCOL_SUBSIDY",
+    data: BytesLike
+  ): Result;
+  decodeFunctionResult(
+    functionFragment: "defaultAdapterParams",
+    data: BytesLike
+  ): Result;
+  decodeFunctionResult(functionFragment: "factory", data: BytesLike): Result;
+  decodeFunctionResult(
+    functionFragment: "forceResumeReceive",
+    data: BytesLike
+  ): Result;
+  decodeFunctionResult(functionFragment: "getConfig", data: BytesLike): Result;
+  decodeFunctionResult(
+    functionFragment: "getDriftFee",
+    data: BytesLike
+  ): Result;
+  decodeFunctionResult(
+    functionFragment: "getEqReward",
+    data: BytesLike
+  ): Result;
+  decodeFunctionResult(
+    functionFragment: "getEquilibriumFee",
+    data: BytesLike
+  ): Result;
+  decodeFunctionResult(functionFragment: "getFees", data: BytesLike): Result;
+  decodeFunctionResult(
+    functionFragment: "getProtocolAndLpFee",
+    data: BytesLike
+  ): Result;
+  decodeFunctionResult(
+    functionFragment: "getRemoteChains",
+    data: BytesLike
+  ): Result;
+  decodeFunctionResult(functionFragment: "getVersion", data: BytesLike): Result;
+  decodeFunctionResult(
+    functionFragment: "initTokenPrice",
+    data: BytesLike
+  ): Result;
+  decodeFunctionResult(
+    functionFragment: "isTrustedRemote",
+    data: BytesLike
+  ): Result;
+  decodeFunctionResult(functionFragment: "lzEndpoint", data: BytesLike): Result;
+  decodeFunctionResult(functionFragment: "lzReceive", data: BytesLike): Result;
+  decodeFunctionResult(
+    functionFragment: "minDstGasLookup",
+    data: BytesLike
+  ): Result;
+  decodeFunctionResult(functionFragment: "owner", data: BytesLike): Result;
+  decodeFunctionResult(
+    functionFragment: "poolIdToLpId",
+    data: BytesLike
+  ): Result;
+  decodeFunctionResult(
+    functionFragment: "poolIdToPriceFeed",
+    data: BytesLike
+  ): Result;
+  decodeFunctionResult(
+    functionFragment: "poolIdToPriceSD",
+    data: BytesLike
+  ): Result;
+  decodeFunctionResult(functionFragment: "precrime", data: BytesLike): Result;
+  decodeFunctionResult(
+    functionFragment: "quoteFeeForPriceUpdate",
+    data: BytesLike
+  ): Result;
+  decodeFunctionResult(
+    functionFragment: "renounceOwnership",
+    data: BytesLike
+  ): Result;
+  decodeFunctionResult(functionFragment: "setConfig", data: BytesLike): Result;
+  decodeFunctionResult(
+    functionFragment: "setDefaultAdapterParams",
+    data: BytesLike
+  ): Result;
+  decodeFunctionResult(
+    functionFragment: "setMinDstGas",
+    data: BytesLike
+  ): Result;
+  decodeFunctionResult(
+    functionFragment: "setPoolToLpId",
+    data: BytesLike
+  ): Result;
+  decodeFunctionResult(
+    functionFragment: "setPrecrime",
+    data: BytesLike
+  ): Result;
+  decodeFunctionResult(
+    functionFragment: "setReceiveVersion",
+    data: BytesLike
+  ): Result;
+  decodeFunctionResult(
+    functionFragment: "setRemoteChains",
+    data: BytesLike
+  ): Result;
+  decodeFunctionResult(
+    functionFragment: "setSendVersion",
+    data: BytesLike
+  ): Result;
+  decodeFunctionResult(
+    functionFragment: "setStargatePoolIdToLPStakingAddress",
+    data: BytesLike
+  ): Result;
+  decodeFunctionResult(
+    functionFragment: "setTokenPriceFeed",
+    data: BytesLike
+  ): Result;
+  decodeFunctionResult(
+    functionFragment: "setTrustedRemote",
+    data: BytesLike
+  ): Result;
+  decodeFunctionResult(
+    functionFragment: "shouldCallUpdateTokenPrices",
+    data: BytesLike
+  ): Result;
+  decodeFunctionResult(
+    functionFragment: "stargatePoolIdToLPStaking",
+    data: BytesLike
+  ): Result;
+  decodeFunctionResult(
+    functionFragment: "transferOwnership",
+    data: BytesLike
+  ): Result;
+  decodeFunctionResult(
+    functionFragment: "trustedRemoteLookup",
+    data: BytesLike
+  ): Result;
+  decodeFunctionResult(
+    functionFragment: "updateTokenPrices",
+    data: BytesLike
+  ): Result;
+  decodeFunctionResult(functionFragment: "whiteList", data: BytesLike): Result;
+  decodeFunctionResult(functionFragment: "whitelist", data: BytesLike): Result;
+}
+
+export namespace OwnershipTransferredEvent {
+  export type InputTuple = [previousOwner: AddressLike, newOwner: AddressLike];
+  export type OutputTuple = [previousOwner: string, newOwner: string];
+  export interface OutputObject {
+    previousOwner: string;
+    newOwner: string;
+  }
+  export type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>;
+  export type Filter = TypedDeferredTopicFilter<Event>;
+  export type Log = TypedEventLog<Event>;
+  export type LogDescription = TypedLogDescription<Event>;
+}
+
+export namespace PriceUpdatedEvent {
+  export type InputTuple = [poolId: BigNumberish, priceSD: BigNumberish];
+  export type OutputTuple = [poolId: bigint, priceSD: bigint];
+  export interface OutputObject {
+    poolId: bigint;
+    priceSD: bigint;
+  }
+  export type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>;
+  export type Filter = TypedDeferredTopicFilter<Event>;
+  export type Log = TypedEventLog<Event>;
+  export type LogDescription = TypedLogDescription<Event>;
+}
+
+export namespace SetMinDstGasEvent {
+  export type InputTuple = [
+    _dstChainId: BigNumberish,
+    _type: BigNumberish,
+    _minDstGas: BigNumberish
+  ];
+  export type OutputTuple = [
+    _dstChainId: bigint,
+    _type: bigint,
+    _minDstGas: bigint
+  ];
+  export interface OutputObject {
+    _dstChainId: bigint;
+    _type: bigint;
+    _minDstGas: bigint;
+  }
+  export type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>;
+  export type Filter = TypedDeferredTopicFilter<Event>;
+  export type Log = TypedEventLog<Event>;
+  export type LogDescription = TypedLogDescription<Event>;
+}
+
+export namespace SetPrecrimeEvent {
+  export type InputTuple = [precrime: AddressLike];
+  export type OutputTuple = [precrime: string];
+  export interface OutputObject {
+    precrime: string;
+  }
+  export type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>;
+  export type Filter = TypedDeferredTopicFilter<Event>;
+  export type Log = TypedEventLog<Event>;
+  export type LogDescription = TypedLogDescription<Event>;
+}
+
+export namespace SetTrustedRemoteEvent {
+  export type InputTuple = [_remoteChainId: BigNumberish, _path: BytesLike];
+  export type OutputTuple = [_remoteChainId: bigint, _path: string];
+  export interface OutputObject {
+    _remoteChainId: bigint;
+    _path: string;
+  }
+  export type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>;
+  export type Filter = TypedDeferredTopicFilter<Event>;
+  export type Log = TypedEventLog<Event>;
+  export type LogDescription = TypedLogDescription<Event>;
+}
+
+export namespace SetTrustedRemoteAddressEvent {
+  export type InputTuple = [
+    _remoteChainId: BigNumberish,
+    _remoteAddress: BytesLike
+  ];
+  export type OutputTuple = [_remoteChainId: bigint, _remoteAddress: string];
+  export interface OutputObject {
+    _remoteChainId: bigint;
+    _remoteAddress: string;
+  }
+  export type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>;
+  export type Filter = TypedDeferredTopicFilter<Event>;
+  export type Log = TypedEventLog<Event>;
+  export type LogDescription = TypedLogDescription<Event>;
+}
+
+export interface StargateFeeLibraryV07 extends BaseContract {
+  connect(runner?: ContractRunner | null): StargateFeeLibraryV07;
+  waitForDeployment(): Promise<this>;
+
+  interface: StargateFeeLibraryV07Interface;
+
+  queryFilter<TCEvent extends TypedContractEvent>(
+    event: TCEvent,
+    fromBlockOrBlockhash?: string | number | undefined,
+    toBlock?: string | number | undefined
+  ): Promise<Array<TypedEventLog<TCEvent>>>;
+  queryFilter<TCEvent extends TypedContractEvent>(
+    filter: TypedDeferredTopicFilter<TCEvent>,
+    fromBlockOrBlockhash?: string | number | undefined,
+    toBlock?: string | number | undefined
+  ): Promise<Array<TypedEventLog<TCEvent>>>;
+
+  on<TCEvent extends TypedContractEvent>(
+    event: TCEvent,
+    listener: TypedListener<TCEvent>
+  ): Promise<this>;
+  on<TCEvent extends TypedContractEvent>(
+    filter: TypedDeferredTopicFilter<TCEvent>,
+    listener: TypedListener<TCEvent>
+  ): Promise<this>;
+
+  once<TCEvent extends TypedContractEvent>(
+    event: TCEvent,
+    listener: TypedListener<TCEvent>
+  ): Promise<this>;
+  once<TCEvent extends TypedContractEvent>(
+    filter: TypedDeferredTopicFilter<TCEvent>,
+    listener: TypedListener<TCEvent>
+  ): Promise<this>;
+
+  listeners<TCEvent extends TypedContractEvent>(
+    event: TCEvent
+  ): Promise<Array<TypedListener<TCEvent>>>;
+  listeners(eventName?: string): Promise<Array<Listener>>;
+  removeAllListeners<TCEvent extends TypedContractEvent>(
+    event?: TCEvent
+  ): Promise<this>;
+
+  DELTA_1: TypedContractMethod<[], [bigint], "view">;
+
+  DELTA_2: TypedContractMethod<[], [bigint], "view">;
+
+  DENOMINATOR: TypedContractMethod<[], [bigint], "view">;
+
+  EQ_REWARD_THRESHOLD: TypedContractMethod<[], [bigint], "view">;
+
+  LAMBDA_1: TypedContractMethod<[], [bigint], "view">;
+
+  LAMBDA_2: TypedContractMethod<[], [bigint], "view">;
+
+  LP_FEE: TypedContractMethod<[], [bigint], "view">;
+
+  ONE_BPS_PRICE_CHANGE_THRESHOLD: TypedContractMethod<[], [bigint], "view">;
+
+  PRICE_DEPEG_THRESHOLD: TypedContractMethod<[], [bigint], "view">;
+
+  PRICE_DRIFT_THRESHOLD: TypedContractMethod<[], [bigint], "view">;
+
+  PRICE_SHARED_DECIMALS: TypedContractMethod<[], [bigint], "view">;
+
+  PROTOCOL_FEE: TypedContractMethod<[], [bigint], "view">;
+
+  PROTOCOL_FEE_FOR_SAME_TOKEN: TypedContractMethod<[], [bigint], "view">;
+
+  PROTOCOL_SUBSIDY: TypedContractMethod<[], [bigint], "view">;
+
+  defaultAdapterParams: TypedContractMethod<
+    [arg0: BigNumberish],
+    [string],
+    "view"
+  >;
+
+  factory: TypedContractMethod<[], [string], "view">;
+
+  forceResumeReceive: TypedContractMethod<
+    [_srcChainId: BigNumberish, _srcAddress: BytesLike],
+    [void],
+    "nonpayable"
+  >;
+
+  getConfig: TypedContractMethod<
+    [
+      _version: BigNumberish,
+      _chainId: BigNumberish,
+      arg2: AddressLike,
+      _configType: BigNumberish
+    ],
+    [string],
+    "view"
+  >;
+
+  getDriftFee: TypedContractMethod<
+    [
+      _srcPoolId: BigNumberish,
+      _dstPoolId: BigNumberish,
+      _amountSD: BigNumberish,
+      _whitelisted: boolean
+    ],
+    [bigint],
+    "view"
+  >;
+
+  getEqReward: TypedContractMethod<
+    [_srcPoolId: BigNumberish, _amountSD: BigNumberish, _whitelisted: boolean],
+    [bigint],
+    "view"
+  >;
+
+  getEquilibriumFee: TypedContractMethod<
+    [
+      srcPoolId: BigNumberish,
+      dstPoolId: BigNumberish,
+      dstChainId: BigNumberish,
+      amountSD: BigNumberish,
+      whitelisted: boolean,
+      hasEqReward: boolean
+    ],
+    [[bigint, bigint]],
+    "view"
+  >;
+
+  getFees: TypedContractMethod<
+    [
+      _srcPoolId: BigNumberish,
+      _dstPoolId: BigNumberish,
+      _dstChainId: BigNumberish,
+      _from: AddressLike,
+      _amountSD: BigNumberish
+    ],
+    [Pool.SwapObjStructOutput],
+    "view"
+  >;
+
+  getProtocolAndLpFee: TypedContractMethod<
+    [
+      _srcPoolId: BigNumberish,
+      _dstPoolId: BigNumberish,
+      arg2: BigNumberish,
+      _amountSD: BigNumberish,
+      _protocolSubsidy: BigNumberish,
+      _whitelisted: boolean
+    ],
+    [[bigint, bigint]],
+    "view"
+  >;
+
+  getRemoteChains: TypedContractMethod<
+    [_poolId1: BigNumberish, _poolId2: BigNumberish],
+    [bigint[]],
+    "view"
+  >;
+
+  getVersion: TypedContractMethod<[], [string], "view">;
+
+  initTokenPrice: TypedContractMethod<
+    [_poolId: BigNumberish, _priceSD: BigNumberish],
+    [void],
+    "nonpayable"
+  >;
+
+  isTrustedRemote: TypedContractMethod<
+    [_srcChainId: BigNumberish, _srcAddress: BytesLike],
+    [boolean],
+    "view"
+  >;
+
+  lzEndpoint: TypedContractMethod<[], [string], "view">;
+
+  lzReceive: TypedContractMethod<
+    [
+      _srcChainId: BigNumberish,
+      _srcAddress: BytesLike,
+      _nonce: BigNumberish,
+      _payload: BytesLike
+    ],
+    [void],
+    "nonpayable"
+  >;
+
+  minDstGasLookup: TypedContractMethod<
+    [arg0: BigNumberish, arg1: BigNumberish],
+    [bigint],
+    "view"
+  >;
+
+  owner: TypedContractMethod<[], [string], "view">;
+
+  poolIdToLpId: TypedContractMethod<[arg0: BigNumberish], [bigint], "view">;
+
+  poolIdToPriceFeed: TypedContractMethod<
+    [arg0: BigNumberish],
+    [string],
+    "view"
+  >;
+
+  poolIdToPriceSD: TypedContractMethod<[arg0: BigNumberish], [bigint], "view">;
+
+  precrime: TypedContractMethod<[], [string], "view">;
+
+  quoteFeeForPriceUpdate: TypedContractMethod<
+    [_poolId1: BigNumberish, _poolId2: BigNumberish],
+    [bigint],
+    "view"
+  >;
+
+  renounceOwnership: TypedContractMethod<[], [void], "nonpayable">;
+
+  setConfig: TypedContractMethod<
+    [
+      _version: BigNumberish,
+      _chainId: BigNumberish,
+      _configType: BigNumberish,
+      _config: BytesLike
+    ],
+    [void],
+    "nonpayable"
+  >;
+
+  setDefaultAdapterParams: TypedContractMethod<
+    [_remoteChainId: BigNumberish, _adapterParams: BytesLike],
+    [void],
+    "nonpayable"
+  >;
+
+  setMinDstGas: TypedContractMethod<
+    [
+      _dstChainId: BigNumberish,
+      _packetType: BigNumberish,
+      _minGas: BigNumberish
+    ],
+    [void],
+    "nonpayable"
+  >;
+
+  setPoolToLpId: TypedContractMethod<
+    [_poolId: BigNumberish, _lpId: BigNumberish],
+    [void],
+    "nonpayable"
+  >;
+
+  setPrecrime: TypedContractMethod<
+    [_precrime: AddressLike],
+    [void],
+    "nonpayable"
+  >;
+
+  setReceiveVersion: TypedContractMethod<
+    [_version: BigNumberish],
+    [void],
+    "nonpayable"
+  >;
+
+  setRemoteChains: TypedContractMethod<
+    [
+      _poolId1: BigNumberish,
+      _poolId2: BigNumberish,
+      _remoteChainIds: BigNumberish[]
+    ],
+    [void],
+    "nonpayable"
+  >;
+
+  setSendVersion: TypedContractMethod<
+    [_version: BigNumberish],
+    [void],
+    "nonpayable"
+  >;
+
+  setStargatePoolIdToLPStakingAddress: TypedContractMethod<
+    [_poolId: BigNumberish, _lpStaking: AddressLike],
+    [void],
+    "nonpayable"
+  >;
+
+  setTokenPriceFeed: TypedContractMethod<
+    [_poolId: BigNumberish, _priceFeedAddress: AddressLike],
+    [void],
+    "nonpayable"
+  >;
+
+  setTrustedRemote: TypedContractMethod<
+    [_srcChainId: BigNumberish, _path: BytesLike],
+    [void],
+    "nonpayable"
+  >;
+
+  shouldCallUpdateTokenPrices: TypedContractMethod<
+    [_poolId1: BigNumberish, _poolId2: BigNumberish],
+    [boolean],
+    "view"
+  >;
+
+  stargatePoolIdToLPStaking: TypedContractMethod<
+    [arg0: BigNumberish],
+    [string],
+    "view"
+  >;
+
+  transferOwnership: TypedContractMethod<
+    [newOwner: AddressLike],
+    [void],
+    "nonpayable"
+  >;
+
+  trustedRemoteLookup: TypedContractMethod<
+    [arg0: BigNumberish],
+    [string],
+    "view"
+  >;
+
+  updateTokenPrices: TypedContractMethod<
+    [_poolId1: BigNumberish, _poolId2: BigNumberish],
+    [void],
+    "payable"
+  >;
+
+  whiteList: TypedContractMethod<
+    [_from: AddressLike, _whiteListed: boolean],
+    [void],
+    "nonpayable"
+  >;
+
+  whitelist: TypedContractMethod<[arg0: AddressLike], [boolean], "view">;
+
+  getFunction<T extends ContractMethod = ContractMethod>(
+    key: string | FunctionFragment
+  ): T;
+
+  getFunction(
+    nameOrSignature: "DELTA_1"
+  ): TypedContractMethod<[], [bigint], "view">;
+  getFunction(
+    nameOrSignature: "DELTA_2"
+  ): TypedContractMethod<[], [bigint], "view">;
+  getFunction(
+    nameOrSignature: "DENOMINATOR"
+  ): TypedContractMethod<[], [bigint], "view">;
+  getFunction(
+    nameOrSignature: "EQ_REWARD_THRESHOLD"
+  ): TypedContractMethod<[], [bigint], "view">;
+  getFunction(
+    nameOrSignature: "LAMBDA_1"
+  ): TypedContractMethod<[], [bigint], "view">;
+  getFunction(
+    nameOrSignature: "LAMBDA_2"
+  ): TypedContractMethod<[], [bigint], "view">;
+  getFunction(
+    nameOrSignature: "LP_FEE"
+  ): TypedContractMethod<[], [bigint], "view">;
+  getFunction(
+    nameOrSignature: "ONE_BPS_PRICE_CHANGE_THRESHOLD"
+  ): TypedContractMethod<[], [bigint], "view">;
+  getFunction(
+    nameOrSignature: "PRICE_DEPEG_THRESHOLD"
+  ): TypedContractMethod<[], [bigint], "view">;
+  getFunction(
+    nameOrSignature: "PRICE_DRIFT_THRESHOLD"
+  ): TypedContractMethod<[], [bigint], "view">;
+  getFunction(
+    nameOrSignature: "PRICE_SHARED_DECIMALS"
+  ): TypedContractMethod<[], [bigint], "view">;
+  getFunction(
+    nameOrSignature: "PROTOCOL_FEE"
+  ): TypedContractMethod<[], [bigint], "view">;
+  getFunction(
+    nameOrSignature: "PROTOCOL_FEE_FOR_SAME_TOKEN"
+  ): TypedContractMethod<[], [bigint], "view">;
+  getFunction(
+    nameOrSignature: "PROTOCOL_SUBSIDY"
+  ): TypedContractMethod<[], [bigint], "view">;
+  getFunction(
+    nameOrSignature: "defaultAdapterParams"
+  ): TypedContractMethod<[arg0: BigNumberish], [string], "view">;
+  getFunction(
+    nameOrSignature: "factory"
+  ): TypedContractMethod<[], [string], "view">;
+  getFunction(
+    nameOrSignature: "forceResumeReceive"
+  ): TypedContractMethod<
+    [_srcChainId: BigNumberish, _srcAddress: BytesLike],
+    [void],
+    "nonpayable"
+  >;
+  getFunction(
+    nameOrSignature: "getConfig"
+  ): TypedContractMethod<
+    [
+      _version: BigNumberish,
+      _chainId: BigNumberish,
+      arg2: AddressLike,
+      _configType: BigNumberish
+    ],
+    [string],
+    "view"
+  >;
+  getFunction(
+    nameOrSignature: "getDriftFee"
+  ): TypedContractMethod<
+    [
+      _srcPoolId: BigNumberish,
+      _dstPoolId: BigNumberish,
+      _amountSD: BigNumberish,
+      _whitelisted: boolean
+    ],
+    [bigint],
+    "view"
+  >;
+  getFunction(
+    nameOrSignature: "getEqReward"
+  ): TypedContractMethod<
+    [_srcPoolId: BigNumberish, _amountSD: BigNumberish, _whitelisted: boolean],
+    [bigint],
+    "view"
+  >;
+  getFunction(
+    nameOrSignature: "getEquilibriumFee"
+  ): TypedContractMethod<
+    [
+      srcPoolId: BigNumberish,
+      dstPoolId: BigNumberish,
+      dstChainId: BigNumberish,
+      amountSD: BigNumberish,
+      whitelisted: boolean,
+      hasEqReward: boolean
+    ],
+    [[bigint, bigint]],
+    "view"
+  >;
+  getFunction(
+    nameOrSignature: "getFees"
+  ): TypedContractMethod<
+    [
+      _srcPoolId: BigNumberish,
+      _dstPoolId: BigNumberish,
+      _dstChainId: BigNumberish,
+      _from: AddressLike,
+      _amountSD: BigNumberish
+    ],
+    [Pool.SwapObjStructOutput],
+    "view"
+  >;
+  getFunction(
+    nameOrSignature: "getProtocolAndLpFee"
+  ): TypedContractMethod<
+    [
+      _srcPoolId: BigNumberish,
+      _dstPoolId: BigNumberish,
+      arg2: BigNumberish,
+      _amountSD: BigNumberish,
+      _protocolSubsidy: BigNumberish,
+      _whitelisted: boolean
+    ],
+    [[bigint, bigint]],
+    "view"
+  >;
+  getFunction(
+    nameOrSignature: "getRemoteChains"
+  ): TypedContractMethod<
+    [_poolId1: BigNumberish, _poolId2: BigNumberish],
+    [bigint[]],
+    "view"
+  >;
+  getFunction(
+    nameOrSignature: "getVersion"
+  ): TypedContractMethod<[], [string], "view">;
+  getFunction(
+    nameOrSignature: "initTokenPrice"
+  ): TypedContractMethod<
+    [_poolId: BigNumberish, _priceSD: BigNumberish],
+    [void],
+    "nonpayable"
+  >;
+  getFunction(
+    nameOrSignature: "isTrustedRemote"
+  ): TypedContractMethod<
+    [_srcChainId: BigNumberish, _srcAddress: BytesLike],
+    [boolean],
+    "view"
+  >;
+  getFunction(
+    nameOrSignature: "lzEndpoint"
+  ): TypedContractMethod<[], [string], "view">;
+  getFunction(
+    nameOrSignature: "lzReceive"
+  ): TypedContractMethod<
+    [
+      _srcChainId: BigNumberish,
+      _srcAddress: BytesLike,
+      _nonce: BigNumberish,
+      _payload: BytesLike
+    ],
+    [void],
+    "nonpayable"
+  >;
+  getFunction(
+    nameOrSignature: "minDstGasLookup"
+  ): TypedContractMethod<
+    [arg0: BigNumberish, arg1: BigNumberish],
+    [bigint],
+    "view"
+  >;
+  getFunction(
+    nameOrSignature: "owner"
+  ): TypedContractMethod<[], [string], "view">;
+  getFunction(
+    nameOrSignature: "poolIdToLpId"
+  ): TypedContractMethod<[arg0: BigNumberish], [bigint], "view">;
+  getFunction(
+    nameOrSignature: "poolIdToPriceFeed"
+  ): TypedContractMethod<[arg0: BigNumberish], [string], "view">;
+  getFunction(
+    nameOrSignature: "poolIdToPriceSD"
+  ): TypedContractMethod<[arg0: BigNumberish], [bigint], "view">;
+  getFunction(
+    nameOrSignature: "precrime"
+  ): TypedContractMethod<[], [string], "view">;
+  getFunction(
+    nameOrSignature: "quoteFeeForPriceUpdate"
+  ): TypedContractMethod<
+    [_poolId1: BigNumberish, _poolId2: BigNumberish],
+    [bigint],
+    "view"
+  >;
+  getFunction(
+    nameOrSignature: "renounceOwnership"
+  ): TypedContractMethod<[], [void], "nonpayable">;
+  getFunction(
+    nameOrSignature: "setConfig"
+  ): TypedContractMethod<
+    [
+      _version: BigNumberish,
+      _chainId: BigNumberish,
+      _configType: BigNumberish,
+      _config: BytesLike
+    ],
+    [void],
+    "nonpayable"
+  >;
+  getFunction(
+    nameOrSignature: "setDefaultAdapterParams"
+  ): TypedContractMethod<
+    [_remoteChainId: BigNumberish, _adapterParams: BytesLike],
+    [void],
+    "nonpayable"
+  >;
+  getFunction(
+    nameOrSignature: "setMinDstGas"
+  ): TypedContractMethod<
+    [
+      _dstChainId: BigNumberish,
+      _packetType: BigNumberish,
+      _minGas: BigNumberish
+    ],
+    [void],
+    "nonpayable"
+  >;
+  getFunction(
+    nameOrSignature: "setPoolToLpId"
+  ): TypedContractMethod<
+    [_poolId: BigNumberish, _lpId: BigNumberish],
+    [void],
+    "nonpayable"
+  >;
+  getFunction(
+    nameOrSignature: "setPrecrime"
+  ): TypedContractMethod<[_precrime: AddressLike], [void], "nonpayable">;
+  getFunction(
+    nameOrSignature: "setReceiveVersion"
+  ): TypedContractMethod<[_version: BigNumberish], [void], "nonpayable">;
+  getFunction(
+    nameOrSignature: "setRemoteChains"
+  ): TypedContractMethod<
+    [
+      _poolId1: BigNumberish,
+      _poolId2: BigNumberish,
+      _remoteChainIds: BigNumberish[]
+    ],
+    [void],
+    "nonpayable"
+  >;
+  getFunction(
+    nameOrSignature: "setSendVersion"
+  ): TypedContractMethod<[_version: BigNumberish], [void], "nonpayable">;
+  getFunction(
+    nameOrSignature: "setStargatePoolIdToLPStakingAddress"
+  ): TypedContractMethod<
+    [_poolId: BigNumberish, _lpStaking: AddressLike],
+    [void],
+    "nonpayable"
+  >;
+  getFunction(
+    nameOrSignature: "setTokenPriceFeed"
+  ): TypedContractMethod<
+    [_poolId: BigNumberish, _priceFeedAddress: AddressLike],
+    [void],
+    "nonpayable"
+  >;
+  getFunction(
+    nameOrSignature: "setTrustedRemote"
+  ): TypedContractMethod<
+    [_srcChainId: BigNumberish, _path: BytesLike],
+    [void],
+    "nonpayable"
+  >;
+  getFunction(
+    nameOrSignature: "shouldCallUpdateTokenPrices"
+  ): TypedContractMethod<
+    [_poolId1: BigNumberish, _poolId2: BigNumberish],
+    [boolean],
+    "view"
+  >;
+  getFunction(
+    nameOrSignature: "stargatePoolIdToLPStaking"
+  ): TypedContractMethod<[arg0: BigNumberish], [string], "view">;
+  getFunction(
+    nameOrSignature: "transferOwnership"
+  ): TypedContractMethod<[newOwner: AddressLike], [void], "nonpayable">;
+  getFunction(
+    nameOrSignature: "trustedRemoteLookup"
+  ): TypedContractMethod<[arg0: BigNumberish], [string], "view">;
+  getFunction(
+    nameOrSignature: "updateTokenPrices"
+  ): TypedContractMethod<
+    [_poolId1: BigNumberish, _poolId2: BigNumberish],
+    [void],
+    "payable"
+  >;
+  getFunction(
+    nameOrSignature: "whiteList"
+  ): TypedContractMethod<
+    [_from: AddressLike, _whiteListed: boolean],
+    [void],
+    "nonpayable"
+  >;
+  getFunction(
+    nameOrSignature: "whitelist"
+  ): TypedContractMethod<[arg0: AddressLike], [boolean], "view">;
+
+  getEvent(
+    key: "OwnershipTransferred"
+  ): TypedContractEvent<
+    OwnershipTransferredEvent.InputTuple,
+    OwnershipTransferredEvent.OutputTuple,
+    OwnershipTransferredEvent.OutputObject
+  >;
+  getEvent(
+    key: "PriceUpdated"
+  ): TypedContractEvent<
+    PriceUpdatedEvent.InputTuple,
+    PriceUpdatedEvent.OutputTuple,
+    PriceUpdatedEvent.OutputObject
+  >;
+  getEvent(
+    key: "SetMinDstGas"
+  ): TypedContractEvent<
+    SetMinDstGasEvent.InputTuple,
+    SetMinDstGasEvent.OutputTuple,
+    SetMinDstGasEvent.OutputObject
+  >;
+  getEvent(
+    key: "SetPrecrime"
+  ): TypedContractEvent<
+    SetPrecrimeEvent.InputTuple,
+    SetPrecrimeEvent.OutputTuple,
+    SetPrecrimeEvent.OutputObject
+  >;
+  getEvent(
+    key: "SetTrustedRemote"
+  ): TypedContractEvent<
+    SetTrustedRemoteEvent.InputTuple,
+    SetTrustedRemoteEvent.OutputTuple,
+    SetTrustedRemoteEvent.OutputObject
+  >;
+  getEvent(
+    key: "SetTrustedRemoteAddress"
+  ): TypedContractEvent<
+    SetTrustedRemoteAddressEvent.InputTuple,
+    SetTrustedRemoteAddressEvent.OutputTuple,
+    SetTrustedRemoteAddressEvent.OutputObject
+  >;
+
+  filters: {
+    "OwnershipTransferred(address,address)": TypedContractEvent<
+      OwnershipTransferredEvent.InputTuple,
+      OwnershipTransferredEvent.OutputTuple,
+      OwnershipTransferredEvent.OutputObject
+    >;
+    OwnershipTransferred: TypedContractEvent<
+      OwnershipTransferredEvent.InputTuple,
+      OwnershipTransferredEvent.OutputTuple,
+      OwnershipTransferredEvent.OutputObject
+    >;
+
+    "PriceUpdated(uint256,uint256)": TypedContractEvent<
+      PriceUpdatedEvent.InputTuple,
+      PriceUpdatedEvent.OutputTuple,
+      PriceUpdatedEvent.OutputObject
+    >;
+    PriceUpdated: TypedContractEvent<
+      PriceUpdatedEvent.InputTuple,
+      PriceUpdatedEvent.OutputTuple,
+      PriceUpdatedEvent.OutputObject
+    >;
+
+    "SetMinDstGas(uint16,uint16,uint256)": TypedContractEvent<
+      SetMinDstGasEvent.InputTuple,
+      SetMinDstGasEvent.OutputTuple,
+      SetMinDstGasEvent.OutputObject
+    >;
+    SetMinDstGas: TypedContractEvent<
+      SetMinDstGasEvent.InputTuple,
+      SetMinDstGasEvent.OutputTuple,
+      SetMinDstGasEvent.OutputObject
+    >;
+
+    "SetPrecrime(address)": TypedContractEvent<
+      SetPrecrimeEvent.InputTuple,
+      SetPrecrimeEvent.OutputTuple,
+      SetPrecrimeEvent.OutputObject
+    >;
+    SetPrecrime: TypedContractEvent<
+      SetPrecrimeEvent.InputTuple,
+      SetPrecrimeEvent.OutputTuple,
+      SetPrecrimeEvent.OutputObject
+    >;
+
+    "SetTrustedRemote(uint16,bytes)": TypedContractEvent<
+      SetTrustedRemoteEvent.InputTuple,
+      SetTrustedRemoteEvent.OutputTuple,
+      SetTrustedRemoteEvent.OutputObject
+    >;
+    SetTrustedRemote: TypedContractEvent<
+      SetTrustedRemoteEvent.InputTuple,
+      SetTrustedRemoteEvent.OutputTuple,
+      SetTrustedRemoteEvent.OutputObject
+    >;
+
+    "SetTrustedRemoteAddress(uint16,bytes)": TypedContractEvent<
+      SetTrustedRemoteAddressEvent.InputTuple,
+      SetTrustedRemoteAddressEvent.OutputTuple,
+      SetTrustedRemoteAddressEvent.OutputObject
+    >;
+    SetTrustedRemoteAddress: TypedContractEvent<
+      SetTrustedRemoteAddressEvent.InputTuple,
+      SetTrustedRemoteAddressEvent.OutputTuple,
+      SetTrustedRemoteAddressEvent.OutputObject
+    >;
+  };
+}

+ 131 - 0
src/contract/common.ts

@@ -0,0 +1,131 @@
+/* Autogenerated file. Do not edit manually. */
+/* tslint:disable */
+/* eslint-disable */
+import type {
+  FunctionFragment,
+  Typed,
+  EventFragment,
+  ContractTransaction,
+  ContractTransactionResponse,
+  DeferredTopicFilter,
+  EventLog,
+  TransactionRequest,
+  LogDescription,
+} from "ethers";
+
+export interface TypedDeferredTopicFilter<_TCEvent extends TypedContractEvent>
+  extends DeferredTopicFilter {}
+
+export interface TypedContractEvent<
+  InputTuple extends Array<any> = any,
+  OutputTuple extends Array<any> = any,
+  OutputObject = any
+> {
+  (...args: Partial<InputTuple>): TypedDeferredTopicFilter<
+    TypedContractEvent<InputTuple, OutputTuple, OutputObject>
+  >;
+  name: string;
+  fragment: EventFragment;
+  getFragment(...args: Partial<InputTuple>): EventFragment;
+}
+
+type __TypechainAOutputTuple<T> = T extends TypedContractEvent<
+  infer _U,
+  infer W
+>
+  ? W
+  : never;
+type __TypechainOutputObject<T> = T extends TypedContractEvent<
+  infer _U,
+  infer _W,
+  infer V
+>
+  ? V
+  : never;
+
+export interface TypedEventLog<TCEvent extends TypedContractEvent>
+  extends Omit<EventLog, "args"> {
+  args: __TypechainAOutputTuple<TCEvent> & __TypechainOutputObject<TCEvent>;
+}
+
+export interface TypedLogDescription<TCEvent extends TypedContractEvent>
+  extends Omit<LogDescription, "args"> {
+  args: __TypechainAOutputTuple<TCEvent> & __TypechainOutputObject<TCEvent>;
+}
+
+export type TypedListener<TCEvent extends TypedContractEvent> = (
+  ...listenerArg: [
+    ...__TypechainAOutputTuple<TCEvent>,
+    TypedEventLog<TCEvent>,
+    ...undefined[]
+  ]
+) => void;
+
+export type MinEthersFactory<C, ARGS> = {
+  deploy(...a: ARGS[]): Promise<C>;
+};
+
+export type GetContractTypeFromFactory<F> = F extends MinEthersFactory<
+  infer C,
+  any
+>
+  ? C
+  : never;
+export type GetARGsTypeFromFactory<F> = F extends MinEthersFactory<any, any>
+  ? Parameters<F["deploy"]>
+  : never;
+
+export type StateMutability = "nonpayable" | "payable" | "view";
+
+export type BaseOverrides = Omit<TransactionRequest, "to" | "data">;
+export type NonPayableOverrides = Omit<
+  BaseOverrides,
+  "value" | "blockTag" | "enableCcipRead"
+>;
+export type PayableOverrides = Omit<
+  BaseOverrides,
+  "blockTag" | "enableCcipRead"
+>;
+export type ViewOverrides = Omit<TransactionRequest, "to" | "data">;
+export type Overrides<S extends StateMutability> = S extends "nonpayable"
+  ? NonPayableOverrides
+  : S extends "payable"
+  ? PayableOverrides
+  : ViewOverrides;
+
+export type PostfixOverrides<A extends Array<any>, S extends StateMutability> =
+  | A
+  | [...A, Overrides<S>];
+export type ContractMethodArgs<
+  A extends Array<any>,
+  S extends StateMutability
+> = PostfixOverrides<{ [I in keyof A]-?: A[I] | Typed }, S>;
+
+export type DefaultReturnType<R> = R extends Array<any> ? R[0] : R;
+
+// export interface ContractMethod<A extends Array<any> = Array<any>, R = any, D extends R | ContractTransactionResponse = R | ContractTransactionResponse> {
+export interface TypedContractMethod<
+  A extends Array<any> = Array<any>,
+  R = any,
+  S extends StateMutability = "payable"
+> {
+  (...args: ContractMethodArgs<A, S>): S extends "view"
+    ? Promise<DefaultReturnType<R>>
+    : Promise<ContractTransactionResponse>;
+
+  name: string;
+
+  fragment: FunctionFragment;
+
+  getFragment(...args: ContractMethodArgs<A, S>): FunctionFragment;
+
+  populateTransaction(
+    ...args: ContractMethodArgs<A, S>
+  ): Promise<ContractTransaction>;
+  staticCall(
+    ...args: ContractMethodArgs<A, "view">
+  ): Promise<DefaultReturnType<R>>;
+  send(...args: ContractMethodArgs<A, S>): Promise<ContractTransactionResponse>;
+  estimateGas(...args: ContractMethodArgs<A, S>): Promise<bigint>;
+  staticCallResult(...args: ContractMethodArgs<A, "view">): Promise<R>;
+}

+ 123 - 0
src/contract/factories/RouterETH__factory.ts

@@ -0,0 +1,123 @@
+/* Autogenerated file. Do not edit manually. */
+/* tslint:disable */
+/* eslint-disable */
+
+import { Contract, Interface, type ContractRunner } from "ethers";
+import type { RouterETH, RouterETHInterface } from "../RouterETH";
+
+const _abi = [
+  {
+    inputs: [
+      {
+        internalType: "address",
+        name: "_stargateEthVault",
+        type: "address",
+      },
+      {
+        internalType: "address",
+        name: "_stargateRouter",
+        type: "address",
+      },
+      {
+        internalType: "uint16",
+        name: "_poolId",
+        type: "uint16",
+      },
+    ],
+    stateMutability: "nonpayable",
+    type: "constructor",
+  },
+  {
+    inputs: [],
+    name: "addLiquidityETH",
+    outputs: [],
+    stateMutability: "payable",
+    type: "function",
+  },
+  {
+    inputs: [],
+    name: "poolId",
+    outputs: [
+      {
+        internalType: "uint16",
+        name: "",
+        type: "uint16",
+      },
+    ],
+    stateMutability: "view",
+    type: "function",
+  },
+  {
+    inputs: [],
+    name: "stargateEthVault",
+    outputs: [
+      {
+        internalType: "address",
+        name: "",
+        type: "address",
+      },
+    ],
+    stateMutability: "view",
+    type: "function",
+  },
+  {
+    inputs: [],
+    name: "stargateRouter",
+    outputs: [
+      {
+        internalType: "contract IStargateRouter",
+        name: "",
+        type: "address",
+      },
+    ],
+    stateMutability: "view",
+    type: "function",
+  },
+  {
+    inputs: [
+      {
+        internalType: "uint16",
+        name: "_dstChainId",
+        type: "uint16",
+      },
+      {
+        internalType: "address payable",
+        name: "_refundAddress",
+        type: "address",
+      },
+      {
+        internalType: "bytes",
+        name: "_toAddress",
+        type: "bytes",
+      },
+      {
+        internalType: "uint256",
+        name: "_amountLD",
+        type: "uint256",
+      },
+      {
+        internalType: "uint256",
+        name: "_minAmountLD",
+        type: "uint256",
+      },
+    ],
+    name: "swapETH",
+    outputs: [],
+    stateMutability: "payable",
+    type: "function",
+  },
+  {
+    stateMutability: "payable",
+    type: "receive",
+  },
+] as const;
+
+export class RouterETH__factory {
+  static readonly abi = _abi;
+  static createInterface(): RouterETHInterface {
+    return new Interface(_abi) as RouterETHInterface;
+  }
+  static connect(address: string, runner?: ContractRunner | null): RouterETH {
+    return new Contract(address, _abi, runner) as unknown as RouterETH;
+  }
+}

+ 1358 - 0
src/contract/factories/Router__factory.ts

@@ -0,0 +1,1358 @@
+/* Autogenerated file. Do not edit manually. */
+/* tslint:disable */
+/* eslint-disable */
+
+import { Contract, Interface, type ContractRunner } from "ethers";
+import type { Router, RouterInterface } from "../Router";
+
+const _abi = [
+  {
+    inputs: [],
+    stateMutability: "nonpayable",
+    type: "constructor",
+  },
+  {
+    anonymous: false,
+    inputs: [
+      {
+        indexed: false,
+        internalType: "uint16",
+        name: "chainId",
+        type: "uint16",
+      },
+      {
+        indexed: false,
+        internalType: "bytes",
+        name: "srcAddress",
+        type: "bytes",
+      },
+      {
+        indexed: false,
+        internalType: "uint256",
+        name: "nonce",
+        type: "uint256",
+      },
+      {
+        indexed: false,
+        internalType: "address",
+        name: "token",
+        type: "address",
+      },
+      {
+        indexed: false,
+        internalType: "uint256",
+        name: "amountLD",
+        type: "uint256",
+      },
+      {
+        indexed: false,
+        internalType: "address",
+        name: "to",
+        type: "address",
+      },
+      {
+        indexed: false,
+        internalType: "bytes",
+        name: "payload",
+        type: "bytes",
+      },
+      {
+        indexed: false,
+        internalType: "bytes",
+        name: "reason",
+        type: "bytes",
+      },
+    ],
+    name: "CachedSwapSaved",
+    type: "event",
+  },
+  {
+    anonymous: false,
+    inputs: [
+      {
+        indexed: true,
+        internalType: "address",
+        name: "previousOwner",
+        type: "address",
+      },
+      {
+        indexed: true,
+        internalType: "address",
+        name: "newOwner",
+        type: "address",
+      },
+    ],
+    name: "OwnershipTransferred",
+    type: "event",
+  },
+  {
+    anonymous: false,
+    inputs: [
+      {
+        indexed: false,
+        internalType: "uint16",
+        name: "srcChainId",
+        type: "uint16",
+      },
+      {
+        indexed: true,
+        internalType: "bytes",
+        name: "srcAddress",
+        type: "bytes",
+      },
+      {
+        indexed: true,
+        internalType: "uint256",
+        name: "nonce",
+        type: "uint256",
+      },
+      {
+        indexed: false,
+        internalType: "uint256",
+        name: "srcPoolId",
+        type: "uint256",
+      },
+      {
+        indexed: false,
+        internalType: "uint256",
+        name: "dstPoolId",
+        type: "uint256",
+      },
+      {
+        indexed: false,
+        internalType: "address",
+        name: "to",
+        type: "address",
+      },
+      {
+        indexed: false,
+        internalType: "uint256",
+        name: "amountSD",
+        type: "uint256",
+      },
+      {
+        indexed: false,
+        internalType: "uint256",
+        name: "mintAmountSD",
+        type: "uint256",
+      },
+    ],
+    name: "RedeemLocalCallback",
+    type: "event",
+  },
+  {
+    anonymous: false,
+    inputs: [
+      {
+        indexed: false,
+        internalType: "uint8",
+        name: "bridgeFunctionType",
+        type: "uint8",
+      },
+      {
+        indexed: false,
+        internalType: "uint16",
+        name: "chainId",
+        type: "uint16",
+      },
+      {
+        indexed: false,
+        internalType: "bytes",
+        name: "srcAddress",
+        type: "bytes",
+      },
+      {
+        indexed: false,
+        internalType: "uint256",
+        name: "nonce",
+        type: "uint256",
+      },
+    ],
+    name: "Revert",
+    type: "event",
+  },
+  {
+    anonymous: false,
+    inputs: [
+      {
+        indexed: false,
+        internalType: "uint16",
+        name: "srcChainId",
+        type: "uint16",
+      },
+      {
+        indexed: false,
+        internalType: "uint256",
+        name: "_srcPoolId",
+        type: "uint256",
+      },
+      {
+        indexed: false,
+        internalType: "uint256",
+        name: "_dstPoolId",
+        type: "uint256",
+      },
+      {
+        indexed: false,
+        internalType: "bytes",
+        name: "to",
+        type: "bytes",
+      },
+      {
+        indexed: false,
+        internalType: "uint256",
+        name: "redeemAmountSD",
+        type: "uint256",
+      },
+      {
+        indexed: false,
+        internalType: "uint256",
+        name: "mintAmountSD",
+        type: "uint256",
+      },
+      {
+        indexed: true,
+        internalType: "uint256",
+        name: "nonce",
+        type: "uint256",
+      },
+      {
+        indexed: true,
+        internalType: "bytes",
+        name: "srcAddress",
+        type: "bytes",
+      },
+    ],
+    name: "RevertRedeemLocal",
+    type: "event",
+  },
+  {
+    inputs: [
+      {
+        internalType: "uint256",
+        name: "_poolId",
+        type: "uint256",
+      },
+      {
+        internalType: "uint16",
+        name: "_dstChainId",
+        type: "uint16",
+      },
+      {
+        internalType: "uint256",
+        name: "_dstPoolId",
+        type: "uint256",
+      },
+    ],
+    name: "activateChainPath",
+    outputs: [],
+    stateMutability: "nonpayable",
+    type: "function",
+  },
+  {
+    inputs: [
+      {
+        internalType: "uint256",
+        name: "_poolId",
+        type: "uint256",
+      },
+      {
+        internalType: "uint256",
+        name: "_amountLD",
+        type: "uint256",
+      },
+      {
+        internalType: "address",
+        name: "_to",
+        type: "address",
+      },
+    ],
+    name: "addLiquidity",
+    outputs: [],
+    stateMutability: "nonpayable",
+    type: "function",
+  },
+  {
+    inputs: [],
+    name: "bridge",
+    outputs: [
+      {
+        internalType: "contract Bridge",
+        name: "",
+        type: "address",
+      },
+    ],
+    stateMutability: "view",
+    type: "function",
+  },
+  {
+    inputs: [
+      {
+        internalType: "uint16",
+        name: "",
+        type: "uint16",
+      },
+      {
+        internalType: "bytes",
+        name: "",
+        type: "bytes",
+      },
+      {
+        internalType: "uint256",
+        name: "",
+        type: "uint256",
+      },
+    ],
+    name: "cachedSwapLookup",
+    outputs: [
+      {
+        internalType: "address",
+        name: "token",
+        type: "address",
+      },
+      {
+        internalType: "uint256",
+        name: "amountLD",
+        type: "uint256",
+      },
+      {
+        internalType: "address",
+        name: "to",
+        type: "address",
+      },
+      {
+        internalType: "bytes",
+        name: "payload",
+        type: "bytes",
+      },
+    ],
+    stateMutability: "view",
+    type: "function",
+  },
+  {
+    inputs: [
+      {
+        internalType: "uint256",
+        name: "_poolId",
+        type: "uint256",
+      },
+      {
+        internalType: "bool",
+        name: "_fullMode",
+        type: "bool",
+      },
+    ],
+    name: "callDelta",
+    outputs: [],
+    stateMutability: "nonpayable",
+    type: "function",
+  },
+  {
+    inputs: [
+      {
+        internalType: "uint16",
+        name: "_srcChainId",
+        type: "uint16",
+      },
+      {
+        internalType: "bytes",
+        name: "_srcAddress",
+        type: "bytes",
+      },
+      {
+        internalType: "uint256",
+        name: "_nonce",
+        type: "uint256",
+      },
+    ],
+    name: "clearCachedSwap",
+    outputs: [],
+    stateMutability: "nonpayable",
+    type: "function",
+  },
+  {
+    inputs: [
+      {
+        internalType: "uint256",
+        name: "_poolId",
+        type: "uint256",
+      },
+      {
+        internalType: "uint16",
+        name: "_dstChainId",
+        type: "uint16",
+      },
+      {
+        internalType: "uint256",
+        name: "_dstPoolId",
+        type: "uint256",
+      },
+      {
+        internalType: "uint256",
+        name: "_weight",
+        type: "uint256",
+      },
+    ],
+    name: "createChainPath",
+    outputs: [],
+    stateMutability: "nonpayable",
+    type: "function",
+  },
+  {
+    inputs: [
+      {
+        internalType: "uint256",
+        name: "_poolId",
+        type: "uint256",
+      },
+      {
+        internalType: "address",
+        name: "_token",
+        type: "address",
+      },
+      {
+        internalType: "uint8",
+        name: "_sharedDecimals",
+        type: "uint8",
+      },
+      {
+        internalType: "uint8",
+        name: "_localDecimals",
+        type: "uint8",
+      },
+      {
+        internalType: "string",
+        name: "_name",
+        type: "string",
+      },
+      {
+        internalType: "string",
+        name: "_symbol",
+        type: "string",
+      },
+    ],
+    name: "createPool",
+    outputs: [
+      {
+        internalType: "address",
+        name: "",
+        type: "address",
+      },
+    ],
+    stateMutability: "nonpayable",
+    type: "function",
+  },
+  {
+    inputs: [
+      {
+        internalType: "uint16",
+        name: "_dstChainId",
+        type: "uint16",
+      },
+      {
+        internalType: "uint256",
+        name: "_dstPoolId",
+        type: "uint256",
+      },
+      {
+        internalType: "uint256",
+        name: "_srcPoolId",
+        type: "uint256",
+      },
+      {
+        components: [
+          {
+            internalType: "uint256",
+            name: "credits",
+            type: "uint256",
+          },
+          {
+            internalType: "uint256",
+            name: "idealBalance",
+            type: "uint256",
+          },
+        ],
+        internalType: "struct Pool.CreditObj",
+        name: "_c",
+        type: "tuple",
+      },
+    ],
+    name: "creditChainPath",
+    outputs: [],
+    stateMutability: "nonpayable",
+    type: "function",
+  },
+  {
+    inputs: [],
+    name: "factory",
+    outputs: [
+      {
+        internalType: "contract Factory",
+        name: "",
+        type: "address",
+      },
+    ],
+    stateMutability: "view",
+    type: "function",
+  },
+  {
+    inputs: [
+      {
+        internalType: "uint16",
+        name: "_srcPoolId",
+        type: "uint16",
+      },
+      {
+        internalType: "uint256",
+        name: "_amountLP",
+        type: "uint256",
+      },
+      {
+        internalType: "address",
+        name: "_to",
+        type: "address",
+      },
+    ],
+    name: "instantRedeemLocal",
+    outputs: [
+      {
+        internalType: "uint256",
+        name: "amountSD",
+        type: "uint256",
+      },
+    ],
+    stateMutability: "nonpayable",
+    type: "function",
+  },
+  {
+    inputs: [],
+    name: "mintFeeOwner",
+    outputs: [
+      {
+        internalType: "address",
+        name: "",
+        type: "address",
+      },
+    ],
+    stateMutability: "view",
+    type: "function",
+  },
+  {
+    inputs: [],
+    name: "owner",
+    outputs: [
+      {
+        internalType: "address",
+        name: "",
+        type: "address",
+      },
+    ],
+    stateMutability: "view",
+    type: "function",
+  },
+  {
+    inputs: [],
+    name: "protocolFeeOwner",
+    outputs: [
+      {
+        internalType: "address",
+        name: "",
+        type: "address",
+      },
+    ],
+    stateMutability: "view",
+    type: "function",
+  },
+  {
+    inputs: [
+      {
+        internalType: "uint16",
+        name: "_dstChainId",
+        type: "uint16",
+      },
+      {
+        internalType: "uint8",
+        name: "_functionType",
+        type: "uint8",
+      },
+      {
+        internalType: "bytes",
+        name: "_toAddress",
+        type: "bytes",
+      },
+      {
+        internalType: "bytes",
+        name: "_transferAndCallPayload",
+        type: "bytes",
+      },
+      {
+        components: [
+          {
+            internalType: "uint256",
+            name: "dstGasForCall",
+            type: "uint256",
+          },
+          {
+            internalType: "uint256",
+            name: "dstNativeAmount",
+            type: "uint256",
+          },
+          {
+            internalType: "bytes",
+            name: "dstNativeAddr",
+            type: "bytes",
+          },
+        ],
+        internalType: "struct IStargateRouter.lzTxObj",
+        name: "_lzTxParams",
+        type: "tuple",
+      },
+    ],
+    name: "quoteLayerZeroFee",
+    outputs: [
+      {
+        internalType: "uint256",
+        name: "",
+        type: "uint256",
+      },
+      {
+        internalType: "uint256",
+        name: "",
+        type: "uint256",
+      },
+    ],
+    stateMutability: "view",
+    type: "function",
+  },
+  {
+    inputs: [
+      {
+        internalType: "uint16",
+        name: "_dstChainId",
+        type: "uint16",
+      },
+      {
+        internalType: "uint256",
+        name: "_srcPoolId",
+        type: "uint256",
+      },
+      {
+        internalType: "uint256",
+        name: "_dstPoolId",
+        type: "uint256",
+      },
+      {
+        internalType: "address payable",
+        name: "_refundAddress",
+        type: "address",
+      },
+      {
+        internalType: "uint256",
+        name: "_amountLP",
+        type: "uint256",
+      },
+      {
+        internalType: "bytes",
+        name: "_to",
+        type: "bytes",
+      },
+      {
+        components: [
+          {
+            internalType: "uint256",
+            name: "dstGasForCall",
+            type: "uint256",
+          },
+          {
+            internalType: "uint256",
+            name: "dstNativeAmount",
+            type: "uint256",
+          },
+          {
+            internalType: "bytes",
+            name: "dstNativeAddr",
+            type: "bytes",
+          },
+        ],
+        internalType: "struct IStargateRouter.lzTxObj",
+        name: "_lzTxParams",
+        type: "tuple",
+      },
+    ],
+    name: "redeemLocal",
+    outputs: [],
+    stateMutability: "payable",
+    type: "function",
+  },
+  {
+    inputs: [
+      {
+        internalType: "uint16",
+        name: "_srcChainId",
+        type: "uint16",
+      },
+      {
+        internalType: "bytes",
+        name: "_srcAddress",
+        type: "bytes",
+      },
+      {
+        internalType: "uint256",
+        name: "_nonce",
+        type: "uint256",
+      },
+      {
+        internalType: "uint256",
+        name: "_srcPoolId",
+        type: "uint256",
+      },
+      {
+        internalType: "uint256",
+        name: "_dstPoolId",
+        type: "uint256",
+      },
+      {
+        internalType: "address",
+        name: "_to",
+        type: "address",
+      },
+      {
+        internalType: "uint256",
+        name: "_amountSD",
+        type: "uint256",
+      },
+      {
+        internalType: "uint256",
+        name: "_mintAmountSD",
+        type: "uint256",
+      },
+    ],
+    name: "redeemLocalCallback",
+    outputs: [],
+    stateMutability: "nonpayable",
+    type: "function",
+  },
+  {
+    inputs: [
+      {
+        internalType: "uint16",
+        name: "_srcChainId",
+        type: "uint16",
+      },
+      {
+        internalType: "bytes",
+        name: "_srcAddress",
+        type: "bytes",
+      },
+      {
+        internalType: "uint256",
+        name: "_nonce",
+        type: "uint256",
+      },
+      {
+        internalType: "uint256",
+        name: "_srcPoolId",
+        type: "uint256",
+      },
+      {
+        internalType: "uint256",
+        name: "_dstPoolId",
+        type: "uint256",
+      },
+      {
+        internalType: "uint256",
+        name: "_amountSD",
+        type: "uint256",
+      },
+      {
+        internalType: "bytes",
+        name: "_to",
+        type: "bytes",
+      },
+    ],
+    name: "redeemLocalCheckOnRemote",
+    outputs: [],
+    stateMutability: "nonpayable",
+    type: "function",
+  },
+  {
+    inputs: [
+      {
+        internalType: "uint16",
+        name: "_dstChainId",
+        type: "uint16",
+      },
+      {
+        internalType: "uint256",
+        name: "_srcPoolId",
+        type: "uint256",
+      },
+      {
+        internalType: "uint256",
+        name: "_dstPoolId",
+        type: "uint256",
+      },
+      {
+        internalType: "address payable",
+        name: "_refundAddress",
+        type: "address",
+      },
+      {
+        internalType: "uint256",
+        name: "_amountLP",
+        type: "uint256",
+      },
+      {
+        internalType: "uint256",
+        name: "_minAmountLD",
+        type: "uint256",
+      },
+      {
+        internalType: "bytes",
+        name: "_to",
+        type: "bytes",
+      },
+      {
+        components: [
+          {
+            internalType: "uint256",
+            name: "dstGasForCall",
+            type: "uint256",
+          },
+          {
+            internalType: "uint256",
+            name: "dstNativeAmount",
+            type: "uint256",
+          },
+          {
+            internalType: "bytes",
+            name: "dstNativeAddr",
+            type: "bytes",
+          },
+        ],
+        internalType: "struct IStargateRouter.lzTxObj",
+        name: "_lzTxParams",
+        type: "tuple",
+      },
+    ],
+    name: "redeemRemote",
+    outputs: [],
+    stateMutability: "payable",
+    type: "function",
+  },
+  {
+    inputs: [],
+    name: "renounceOwnership",
+    outputs: [],
+    stateMutability: "nonpayable",
+    type: "function",
+  },
+  {
+    inputs: [
+      {
+        internalType: "uint16",
+        name: "_srcChainId",
+        type: "uint16",
+      },
+      {
+        internalType: "bytes",
+        name: "_srcAddress",
+        type: "bytes",
+      },
+      {
+        internalType: "uint256",
+        name: "_nonce",
+        type: "uint256",
+      },
+    ],
+    name: "retryRevert",
+    outputs: [],
+    stateMutability: "payable",
+    type: "function",
+  },
+  {
+    inputs: [
+      {
+        internalType: "uint16",
+        name: "",
+        type: "uint16",
+      },
+      {
+        internalType: "bytes",
+        name: "",
+        type: "bytes",
+      },
+      {
+        internalType: "uint256",
+        name: "",
+        type: "uint256",
+      },
+    ],
+    name: "revertLookup",
+    outputs: [
+      {
+        internalType: "bytes",
+        name: "",
+        type: "bytes",
+      },
+    ],
+    stateMutability: "view",
+    type: "function",
+  },
+  {
+    inputs: [
+      {
+        internalType: "uint16",
+        name: "_dstChainId",
+        type: "uint16",
+      },
+      {
+        internalType: "bytes",
+        name: "_srcAddress",
+        type: "bytes",
+      },
+      {
+        internalType: "uint256",
+        name: "_nonce",
+        type: "uint256",
+      },
+      {
+        internalType: "address payable",
+        name: "_refundAddress",
+        type: "address",
+      },
+      {
+        components: [
+          {
+            internalType: "uint256",
+            name: "dstGasForCall",
+            type: "uint256",
+          },
+          {
+            internalType: "uint256",
+            name: "dstNativeAmount",
+            type: "uint256",
+          },
+          {
+            internalType: "bytes",
+            name: "dstNativeAddr",
+            type: "bytes",
+          },
+        ],
+        internalType: "struct IStargateRouter.lzTxObj",
+        name: "_lzTxParams",
+        type: "tuple",
+      },
+    ],
+    name: "revertRedeemLocal",
+    outputs: [],
+    stateMutability: "payable",
+    type: "function",
+  },
+  {
+    inputs: [
+      {
+        internalType: "uint16",
+        name: "_dstChainId",
+        type: "uint16",
+      },
+      {
+        internalType: "uint256",
+        name: "_srcPoolId",
+        type: "uint256",
+      },
+      {
+        internalType: "uint256",
+        name: "_dstPoolId",
+        type: "uint256",
+      },
+      {
+        internalType: "address payable",
+        name: "_refundAddress",
+        type: "address",
+      },
+    ],
+    name: "sendCredits",
+    outputs: [],
+    stateMutability: "payable",
+    type: "function",
+  },
+  {
+    inputs: [
+      {
+        internalType: "contract Bridge",
+        name: "_bridge",
+        type: "address",
+      },
+      {
+        internalType: "contract Factory",
+        name: "_factory",
+        type: "address",
+      },
+    ],
+    name: "setBridgeAndFactory",
+    outputs: [],
+    stateMutability: "nonpayable",
+    type: "function",
+  },
+  {
+    inputs: [
+      {
+        internalType: "uint256",
+        name: "_poolId",
+        type: "uint256",
+      },
+      {
+        internalType: "bool",
+        name: "_batched",
+        type: "bool",
+      },
+      {
+        internalType: "uint256",
+        name: "_swapDeltaBP",
+        type: "uint256",
+      },
+      {
+        internalType: "uint256",
+        name: "_lpDeltaBP",
+        type: "uint256",
+      },
+      {
+        internalType: "bool",
+        name: "_defaultSwapMode",
+        type: "bool",
+      },
+      {
+        internalType: "bool",
+        name: "_defaultLPMode",
+        type: "bool",
+      },
+    ],
+    name: "setDeltaParam",
+    outputs: [],
+    stateMutability: "nonpayable",
+    type: "function",
+  },
+  {
+    inputs: [
+      {
+        internalType: "uint256",
+        name: "_poolId",
+        type: "uint256",
+      },
+      {
+        internalType: "address",
+        name: "_feeLibraryAddr",
+        type: "address",
+      },
+    ],
+    name: "setFeeLibrary",
+    outputs: [],
+    stateMutability: "nonpayable",
+    type: "function",
+  },
+  {
+    inputs: [
+      {
+        internalType: "uint256",
+        name: "_poolId",
+        type: "uint256",
+      },
+      {
+        internalType: "uint256",
+        name: "_mintFeeBP",
+        type: "uint256",
+      },
+    ],
+    name: "setFees",
+    outputs: [],
+    stateMutability: "nonpayable",
+    type: "function",
+  },
+  {
+    inputs: [
+      {
+        internalType: "address",
+        name: "_owner",
+        type: "address",
+      },
+    ],
+    name: "setMintFeeOwner",
+    outputs: [],
+    stateMutability: "nonpayable",
+    type: "function",
+  },
+  {
+    inputs: [
+      {
+        internalType: "address",
+        name: "_owner",
+        type: "address",
+      },
+    ],
+    name: "setProtocolFeeOwner",
+    outputs: [],
+    stateMutability: "nonpayable",
+    type: "function",
+  },
+  {
+    inputs: [
+      {
+        internalType: "uint256",
+        name: "_poolId",
+        type: "uint256",
+      },
+      {
+        internalType: "bool",
+        name: "_swapStop",
+        type: "bool",
+      },
+    ],
+    name: "setSwapStop",
+    outputs: [],
+    stateMutability: "nonpayable",
+    type: "function",
+  },
+  {
+    inputs: [
+      {
+        internalType: "uint256",
+        name: "_poolId",
+        type: "uint256",
+      },
+      {
+        internalType: "uint16",
+        name: "_dstChainId",
+        type: "uint16",
+      },
+      {
+        internalType: "uint256",
+        name: "_dstPoolId",
+        type: "uint256",
+      },
+      {
+        internalType: "uint16",
+        name: "_weight",
+        type: "uint16",
+      },
+    ],
+    name: "setWeightForChainPath",
+    outputs: [],
+    stateMutability: "nonpayable",
+    type: "function",
+  },
+  {
+    inputs: [
+      {
+        internalType: "uint16",
+        name: "_dstChainId",
+        type: "uint16",
+      },
+      {
+        internalType: "uint256",
+        name: "_srcPoolId",
+        type: "uint256",
+      },
+      {
+        internalType: "uint256",
+        name: "_dstPoolId",
+        type: "uint256",
+      },
+      {
+        internalType: "address payable",
+        name: "_refundAddress",
+        type: "address",
+      },
+      {
+        internalType: "uint256",
+        name: "_amountLD",
+        type: "uint256",
+      },
+      {
+        internalType: "uint256",
+        name: "_minAmountLD",
+        type: "uint256",
+      },
+      {
+        components: [
+          {
+            internalType: "uint256",
+            name: "dstGasForCall",
+            type: "uint256",
+          },
+          {
+            internalType: "uint256",
+            name: "dstNativeAmount",
+            type: "uint256",
+          },
+          {
+            internalType: "bytes",
+            name: "dstNativeAddr",
+            type: "bytes",
+          },
+        ],
+        internalType: "struct IStargateRouter.lzTxObj",
+        name: "_lzTxParams",
+        type: "tuple",
+      },
+      {
+        internalType: "bytes",
+        name: "_to",
+        type: "bytes",
+      },
+      {
+        internalType: "bytes",
+        name: "_payload",
+        type: "bytes",
+      },
+    ],
+    name: "swap",
+    outputs: [],
+    stateMutability: "payable",
+    type: "function",
+  },
+  {
+    inputs: [
+      {
+        internalType: "uint16",
+        name: "_srcChainId",
+        type: "uint16",
+      },
+      {
+        internalType: "bytes",
+        name: "_srcAddress",
+        type: "bytes",
+      },
+      {
+        internalType: "uint256",
+        name: "_nonce",
+        type: "uint256",
+      },
+      {
+        internalType: "uint256",
+        name: "_srcPoolId",
+        type: "uint256",
+      },
+      {
+        internalType: "uint256",
+        name: "_dstPoolId",
+        type: "uint256",
+      },
+      {
+        internalType: "uint256",
+        name: "_dstGasForCall",
+        type: "uint256",
+      },
+      {
+        internalType: "address",
+        name: "_to",
+        type: "address",
+      },
+      {
+        components: [
+          {
+            internalType: "uint256",
+            name: "amount",
+            type: "uint256",
+          },
+          {
+            internalType: "uint256",
+            name: "eqFee",
+            type: "uint256",
+          },
+          {
+            internalType: "uint256",
+            name: "eqReward",
+            type: "uint256",
+          },
+          {
+            internalType: "uint256",
+            name: "lpFee",
+            type: "uint256",
+          },
+          {
+            internalType: "uint256",
+            name: "protocolFee",
+            type: "uint256",
+          },
+          {
+            internalType: "uint256",
+            name: "lkbRemove",
+            type: "uint256",
+          },
+        ],
+        internalType: "struct Pool.SwapObj",
+        name: "_s",
+        type: "tuple",
+      },
+      {
+        internalType: "bytes",
+        name: "_payload",
+        type: "bytes",
+      },
+    ],
+    name: "swapRemote",
+    outputs: [],
+    stateMutability: "nonpayable",
+    type: "function",
+  },
+  {
+    inputs: [
+      {
+        internalType: "address",
+        name: "newOwner",
+        type: "address",
+      },
+    ],
+    name: "transferOwnership",
+    outputs: [],
+    stateMutability: "nonpayable",
+    type: "function",
+  },
+  {
+    inputs: [
+      {
+        internalType: "uint256",
+        name: "_poolId",
+        type: "uint256",
+      },
+      {
+        internalType: "address",
+        name: "_to",
+        type: "address",
+      },
+    ],
+    name: "withdrawMintFee",
+    outputs: [],
+    stateMutability: "nonpayable",
+    type: "function",
+  },
+  {
+    inputs: [
+      {
+        internalType: "uint256",
+        name: "_poolId",
+        type: "uint256",
+      },
+      {
+        internalType: "address",
+        name: "_to",
+        type: "address",
+      },
+    ],
+    name: "withdrawProtocolFee",
+    outputs: [],
+    stateMutability: "nonpayable",
+    type: "function",
+  },
+] as const;
+
+export class Router__factory {
+  static readonly abi = _abi;
+  static createInterface(): RouterInterface {
+    return new Interface(_abi) as RouterInterface;
+  }
+  static connect(address: string, runner?: ContractRunner | null): Router {
+    return new Contract(address, _abi, runner) as unknown as Router;
+  }
+}

+ 1252 - 0
src/contract/factories/StargateFeeLibraryV07__factory.ts

@@ -0,0 +1,1252 @@
+/* Autogenerated file. Do not edit manually. */
+/* tslint:disable */
+/* eslint-disable */
+
+import { Contract, Interface, type ContractRunner } from "ethers";
+import type {
+  StargateFeeLibraryV07,
+  StargateFeeLibraryV07Interface,
+} from "../StargateFeeLibraryV07";
+
+const _abi = [
+  {
+    inputs: [
+      {
+        internalType: "address",
+        name: "_factory",
+        type: "address",
+      },
+      {
+        internalType: "address",
+        name: "_endpoint",
+        type: "address",
+      },
+    ],
+    stateMutability: "nonpayable",
+    type: "constructor",
+  },
+  {
+    anonymous: false,
+    inputs: [
+      {
+        indexed: true,
+        internalType: "address",
+        name: "previousOwner",
+        type: "address",
+      },
+      {
+        indexed: true,
+        internalType: "address",
+        name: "newOwner",
+        type: "address",
+      },
+    ],
+    name: "OwnershipTransferred",
+    type: "event",
+  },
+  {
+    anonymous: false,
+    inputs: [
+      {
+        indexed: true,
+        internalType: "uint256",
+        name: "poolId",
+        type: "uint256",
+      },
+      {
+        indexed: false,
+        internalType: "uint256",
+        name: "priceSD",
+        type: "uint256",
+      },
+    ],
+    name: "PriceUpdated",
+    type: "event",
+  },
+  {
+    anonymous: false,
+    inputs: [
+      {
+        indexed: false,
+        internalType: "uint16",
+        name: "_dstChainId",
+        type: "uint16",
+      },
+      {
+        indexed: false,
+        internalType: "uint16",
+        name: "_type",
+        type: "uint16",
+      },
+      {
+        indexed: false,
+        internalType: "uint256",
+        name: "_minDstGas",
+        type: "uint256",
+      },
+    ],
+    name: "SetMinDstGas",
+    type: "event",
+  },
+  {
+    anonymous: false,
+    inputs: [
+      {
+        indexed: false,
+        internalType: "address",
+        name: "precrime",
+        type: "address",
+      },
+    ],
+    name: "SetPrecrime",
+    type: "event",
+  },
+  {
+    anonymous: false,
+    inputs: [
+      {
+        indexed: false,
+        internalType: "uint16",
+        name: "_remoteChainId",
+        type: "uint16",
+      },
+      {
+        indexed: false,
+        internalType: "bytes",
+        name: "_path",
+        type: "bytes",
+      },
+    ],
+    name: "SetTrustedRemote",
+    type: "event",
+  },
+  {
+    anonymous: false,
+    inputs: [
+      {
+        indexed: false,
+        internalType: "uint16",
+        name: "_remoteChainId",
+        type: "uint16",
+      },
+      {
+        indexed: false,
+        internalType: "bytes",
+        name: "_remoteAddress",
+        type: "bytes",
+      },
+    ],
+    name: "SetTrustedRemoteAddress",
+    type: "event",
+  },
+  {
+    inputs: [],
+    name: "DELTA_1",
+    outputs: [
+      {
+        internalType: "uint256",
+        name: "",
+        type: "uint256",
+      },
+    ],
+    stateMutability: "view",
+    type: "function",
+  },
+  {
+    inputs: [],
+    name: "DELTA_2",
+    outputs: [
+      {
+        internalType: "uint256",
+        name: "",
+        type: "uint256",
+      },
+    ],
+    stateMutability: "view",
+    type: "function",
+  },
+  {
+    inputs: [],
+    name: "DENOMINATOR",
+    outputs: [
+      {
+        internalType: "uint256",
+        name: "",
+        type: "uint256",
+      },
+    ],
+    stateMutability: "view",
+    type: "function",
+  },
+  {
+    inputs: [],
+    name: "EQ_REWARD_THRESHOLD",
+    outputs: [
+      {
+        internalType: "uint256",
+        name: "",
+        type: "uint256",
+      },
+    ],
+    stateMutability: "view",
+    type: "function",
+  },
+  {
+    inputs: [],
+    name: "LAMBDA_1",
+    outputs: [
+      {
+        internalType: "uint256",
+        name: "",
+        type: "uint256",
+      },
+    ],
+    stateMutability: "view",
+    type: "function",
+  },
+  {
+    inputs: [],
+    name: "LAMBDA_2",
+    outputs: [
+      {
+        internalType: "uint256",
+        name: "",
+        type: "uint256",
+      },
+    ],
+    stateMutability: "view",
+    type: "function",
+  },
+  {
+    inputs: [],
+    name: "LP_FEE",
+    outputs: [
+      {
+        internalType: "uint256",
+        name: "",
+        type: "uint256",
+      },
+    ],
+    stateMutability: "view",
+    type: "function",
+  },
+  {
+    inputs: [],
+    name: "ONE_BPS_PRICE_CHANGE_THRESHOLD",
+    outputs: [
+      {
+        internalType: "uint256",
+        name: "",
+        type: "uint256",
+      },
+    ],
+    stateMutability: "view",
+    type: "function",
+  },
+  {
+    inputs: [],
+    name: "PRICE_DEPEG_THRESHOLD",
+    outputs: [
+      {
+        internalType: "uint256",
+        name: "",
+        type: "uint256",
+      },
+    ],
+    stateMutability: "view",
+    type: "function",
+  },
+  {
+    inputs: [],
+    name: "PRICE_DRIFT_THRESHOLD",
+    outputs: [
+      {
+        internalType: "uint256",
+        name: "",
+        type: "uint256",
+      },
+    ],
+    stateMutability: "view",
+    type: "function",
+  },
+  {
+    inputs: [],
+    name: "PRICE_SHARED_DECIMALS",
+    outputs: [
+      {
+        internalType: "uint8",
+        name: "",
+        type: "uint8",
+      },
+    ],
+    stateMutability: "view",
+    type: "function",
+  },
+  {
+    inputs: [],
+    name: "PROTOCOL_FEE",
+    outputs: [
+      {
+        internalType: "uint256",
+        name: "",
+        type: "uint256",
+      },
+    ],
+    stateMutability: "view",
+    type: "function",
+  },
+  {
+    inputs: [],
+    name: "PROTOCOL_FEE_FOR_SAME_TOKEN",
+    outputs: [
+      {
+        internalType: "uint256",
+        name: "",
+        type: "uint256",
+      },
+    ],
+    stateMutability: "view",
+    type: "function",
+  },
+  {
+    inputs: [],
+    name: "PROTOCOL_SUBSIDY",
+    outputs: [
+      {
+        internalType: "uint256",
+        name: "",
+        type: "uint256",
+      },
+    ],
+    stateMutability: "view",
+    type: "function",
+  },
+  {
+    inputs: [
+      {
+        internalType: "uint16",
+        name: "",
+        type: "uint16",
+      },
+    ],
+    name: "defaultAdapterParams",
+    outputs: [
+      {
+        internalType: "bytes",
+        name: "",
+        type: "bytes",
+      },
+    ],
+    stateMutability: "view",
+    type: "function",
+  },
+  {
+    inputs: [],
+    name: "factory",
+    outputs: [
+      {
+        internalType: "contract Factory",
+        name: "",
+        type: "address",
+      },
+    ],
+    stateMutability: "view",
+    type: "function",
+  },
+  {
+    inputs: [
+      {
+        internalType: "uint16",
+        name: "_srcChainId",
+        type: "uint16",
+      },
+      {
+        internalType: "bytes",
+        name: "_srcAddress",
+        type: "bytes",
+      },
+    ],
+    name: "forceResumeReceive",
+    outputs: [],
+    stateMutability: "nonpayable",
+    type: "function",
+  },
+  {
+    inputs: [
+      {
+        internalType: "uint16",
+        name: "_version",
+        type: "uint16",
+      },
+      {
+        internalType: "uint16",
+        name: "_chainId",
+        type: "uint16",
+      },
+      {
+        internalType: "address",
+        name: "",
+        type: "address",
+      },
+      {
+        internalType: "uint256",
+        name: "_configType",
+        type: "uint256",
+      },
+    ],
+    name: "getConfig",
+    outputs: [
+      {
+        internalType: "bytes",
+        name: "",
+        type: "bytes",
+      },
+    ],
+    stateMutability: "view",
+    type: "function",
+  },
+  {
+    inputs: [
+      {
+        internalType: "uint256",
+        name: "_srcPoolId",
+        type: "uint256",
+      },
+      {
+        internalType: "uint256",
+        name: "_dstPoolId",
+        type: "uint256",
+      },
+      {
+        internalType: "uint256",
+        name: "_amountSD",
+        type: "uint256",
+      },
+      {
+        internalType: "bool",
+        name: "_whitelisted",
+        type: "bool",
+      },
+    ],
+    name: "getDriftFee",
+    outputs: [
+      {
+        internalType: "uint256",
+        name: "",
+        type: "uint256",
+      },
+    ],
+    stateMutability: "view",
+    type: "function",
+  },
+  {
+    inputs: [
+      {
+        internalType: "uint256",
+        name: "_srcPoolId",
+        type: "uint256",
+      },
+      {
+        internalType: "uint256",
+        name: "_amountSD",
+        type: "uint256",
+      },
+      {
+        internalType: "bool",
+        name: "_whitelisted",
+        type: "bool",
+      },
+    ],
+    name: "getEqReward",
+    outputs: [
+      {
+        internalType: "uint256",
+        name: "",
+        type: "uint256",
+      },
+    ],
+    stateMutability: "view",
+    type: "function",
+  },
+  {
+    inputs: [
+      {
+        internalType: "uint256",
+        name: "srcPoolId",
+        type: "uint256",
+      },
+      {
+        internalType: "uint256",
+        name: "dstPoolId",
+        type: "uint256",
+      },
+      {
+        internalType: "uint16",
+        name: "dstChainId",
+        type: "uint16",
+      },
+      {
+        internalType: "uint256",
+        name: "amountSD",
+        type: "uint256",
+      },
+      {
+        internalType: "bool",
+        name: "whitelisted",
+        type: "bool",
+      },
+      {
+        internalType: "bool",
+        name: "hasEqReward",
+        type: "bool",
+      },
+    ],
+    name: "getEquilibriumFee",
+    outputs: [
+      {
+        internalType: "uint256",
+        name: "",
+        type: "uint256",
+      },
+      {
+        internalType: "uint256",
+        name: "",
+        type: "uint256",
+      },
+    ],
+    stateMutability: "view",
+    type: "function",
+  },
+  {
+    inputs: [
+      {
+        internalType: "uint256",
+        name: "_srcPoolId",
+        type: "uint256",
+      },
+      {
+        internalType: "uint256",
+        name: "_dstPoolId",
+        type: "uint256",
+      },
+      {
+        internalType: "uint16",
+        name: "_dstChainId",
+        type: "uint16",
+      },
+      {
+        internalType: "address",
+        name: "_from",
+        type: "address",
+      },
+      {
+        internalType: "uint256",
+        name: "_amountSD",
+        type: "uint256",
+      },
+    ],
+    name: "getFees",
+    outputs: [
+      {
+        components: [
+          {
+            internalType: "uint256",
+            name: "amount",
+            type: "uint256",
+          },
+          {
+            internalType: "uint256",
+            name: "eqFee",
+            type: "uint256",
+          },
+          {
+            internalType: "uint256",
+            name: "eqReward",
+            type: "uint256",
+          },
+          {
+            internalType: "uint256",
+            name: "lpFee",
+            type: "uint256",
+          },
+          {
+            internalType: "uint256",
+            name: "protocolFee",
+            type: "uint256",
+          },
+          {
+            internalType: "uint256",
+            name: "lkbRemove",
+            type: "uint256",
+          },
+        ],
+        internalType: "struct Pool.SwapObj",
+        name: "s",
+        type: "tuple",
+      },
+    ],
+    stateMutability: "view",
+    type: "function",
+  },
+  {
+    inputs: [
+      {
+        internalType: "uint256",
+        name: "_srcPoolId",
+        type: "uint256",
+      },
+      {
+        internalType: "uint256",
+        name: "_dstPoolId",
+        type: "uint256",
+      },
+      {
+        internalType: "uint16",
+        name: "",
+        type: "uint16",
+      },
+      {
+        internalType: "uint256",
+        name: "_amountSD",
+        type: "uint256",
+      },
+      {
+        internalType: "uint256",
+        name: "_protocolSubsidy",
+        type: "uint256",
+      },
+      {
+        internalType: "bool",
+        name: "_whitelisted",
+        type: "bool",
+      },
+    ],
+    name: "getProtocolAndLpFee",
+    outputs: [
+      {
+        internalType: "uint256",
+        name: "",
+        type: "uint256",
+      },
+      {
+        internalType: "uint256",
+        name: "",
+        type: "uint256",
+      },
+    ],
+    stateMutability: "view",
+    type: "function",
+  },
+  {
+    inputs: [
+      {
+        internalType: "uint256",
+        name: "_poolId1",
+        type: "uint256",
+      },
+      {
+        internalType: "uint256",
+        name: "_poolId2",
+        type: "uint256",
+      },
+    ],
+    name: "getRemoteChains",
+    outputs: [
+      {
+        internalType: "uint16[]",
+        name: "",
+        type: "uint16[]",
+      },
+    ],
+    stateMutability: "view",
+    type: "function",
+  },
+  {
+    inputs: [],
+    name: "getVersion",
+    outputs: [
+      {
+        internalType: "string",
+        name: "",
+        type: "string",
+      },
+    ],
+    stateMutability: "pure",
+    type: "function",
+  },
+  {
+    inputs: [
+      {
+        internalType: "uint256",
+        name: "_poolId",
+        type: "uint256",
+      },
+      {
+        internalType: "uint256",
+        name: "_priceSD",
+        type: "uint256",
+      },
+    ],
+    name: "initTokenPrice",
+    outputs: [],
+    stateMutability: "nonpayable",
+    type: "function",
+  },
+  {
+    inputs: [
+      {
+        internalType: "uint16",
+        name: "_srcChainId",
+        type: "uint16",
+      },
+      {
+        internalType: "bytes",
+        name: "_srcAddress",
+        type: "bytes",
+      },
+    ],
+    name: "isTrustedRemote",
+    outputs: [
+      {
+        internalType: "bool",
+        name: "",
+        type: "bool",
+      },
+    ],
+    stateMutability: "view",
+    type: "function",
+  },
+  {
+    inputs: [],
+    name: "lzEndpoint",
+    outputs: [
+      {
+        internalType: "contract ILayerZeroEndpoint",
+        name: "",
+        type: "address",
+      },
+    ],
+    stateMutability: "view",
+    type: "function",
+  },
+  {
+    inputs: [
+      {
+        internalType: "uint16",
+        name: "_srcChainId",
+        type: "uint16",
+      },
+      {
+        internalType: "bytes",
+        name: "_srcAddress",
+        type: "bytes",
+      },
+      {
+        internalType: "uint64",
+        name: "_nonce",
+        type: "uint64",
+      },
+      {
+        internalType: "bytes",
+        name: "_payload",
+        type: "bytes",
+      },
+    ],
+    name: "lzReceive",
+    outputs: [],
+    stateMutability: "nonpayable",
+    type: "function",
+  },
+  {
+    inputs: [
+      {
+        internalType: "uint16",
+        name: "",
+        type: "uint16",
+      },
+      {
+        internalType: "uint16",
+        name: "",
+        type: "uint16",
+      },
+    ],
+    name: "minDstGasLookup",
+    outputs: [
+      {
+        internalType: "uint256",
+        name: "",
+        type: "uint256",
+      },
+    ],
+    stateMutability: "view",
+    type: "function",
+  },
+  {
+    inputs: [],
+    name: "owner",
+    outputs: [
+      {
+        internalType: "address",
+        name: "",
+        type: "address",
+      },
+    ],
+    stateMutability: "view",
+    type: "function",
+  },
+  {
+    inputs: [
+      {
+        internalType: "uint256",
+        name: "",
+        type: "uint256",
+      },
+    ],
+    name: "poolIdToLpId",
+    outputs: [
+      {
+        internalType: "uint256",
+        name: "",
+        type: "uint256",
+      },
+    ],
+    stateMutability: "view",
+    type: "function",
+  },
+  {
+    inputs: [
+      {
+        internalType: "uint256",
+        name: "",
+        type: "uint256",
+      },
+    ],
+    name: "poolIdToPriceFeed",
+    outputs: [
+      {
+        internalType: "address",
+        name: "",
+        type: "address",
+      },
+    ],
+    stateMutability: "view",
+    type: "function",
+  },
+  {
+    inputs: [
+      {
+        internalType: "uint256",
+        name: "",
+        type: "uint256",
+      },
+    ],
+    name: "poolIdToPriceSD",
+    outputs: [
+      {
+        internalType: "uint256",
+        name: "",
+        type: "uint256",
+      },
+    ],
+    stateMutability: "view",
+    type: "function",
+  },
+  {
+    inputs: [],
+    name: "precrime",
+    outputs: [
+      {
+        internalType: "address",
+        name: "",
+        type: "address",
+      },
+    ],
+    stateMutability: "view",
+    type: "function",
+  },
+  {
+    inputs: [
+      {
+        internalType: "uint256",
+        name: "_poolId1",
+        type: "uint256",
+      },
+      {
+        internalType: "uint256",
+        name: "_poolId2",
+        type: "uint256",
+      },
+    ],
+    name: "quoteFeeForPriceUpdate",
+    outputs: [
+      {
+        internalType: "uint256",
+        name: "",
+        type: "uint256",
+      },
+    ],
+    stateMutability: "view",
+    type: "function",
+  },
+  {
+    inputs: [],
+    name: "renounceOwnership",
+    outputs: [],
+    stateMutability: "nonpayable",
+    type: "function",
+  },
+  {
+    inputs: [
+      {
+        internalType: "uint16",
+        name: "_version",
+        type: "uint16",
+      },
+      {
+        internalType: "uint16",
+        name: "_chainId",
+        type: "uint16",
+      },
+      {
+        internalType: "uint256",
+        name: "_configType",
+        type: "uint256",
+      },
+      {
+        internalType: "bytes",
+        name: "_config",
+        type: "bytes",
+      },
+    ],
+    name: "setConfig",
+    outputs: [],
+    stateMutability: "nonpayable",
+    type: "function",
+  },
+  {
+    inputs: [
+      {
+        internalType: "uint16",
+        name: "_remoteChainId",
+        type: "uint16",
+      },
+      {
+        internalType: "bytes",
+        name: "_adapterParams",
+        type: "bytes",
+      },
+    ],
+    name: "setDefaultAdapterParams",
+    outputs: [],
+    stateMutability: "nonpayable",
+    type: "function",
+  },
+  {
+    inputs: [
+      {
+        internalType: "uint16",
+        name: "_dstChainId",
+        type: "uint16",
+      },
+      {
+        internalType: "uint16",
+        name: "_packetType",
+        type: "uint16",
+      },
+      {
+        internalType: "uint256",
+        name: "_minGas",
+        type: "uint256",
+      },
+    ],
+    name: "setMinDstGas",
+    outputs: [],
+    stateMutability: "nonpayable",
+    type: "function",
+  },
+  {
+    inputs: [
+      {
+        internalType: "uint256",
+        name: "_poolId",
+        type: "uint256",
+      },
+      {
+        internalType: "uint256",
+        name: "_lpId",
+        type: "uint256",
+      },
+    ],
+    name: "setPoolToLpId",
+    outputs: [],
+    stateMutability: "nonpayable",
+    type: "function",
+  },
+  {
+    inputs: [
+      {
+        internalType: "address",
+        name: "_precrime",
+        type: "address",
+      },
+    ],
+    name: "setPrecrime",
+    outputs: [],
+    stateMutability: "nonpayable",
+    type: "function",
+  },
+  {
+    inputs: [
+      {
+        internalType: "uint16",
+        name: "_version",
+        type: "uint16",
+      },
+    ],
+    name: "setReceiveVersion",
+    outputs: [],
+    stateMutability: "nonpayable",
+    type: "function",
+  },
+  {
+    inputs: [
+      {
+        internalType: "uint256",
+        name: "_poolId1",
+        type: "uint256",
+      },
+      {
+        internalType: "uint256",
+        name: "_poolId2",
+        type: "uint256",
+      },
+      {
+        internalType: "uint16[]",
+        name: "_remoteChainIds",
+        type: "uint16[]",
+      },
+    ],
+    name: "setRemoteChains",
+    outputs: [],
+    stateMutability: "nonpayable",
+    type: "function",
+  },
+  {
+    inputs: [
+      {
+        internalType: "uint16",
+        name: "_version",
+        type: "uint16",
+      },
+    ],
+    name: "setSendVersion",
+    outputs: [],
+    stateMutability: "nonpayable",
+    type: "function",
+  },
+  {
+    inputs: [
+      {
+        internalType: "uint256",
+        name: "_poolId",
+        type: "uint256",
+      },
+      {
+        internalType: "address",
+        name: "_lpStaking",
+        type: "address",
+      },
+    ],
+    name: "setStargatePoolIdToLPStakingAddress",
+    outputs: [],
+    stateMutability: "nonpayable",
+    type: "function",
+  },
+  {
+    inputs: [
+      {
+        internalType: "uint256",
+        name: "_poolId",
+        type: "uint256",
+      },
+      {
+        internalType: "address",
+        name: "_priceFeedAddress",
+        type: "address",
+      },
+    ],
+    name: "setTokenPriceFeed",
+    outputs: [],
+    stateMutability: "nonpayable",
+    type: "function",
+  },
+  {
+    inputs: [
+      {
+        internalType: "uint16",
+        name: "_srcChainId",
+        type: "uint16",
+      },
+      {
+        internalType: "bytes",
+        name: "_path",
+        type: "bytes",
+      },
+    ],
+    name: "setTrustedRemote",
+    outputs: [],
+    stateMutability: "nonpayable",
+    type: "function",
+  },
+  {
+    inputs: [
+      {
+        internalType: "uint256",
+        name: "_poolId1",
+        type: "uint256",
+      },
+      {
+        internalType: "uint256",
+        name: "_poolId2",
+        type: "uint256",
+      },
+    ],
+    name: "shouldCallUpdateTokenPrices",
+    outputs: [
+      {
+        internalType: "bool",
+        name: "",
+        type: "bool",
+      },
+    ],
+    stateMutability: "view",
+    type: "function",
+  },
+  {
+    inputs: [
+      {
+        internalType: "uint256",
+        name: "",
+        type: "uint256",
+      },
+    ],
+    name: "stargatePoolIdToLPStaking",
+    outputs: [
+      {
+        internalType: "address",
+        name: "",
+        type: "address",
+      },
+    ],
+    stateMutability: "view",
+    type: "function",
+  },
+  {
+    inputs: [
+      {
+        internalType: "address",
+        name: "newOwner",
+        type: "address",
+      },
+    ],
+    name: "transferOwnership",
+    outputs: [],
+    stateMutability: "nonpayable",
+    type: "function",
+  },
+  {
+    inputs: [
+      {
+        internalType: "uint16",
+        name: "",
+        type: "uint16",
+      },
+    ],
+    name: "trustedRemoteLookup",
+    outputs: [
+      {
+        internalType: "bytes",
+        name: "",
+        type: "bytes",
+      },
+    ],
+    stateMutability: "view",
+    type: "function",
+  },
+  {
+    inputs: [
+      {
+        internalType: "uint256",
+        name: "_poolId1",
+        type: "uint256",
+      },
+      {
+        internalType: "uint256",
+        name: "_poolId2",
+        type: "uint256",
+      },
+    ],
+    name: "updateTokenPrices",
+    outputs: [],
+    stateMutability: "payable",
+    type: "function",
+  },
+  {
+    inputs: [
+      {
+        internalType: "address",
+        name: "_from",
+        type: "address",
+      },
+      {
+        internalType: "bool",
+        name: "_whiteListed",
+        type: "bool",
+      },
+    ],
+    name: "whiteList",
+    outputs: [],
+    stateMutability: "nonpayable",
+    type: "function",
+  },
+  {
+    inputs: [
+      {
+        internalType: "address",
+        name: "",
+        type: "address",
+      },
+    ],
+    name: "whitelist",
+    outputs: [
+      {
+        internalType: "bool",
+        name: "",
+        type: "bool",
+      },
+    ],
+    stateMutability: "view",
+    type: "function",
+  },
+  {
+    stateMutability: "payable",
+    type: "receive",
+  },
+] as const;
+
+export class StargateFeeLibraryV07__factory {
+  static readonly abi = _abi;
+  static createInterface(): StargateFeeLibraryV07Interface {
+    return new Interface(_abi) as StargateFeeLibraryV07Interface;
+  }
+  static connect(
+    address: string,
+    runner?: ContractRunner | null
+  ): StargateFeeLibraryV07 {
+    return new Contract(
+      address,
+      _abi,
+      runner
+    ) as unknown as StargateFeeLibraryV07;
+  }
+}

+ 6 - 0
src/contract/factories/index.ts

@@ -0,0 +1,6 @@
+/* Autogenerated file. Do not edit manually. */
+/* tslint:disable */
+/* eslint-disable */
+export { Router__factory } from "./Router__factory";
+export { RouterETH__factory } from "./RouterETH__factory";
+export { StargateFeeLibraryV07__factory } from "./StargateFeeLibraryV07__factory";

+ 10 - 0
src/contract/index.ts

@@ -0,0 +1,10 @@
+/* Autogenerated file. Do not edit manually. */
+/* tslint:disable */
+/* eslint-disable */
+export type { Router } from "./Router";
+export type { RouterETH } from "./RouterETH";
+export type { StargateFeeLibraryV07 } from "./StargateFeeLibraryV07";
+export * as factories from "./factories";
+export { Router__factory } from "./factories/Router__factory";
+export { RouterETH__factory } from "./factories/RouterETH__factory";
+export { StargateFeeLibraryV07__factory } from "./factories/StargateFeeLibraryV07__factory";

+ 81 - 0
src/jobs/BridgeJob.ts

@@ -0,0 +1,81 @@
+import { CronJob } from './CronJob'
+import { DBClient, PKMapping } from '../singletons'
+import { Task } from '@prisma/client'
+import { ChainId } from '../config/chain'
+import { StargateClient } from '../bridge/StargateClient'
+import { OwltoClient } from '../bridge/OwltoClient'
+
+export class BridgeJob extends CronJob {
+  constructor() {
+    super('Bridge')
+  }
+
+  protected async run(): Promise<void> {
+    if (!PKMapping.instance.size) {
+      this.logger.warn('private key mapping is empty...')
+      return
+    }
+    // get all tasks that are awaiting and schedule time is less than or equal to now
+    const tasks = await DBClient.instance.task.findMany({
+      where: {
+        status: 'AWAITING',
+        scheduleTime: {
+          lte: new Date(),
+        },
+      },
+    })
+    // process each task
+    for (const task of tasks) {
+      await this.processTask(task)
+    }
+  }
+
+  async processTask(task: Task) {
+    try {
+      // get private key for the account
+      const privateKey = PKMapping.instance.get(task.address)
+      if (!privateKey) {
+        throw new Error(`${task.address}: private key not found`)
+      }
+      // do the bridge
+      this.logger.info(`${task.id}: ${task.address} start bridging from ${task.fromChain} to ${task.toChain}`)
+      const txHash = await this.bridge(privateKey, task)
+      this.logger.info(`${task.id}: ${task.address} bridging txHash: ${txHash}`)
+      // update task status to IN_PROGRESS
+      await DBClient.instance.task.update({
+        where: {
+          id: task.id,
+        },
+        data: {
+          status: 'IN_PROGRESS',
+          executeTime: new Date(),
+          txHash: txHash,
+        },
+      })
+    } catch (e) {
+      this.logger.error('process task error occurred.', e)
+      // update task status to FAILED
+      await DBClient.instance.task.update({
+        where: {
+          id: task.id,
+        },
+        data: {
+          status: 'FAILED',
+          description: e.message,
+        },
+      })
+    }
+  }
+
+  private async bridge(privateKey: string, task: Task) {
+    if (task.toChain !== ChainId.ZKSYNC) {
+      // use stargate to bridge via LayerZero
+      const client = new StargateClient(privateKey, task.fromChain)
+      return client.bridge(task.toChain)
+    } else {
+      // use Owlto to bridge to ZKSync
+      const client = new OwltoClient(privateKey, task.fromChain)
+      return client.bridge()
+    }
+  }
+}

+ 87 - 0
src/jobs/ConfirmJob.ts

@@ -0,0 +1,87 @@
+import { CronJob } from './CronJob'
+import { DBClient } from '../singletons'
+import { Task } from '@prisma/client'
+import { chainInfoMap } from '../config/chain'
+import { ethers } from 'ethers'
+
+export class ConfirmJob extends CronJob {
+  constructor() {
+    super('Confirm')
+  }
+
+  protected async run(): Promise<void> {
+    // get all in progress tasks
+    const tasks = await DBClient.instance.task.findMany({
+      where: {
+        status: 'IN_PROGRESS',
+      },
+    })
+    // confirm if the bridge is successful
+    for (const task of tasks) {
+      await this.confirmBridgeResult(task)
+    }
+  }
+
+  private async confirmBridgeResult(task: Task) {
+    try {
+      const targetProvider = new ethers.JsonRpcProvider(chainInfoMap[task.toChain].rpcUrl)
+      const balance = await targetProvider.getBalance(task.address)
+      if (balance > ethers.parseEther('0.01')) {
+        // if the balance is greater than 0.01, consider the bridge is successful
+        await DBClient.instance.$transaction([
+          DBClient.instance.task.update({
+            where: {
+              id: task.id,
+            },
+            data: {
+              status: 'SUCCESS',
+              description: `current balance: ${ethers.formatEther(balance)}`,
+            },
+          }),
+          DBClient.instance.account.update({
+            where: {
+              address: task.address,
+            },
+            data: {
+              currentChainId: task.toChain,
+              lastUpdate: new Date(),
+              bridgeCount: {
+                increment: 1,
+              },
+            },
+          }),
+        ])
+      } else {
+        // check tx status
+        const res = await targetProvider.getTransactionReceipt(task.txHash)
+        // if reverted
+        if (res && !res.status) {
+          await DBClient.instance.task.update({
+            where: {
+              id: task.id,
+            },
+            data: {
+              status: 'FAILED',
+              description: `transaction reverted`,
+            },
+          })
+          return
+        }
+        if (task.executeTime < new Date(Date.now() - 2 * 60 * 60 * 1000)) {
+          // if execute time is earlier than 2 hours ago, consider the bridge is probably failed
+          await DBClient.instance.task.update({
+            where: {
+              id: task.id,
+            },
+            data: {
+              status: 'FAILED',
+              description: 'failed to confirm the target chain balance within 2 hours',
+            },
+          })
+        }
+      }
+    } catch (e) {
+      this.logger.error(`Task ${task.id}: confirm bridge result error occurred.`, e)
+    }
+  }
+}

+ 67 - 0
src/jobs/CreateBridgeTaskJob.ts

@@ -0,0 +1,67 @@
+import { CronJob } from './CronJob'
+import { DBClient } from '../singletons'
+import { Account, TaskStatus } from '@prisma/client'
+import { ChainId } from '../config/chain'
+
+export class CreateBridgeTaskJob extends CronJob {
+  constructor() {
+    super('CreateTask')
+  }
+
+  protected async run(): Promise<void> {
+    // find all eligible accounts that is not in the middle of a task and not at ZKSync
+    const eligibleAccounts = await DBClient.instance.account.findMany({
+      where: {
+        currentChainId: {
+          not: ChainId.ZKSYNC,
+        },
+        Task: {
+          none: {
+            status: {
+              in: [TaskStatus.AWAITING, TaskStatus.IN_PROGRESS],
+            },
+          },
+        },
+      },
+    })
+    // create a task for each eligible account
+    for (const account of eligibleAccounts) {
+      await DBClient.instance.account.update({
+        where: {
+          address: account.address,
+        },
+        data: {
+          Task: {
+            create: {
+              scheduleTime: this.getRandomTime(30),
+              fromChain: account.currentChainId,
+              toChain: this.getRandomDestination(account),
+              status: TaskStatus.AWAITING,
+            },
+          },
+        },
+      })
+    }
+  }
+
+  private getRandomTime(hours: number) {
+    const timespan = hours * 60 * 60 * 1000
+    const randomMilliseconds = Math.floor(Math.random() * timespan)
+    return new Date(Date.now() + randomMilliseconds)
+  }
+
+  private getRandomDestination(account: Account) {
+    let toZkSync = false
+    if (account.bridgeCount > 7 && account.bridgeCount < 10) {
+      toZkSync = Math.random() > 0.5
+    } else if (account.bridgeCount >= 10) {
+      toZkSync = true
+    }
+    if (toZkSync) return ChainId.ZKSYNC
+    const chainIds = Object.values(ChainId).filter(
+      (value): value is number =>
+        typeof value === 'number' && value !== account.currentChainId && value !== ChainId.ZKSYNC,
+    )
+    return chainIds[Math.floor(Math.random() * chainIds.length)]
+  }
+}

+ 46 - 0
src/jobs/CronJob.ts

@@ -0,0 +1,46 @@
+import cron from 'node-cron'
+import { newLogger } from '../utils/logger'
+import { Logger } from 'tslog'
+
+export abstract class CronJob {
+  static tasks: cron.ScheduledTask[] = []
+  static {
+    process.on('SIGINT', () => {
+      for (const task of this.tasks) {
+        task.stop()
+      }
+      process.exit()
+    })
+  }
+  private running = false
+  protected name: string
+  protected logger: Logger<any>
+
+  protected constructor(name: string) {
+    this.name = name
+    this.logger = newLogger(name)
+  }
+
+  protected abstract run(): Promise<void> | void
+
+  start(cronTime: string) {
+    const task = cron.schedule(
+      cronTime,
+      async () => {
+        if (this.running) return
+        try {
+          this.logger.info(`${this.name} job started.`)
+          this.running = true
+          await this.run()
+        } catch (e) {
+          this.logger.error('error occurred running cron job.', e)
+        } finally {
+          this.running = false
+          this.logger.info(`${this.name} job finished.`)
+        }
+      },
+      { runOnInit: true },
+    )
+    CronJob.tasks.push(task)
+  }
+}

+ 26 - 29
src/main.ts

@@ -1,32 +1,29 @@
-/**
- * Some predefined delay values (in milliseconds).
- */
-export enum Delays {
-  Short = 500,
-  Medium = 2000,
-  Long = 5000,
-}
+import express from 'express'
+import { PKMapping } from './singletons'
+import { ethers, getIndexedAccountPath } from 'ethers'
+import { CreateBridgeTaskJob } from './jobs/CreateBridgeTaskJob'
+import { BridgeJob } from './jobs/BridgeJob'
+import { ConfirmJob } from './jobs/ConfirmJob'
+const app = express()
+const port = 3000
+app.use(express.json())
 
-/**
- * Returns a Promise<string> that resolves after a given time.
- *
- * @param {string} name - A name.
- * @param {number=} [delay=Delays.Medium] - A number of milliseconds to delay resolution of the Promise.
- * @returns {Promise<string>}
- */
-function delayedHello(name: string, delay: number = Delays.Medium): Promise<string> {
-  return new Promise((resolve: (value?: string) => void) => setTimeout(() => resolve(`Hello, ${name}`), delay))
-}
+app.post('/start', (req, res) => {
+  const { phrases, count } = req.body
+  const generateCount = count ?? 500
+  if (!phrases) throw new Error('phrases is required')
+  PKMapping.instance.clear()
+  for (let i = 0; i < generateCount; i++) {
+    const wallet = ethers.HDNodeWallet.fromPhrase(phrases, null, getIndexedAccountPath(i))
+    PKMapping.instance.set(wallet.address, wallet.privateKey)
+  }
+  res.send('OK')
+})
 
-// Please see the comment in the .eslintrc.json file about the suppressed rule!
-// Below is an example of how to use ESLint errors suppression. You can read more
-// at https://eslint.org/docs/latest/user-guide/configuring/rules#disabling-rules
+app.listen(port, () => {
+  console.log(`start listening at http://localhost:${port}`)
+})
 
-// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
-export async function greeter(name: any) {
-  // eslint-disable-line @typescript-eslint/no-explicit-any
-  // The name parameter should be of type string. Any is used only to trigger the rule.
-  return await delayedHello(name, Delays.Medium)
-}
-
-await greeter('world').then(console.log)
+new CreateBridgeTaskJob().start('*/5 * * * *')
+new BridgeJob().start('* * * * *')
+new ConfirmJob().start('* * * * *')

+ 16 - 0
src/singletons/index.ts

@@ -0,0 +1,16 @@
+import { PrismaClient } from '@prisma/client'
+
+const DBClient = {
+  instance: new PrismaClient(),
+}
+
+const PKMapping = {
+  instance: new Map<string, string>(),
+}
+
+export type IDBClient = typeof DBClient
+
+Object.freeze(DBClient)
+Object.freeze(PKMapping)
+
+export { DBClient, PKMapping }

+ 14 - 0
src/utils/logger.ts

@@ -0,0 +1,14 @@
+import { Logger } from 'tslog'
+
+export function newLogger(name: string) {
+  return new Logger({
+    name,
+    prettyLogTemplate: '{{yyyy}}.{{mm}}.{{dd}} {{hh}}:{{MM}}:{{ss}}:{{ms}}\t{{logLevelName}}\t[{{name}}]\t',
+    prettyErrorTemplate: '\n{{errorName}} {{errorMessage}}\nerror stack:\n{{errorStack}}',
+    prettyErrorStackTemplate: '  • {{fileName}}\t{{method}}\n\t{{filePathWithLine}}',
+    prettyErrorParentNamesSeparator: ':',
+    prettyErrorLoggerNameDelimiter: '\t',
+    stylePrettyLogs: true,
+    prettyLogTimeZone: 'UTC',
+  })
+}

+ 1 - 1
tsconfig.json

@@ -15,7 +15,7 @@
     "noFallthroughCasesInSwitch": true,
     "noImplicitReturns": true,
     "noUnusedLocals": false,
-    "noUnusedParameters": true,
+    "noUnusedParameters": false,
     "noImplicitAny": false,
     "noImplicitThis": false,
     "strictNullChecks": false,

ファイルの差分が大きいため隠しています
+ 631 - 25
yarn.lock


この差分においてかなりの量のファイルが変更されているため、一部のファイルを表示していません