├── .npmrc ├── tests ├── .latest.json ├── euler-earn-factory-utils.ts ├── euler-earn.test.ts ├── euler-earn-factory.test.ts ├── tracking.test.ts └── euler-earn-utils.ts ├── contracts ├── abi │ ├── lens │ │ ├── 1 │ │ │ └── index.ts │ │ ├── 10 │ │ │ └── index.ts │ │ ├── 56 │ │ │ └── index.ts │ │ ├── 100 │ │ │ └── index.ts │ │ ├── 130 │ │ │ └── index.ts │ │ ├── 137 │ │ │ └── index.ts │ │ ├── 146 │ │ │ └── index.ts │ │ ├── 239 │ │ │ └── index.ts │ │ ├── 480 │ │ │ └── index.ts │ │ ├── 999 │ │ │ └── index.ts │ │ ├── 1923 │ │ │ └── index.ts │ │ ├── 2390 │ │ │ └── index.ts │ │ ├── 8453 │ │ │ └── index.ts │ │ ├── 42161 │ │ │ └── index.ts │ │ ├── 43114 │ │ │ └── index.ts │ │ ├── 57073 │ │ │ └── index.ts │ │ ├── 60808 │ │ │ └── index.ts │ │ └── 80094 │ │ │ └── index.ts │ ├── index.ts │ ├── swapVerifierAbi.ts │ ├── basePerspectiveAbi.ts │ ├── termsOfUseSignerAbi.ts │ ├── swapperAbi.ts │ └── feeFlowControllerAbi.ts └── addresses │ ├── 1 │ ├── tokenAddresses.ts │ ├── swapAddresses.ts │ ├── index.ts │ ├── lensAddresses.ts │ ├── coreAddresses.ts │ └── peripheryAddresses.ts │ ├── 10 │ ├── tokenAddresses.ts │ ├── swapAddresses.ts │ ├── index.ts │ ├── lensAddresses.ts │ ├── coreAddresses.ts │ └── peripheryAddresses.ts │ ├── 56 │ ├── tokenAddresses.ts │ ├── swapAddresses.ts │ ├── index.ts │ ├── lensAddresses.ts │ ├── coreAddresses.ts │ └── peripheryAddresses.ts │ ├── 100 │ ├── tokenAddresses.ts │ ├── index.ts │ ├── swapAddresses.ts │ ├── lensAddresses.ts │ ├── coreAddresses.ts │ └── peripheryAddresses.ts │ ├── 130 │ ├── tokenAddresses.ts │ ├── index.ts │ ├── swapAddresses.ts │ ├── lensAddresses.ts │ ├── coreAddresses.ts │ └── peripheryAddresses.ts │ ├── 137 │ ├── tokenAddresses.ts │ ├── index.ts │ ├── swapAddresses.ts │ ├── lensAddresses.ts │ ├── coreAddresses.ts │ └── peripheryAddresses.ts │ ├── 146 │ ├── tokenAddresses.ts │ ├── index.ts │ ├── swapAddresses.ts │ ├── lensAddresses.ts │ ├── coreAddresses.ts │ └── peripheryAddresses.ts │ ├── 239 │ ├── tokenAddresses.ts │ ├── index.ts │ ├── swapAddresses.ts │ ├── lensAddresses.ts │ ├── coreAddresses.ts │ └── peripheryAddresses.ts │ ├── 480 │ ├── tokenAddresses.ts │ ├── index.ts │ ├── swapAddresses.ts │ ├── lensAddresses.ts │ ├── coreAddresses.ts │ └── peripheryAddresses.ts │ ├── 999 │ ├── tokenAddresses.ts │ ├── index.ts │ ├── swapAddresses.ts │ ├── lensAddresses.ts │ ├── coreAddresses.ts │ └── peripheryAddresses.ts │ ├── 1923 │ ├── tokenAddresses.ts │ ├── swapAddresses.ts │ ├── index.ts │ ├── lensAddresses.ts │ ├── coreAddresses.ts │ └── peripheryAddresses.ts │ ├── 2390 │ ├── tokenAddresses.ts │ ├── index.ts │ ├── swapAddresses.ts │ ├── lensAddresses.ts │ ├── coreAddresses.ts │ └── peripheryAddresses.ts │ ├── 8453 │ ├── tokenAddresses.ts │ ├── swapAddresses.ts │ ├── index.ts │ ├── lensAddresses.ts │ ├── coreAddresses.ts │ └── peripheryAddresses.ts │ ├── 42161 │ ├── tokenAddresses.ts │ ├── swapAddresses.ts │ ├── index.ts │ ├── lensAddresses.ts │ ├── coreAddresses.ts │ └── peripheryAddresses.ts │ ├── 43114 │ ├── tokenAddresses.ts │ ├── swapAddresses.ts │ ├── index.ts │ ├── lensAddresses.ts │ ├── coreAddresses.ts │ └── peripheryAddresses.ts │ ├── 57073 │ ├── tokenAddresses.ts │ ├── swapAddresses.ts │ ├── index.ts │ ├── lensAddresses.ts │ ├── coreAddresses.ts │ └── peripheryAddresses.ts │ ├── 60808 │ ├── tokenAddresses.ts │ ├── swapAddresses.ts │ ├── index.ts │ ├── lensAddresses.ts │ ├── coreAddresses.ts │ └── peripheryAddresses.ts │ ├── 80094 │ ├── tokenAddresses.ts │ ├── swapAddresses.ts │ ├── index.ts │ ├── lensAddresses.ts │ ├── coreAddresses.ts │ └── peripheryAddresses.ts │ └── index.ts ├── tsconfig.json ├── .gitignore ├── scripts ├── tsconfig.scripts.json ├── tag-deployments.ts ├── prepare.ts ├── utils │ └── utils.ts ├── generate-deployments.ts ├── deploy.ts ├── abisAddressesSync.sh └── config.ts ├── src ├── utils │ ├── eulerSwap.ts │ ├── counter.ts │ ├── clasicVaut.ts │ ├── constants.ts │ └── earnVault.ts ├── factories │ ├── euler-vault-factory.ts │ ├── euler-earn-factory.ts │ └── euler-swap-factory.ts ├── euler-swap.ts ├── ethereum-vault-connector.ts └── euler-earn.ts ├── verify ├── utils │ └── utils.ts ├── checkAccountPositions.ts └── checkAccountVaultBalances.ts ├── deployments.json ├── abis ├── EulerEarnFactory.json └── EulerVaultFactory.json ├── package.json ├── README.md └── template └── subgraph.template.yaml /.npmrc: -------------------------------------------------------------------------------- 1 | engine-strict=true 2 | use-pnpm=true 3 | -------------------------------------------------------------------------------- /tests/.latest.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.6.0", 3 | "timestamp": 1738845245118 4 | } -------------------------------------------------------------------------------- /contracts/abi/lens/1/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./accountLensAbi" 2 | export * from "./lqgEarnVaultLensAbi" 3 | export * from "./utilsLensAbi" 4 | export * from "./vaultLensAbi" 5 | -------------------------------------------------------------------------------- /contracts/abi/lens/10/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./accountLensAbi" 2 | export * from "./lqgEarnVaultLensAbi" 3 | export * from "./utilsLensAbi" 4 | export * from "./vaultLensAbi" 5 | -------------------------------------------------------------------------------- /contracts/abi/lens/100/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./accountLensAbi" 2 | export * from "./lqgEarnVaultLensAbi" 3 | export * from "./utilsLensAbi" 4 | export * from "./vaultLensAbi" 5 | -------------------------------------------------------------------------------- /contracts/abi/lens/130/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./accountLensAbi" 2 | export * from "./lqgEarnVaultLensAbi" 3 | export * from "./utilsLensAbi" 4 | export * from "./vaultLensAbi" 5 | -------------------------------------------------------------------------------- /contracts/abi/lens/137/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./accountLensAbi" 2 | export * from "./lqgEarnVaultLensAbi" 3 | export * from "./utilsLensAbi" 4 | export * from "./vaultLensAbi" 5 | -------------------------------------------------------------------------------- /contracts/abi/lens/146/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./accountLensAbi" 2 | export * from "./lqgEarnVaultLensAbi" 3 | export * from "./utilsLensAbi" 4 | export * from "./vaultLensAbi" 5 | -------------------------------------------------------------------------------- /contracts/abi/lens/1923/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./accountLensAbi" 2 | export * from "./lqgEarnVaultLensAbi" 3 | export * from "./utilsLensAbi" 4 | export * from "./vaultLensAbi" 5 | -------------------------------------------------------------------------------- /contracts/abi/lens/239/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./accountLensAbi" 2 | export * from "./lqgEarnVaultLensAbi" 3 | export * from "./utilsLensAbi" 4 | export * from "./vaultLensAbi" 5 | -------------------------------------------------------------------------------- /contracts/abi/lens/2390/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./accountLensAbi" 2 | export * from "./lqgEarnVaultLensAbi" 3 | export * from "./utilsLensAbi" 4 | export * from "./vaultLensAbi" 5 | -------------------------------------------------------------------------------- /contracts/abi/lens/42161/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./accountLensAbi" 2 | export * from "./lqgEarnVaultLensAbi" 3 | export * from "./utilsLensAbi" 4 | export * from "./vaultLensAbi" 5 | -------------------------------------------------------------------------------- /contracts/abi/lens/43114/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./accountLensAbi" 2 | export * from "./lqgEarnVaultLensAbi" 3 | export * from "./utilsLensAbi" 4 | export * from "./vaultLensAbi" 5 | -------------------------------------------------------------------------------- /contracts/abi/lens/480/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./accountLensAbi" 2 | export * from "./lqgEarnVaultLensAbi" 3 | export * from "./utilsLensAbi" 4 | export * from "./vaultLensAbi" 5 | -------------------------------------------------------------------------------- /contracts/abi/lens/56/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./accountLensAbi" 2 | export * from "./lqgEarnVaultLensAbi" 3 | export * from "./utilsLensAbi" 4 | export * from "./vaultLensAbi" 5 | -------------------------------------------------------------------------------- /contracts/abi/lens/57073/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./accountLensAbi" 2 | export * from "./lqgEarnVaultLensAbi" 3 | export * from "./utilsLensAbi" 4 | export * from "./vaultLensAbi" 5 | -------------------------------------------------------------------------------- /contracts/abi/lens/60808/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./accountLensAbi" 2 | export * from "./lqgEarnVaultLensAbi" 3 | export * from "./utilsLensAbi" 4 | export * from "./vaultLensAbi" 5 | -------------------------------------------------------------------------------- /contracts/abi/lens/80094/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./accountLensAbi" 2 | export * from "./lqgEarnVaultLensAbi" 3 | export * from "./utilsLensAbi" 4 | export * from "./vaultLensAbi" 5 | -------------------------------------------------------------------------------- /contracts/abi/lens/8453/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./accountLensAbi" 2 | export * from "./lqgEarnVaultLensAbi" 3 | export * from "./utilsLensAbi" 4 | export * from "./vaultLensAbi" 5 | -------------------------------------------------------------------------------- /contracts/abi/lens/999/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./accountLensAbi" 2 | export * from "./lqgEarnVaultLensAbi" 3 | export * from "./utilsLensAbi" 4 | export * from "./vaultLensAbi" 5 | -------------------------------------------------------------------------------- /contracts/addresses/1/tokenAddresses.ts: -------------------------------------------------------------------------------- 1 | export const tokenAddresses = { 2 | EUL: "0xd9Fcd98c322942075A5C3860693e9f4f03AAE07b", 3 | rEUL: "0xf3e621395fc714B90dA337AA9108771597b4E696", 4 | } as const 5 | -------------------------------------------------------------------------------- /contracts/addresses/10/tokenAddresses.ts: -------------------------------------------------------------------------------- 1 | export const tokenAddresses = { 2 | EUL: "0xA8A7c3468Faa6750f1Dc5FDAfdcE03cDEA029304", 3 | rEUL: "0x5Ee4d837AB84285924AE746Eb5622Bb6774692be", 4 | } as const 5 | -------------------------------------------------------------------------------- /contracts/addresses/100/tokenAddresses.ts: -------------------------------------------------------------------------------- 1 | export const tokenAddresses = { 2 | EUL: "0x6CA7d728949528b52f9A0AEbCa6D68d9874A8728", 3 | rEUL: "0x33f3D7916615EBDeEE66943ed1024D2444eFd9FB", 4 | } as const 5 | -------------------------------------------------------------------------------- /contracts/addresses/130/tokenAddresses.ts: -------------------------------------------------------------------------------- 1 | export const tokenAddresses = { 2 | EUL: "0xE9C43e09C5FA733bCC2aEAa96063A4a60147AA09", 3 | rEUL: "0x1b0e3Da51b2517E09aE74CD31b708e46B9158E8b", 4 | } as const 5 | -------------------------------------------------------------------------------- /contracts/addresses/137/tokenAddresses.ts: -------------------------------------------------------------------------------- 1 | export const tokenAddresses = { 2 | EUL: "0x1323a02946877e0F0c1CA99468f4429Cc0F0954c", 3 | rEUL: "0xbfB6318123dA1682B8bD963846C1e9608F5F3Cda", 4 | } as const 5 | -------------------------------------------------------------------------------- /contracts/addresses/146/tokenAddresses.ts: -------------------------------------------------------------------------------- 1 | export const tokenAddresses = { 2 | EUL: "0x8e15C8D399e86d4FD7B427D42f06c60cDD9397e7", 3 | rEUL: "0x09E6cab47B7199b9d3839A2C40654f246d518a80", 4 | } as const 5 | -------------------------------------------------------------------------------- /contracts/addresses/1923/tokenAddresses.ts: -------------------------------------------------------------------------------- 1 | export const tokenAddresses = { 2 | EUL: "0x80ccFBec4b8c82265abdc226Ad3Df84C0726E7A3", 3 | rEUL: "0x021694af083d67950Ac994E63e0a70C30D913836", 4 | } as const 5 | -------------------------------------------------------------------------------- /contracts/addresses/239/tokenAddresses.ts: -------------------------------------------------------------------------------- 1 | export const tokenAddresses = { 2 | EUL: "0x38C043856A109066d64a60c82e07848a1C58e7Dc", 3 | rEUL: "0xCf623E50430CCb55214985F9C986a5Fa50aD7686", 4 | } as const 5 | -------------------------------------------------------------------------------- /contracts/addresses/2390/tokenAddresses.ts: -------------------------------------------------------------------------------- 1 | export const tokenAddresses = { 2 | EUL: "0x00bD3eFf25E6fB0A164026BD5f2916801bdf434E", 3 | rEUL: "0xFd140871bABAe1176bA0E38f5813d56B6B53837F", 4 | } as const 5 | -------------------------------------------------------------------------------- /contracts/addresses/480/tokenAddresses.ts: -------------------------------------------------------------------------------- 1 | export const tokenAddresses = { 2 | EUL: "0x24D6f84DC525eD073E2f9969D45A192C064397b8", 3 | rEUL: "0xbceBC1cEbDB9704Ff4332634d5662E342685AF9F", 4 | } as const 5 | -------------------------------------------------------------------------------- /contracts/addresses/56/tokenAddresses.ts: -------------------------------------------------------------------------------- 1 | export const tokenAddresses = { 2 | EUL: "0x2117E8b79e8E176A670c9fCf945d4348556bfFad", 3 | rEUL: "0x5e13d41913aDF18bb2acAe34228E8D21f3c2f2Eb", 4 | } as const 5 | -------------------------------------------------------------------------------- /contracts/addresses/8453/tokenAddresses.ts: -------------------------------------------------------------------------------- 1 | export const tokenAddresses = { 2 | EUL: "0xa153Ad732F831a79b5575Fa02e793EC4E99181b0", 3 | rEUL: "0xE08e1f00D388E201e48842E53fA96195568e6813", 4 | } as const 5 | -------------------------------------------------------------------------------- /contracts/addresses/999/tokenAddresses.ts: -------------------------------------------------------------------------------- 1 | export const tokenAddresses = { 2 | EUL: "0x3A41f426E55ECdE4BC734fA79ccE991b94aFf711", 3 | rEUL: "0x14DCA6543Ef03b932cBD801FBfd70e42a9b6122b", 4 | } as const 5 | -------------------------------------------------------------------------------- /contracts/addresses/1/swapAddresses.ts: -------------------------------------------------------------------------------- 1 | export const swapAddresses = { 2 | lqgSwapFactory: "0xb013be1D0D380C13B58e889f412895970A2Cf228", 3 | lqgSwap: "0x0000000000000000000000000000000000000000", 4 | } 5 | -------------------------------------------------------------------------------- /contracts/addresses/10/swapAddresses.ts: -------------------------------------------------------------------------------- 1 | export const swapAddresses = { 2 | lqgSwapFactory: "0x0000000000000000000000000000000000000000", 3 | lqgSwap: "0x0000000000000000000000000000000000000000", 4 | } 5 | -------------------------------------------------------------------------------- /contracts/addresses/42161/tokenAddresses.ts: -------------------------------------------------------------------------------- 1 | export const tokenAddresses = { 2 | EUL: "0x462cD9E0247b2e63831c3189aE738E5E9a5a4b64", 3 | rEUL: "0xFA31599a4928c2d57C0dd77DFCA5DA1E94E6D2D2", 4 | } as const 5 | -------------------------------------------------------------------------------- /contracts/addresses/43114/tokenAddresses.ts: -------------------------------------------------------------------------------- 1 | export const tokenAddresses = { 2 | EUL: "0x9ceeD3A7f753608372eeAb300486cc7c2F38AC68", 3 | rEUL: "0x2e3b32730B4F6b6502BdAa9122df3B026eDE5391", 4 | } as const 5 | -------------------------------------------------------------------------------- /contracts/addresses/56/swapAddresses.ts: -------------------------------------------------------------------------------- 1 | export const swapAddresses = { 2 | lqgSwapFactory: "0x3e378e5E339DF5e0Da32964F9EEC2CDb90D28Cc7", 3 | lqgSwap: "0x0000000000000000000000000000000000000000", 4 | } 5 | -------------------------------------------------------------------------------- /contracts/addresses/57073/tokenAddresses.ts: -------------------------------------------------------------------------------- 1 | export const tokenAddresses = { 2 | EUL: "0xB90e23CeF93CA91c1526aAF9742A13A0946E9de4", 3 | rEUL: "0x47296EC1Ec5143640653169D1a6c8C2C387E41A6", 4 | } as const 5 | -------------------------------------------------------------------------------- /contracts/addresses/60808/tokenAddresses.ts: -------------------------------------------------------------------------------- 1 | export const tokenAddresses = { 2 | EUL: "0xDe1763aFA5eB658CfFFfD16835AfeB47e7aC0B8D", 3 | rEUL: "0x9f395F610Af9ffC98693A0769190446180dc7192", 4 | } as const 5 | -------------------------------------------------------------------------------- /contracts/addresses/80094/tokenAddresses.ts: -------------------------------------------------------------------------------- 1 | export const tokenAddresses = { 2 | EUL: "0xEb9b5f4EB023aE754fF59A04c9C038D58606DAC6", 3 | rEUL: "0x56C44d2F484A61ce92Fa0BCc849feB37aBfeB59C", 4 | } as const 5 | -------------------------------------------------------------------------------- /contracts/addresses/1/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./coreAddresses" 2 | export * from "./lensAddresses" 3 | export * from "./peripheryAddresses" 4 | export * from "./swapAddresses" 5 | export * from "./tokenAddresses" 6 | -------------------------------------------------------------------------------- /contracts/addresses/10/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./coreAddresses" 2 | export * from "./lensAddresses" 3 | export * from "./peripheryAddresses" 4 | export * from "./swapAddresses" 5 | export * from "./tokenAddresses" 6 | -------------------------------------------------------------------------------- /contracts/addresses/100/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./coreAddresses" 2 | export * from "./lensAddresses" 3 | export * from "./peripheryAddresses" 4 | export * from "./swapAddresses" 5 | export * from "./tokenAddresses" 6 | -------------------------------------------------------------------------------- /contracts/addresses/100/swapAddresses.ts: -------------------------------------------------------------------------------- 1 | export const swapAddresses = { 2 | lqgSwapFactory: "0x0000000000000000000000000000000000000000", 3 | lqgSwap: "0x0000000000000000000000000000000000000000", 4 | } 5 | -------------------------------------------------------------------------------- /contracts/addresses/130/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./coreAddresses" 2 | export * from "./lensAddresses" 3 | export * from "./peripheryAddresses" 4 | export * from "./swapAddresses" 5 | export * from "./tokenAddresses" 6 | -------------------------------------------------------------------------------- /contracts/addresses/130/swapAddresses.ts: -------------------------------------------------------------------------------- 1 | export const swapAddresses = { 2 | lqgSwapFactory: "0x45b146BC07c9985589B52df651310e75C6BE066A", 3 | lqgSwap: "0x0000000000000000000000000000000000000000", 4 | } 5 | -------------------------------------------------------------------------------- /contracts/addresses/137/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./coreAddresses" 2 | export * from "./lensAddresses" 3 | export * from "./peripheryAddresses" 4 | export * from "./swapAddresses" 5 | export * from "./tokenAddresses" 6 | -------------------------------------------------------------------------------- /contracts/addresses/137/swapAddresses.ts: -------------------------------------------------------------------------------- 1 | export const swapAddresses = { 2 | lqgSwapFactory: "0x0000000000000000000000000000000000000000", 3 | lqgSwap: "0x0000000000000000000000000000000000000000", 4 | } 5 | -------------------------------------------------------------------------------- /contracts/addresses/146/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./coreAddresses" 2 | export * from "./lensAddresses" 3 | export * from "./peripheryAddresses" 4 | export * from "./swapAddresses" 5 | export * from "./tokenAddresses" 6 | -------------------------------------------------------------------------------- /contracts/addresses/146/swapAddresses.ts: -------------------------------------------------------------------------------- 1 | export const swapAddresses = { 2 | lqgSwapFactory: "0x94041db6deC15f79666B07846c13e6F7341b4a80", 3 | lqgSwap: "0x0000000000000000000000000000000000000000", 4 | } 5 | -------------------------------------------------------------------------------- /contracts/addresses/1923/swapAddresses.ts: -------------------------------------------------------------------------------- 1 | export const swapAddresses = { 2 | lqgSwapFactory: "0x976dd85654B3b2f9fb66280ACE30Cab7C81a2130", 3 | lqgSwap: "0x0000000000000000000000000000000000000000", 4 | } 5 | -------------------------------------------------------------------------------- /contracts/addresses/239/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./coreAddresses" 2 | export * from "./lensAddresses" 3 | export * from "./peripheryAddresses" 4 | export * from "./swapAddresses" 5 | export * from "./tokenAddresses" 6 | -------------------------------------------------------------------------------- /contracts/addresses/239/swapAddresses.ts: -------------------------------------------------------------------------------- 1 | export const swapAddresses = { 2 | lqgSwapFactory: "0x0000000000000000000000000000000000000000", 3 | lqgSwap: "0x0000000000000000000000000000000000000000", 4 | } 5 | -------------------------------------------------------------------------------- /contracts/addresses/2390/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./coreAddresses" 2 | export * from "./lensAddresses" 3 | export * from "./peripheryAddresses" 4 | export * from "./tokenAddresses" 5 | export * from "./swapAddresses" -------------------------------------------------------------------------------- /contracts/addresses/2390/swapAddresses.ts: -------------------------------------------------------------------------------- 1 | export const swapAddresses = { 2 | lqgSwapFactory: "0x0000000000000000000000000000000000000000", 3 | lqgSwap: "0x0000000000000000000000000000000000000000", 4 | } 5 | -------------------------------------------------------------------------------- /contracts/addresses/42161/swapAddresses.ts: -------------------------------------------------------------------------------- 1 | export const swapAddresses = { 2 | lqgSwapFactory: "0x0000000000000000000000000000000000000000", 3 | lqgSwap: "0x0000000000000000000000000000000000000000", 4 | } 5 | -------------------------------------------------------------------------------- /contracts/addresses/43114/swapAddresses.ts: -------------------------------------------------------------------------------- 1 | export const swapAddresses = { 2 | lqgSwapFactory: "0x8A1D3a4850ed7deeC9003680Cf41b8E75D27e440", 3 | lqgSwap: "0x0000000000000000000000000000000000000000", 4 | } 5 | -------------------------------------------------------------------------------- /contracts/addresses/480/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./coreAddresses" 2 | export * from "./lensAddresses" 3 | export * from "./peripheryAddresses" 4 | export * from "./swapAddresses" 5 | export * from "./tokenAddresses" 6 | -------------------------------------------------------------------------------- /contracts/addresses/480/swapAddresses.ts: -------------------------------------------------------------------------------- 1 | export const swapAddresses = { 2 | lqgSwapFactory: "0x0000000000000000000000000000000000000000", 3 | lqgSwap: "0x0000000000000000000000000000000000000000", 4 | } 5 | -------------------------------------------------------------------------------- /contracts/addresses/56/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./coreAddresses" 2 | export * from "./lensAddresses" 3 | export * from "./peripheryAddresses" 4 | export * from "./swapAddresses" 5 | export * from "./tokenAddresses" 6 | -------------------------------------------------------------------------------- /contracts/addresses/57073/swapAddresses.ts: -------------------------------------------------------------------------------- 1 | export const swapAddresses = { 2 | lqgSwapFactory: "0x0000000000000000000000000000000000000000", 3 | lqgSwap: "0x0000000000000000000000000000000000000000", 4 | } 5 | -------------------------------------------------------------------------------- /contracts/addresses/60808/swapAddresses.ts: -------------------------------------------------------------------------------- 1 | export const swapAddresses = { 2 | lqgSwapFactory: "0xE25B3cdA6fccAcbD794aEA64eE1B496d7b441644", 3 | lqgSwap: "0x0000000000000000000000000000000000000000", 4 | } 5 | -------------------------------------------------------------------------------- /contracts/addresses/80094/swapAddresses.ts: -------------------------------------------------------------------------------- 1 | export const swapAddresses = { 2 | lqgSwapFactory: "0xD14c95dc228E8851F63d9b83A0001F4D021B5DFf", 3 | lqgSwap: "0x0000000000000000000000000000000000000000", 4 | } 5 | -------------------------------------------------------------------------------- /contracts/addresses/8453/swapAddresses.ts: -------------------------------------------------------------------------------- 1 | export const swapAddresses = { 2 | lqgSwapFactory: "0xf0CFe22d23699ff1B2CFe6B8f706A6DB63911262", 3 | lqgSwap: "0x0000000000000000000000000000000000000000", 4 | } 5 | -------------------------------------------------------------------------------- /contracts/addresses/999/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./coreAddresses" 2 | export * from "./lensAddresses" 3 | export * from "./peripheryAddresses" 4 | export * from "./swapAddresses" 5 | export * from "./tokenAddresses" 6 | -------------------------------------------------------------------------------- /contracts/addresses/999/swapAddresses.ts: -------------------------------------------------------------------------------- 1 | export const swapAddresses = { 2 | lqgSwapFactory: "0x0000000000000000000000000000000000000000", 3 | lqgSwap: "0x0000000000000000000000000000000000000000", 4 | } 5 | -------------------------------------------------------------------------------- /contracts/addresses/1923/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./coreAddresses" 2 | export * from "./lensAddresses" 3 | export * from "./peripheryAddresses" 4 | export * from "./swapAddresses" 5 | export * from "./tokenAddresses" 6 | -------------------------------------------------------------------------------- /contracts/addresses/42161/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./coreAddresses" 2 | export * from "./lensAddresses" 3 | export * from "./peripheryAddresses" 4 | export * from "./swapAddresses" 5 | export * from "./tokenAddresses" 6 | -------------------------------------------------------------------------------- /contracts/addresses/43114/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./coreAddresses" 2 | export * from "./lensAddresses" 3 | export * from "./peripheryAddresses" 4 | export * from "./swapAddresses" 5 | export * from "./tokenAddresses" 6 | -------------------------------------------------------------------------------- /contracts/addresses/57073/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./coreAddresses" 2 | export * from "./lensAddresses" 3 | export * from "./peripheryAddresses" 4 | export * from "./swapAddresses" 5 | export * from "./tokenAddresses" 6 | -------------------------------------------------------------------------------- /contracts/addresses/60808/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./coreAddresses" 2 | export * from "./lensAddresses" 3 | export * from "./peripheryAddresses" 4 | export * from "./swapAddresses" 5 | export * from "./tokenAddresses" 6 | -------------------------------------------------------------------------------- /contracts/addresses/80094/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./coreAddresses" 2 | export * from "./lensAddresses" 3 | export * from "./peripheryAddresses" 4 | export * from "./swapAddresses" 5 | export * from "./tokenAddresses" 6 | -------------------------------------------------------------------------------- /contracts/addresses/8453/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./coreAddresses" 2 | export * from "./lensAddresses" 3 | export * from "./peripheryAddresses" 4 | export * from "./swapAddresses" 5 | export * from "./tokenAddresses" 6 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@graphprotocol/graph-ts/types/tsconfig.base.json", 3 | "include": [ 4 | "src", 5 | "tests", 6 | ], 7 | "exclude": [ 8 | "scripts", 9 | "contracts", 10 | "node_modules", 11 | "dist" 12 | ] 13 | } -------------------------------------------------------------------------------- /contracts/abi/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./basePerspectiveAbi" 2 | export * from "./ethereumVaultConnectorAbi" 3 | export * from "./eVaultAbi" 4 | export * from "./feeFlowControllerAbi" 5 | export * from "./rewardTokenAbi" 6 | export * from "./swapperAbi" 7 | export * from "./swapVerifierAbi" 8 | export * from "./termsOfUseSignerAbi" 9 | export * from "./trackingRewardStreamsAbi" 10 | -------------------------------------------------------------------------------- /contracts/addresses/1/lensAddresses.ts: -------------------------------------------------------------------------------- 1 | export const lensAddresses = { 2 | accountLens: "0x94B9D29721f0477402162C93d95B3b4e52425844", 3 | lqgEarnVaultLens: "0x189841213ae8DacB2AB40A71082E4D4c47a2458E", 4 | irmLens: "0x35B2Fa6206fCC6f653B75832C281bf9d4eBfeaC2", 5 | oracleLens: "0x0C47736aaBEE757AB8C8F60776741e39DBf3F183", 6 | utilsLens: "0xB8cac3e5CaaC2042B79938aFe7FEA3f44e5afcC1", 7 | vaultLens: "0x079FA5cdE9c9647D26E79F3520Fbdf9dbCC0E45e", 8 | } as const 9 | -------------------------------------------------------------------------------- /contracts/addresses/10/lensAddresses.ts: -------------------------------------------------------------------------------- 1 | export const lensAddresses = { 2 | accountLens: "0xA932bF52EB25Ff4Cf7C1Cc4193992df699E001AE", 3 | lqgEarnVaultLens: "0xf8c4C0d40b175a29Df28A9A41CbAd74dD4aDaD1b", 4 | irmLens: "0xC5450f3e85E421A4cf957392F1EFcd299EEB9Dd3", 5 | oracleLens: "0x5409821a457AA2F746CEc5ab5634696BdF9133f3", 6 | utilsLens: "0x47Eb1950E1edB88AE84172B032d62e3E54045865", 7 | vaultLens: "0x792eD69149740402223BE5C9bAE81545d22C29b5", 8 | } as const 9 | -------------------------------------------------------------------------------- /contracts/addresses/100/lensAddresses.ts: -------------------------------------------------------------------------------- 1 | export const lensAddresses = { 2 | accountLens: "0x88dba8F560b7AC7C0Fa58Ec515E76e1577E43aBb", 3 | lqgEarnVaultLens: "0xF5e8f07e740413Fc6868E36c022F4a94AdE9c890", 4 | irmLens: "0xD6a75D2A8C36Dbd148A21F4253A7d6f97491Eea8", 5 | oracleLens: "0xF28416565455080c2C023F2f537d2541eAb22d60", 6 | utilsLens: "0x492Cab2fD9CBb6050eA2F34A547ca2B5c57c6bA4", 7 | vaultLens: "0x64AA3f4214Aa9e0c6676Aaa0424F77335bE3caB0", 8 | } as const 9 | -------------------------------------------------------------------------------- /contracts/addresses/130/lensAddresses.ts: -------------------------------------------------------------------------------- 1 | export const lensAddresses = { 2 | accountLens: "0xFD45d1256F01aE273D32Aa227b36fc25CC358785", 3 | lqgEarnVaultLens: "0x966A99E20182008AFba017bF1eefF6d5aE393Ad4", 4 | irmLens: "0x308dbB35e11EbfF4D2136Fc03ebd6c729e9eBBcc", 5 | oracleLens: "0x521E9A23ada57FDfaa4C6272eF26C2c4FE0c0Ee8", 6 | utilsLens: "0x3f4F2f1536F428D4555C232E0013D0D36a19485A", 7 | vaultLens: "0x03833b4A873eA1F657340C72971a2d0EbB2B4D82", 8 | } as const 9 | -------------------------------------------------------------------------------- /contracts/addresses/137/lensAddresses.ts: -------------------------------------------------------------------------------- 1 | export const lensAddresses = { 2 | accountLens: "0x778687EB145fB1F9D811b100b861702847F2fB51", 3 | lqgEarnVaultLens: "0x08c9f3bfF367C6Ccb9062EdBa7742dA61d8AE8fA", 4 | irmLens: "0x7f625990C19bE258696bFBc24d5f3F77d798857E", 5 | oracleLens: "0xC15fAe6f21c3a07b72b0155f5ec11f445754d382", 6 | utilsLens: "0xAd37834842b5394b4D863792dBECB8b157219dfD", 7 | vaultLens: "0xC59fcad2ad79E42ce698E7aa0292F14F29706b4E", 8 | } as const 9 | -------------------------------------------------------------------------------- /contracts/addresses/146/lensAddresses.ts: -------------------------------------------------------------------------------- 1 | export const lensAddresses = { 2 | accountLens: "0xD1fcc98BAf6Ba852b360091870969FF12416fBb6", 3 | lqgEarnVaultLens: "0x08588b9F6Dd69ADa2648fC48CAc6c9349DB9E904", 4 | irmLens: "0x16CBAA18631D308ef7860dd8441744E043BacafD", 5 | oracleLens: "0x6Ed14a85CEF0048C57Cb13c2Eb5435eA723e8123", 6 | utilsLens: "0xE05BB9159c4B663c9A56320C5Aa96a59560C5Bbc", 7 | vaultLens: "0x41833712aD47d2dfE9BF7c980124deD2a8DCf0c2", 8 | } as const 9 | -------------------------------------------------------------------------------- /contracts/addresses/1923/lensAddresses.ts: -------------------------------------------------------------------------------- 1 | export const lensAddresses = { 2 | accountLens: "0xEC03D3A5668C0B5016Fe1e5B22157509d3a1DB8c", 3 | lqgEarnVaultLens: "0x9ae68C5E295e45480624214405d647D11a0a0506", 4 | irmLens: "0x839d5b499238c35141dD1b00F9B0f7a2069799f1", 5 | oracleLens: "0x336b1F8969557E69536E69055B4ef0fB8762b135", 6 | utilsLens: "0x681eD47409AF872B7EE81885cDb6A6cF3b2B9242", 7 | vaultLens: "0x1f1997528FbD68496d8007E65599637fBBe85582", 8 | } as const 9 | -------------------------------------------------------------------------------- /contracts/addresses/239/lensAddresses.ts: -------------------------------------------------------------------------------- 1 | export const lensAddresses = { 2 | accountLens: "0xDb6D38D4057505F3B1117199987d9faaCa385237", 3 | lqgEarnVaultLens: "0x0000000000000000000000000000000000000000", 4 | irmLens: "0x64785a400a01bE70A49F7E0A90Cd49fF4273091B", 5 | oracleLens: "0xB7b2530A8a545504d35F7502E0bf9Fba59F772D6", 6 | utilsLens: "0x37A8B0b29382543eb5CE25A6697eDde4cB273Bc3", 7 | vaultLens: "0xf5f5eaf1157c0cbbf2F4aa949aaBbD686622EA6f", 8 | } as const 9 | -------------------------------------------------------------------------------- /contracts/addresses/2390/lensAddresses.ts: -------------------------------------------------------------------------------- 1 | export const lensAddresses = { 2 | accountLens: "0xC477C2D033A43d5fDE3DB0c948bf7170b72F29B0", 3 | lqgEarnVaultLens: "0xBe6d150433c95A96CaA53785224AC02b3E6B8b33", 4 | irmLens: "0xb8c7a7872aD14c6728B37E4daC12482378aDbc86", 5 | oracleLens: "0xE540a259d9A2D7e819cA3C7711346050016bC350", 6 | utilsLens: "0xD42D280F75Ac941279c02A1486a576fbA48261C3", 7 | vaultLens: "0xE025F152d48dCB935A4157618DE32889DBd07fB9" 8 | } as const 9 | -------------------------------------------------------------------------------- /contracts/addresses/42161/lensAddresses.ts: -------------------------------------------------------------------------------- 1 | export const lensAddresses = { 2 | accountLens: "0x48263ed0339Bd229578785FaD52627080D09ddBc", 3 | lqgEarnVaultLens: "0x355Fdf120ab3c2f14972D52d50F066cCF43BAC88", 4 | irmLens: "0x4E184012B966f91FF5A4F05D1FcD979B271d1D16", 5 | oracleLens: "0x5D613b4eC0efAee328f6cA47C667EA49a2eB7884", 6 | utilsLens: "0x2a99a89d820D50b4Ec947679A2d55Dc39600FdB5", 7 | vaultLens: "0x1Df19EE4Ed7353fCC54e26E54f960a19Aa43D304", 8 | } as const 9 | -------------------------------------------------------------------------------- /contracts/addresses/43114/lensAddresses.ts: -------------------------------------------------------------------------------- 1 | export const lensAddresses = { 2 | accountLens: "0x484898e5d3C65362bfbd9DE252Bf9D56a0c9087C", 3 | lqgEarnVaultLens: "0xB8077B9908acb86460d7a704EcFd259d76366CFE", 4 | irmLens: "0xC0692E741236AD79f66Cc09bF68527E151Bea38B", 5 | oracleLens: "0xAB61aefC3Ef93490317310f2274125134765EbBF", 6 | utilsLens: "0x37E873e98480a4D18711eb326F5A8F1A31C43FE6", 7 | vaultLens: "0x3433CdD28427BF5A640c5AddA763FeEbA9e05368", 8 | } as const 9 | -------------------------------------------------------------------------------- /contracts/addresses/480/lensAddresses.ts: -------------------------------------------------------------------------------- 1 | export const lensAddresses = { 2 | accountLens: "0x4F1fCc9049577B216567f162AB22aAFabcBCa6a2", 3 | lqgEarnVaultLens: "0x280045798E9612901c9c785093C4E554DBCaa1d8", 4 | irmLens: "0x9B583F14790Bb4Ade9A5CCB1e5078E01d057dEc9", 5 | oracleLens: "0x8f8D74ca758C035e5C2Fd91eD5831Be82D898166", 6 | utilsLens: "0x33766f349983C83990CFb6044362F52D4be54BE1", 7 | vaultLens: "0x830Cd466b307d8F9230CC3f55F1c4f6b9a4509d3", 8 | } as const 9 | -------------------------------------------------------------------------------- /contracts/addresses/56/lensAddresses.ts: -------------------------------------------------------------------------------- 1 | export const lensAddresses = { 2 | accountLens: "0x505f3214DF11F3e7C7351e7C262E2bA1459fea60", 3 | lqgEarnVaultLens: "0x902d0856bb50cc1118c4F830B150947AAd0cD70F", 4 | irmLens: "0x9Cfa82A229B78e2c39fE466b3898159EF557C9e7", 5 | oracleLens: "0x301a83Cf9ffbDe64DbBD7F7988e900704cbCa2cb", 6 | utilsLens: "0x30be272d1441E9935BCBeA2Cd924cD5e568A052e", 7 | vaultLens: "0x0CbA31319E61E74E0A456b3CE56f302275b90edF", 8 | } as const 9 | -------------------------------------------------------------------------------- /contracts/addresses/57073/lensAddresses.ts: -------------------------------------------------------------------------------- 1 | export const lensAddresses = { 2 | accountLens: "0x03204E4548E92473eA003F89430cB868eAB5933e", 3 | lqgEarnVaultLens: "0x5f284295fE24a6A0411A3B36FC788fa8e3981DEF", 4 | irmLens: "0x1Ba0E524b1DacdA15648a130606E57408De9bDa3", 5 | oracleLens: "0xFCA15e8b1893F41077358476b2E22ab0BeEB324f", 6 | utilsLens: "0xf8d25D4d0A2c286F60361C22CC3C12317d4246FA", 7 | vaultLens: "0x3176304eef250E14F0605c469724041d2ee06ECA", 8 | } as const 9 | -------------------------------------------------------------------------------- /contracts/addresses/60808/lensAddresses.ts: -------------------------------------------------------------------------------- 1 | export const lensAddresses = { 2 | accountLens: "0x68C6C51D0724058d793eA4f4067e75012b6A4445", 3 | lqgEarnVaultLens: "0x4AF98545C9af976BC1a1A92688e1AA6Fa3daa5A0", 4 | irmLens: "0x12671A5fc229628D7f0C6Cd250798fDacC163214", 5 | oracleLens: "0x428a144214D3E640634491F05b7130ba26A394f3", 6 | utilsLens: "0xb05668273c66944CCc5ca69466D27a63CCCfE623", 7 | vaultLens: "0x7C6620E8D5d308CA95B6a22482553F6c046c3e8a", 8 | } as const 9 | -------------------------------------------------------------------------------- /contracts/addresses/80094/lensAddresses.ts: -------------------------------------------------------------------------------- 1 | export const lensAddresses = { 2 | accountLens: "0xe87374419397BAD166e7c57ea1B9bC8Ad88EaaF9", 3 | lqgEarnVaultLens: "0x36F611B6d77a1DfeeAFF8f144C24A91bb9CA2D5c", 4 | irmLens: "0x2bAb6695DEEE9655536A13d6137f8A62b4f48916", 5 | oracleLens: "0x0c0519BaA6c1556f9d4dc9E26073D1BF7C48DC2e", 6 | utilsLens: "0x2943d685b1d3C97b3F0e64f2100c7fD81a8DF905", 7 | vaultLens: "0xD011Cb09C3CE976c4ed245C1F333b48003B9c63a", 8 | } as const 9 | -------------------------------------------------------------------------------- /contracts/addresses/8453/lensAddresses.ts: -------------------------------------------------------------------------------- 1 | export const lensAddresses = { 2 | accountLens: "0xe523607FB5C1E9e7092f4E173CBFD1BEb32D524A", 3 | lqgEarnVaultLens: "0x455292fcEf99569a4c37bb58A3f21B55E304Ca27", 4 | irmLens: "0x4BB741F1BA0A33211854873464884fa45AA6ea9B", 5 | oracleLens: "0x91517C3E57C7e426a0221dEFB21d0acf8231b8b6", 6 | utilsLens: "0xE055Fa087e836efAcaFa257e5F6CF90936c26Cb5", 7 | vaultLens: "0xCCC8D18e40c439F5234042FbEA0f4f1528f52f00", 8 | } as const 9 | -------------------------------------------------------------------------------- /contracts/addresses/999/lensAddresses.ts: -------------------------------------------------------------------------------- 1 | export const lensAddresses = { 2 | accountLens: "0xD761b8cE2D79A7DadEAc6d33bAa5083bBC1240bd", 3 | lqgEarnVaultLens: "0x1C8991ee4D7F0D87E815B75EeF43861C45C5233f", 4 | irmLens: "0x9600dc97eB012158c352e1c90c569670602C39dE", 5 | oracleLens: "0xFa052dCC0c32c51d3127f12eE0d003ef5742E61f", 6 | utilsLens: "0x5d3Bac7b11501fA73eB1fA2039e3eD52C92aDc74", 7 | vaultLens: "0x6038375356C27091986df69777965ae49bBA13Fb", 8 | } as const 9 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Graph CLI generated artifacts 2 | build/ 3 | generated/ 4 | 5 | # Dependency directories 6 | node_modules/ 7 | jspm_packages/ 8 | 9 | # Logs 10 | logs 11 | *.log 12 | npm-debug.log* 13 | yarn-debug.log* 14 | yarn-error.log* 15 | 16 | # Optional npm cache directory 17 | .npm 18 | 19 | # Optional eslint cache 20 | .eslintcache 21 | 22 | # dotenv environment variables file 23 | .env 24 | 25 | # Testing 26 | coverage 27 | coverage.json 28 | 29 | # Typechain 30 | typechain 31 | typechain-types 32 | 33 | # Hardhat files 34 | cache 35 | 36 | data 37 | ./tests/.bin 38 | 39 | subgraph.yaml -------------------------------------------------------------------------------- /contracts/addresses/239/coreAddresses.ts: -------------------------------------------------------------------------------- 1 | export const coreAddresses = { 2 | balanceTracker: "0x45ff89cD0e976392703048F4A4314A2010ee64b8", 3 | eVaultFactory: "0x2b21621b8Ef1406699a99071ce04ec14cCd50677", 4 | eVaultImplementation: "0x1974899F5d6B5a1f8E63b2e8Ad60e14BAC3E7980", 5 | lqgEarnFactory: "0x0000000000000000000000000000000000000000", 6 | evc: "0x01F594c66A5561b90Bc782dD0297f294cD668b64", 7 | permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3", 8 | protocolConfig: "0x4C3D26D7Eb6D5AA62CFD99624ad4Ff3351E4B129", 9 | sequenceRegistry: "0xF7a9F90b5ACb4EE4Cd536940142A04522D28e0Aa", 10 | } as const 11 | -------------------------------------------------------------------------------- /scripts/tsconfig.scripts.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "esModuleInterop": true, 5 | "target": "es2020", 6 | "moduleResolution": "node", 7 | "resolveJsonModule": true, 8 | "outDir": "dist/scripts", 9 | "rootDir": "scripts", 10 | "strict": true, 11 | "skipLibCheck": true, 12 | "forceConsistentCasingInFileNames": true 13 | }, 14 | "include": [ 15 | "contracts/**/*", 16 | "scripts/**/*" 17 | ], 18 | "exclude": [ 19 | "node_modules", 20 | "dist" 21 | ] 22 | } -------------------------------------------------------------------------------- /contracts/addresses/1/coreAddresses.ts: -------------------------------------------------------------------------------- 1 | export const coreAddresses = { 2 | balanceTracker: "0x0D52d06ceB8Dcdeeb40Cfd9f17489B350dD7F8a3", 3 | eVaultFactory: "0x29a56a1b8214D9Cf7c5561811750D5cBDb45CC8e", 4 | eVaultImplementation: "0x8Ff1C814719096b61aBf00Bb46EAd0c9A529Dd7D", 5 | lqgEarnFactory: "0x9a20d3C0c283646e9701a049a2f8C152Bc1e3427", 6 | lqgEarnImplementation: "0xBa42141648dFD74388f3541C1d80fa9387043Da9", 7 | evc: "0x0C9a3dd6b8F28529d72d7f9cE918D493519EE383", 8 | permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3", 9 | protocolConfig: "0x4cD6BF1D183264c02Be7748Cb5cd3A47d013351b", 10 | sequenceRegistry: "0xEADDD21618ad5Deb412D3fD23580FD461c106B54", 11 | } as const 12 | -------------------------------------------------------------------------------- /contracts/addresses/10/coreAddresses.ts: -------------------------------------------------------------------------------- 1 | export const coreAddresses = { 2 | balanceTracker: "0x9f1942a30Dd99896945Ff544BE68c8ce790ECb57", 3 | eVaultFactory: "0x7943231a109703937bB7fb3D4dfB55D824deDe99", 4 | eVaultImplementation: "0x94b14e4678B08c3Ee93cA8611672270575f9ead8", 5 | lqgEarnFactory: "0x317CCF92BEec1B5487C387AEFaCc54F2992165Ce", 6 | lqgEarnImplementation: "0x29C865d1435C3d25FeB7865837e4ebf63D609e65", 7 | evc: "0xbfB28650Cd13CE879E7D56569Ed4715c299823E4", 8 | permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3", 9 | protocolConfig: "0xAECe407aF2DBCd0B6C5Fb522744cCE6beac6Fb72", 10 | sequenceRegistry: "0xb8551503651FfB86371E750802d4094f7435758A", 11 | } as const 12 | -------------------------------------------------------------------------------- /contracts/addresses/100/coreAddresses.ts: -------------------------------------------------------------------------------- 1 | export const coreAddresses = { 2 | balanceTracker: "0xc3688DE625abE9231ca004D6dE78438Da5496Fa9", 3 | eVaultFactory: "0x4CB405C3515841c9BBFB363CD3105479e15ce5B0", 4 | eVaultImplementation: "0x80fF02a2b6b945D3127C21275c0D10116B737731", 5 | lqgEarnFactory: "0xE600cACf641e9143fD5e4Bb4157db9C567E908E8", 6 | lqgEarnImplementation: "0x053961adE0A97F70aF6169763f5EE4C593f564f0", 7 | evc: "0xD1446CDaa29b342C04c6162023f3A645CB318736", 8 | permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3", 9 | protocolConfig: "0xcB7c8afbE09307Be5cdB668274137a92145353D7", 10 | sequenceRegistry: "0x1CF12927ea07abA188bAB81B90Ab535E49A694eB", 11 | } as const 12 | -------------------------------------------------------------------------------- /contracts/addresses/130/coreAddresses.ts: -------------------------------------------------------------------------------- 1 | export const coreAddresses = { 2 | balanceTracker: "0xFbD12fbC91311A8f17598b935e35205EAF16Aa75", 3 | eVaultFactory: "0xbAd8b5BDFB2bcbcd78Cc9f1573D3Aad6E865e752", 4 | eVaultImplementation: "0x71d7250732591C41D1BdeB1EA0Ee730E138E0c8b", 5 | lqgEarnFactory: "0x9efeAc4498d1fA78b750307C2a918Ff491A111DE", 6 | lqgEarnImplementation: "0xE9878336e83d44c367Fb82B85285c26fcF249C4D", 7 | evc: "0x2A1176964F5D7caE5406B627Bf6166664FE83c60", 8 | permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3", 9 | protocolConfig: "0xdCD02E4eA8cd273498D315AD8c047305f8480656", 10 | sequenceRegistry: "0x08799a00BC4a74890d65f77828cd2BFbBFcD96dB", 11 | } as const 12 | -------------------------------------------------------------------------------- /contracts/addresses/137/coreAddresses.ts: -------------------------------------------------------------------------------- 1 | export const coreAddresses = { 2 | balanceTracker: "0x751Ab2C287159fa2fA1a1A5A0f209c3F6e83A282", 3 | eVaultFactory: "0x3f23552A0ABd8E01AFf5E8704E8A5671A80432B5", 4 | eVaultImplementation: "0x5Ed27EFcb2E58b0B9cD163f9ef78bA87F167b8d2", 5 | lqgEarnFactory: "0x38e3818947a4104Cab38f9B51362E991A970168D", 6 | lqgEarnImplementation: "0xab04BAabf333bD9997CAC0661B6EcE4B88Be3F39", 7 | evc: "0xa1C13F5c4929521F0bf31cBE03025cb75C214DCB", 8 | permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3", 9 | protocolConfig: "0x5aE64b596224cdE56C852269E9b35aD25e22Af90", 10 | sequenceRegistry: "0xA9B3Fe66d8FdBa841a4918D32e12894E5D36BC94", 11 | } as const 12 | -------------------------------------------------------------------------------- /contracts/addresses/146/coreAddresses.ts: -------------------------------------------------------------------------------- 1 | export const coreAddresses = { 2 | balanceTracker: "0xe6E4687C35429942391AfE42CDdECba857531492", 3 | eVaultFactory: "0xF075cC8660B51D0b8a4474e3f47eDAC5fA034cFB", 4 | eVaultImplementation: "0x11f95aaa59F1AD89576c61E3C9Cd24DF1FdCF46f", 5 | lqgEarnFactory: "0xc8EB6dD027C4Ab1754245F6FdE91B39090C12aDd", 6 | lqgEarnImplementation: "0xcfE702B937687a9c9C93E794EdfeF435D8D8486B", 7 | evc: "0x4860C903f6Ad709c3eDA46D3D502943f184D4315", 8 | permit2: "0xB952578f3520EE8Ea45b7914994dcf4702cEe578", 9 | protocolConfig: "0xc2f9FE90bd17e017898b6EfDaa73c34Fddde299e", 10 | sequenceRegistry: "0x6F417AaEc1D41dB692307269acDA019Ce5F10b0e", 11 | } as const 12 | -------------------------------------------------------------------------------- /contracts/addresses/1923/coreAddresses.ts: -------------------------------------------------------------------------------- 1 | export const coreAddresses = { 2 | balanceTracker: "0x9fb7215ef6297498D6807caf9f3aC8BA3154db29", 3 | eVaultFactory: "0x238bF86bb451ec3CA69BB855f91BDA001aB118b9", 4 | eVaultImplementation: "0x70f1286239228B28A047c727C2df390045299486", 5 | lqgEarnFactory: "0xf6c81239B4E3c71bFd156223971821438c42Eabc", 6 | lqgEarnImplementation: "0xcD8E56a127B41D40A7542C8c8E77551C157108D0", 7 | evc: "0x08739CBede6E28E387685ba20e6409bD16969Cde", 8 | permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3", 9 | protocolConfig: "0x6682Af2820633067A1de5bE99b2DCb2d38F1e241", 10 | sequenceRegistry: "0xC4589C6199516F96B422D91020563Fe65b28918e", 11 | } as const 12 | -------------------------------------------------------------------------------- /contracts/addresses/2390/coreAddresses.ts: -------------------------------------------------------------------------------- 1 | export const coreAddresses = { 2 | balanceTracker: "0x29CCC4AD900ed8F9cb9B19B550e3179e4c955Aa3", 3 | eVaultFactory: "0x1229C14e3b345E0272597cD71d39d297ee57C96e", 4 | eVaultImplementation: "0x098c5F7A303819B17fEE4305AF66299a2A2e0AbD", 5 | lqgEarnFactory: "0xf283e953849f6775E2B29D89d537E57068150eA4", 6 | lqgEarnImplementation: "0x6e7CFC80cf31C46B6E5cD1d043fF7Df60997BA61", 7 | evc: "0x272911fC4a3Cae478F29d13df85127f9a556B36D", 8 | permit2: "0x63079e13441219D3Acf1012269127EBf304616D8", 9 | protocolConfig: "0xDCDf883E74ffb7489D7939f4728a781e2b3176c9", 10 | sequenceRegistry: "0xE3eCCaE05d6beB6544860A34e50AB4C5D9F17B37" 11 | } as const 12 | -------------------------------------------------------------------------------- /contracts/addresses/42161/coreAddresses.ts: -------------------------------------------------------------------------------- 1 | export const coreAddresses = { 2 | balanceTracker: "0xbCD29c1B596d9fFAfaa6F90780956b4D3d47832f", 3 | eVaultFactory: "0x78Df1CF5bf06a7f27f2ACc580B934238C1b80D50", 4 | eVaultImplementation: "0x832fF4011A3164ea76ceA06A313EE0B6CD72ba96", 5 | lqgEarnFactory: "0xd4500C75048A65Df0e83667a546A5FB27B02AA56", 6 | lqgEarnImplementation: "0x9Da3B8051b2592CA6FB10dae538d7B390e9c8376", 7 | evc: "0x6302ef0F34100CDDFb5489fbcB6eE1AA95CD1066", 8 | permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3", 9 | protocolConfig: "0x06c1Ab0A1672E8FC7F7D10BD7B869B4116D18a2c", 10 | sequenceRegistry: "0x924C73abAa350800fc22c11ffdFB09641106E3ce", 11 | } as const 12 | -------------------------------------------------------------------------------- /contracts/addresses/43114/coreAddresses.ts: -------------------------------------------------------------------------------- 1 | export const coreAddresses = { 2 | balanceTracker: "0xAf5659428FEF1F6a701FaB46d8f3aF8371A9913D", 3 | eVaultFactory: "0xaf4B4c18B17F6a2B32F6c398a3910bdCD7f26181", 4 | eVaultImplementation: "0x29E9b639e165d919FEcf02521F8A9dA0492D4f21", 5 | lqgEarnFactory: "0xe5a94aE6178CFd65856b19A4EB8dD61D85C63E11", 6 | lqgEarnImplementation: "0x789d447Cf07a703a1A1326B6B4CA84693d29A4Dd", 7 | evc: "0xddcbe30A761Edd2e19bba930A977475265F36Fa1", 8 | permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3", 9 | protocolConfig: "0x8564160f30926eA1229DCcf24118c6De155D2e30", 10 | sequenceRegistry: "0x9C38f923baC407C818312EADEf69AdC116fd16FD", 11 | } as const 12 | -------------------------------------------------------------------------------- /contracts/addresses/480/coreAddresses.ts: -------------------------------------------------------------------------------- 1 | export const coreAddresses = { 2 | balanceTracker: "0x2e37490ecEBc68dc9250ab2DC7729037C1638270", 3 | eVaultFactory: "0xba31C9e91E909E47F2F4F174936811A1E2123B57", 4 | eVaultImplementation: "0x1F2A11F83E6260FE660F6C0A89bAAF204a2d723C", 5 | lqgEarnFactory: "0xeEB368cCac95171C785cfAd7a099B26078b4F76c", 6 | lqgEarnImplementation: "0xA3aE917eDbBC260ad23515082d41B4F120Ad15F2", 7 | evc: "0x1384708aD4EEd6c264c196555422956306348359", 8 | permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3", 9 | protocolConfig: "0x1a03E7b634D813EFC3a8415EF0DC034026DC86b0", 10 | sequenceRegistry: "0x975aF70E8C2B40BBe13677931C285Baa941E4337", 11 | } as const 12 | -------------------------------------------------------------------------------- /contracts/addresses/56/coreAddresses.ts: -------------------------------------------------------------------------------- 1 | export const coreAddresses = { 2 | balanceTracker: "0x2D13C46FE6c8B6c9ad3C5A78eD51b26733caE350", 3 | eVaultFactory: "0x7F53E2755eB3c43824E162F7F6F087832B9C9Df6", 4 | eVaultImplementation: "0xB236413f1A8Fd4C5D5545ecAaC5e64fF686afe4e", 5 | lqgEarnFactory: "0xd4FffC1e799E714aEd1461C14e95f55b6B3390e8", 6 | lqgEarnImplementation: "0x8FF6da0a7C96f33690bD71f5507118033d2D7c25", 7 | evc: "0xb2E5a73CeE08593d1a076a2AE7A6e02925a640ea", 8 | permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3", 9 | protocolConfig: "0xF524F75ad063919B86d6c5D9242847A44337BFCe", 10 | sequenceRegistry: "0x7fD287B3AE3Bf2F6C9871a44b6d9de208B0ABBE5", 11 | } as const 12 | -------------------------------------------------------------------------------- /contracts/addresses/57073/coreAddresses.ts: -------------------------------------------------------------------------------- 1 | export const coreAddresses = { 2 | balanceTracker: "0x7A49f3b99d5737c1D3dcF9F278a8568ed4092416", 3 | eVaultFactory: "0xD17587B7da4383bE4b64bD2D0c87119a17Ee5130", 4 | eVaultImplementation: "0x927dBf538B7A02491268e53748546730706a0fDc", 5 | lqgEarnFactory: "0x855A399bE9d3d7afED44346BDe35FD2C8D910668", 6 | lqgEarnImplementation: "0x8360B4D341e4459AE77b98F70a4757fcf51e4431", 7 | evc: "0x59B8DfBcD3F004e7287eA021A67D54763fEAeE0C", 8 | permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3", 9 | protocolConfig: "0x41fa2486c164840B49663D422eb7E1Ee19C4FB23", 10 | sequenceRegistry: "0x4790c32228a704B635d7c50f91CefD3A0F77E721", 11 | } as const 12 | -------------------------------------------------------------------------------- /contracts/addresses/60808/coreAddresses.ts: -------------------------------------------------------------------------------- 1 | export const coreAddresses = { 2 | balanceTracker: "0x5a3828beA292E5f29725Fa449F9113Cb5E60ADF8", 3 | eVaultFactory: "0x046a9837A61d6b6263f54F4E27EE072bA4bdC7e4", 4 | eVaultImplementation: "0x32CFc56917C0025501b34C43f7FE767Ef1EDE3a2", 5 | lqgEarnFactory: "0x118feebFBaFc7106aE79Dd4d6D2661df4D031B1E", 6 | lqgEarnImplementation: "0x2D72821B5C46718A728Bc2eD9d346cf11A91638C", 7 | evc: "0x59f0FeEc4fA474Ad4ffC357cC8d8595B68abE47d", 8 | permit2: "0xCbe9Be2C87b24b063A21369b6AB0Aa9f149c598F", 9 | protocolConfig: "0x94047C7daF06a6DE4049365cFa95fb4389a6F9Fe", 10 | sequenceRegistry: "0xf4C097718c64B6B0A75Cd9e0EF348fD6F176bE67", 11 | } as const 12 | -------------------------------------------------------------------------------- /contracts/addresses/80094/coreAddresses.ts: -------------------------------------------------------------------------------- 1 | export const coreAddresses = { 2 | balanceTracker: "0x70Fb24bDa46E7cFD447C64bB32180Bc746ba3A71", 3 | eVaultFactory: "0x5C13fb43ae9BAe8470f646ea647784534E9543AF", 4 | eVaultImplementation: "0x402598Ac4034D24f2cB37BDb0721A67365aD19BD", 5 | lqgEarnFactory: "0xDf380dc486a72984fBCBf224dc4e21599485d1B1", 6 | lqgEarnImplementation: "0xB053A4fb7d9C86e9135f581231d98abA0A940d29", 7 | evc: "0x45334608ECE7B2775136bC847EB92B5D332806A9", 8 | permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3", 9 | protocolConfig: "0x51432af61A715DB3D0f20A3691C1E25F9A2c6B05", 10 | sequenceRegistry: "0x0c9a75E05764775A0cF52bC6cbfE6Cb229bb3901", 11 | } as const 12 | -------------------------------------------------------------------------------- /contracts/addresses/8453/coreAddresses.ts: -------------------------------------------------------------------------------- 1 | export const coreAddresses = { 2 | balanceTracker: "0x029fDEe85BEdB0553D6fdc538546586641DD7438", 3 | eVaultFactory: "0x7F321498A801A191a93C840750ed637149dDf8D0", 4 | eVaultImplementation: "0x30a9A9654804F1e5b3291a86E83EdeD7cF281618", 5 | lqgEarnFactory: "0x72bbDB652F2AEC9056115644EfCcDd1986F51f15", 6 | lqgEarnImplementation: "0x6104c0F2a7750F1b143DAB49752e19DA43dec34A", 7 | evc: "0x5301c7dD20bD945D2013b48ed0DEE3A284ca8989", 8 | permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3", 9 | protocolConfig: "0x1D4b9e6ACACdc82Dd9E903C3F4431558Af32C4A9", 10 | sequenceRegistry: "0xfE9011FD097cd35866b9e4740BBC88B4ef26E3ba", 11 | } as const 12 | -------------------------------------------------------------------------------- /contracts/addresses/999/coreAddresses.ts: -------------------------------------------------------------------------------- 1 | export const coreAddresses = { 2 | balanceTracker: "0x05d14f4eDFA7Cbfb90711C2EC5505bcbd49b9cD2", 3 | eVaultFactory: "0xcF5552580fD364cdBBFcB5Ae345f75674c59273A", 4 | eVaultImplementation: "0x05de079A28386135E048369cdf0Bc4D326d5EBDF", 5 | lqgEarnFactory: "0xf21dfadFc4d3da25aCE489c7A95EDDc5f47B809a", 6 | lqgEarnImplementation: "0xFf70E197F6Ae7416f143fAB5C9bEc30ecF55B093", 7 | evc: "0xceAA7cdCD7dDBee8601127a9Abb17A974d613db4", 8 | permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3", 9 | protocolConfig: "0x43144f09896F8759DE2ec6D777391B9F05A51128", 10 | sequenceRegistry: "0x47618E4CBDcFBf5f21D6594A7e3a4f4683719994", 11 | } as const 12 | -------------------------------------------------------------------------------- /src/utils/eulerSwap.ts: -------------------------------------------------------------------------------- 1 | import { BigInt, Bytes } from "@graphprotocol/graph-ts" 2 | import { lqgSwapPool } from "../../generated/schema" 3 | 4 | 5 | 6 | export function loadOrCreatelqgSwapPool(address: Bytes): lqgSwapPool { 7 | let pool = lqgSwapPool.load(address) 8 | if (!pool) { 9 | pool = new lqgSwapPool(address) 10 | pool.active = false 11 | pool.asset0 = Bytes.fromHexString("0x") 12 | pool.asset1 = Bytes.fromHexString("0x") 13 | pool.lqgAccount = Bytes.fromHexString("0x") 14 | pool.pool = address 15 | pool.blockNumber = BigInt.fromI32(0) 16 | pool.blockTimestamp = BigInt.fromI32(0) 17 | pool.transactionHash = Bytes.fromHexString("0x") 18 | pool.save() 19 | } 20 | return pool 21 | } -------------------------------------------------------------------------------- /contracts/addresses/index.ts: -------------------------------------------------------------------------------- 1 | export * as mainnetAddresses from "./1" 2 | export * as optimismAddresses from "./10" 3 | export * as bscAddresses from "./56" 4 | export * as gnosisAddresses from "./100" 5 | export * as unichainAddresses from "./130" 6 | export * as polygonAddresses from "./137" 7 | export * as sonicAddresses from "./146" 8 | export * as tacAddresses from "./239" 9 | export * as worldchainAddresses from "./480" 10 | export * as hyperevmAddresses from "./999" 11 | export * as swellAddresses from "./1923" 12 | export * as baseAddresses from "./8453" 13 | export * as arbitrumAddresses from "./42161" 14 | export * as avalancheAddresses from "./43114" 15 | export * as inkAddresses from "./57073" 16 | export * as bobAddresses from "./60808" 17 | export * as berachainAddresses from "./80094" 18 | 19 | // TESTNETS 20 | export * as tacTurinAddresses from "./2390" -------------------------------------------------------------------------------- /src/factories/euler-vault-factory.ts: -------------------------------------------------------------------------------- 1 | import { dataSource } from "@graphprotocol/graph-ts" 2 | import { 3 | ProxyCreated as ProxyCreatedEvent, 4 | } from "../../generated/EVaultFactory/EVaultFactory" 5 | import { 6 | ProxyCreated, 7 | } from "../../generated/schema" 8 | import { lqgVault as lqgVaultTemplate } from "../../generated/templates" 9 | 10 | export function handleProxyCreated(event: ProxyCreatedEvent): void { 11 | let entity = new ProxyCreated( 12 | event.transaction.hash.concatI32(event.logIndex.toI32()), 13 | ) 14 | entity.proxy = event.params.proxy 15 | entity.upgradeable = event.params.upgradeable 16 | entity.implementation = event.params.implementation 17 | entity.trailingData = event.params.trailingData 18 | 19 | entity.blockNumber = event.block.number 20 | entity.blockTimestamp = event.block.timestamp 21 | entity.transactionHash = event.transaction.hash 22 | 23 | entity.save() 24 | 25 | let context = dataSource.context() 26 | lqgVaultTemplate.createWithContext(event.params.proxy, context) 27 | } 28 | 29 | -------------------------------------------------------------------------------- /tests/euler-earn-factory-utils.ts: -------------------------------------------------------------------------------- 1 | import { newMockEvent } from "matchstick-as" 2 | import { ethereum, Address } from "@graphprotocol/graph-ts" 3 | import { DeploylqgEarn } from "../generated/lqgEarnFactory/lqgEarnFactory" 4 | 5 | // export function createDeploylqgEarnEvent( 6 | // _owner: Address, 7 | // _lqgEarnVault: Address, 8 | // _asset: Address 9 | // ): DeploylqgEarn { 10 | // let deploylqgEarnEvent = changetype(newMockEvent()) 11 | 12 | // deploylqgEarnEvent.parameters = new Array() 13 | 14 | // deploylqgEarnEvent.parameters.push( 15 | // new ethereum.EventParam("_owner", ethereum.Value.fromAddress(_owner)) 16 | // ) 17 | // deploylqgEarnEvent.parameters.push( 18 | // new ethereum.EventParam( 19 | // "_lqgEarnVault", 20 | // ethereum.Value.fromAddress(_lqgEarnVault) 21 | // ) 22 | // ) 23 | // deploylqgEarnEvent.parameters.push( 24 | // new ethereum.EventParam("_asset", ethereum.Value.fromAddress(_asset)) 25 | // ) 26 | 27 | // return deploylqgEarnEvent 28 | // } 29 | 30 | 31 | -------------------------------------------------------------------------------- /scripts/tag-deployments.ts: -------------------------------------------------------------------------------- 1 | import { execSync } from 'child_process' 2 | import { readFileSync, writeFileSync } from 'fs' 3 | import { extractSubgraphInfo } from './utils/utils' 4 | 5 | const DEPLOYMENTS_FILE = 'deployments.json' 6 | const TAG_NAME = 'latest' 7 | 8 | function tagDeployments() { 9 | const deployments = JSON.parse(readFileSync(DEPLOYMENTS_FILE, 'utf8')) 10 | 11 | for (const deployment of deployments) { 12 | try { 13 | const { name, version } = extractSubgraphInfo(deployment.url) 14 | console.log(`Tagging ${name} v${version}...`) 15 | console.log(`>> goldsky subgraph tag create ${name}/${version} --tag ${TAG_NAME}`) 16 | execSync(`goldsky subgraph tag create ${name}/${version} --tag ${TAG_NAME}`, { stdio: 'inherit' }) 17 | console.log(`Successfully tagged v${version}`) 18 | } catch (error) { 19 | console.error('Error tagging: ', deployment, ' error: ', error) 20 | // @ts-ignore 21 | process.exit(1) 22 | } 23 | } 24 | } 25 | 26 | tagDeployments() -------------------------------------------------------------------------------- /scripts/prepare.ts: -------------------------------------------------------------------------------- 1 | import fs from 'fs' 2 | import path from 'path' 3 | import Mustache from 'mustache' 4 | import { networks } from './config' 5 | 6 | 7 | 8 | // Read template 9 | const template = fs.readFileSync( 10 | path.join(__dirname, '../template/subgraph.template.yaml'), 11 | 'utf8' 12 | ) 13 | 14 | function generateConfig(network: keyof typeof networks) { 15 | const config = networks[network] 16 | // Force string rendering for specific fields 17 | // @ts-ignore 18 | const output = Mustache.render(template, config, {}, { 19 | escape: (value: any) => { 20 | if (typeof value === 'string' && value.startsWith('0x')) { 21 | return value; 22 | } 23 | return value; 24 | } 25 | }) 26 | fs.writeFileSync(path.join(__dirname, '../subgraph.yaml'), output) 27 | } 28 | 29 | // Get network from command line args 30 | const network = process.argv[2] as keyof typeof networks || 'mainnet' 31 | if (!networks[network]) { 32 | throw new Error(`Network ${network} not supported`) 33 | } 34 | console.log("Generating config for: ", networks[network]) 35 | generateConfig(network) -------------------------------------------------------------------------------- /scripts/utils/utils.ts: -------------------------------------------------------------------------------- 1 | import { Version } from "../config"; 2 | 3 | export function parseVersion(versionStr: string): Version { 4 | const [major = 0, minor = 0, patch = 0] = versionStr.split('.').map(Number) 5 | return { major, minor, patch } 6 | } 7 | 8 | export function formatVersion(version: Version): string { 9 | return `${version.major}.${version.minor}.${version.patch}` 10 | } 11 | 12 | export function compareVersions(a: Version, b: Version): number { 13 | if (a.major !== b.major) return b.major - a.major 14 | if (a.minor !== b.minor) return b.minor - a.minor 15 | return b.patch - a.patch 16 | } 17 | 18 | export interface SubgraphInfo { 19 | name: string; 20 | version: string; 21 | } 22 | 23 | export function extractSubgraphInfo(url: string): SubgraphInfo { 24 | try { 25 | // Extract the part after "subgraphs/" 26 | const match = url.match(/\/subgraphs\/([^\/]+)\/([^\/]+)/); 27 | if (!match) throw new Error('Invalid URL') 28 | 29 | return { 30 | name: match[1] || '', 31 | version: match[2] || '' 32 | }; 33 | } catch (error) { 34 | console.error('Error extracting subgraph info: ', error) 35 | throw error 36 | } 37 | } -------------------------------------------------------------------------------- /src/factories/euler-earn-factory.ts: -------------------------------------------------------------------------------- 1 | import { dataSource } from "@graphprotocol/graph-ts" 2 | import { DeploylqgEarn as DeploylqgEarnEvent } from "../../generated/lqgEarnFactory/lqgEarnFactory" 3 | import { DeploylqgEarn, lqgEarnVault } from "../../generated/schema" 4 | import { lqgEarn as lqgEarnTemplate } from "../../generated/templates" 5 | 6 | import { loadOrCreatelqgEarnVault } from "../utils/earnVault" 7 | export function handleDeploylqgEarn(event: DeploylqgEarnEvent): void { 8 | // Create DeploylqgEarn entity 9 | let deployEntity = new DeploylqgEarn( 10 | event.transaction.hash.concatI32(event.logIndex.toI32()), 11 | ) 12 | deployEntity.owner = event.params._owner 13 | deployEntity.lqgEarnVault = event.params._lqgEarnVault 14 | deployEntity.asset = event.params._asset 15 | 16 | deployEntity.blockNumber = event.block.number 17 | deployEntity.blockTimestamp = event.block.timestamp 18 | deployEntity.transactionHash = event.transaction.hash 19 | 20 | deployEntity.save() 21 | 22 | let earnVault = loadOrCreatelqgEarnVault(event.params._lqgEarnVault) 23 | earnVault.owner = event.params._owner 24 | earnVault.save() 25 | // Create templates with context 26 | let context = dataSource.context() 27 | lqgEarnTemplate.createWithContext(event.params._lqgEarnVault, context) 28 | } 29 | -------------------------------------------------------------------------------- /src/utils/counter.ts: -------------------------------------------------------------------------------- 1 | import { BigInt, Bytes } from "@graphprotocol/graph-ts" 2 | import { Counter } from "../../generated/schema" 3 | 4 | function loadCounter(id: string, isGlobal: boolean): Counter { 5 | let entity = Counter.load(Bytes.fromUTF8(id)) 6 | if (entity == null) { 7 | entity = new Counter(Bytes.fromUTF8(id)) 8 | entity.value = BigInt.zero() 9 | entity.isGlobal = isGlobal 10 | entity.type = id 11 | entity.save() 12 | } 13 | return entity 14 | } 15 | 16 | export function increaseCounter( 17 | type: string, 18 | blockNumber: BigInt, 19 | blockTimestamp: BigInt, 20 | transactionHash: Bytes, 21 | ): void { 22 | let global = loadCounter("global", true) 23 | let entity = loadCounter(type, false) 24 | 25 | // Set the type 26 | global.type = type 27 | entity.type = type 28 | // Increase one the counter 29 | global.value = global.value.plus(BigInt.fromI32(1)) 30 | entity.value = entity.value.plus(BigInt.fromI32(1)) 31 | // Update information from the last TX 32 | global.blockNumber = blockNumber 33 | entity.blockNumber = blockNumber 34 | global.blockTimestamp = blockTimestamp 35 | entity.blockTimestamp = blockTimestamp 36 | global.transactionHash = transactionHash 37 | entity.transactionHash = transactionHash 38 | 39 | // Save the entity 40 | global.save() 41 | entity.save() 42 | } 43 | -------------------------------------------------------------------------------- /contracts/addresses/2390/peripheryAddresses.ts: -------------------------------------------------------------------------------- 1 | export const peripheryAddresses = { 2 | adaptiveCurveIRMFactory: "0xaA4b98f58253E9FEf7D046616FbCA88af892E749", 3 | edgeFactory: "0x79525e81339B18713F0caa12665af06BFC8B17a2", 4 | edgeFactoryPerspective: "0x1AA5821AF87de5c6D0D5e2F7bF123F68EC790897", 5 | escrowedCollateralPerspective: "0xb13759d9AA3881001DEA707Dd689558dCfCd9dE2", 6 | lqgEarnFactoryPerspective: "0x0f8fCf22e847b9C50FD959463a8625a8B2aE677f", 7 | lqgEarnGovernedPerspective: "0xBc67CCdBd2B34ae06d8D8112996A2a01E570550E", 8 | lqgUngoverned0xPerspective: "0x3036207e955C21929924EeB50b92ddCE5c2e2336", 9 | lqgUngovernedNzxPerspective: "0x40f5998289Dcd7579950b797aEb7aD3F9C7f922b", 10 | evkFactoryPerspective: "0xA94b77Ee44590Ac34c69615b77c6168Ebd155A4c", 11 | externalVaultRegistry: "0x5f9bb3b32fAd86BAbCa27331ccA9680c49B5a15F", 12 | feeFlowController: "0x0000000000000000000000000000000000000000", 13 | governedPerspective: "0xCc88B88C063CEAB7CF1685724636f3B27874F65d", 14 | governorAccessControlEmergencyFactory: "0xf1D34F5722e1160415f67dbf6d3E407292a71569", 15 | irmRegistry: "0x433Eaf9Ce8Cc4d7c83CB1D3FE1C292FdcdfBfB8a", 16 | kinkIRMFactory: "0x3C9461Af1C3AC31524d597b5372Ec545BB7821E7", 17 | oracleAdapterRegistry: "0x840dc90F46952a74c112172Bb5beE46f96588A3b", 18 | oracleRouterFactory: "0x769bAF8ADFBfaf71B867b2e0288b57f850297835", 19 | swapVerifier: "0xbBAcf03386E83cC6A08dda6AC68B1893520BB880", 20 | swapper: "0xDDB5949D697c2abbFf9133eb68A1dAE955271266", 21 | termsOfUseSigner: "0x33060Ae5960E4CB14f5dfd2a675E60bb4b1fEcEe" 22 | } as const 23 | -------------------------------------------------------------------------------- /contracts/addresses/1/peripheryAddresses.ts: -------------------------------------------------------------------------------- 1 | export const peripheryAddresses = { 2 | adaptiveCurveIRMFactory: "0x3EC2d5af936bBB57DD19C292BAfb89da0E377F42", 3 | capRiskStewardFactory: "0x93c233008971E878d60a7737657869ab746f3208", 4 | edgeFactory: "0xA969B8a46166B135fD5AC533AdC28c816E1659Bd", 5 | edgeFactoryPerspective: "0x8c7543f83D3d295F68447792581F73d7d5D4d788", 6 | escrowedCollateralPerspective: "0x4e58BBEa423c4B9A2Fc7b8E58F5499f9927fADdE", 7 | lqgEarnFactoryPerspective: "0xC09be111D95171d1D5db43f1324005D21C098B52", 8 | lqgEarnGovernedPerspective: "0x747a726736DDBE6210B9d7187b3479DC5705165E", 9 | lqgUngoverned0xPerspective: "0xb50a07C2B0F128Faa065bD18Ea2091F5da5e7FbF", 10 | lqgUngovernedNzxPerspective: "0x600bBe1D0759F380Fea72B2e9B2B6DCb4A21B507", 11 | evkFactoryPerspective: "0xB30f23bc5F93F097B3A699f71B0b1718Fc82e182", 12 | externalVaultRegistry: "0xB3b30ffb54082CB861B17DfBE459370d1Cc219AC", 13 | feeFlowController: "0xFcd3Db06EA814eB21C84304fC7F90798C00D1e32", 14 | governedPerspective: "0xC0121817FF224a018840e4D15a864747d36e6Eb2", 15 | governorAccessControlEmergencyFactory: 16 | "0x025C8831c6E45420DF8E71F7B6b99F733D120Faf", 17 | irmRegistry: "0x0a64670763777E59898AE28d6ACb7f2062BF459C", 18 | kinkIRMFactory: "0xcAe0A39B45Ee9C3213f64392FA6DF30CE034C9F9", 19 | oracleAdapterRegistry: "0xA084A7F49723E3cc5722E052CF7fce910E7C5Fe6", 20 | oracleRouterFactory: "0x70B3f6F61b7Bf237DF04589DdAA842121072326A", 21 | swapVerifier: "0xae26485ACDDeFd486Fe9ad7C2b34169d360737c7", 22 | swapper: "0x2Bba09866b6F1025258542478C39720A09B728bF", 23 | termsOfUseSigner: "0x9ba11Acd88B79b657BDbD00B6dE759718AaAdCbA", 24 | } as const 25 | -------------------------------------------------------------------------------- /contracts/addresses/10/peripheryAddresses.ts: -------------------------------------------------------------------------------- 1 | export const peripheryAddresses = { 2 | adaptiveCurveIRMFactory: "0x367902505cbba03F9c7ac71F8a00a8E252718f45", 3 | capRiskStewardFactory: "0x50741d6feF8Db2d80b0bcBe71dAE6DbbE4641f40", 4 | edgeFactory: "0xEb0a720eCbf1550108CF0189C15853e1ef4Bdb85", 5 | edgeFactoryPerspective: "0x0b5301f610F4F04D510B28F5e7234363111c9907", 6 | escrowedCollateralPerspective: "0xabEcAFaf0bC41A007a1A3eDAFAAdFA06a0a83eCB", 7 | lqgEarnFactoryPerspective: "0x4d3490EED1e7314b27974478af13dDbD8267cF6e", 8 | lqgEarnGovernedPerspective: "0xe205b73AB9e85B22DE1120665e32a85b214A2a55", 9 | lqgUngoverned0xPerspective: "0x6DF5324FA7Ec14fAa294cb6961e4EE647A6b73EC", 10 | lqgUngovernedNzxPerspective: "0x67907760F923897A337a9435e5027242B0E168A9", 11 | evkFactoryPerspective: "0x044dc4d90fe80f9239dd6493f11a09164Ca78854", 12 | externalVaultRegistry: "0x8cadE2806f83198676e89d3e77b97b472F656feb", 13 | feeFlowController: "0xD04C4B53d086144DB07900792aDB6De5E5813F85", 14 | governedPerspective: "0x24E9B780e9CF56B326A08C81EEAe0242F2754304", 15 | governorAccessControlEmergencyFactory: 16 | "0x19dD77f17FaAe0415261E1585Fd1fB79c6CefE48", 17 | irmRegistry: "0xECB7945403897a575Ee29296F39A6d2b45623b0F", 18 | kinkIRMFactory: "0xc01c5A25659AF1f9415C15AE2e483C5b0c149041", 19 | oracleAdapterRegistry: "0x0f62EBc542c9c0c4Dbf31f69A8E2d6f4aF93229B", 20 | oracleRouterFactory: "0xA0F284fe1788c389E5F9897e106e600F1D20ee5c", 21 | swapVerifier: "0x804C754ea602B54B28b0D3a10F8122e0a605dAD9", 22 | swapper: "0x76B103bECa4459C9E0dd35a8E5ad48c8f93e768f", 23 | termsOfUseSigner: "0xAC2c4399c27Ac78F5A1400E5062cf90858F75D6A", 24 | } as const 25 | -------------------------------------------------------------------------------- /contracts/addresses/100/peripheryAddresses.ts: -------------------------------------------------------------------------------- 1 | export const peripheryAddresses = { 2 | adaptiveCurveIRMFactory: "0x890E00FEB4A811B1a96F3A6F965c4F230462b66A", 3 | capRiskStewardFactory: "0x3B5DFdDb6217Da0C47aA01823862584c2Ca859a3", 4 | edgeFactory: "0x5fC21d1eC3e21E98f5D2edfe0c27bF974423a733", 5 | edgeFactoryPerspective: "0x5aD4aE33cCE0Bf9C0dCCDD018277bDD4d6865262", 6 | escrowedCollateralPerspective: "0x7c15B3Dfd84254FfaAA5b6f8B1FbF7eAb1c22b2A", 7 | lqgEarnFactoryPerspective: "0xa52af4bdf27A0067aDC99B170fa976220DCC4D9F", 8 | lqgEarnGovernedPerspective: "0xDECa03e98A96eD3FF373b9aF00eb1f27154093E3", 9 | lqgUngoverned0xPerspective: "0x90f0c2692Cd73F11Ed46b2835d2e06Bd5A14E666", 10 | lqgUngovernedNzxPerspective: "0xA4dff11699BACaBa853659991d353062A8894B69", 11 | evkFactoryPerspective: "0x777AFd73AFC260Ef7025d0C51A8158554d816e7E", 12 | externalVaultRegistry: "0x95c12bCd808C4E51eD34F58de72A8d9583e9eBE7", 13 | feeFlowController: "0x36ADfebbE0c65aEA3B01e58441e1E7b0c342E665", 14 | governedPerspective: "0xb6135C19b456836B73dFba49AeeFF0b7fCD28BCc", 15 | governorAccessControlEmergencyFactory: 16 | "0x6895f5E26d7ae3D47eA30C0727F5c04896622B3d", 17 | irmRegistry: "0xEd67e854160efBC77EFf549Ed456a52d2D0B84a1", 18 | kinkIRMFactory: "0x6F9A745EdBdD5F205B75286F50EB95701539a99d", 19 | oracleAdapterRegistry: "0xfBCBc9b4138479b044Ac3b53045B92730D8912e8", 20 | oracleRouterFactory: "0x8438A93e8d4Fc14882CBBDb0263a70988dF25C10", 21 | swapVerifier: "0xf730e013eA862e91baD957Bc8F8837441259a4D2", 22 | swapper: "0x59072bf20763F311f560B26a887dca5a53E20922", 23 | termsOfUseSigner: "0xafc9Af1241F0356dEA9C215D26988286C67874bC", 24 | } as const 25 | -------------------------------------------------------------------------------- /contracts/addresses/130/peripheryAddresses.ts: -------------------------------------------------------------------------------- 1 | export const peripheryAddresses = { 2 | adaptiveCurveIRMFactory: "0xbAbbE203727f8327106e6087f075F2B2F2B738d1", 3 | capRiskStewardFactory: "0x805C408e8afAbb4D44b39B838F0586617993043a", 4 | edgeFactory: "0x5aECa7B7bDD4C876ed88E33Da7bAd45CB7224B12", 5 | edgeFactoryPerspective: "0x990Bb5D21Cc852687bF95B850a279daF9b6C45D2", 6 | escrowedCollateralPerspective: "0x413Cf25A789784e07a428D7fb1e0B43eeF84A4B0", 7 | lqgEarnFactoryPerspective: "0x9138ABa3239F450407E2ed943693945FFA1877CF", 8 | lqgEarnGovernedPerspective: "0x994898E67539df565f1590B6799F7feE77822533", 9 | lqgUngoverned0xPerspective: "0xeEF6CF66abbD88fe97BeE236aac21285158f3a3A", 10 | lqgUngovernedNzxPerspective: "0xcAb8bBe881a13A513770746AF15F7cC884843734", 11 | evkFactoryPerspective: "0x5A2164C500f4FD26AB037d97A3ed5d0774446c6B", 12 | externalVaultRegistry: "0xC0a8dFA92CB9FF9F503803D3bAE2CF19E9c15411", 13 | feeFlowController: "0x87BeecC6B609723B2Ef071c20AA756846969240C", 14 | governedPerspective: "0x44d781D9f61649fACeeEC919c71C8537531df027", 15 | governorAccessControlEmergencyFactory: 16 | "0x4F74dEd1980096C44B5fEE2A697B4B05AC75d987", 17 | irmRegistry: "0x01315b1fa7e8A58D641C2c7f538654Fa32E0341f", 18 | kinkIRMFactory: "0x34f3Ecd35E05b0554B6F4ee5Ba3A373ADd6a2538", 19 | oracleAdapterRegistry: "0xDc0D3E9119d4ccB7E186E699d1df5cDd7bCa5783", 20 | oracleRouterFactory: "0xE551288F0D82C10bBF517DBA66E15C60BF87FE8f", 21 | swapVerifier: "0x7eaf8C22480129E5D7426e3A33880D7bE19B50a7", 22 | swapper: "0x319E8ecd3BaB57fE684ca1aCfaB60c5603087B3A", 23 | termsOfUseSigner: "0xEfd9F447b35aF280110975BCFA442050EF283D86", 24 | } as const 25 | -------------------------------------------------------------------------------- /contracts/addresses/137/peripheryAddresses.ts: -------------------------------------------------------------------------------- 1 | export const peripheryAddresses = { 2 | adaptiveCurveIRMFactory: "0x3617a7139dEd8F243B6CD24Da7a28c3D333a44Ce", 3 | capRiskStewardFactory: "0xcE4d060349A7301B7a39615D577287aeBEbD3df2", 4 | edgeFactory: "0x61d3aacC7Ed1bA5Ca896e6C5F642238FaaCA5C03", 5 | edgeFactoryPerspective: "0xAD52974Dc0c710D7ca807492F53940CBFDb5F56A", 6 | escrowedCollateralPerspective: "0x86B8C370fb1a40ff27AE5cC55a06095F85414f19", 7 | lqgEarnFactoryPerspective: "0xF1B0C81e03Dd1B82Dc31feD61833A9D9476B00F1", 8 | lqgEarnGovernedPerspective: "0x5C128b1F4A0C0D257733bCc93eD530AF4a31157F", 9 | lqgUngoverned0xPerspective: "0x11B6ED83e1700E46d62EbC971aF238a85d2E0594", 10 | lqgUngovernedNzxPerspective: "0xFe27bCB7dEC7a9b624821E28Dd0cb75853f74C9b", 11 | evkFactoryPerspective: "0x0a165FaB7D2a0DAce3C717e2ad863E831E94E433", 12 | externalVaultRegistry: "0x226FF0f895192ffBd025a9dF16da60E559AB4a63", 13 | feeFlowController: "0x116e4de5E628E6beaCc6ba94Faf8Cc50ACe6225a", 14 | governedPerspective: "0x4249Aae9497a541682F1110be5fD1abDeF07D7Fb", 15 | governorAccessControlEmergencyFactory: 16 | "0xD93452A6456783b0d17F9cd7Dc6c67BEf433f08f", 17 | irmRegistry: "0xab8681067EE4dedD602A65738332038781A69ea9", 18 | kinkIRMFactory: "0x52A5228987bE510c7D89aD928b47C51975f99Df6", 19 | oracleAdapterRegistry: "0xC9601d737dbd6649B066Fd22599969abD024a6E0", 20 | oracleRouterFactory: "0x9FCc467b739871f97485570d754d6786752Db553", 21 | swapVerifier: "0xD2c4D6831C6F7c2162015523b8105b972a3D2958", 22 | swapper: "0xe6C04A97fdfAE75BBA82451Ae7296D8b48B8C0A4", 23 | termsOfUseSigner: "0xde9B03C4cAa64D69a22eaA6A6f973EcaEd40fA5F", 24 | } as const 25 | -------------------------------------------------------------------------------- /contracts/addresses/146/peripheryAddresses.ts: -------------------------------------------------------------------------------- 1 | export const peripheryAddresses = { 2 | adaptiveCurveIRMFactory: "0x1515a13551fDF554203f2a86021e0370a08a8D94", 3 | capRiskStewardFactory: "0xE5BEEAaDd7b35Ed4F9F8d519323236698a4866b7", 4 | edgeFactory: "0x262761D43309ba3b05C240cd8825D3689E600Ef3", 5 | edgeFactoryPerspective: "0xBB3C87743126F6CD025569be8af89Aeb43384ef1", 6 | escrowedCollateralPerspective: "0xb70DbFBBaB2B9F01A86B397F0954beA2EAF3Bce5", 7 | lqgEarnFactoryPerspective: "0xA912262Ba05D9C0233D6D652BaB6810Cb2405972", 8 | lqgEarnGovernedPerspective: "0xa5F5b253D0Fd9D0fA79078540AC7e56299eF65c9", 9 | lqgUngoverned0xPerspective: "0x770500Ee92d2C395Aa39f2C573A08D78D5FF8090", 10 | lqgUngovernedNzxPerspective: "0x2a75a1D4e4bba15e74693141f8D75f206BFa2967", 11 | evkFactoryPerspective: "0x69D2403d9a0715CDc89AcB015Ec2AfB200C4f6BD", 12 | externalVaultRegistry: "0x650737Bf472588A04530494189c3c30eaF5f6C50", 13 | feeFlowController: "0xD3Cf3Ec3D7849F2C7Bb9Ff5a8662Ae36a177bEb8", 14 | governedPerspective: "0x93478469b049e75B8d20b6d2c5A8da84E35f14D0", 15 | governorAccessControlEmergencyFactory: 16 | "0xE83A3ba3D2D04b6bfeeA198e27d2f6cA7e125bA1", 17 | irmRegistry: "0xeEF91153b27fabF42a2F88e753285D0aFb736d09", 18 | kinkIRMFactory: "0x52E856790779fD4fCa34bA52C67Cd191338572C0", 19 | oracleAdapterRegistry: "0x93Fd7A2b4E6BEa3c35D06468a7Bd7b0eA202d075", 20 | oracleRouterFactory: "0xc5b9B95a769C24c18c344c2659db61a0AdFB736E", 21 | swapVerifier: "0x003ef4048b45a5A79D4499aaBd52108B3Bc9209f", 22 | swapper: "0xbAf5B12c92711a3657DD4adA6b3C7801e83Bb56a", 23 | termsOfUseSigner: "0xe82F78560A2a15561f2A6778295B0C55048b6053", 24 | } as const 25 | -------------------------------------------------------------------------------- /contracts/addresses/1923/peripheryAddresses.ts: -------------------------------------------------------------------------------- 1 | export const peripheryAddresses = { 2 | adaptiveCurveIRMFactory: "0x73ab43878997BcDc5d726b7aE76F149ebe9d3AA9", 3 | capRiskStewardFactory: "0x58898Aa0c361EaC3740dadef99eD4b4d41AC1533", 4 | edgeFactory: "0xE2Fa51b41D7B41d16ba911e405d86dA7FB3D1c45", 5 | edgeFactoryPerspective: "0x05cf50742e4457cD7CB2f191c03a61ae95CF3C30", 6 | escrowedCollateralPerspective: "0x5757C89D418e35EF1a0CE3A06258A1Fc8D3d31b2", 7 | lqgEarnFactoryPerspective: "0xA018cEa7Bcf46331BEA8EFabb11959219Bf46CF9", 8 | lqgEarnGovernedPerspective: "0x8ef149D4dE271b6aC317eD9E3466c3314dab0991", 9 | lqgUngoverned0xPerspective: "0x96367505890EF888c0C92E19a9814fa27B461549", 10 | lqgUngovernedNzxPerspective: "0x2671dA0a4539886cDd4E40096fF1A70b45fc7289", 11 | evkFactoryPerspective: "0x96070bE9d3dFb045c6C96D35CeCc70Aa2940c756", 12 | externalVaultRegistry: "0x575fcBb7a9f72F8550E578f8fEed6Ac40e0b3b5C", 13 | feeFlowController: "0xA93Ff8C4CC2Ba56Ee182B70bb07F2C75DA249879", 14 | governedPerspective: "0xda258aB9569d0156B99943aDC4083E542F70a6f1", 15 | governorAccessControlEmergencyFactory: 16 | "0x88B049E6e1A3e11306aC437bbedD0077a2859A36", 17 | irmRegistry: "0x25fDdEae07949101fb4D060b95aB999fcAe547D5", 18 | kinkIRMFactory: "0xBECb652Fded7024765575165A98Bfe30b7374058", 19 | oracleAdapterRegistry: "0x049B9404B9cB8E0A02191e563faEFEAA8D87E619", 20 | oracleRouterFactory: "0x0135fC2605ff2C89E550C2d4C7d75068A4782B43", 21 | swapVerifier: "0x392C1570b3Bf29B113944b759cAa9a9282DA12Fe", 22 | swapper: "0x05Eb1A647265D974a1B0A57206048312604Ac6C3", 23 | termsOfUseSigner: "0xAD8E191ae4D4F6266BbD1bb248Fa2379c98b5b44", 24 | } as const 25 | -------------------------------------------------------------------------------- /contracts/addresses/480/peripheryAddresses.ts: -------------------------------------------------------------------------------- 1 | export const peripheryAddresses = { 2 | adaptiveCurveIRMFactory: "0x43B08f0b5256F611AD46a3fE7E82a00C0F2E6fFc", 3 | capRiskStewardFactory: "0xbBF5B94c81f64609aeA4849fAc8E3424f9b664E5", 4 | edgeFactory: "0x05d5261384370275E11A8e543275C820De6525D6", 5 | edgeFactoryPerspective: "0x219A70AbaB2Ae76CD3F18C46F0ebA0d89F7349eE", 6 | escrowedCollateralPerspective: "0x350fA9063a51b674e2cbb84Ec82B86E4e47beD13", 7 | lqgEarnFactoryPerspective: "0x908233ff55744f4B68FE3ADcA85A13a0A6394B20", 8 | lqgEarnGovernedPerspective: "0xAEe9fad984563177C7aF6427dCfBf7Bd7F6E0A72", 9 | lqgUngoverned0xPerspective: "0xb3EE544576F29dFD624F8fdD5B4efb3E316A9961", 10 | lqgUngovernedNzxPerspective: "0xF2610120459D4B9E014e0196188D26E1D10C7c29", 11 | evkFactoryPerspective: "0xCCd49830Ba50e495A5F7b0488e6aC7d5c9A9AdF4", 12 | externalVaultRegistry: "0x7c261465b4Eb836Bc19c055F0E8BdA538534C705", 13 | feeFlowController: "0xf2dF5C4Aa337bc7736ABDfb2e44F6804Dc17b228", 14 | governedPerspective: "0x8bf602785580BdcDD04F3dae483331DF4C50a0D7", 15 | governorAccessControlEmergencyFactory: 16 | "0x7B950a27F8e92eb9dAB57bDEeb58ED1f6147A259", 17 | irmRegistry: "0xd4d0b7731F5CA13BCA85eFd0665108cFef768215", 18 | kinkIRMFactory: "0x91D809E822a6735afe0613eF593887f1b576B91f", 19 | oracleAdapterRegistry: "0x933B95D5d729c5DcBaf8239d66e9Ab4002fdFfd7", 20 | oracleRouterFactory: "0xfABa404edb5CA55727533D81f415f95b2fD194Ee", 21 | swapVerifier: "0x7aAA49a2eC3A7CCCeb88B6E4cB450175623F7230", 22 | swapper: "0x20C6fC317bE2a454E4b8c1A08B3E6A15Ee8cb38E", 23 | termsOfUseSigner: "0x68f4a4e6EeC2a1C64162c8A6F2c3afe965eEC8d3", 24 | } as const 25 | -------------------------------------------------------------------------------- /contracts/addresses/56/peripheryAddresses.ts: -------------------------------------------------------------------------------- 1 | export const peripheryAddresses = { 2 | adaptiveCurveIRMFactory: "0x6155921DaEa6a8Dca108c4B434bC66E1c51F6d6E", 3 | capRiskStewardFactory: "0x34718b85452021Df5403A38CE798d80921921079", 4 | edgeFactory: "0x34A260811256abc5EB13BE6C867197d0C0133F9D", 5 | edgeFactoryPerspective: "0x546d1E3C430C712A610Df311727529aa6512c7e5", 6 | escrowedCollateralPerspective: "0x65B8Faec13bA76Decc5dc5678bf356954cCd6823", 7 | lqgEarnFactoryPerspective: "0x415e5a027fc8924DeC7100473c5e7787618B5e25", 8 | lqgEarnGovernedPerspective: "0xAbD38A64b41242d6F1565CC1702951Ec46E22cB9", 9 | lqgUngoverned0xPerspective: "0xea19a15182A78e8fFF080F79C769FBB590f4D3E9", 10 | lqgUngovernedNzxPerspective: "0x32581e478819f24434baC9041542770026cE32A7", 11 | evkFactoryPerspective: "0x9d928D359646dC4249A8d57259d87673F118Ec85", 12 | externalVaultRegistry: "0x74171139d712AE64faA8cEFA524e13fd52826c1b", 13 | feeFlowController: "0xE7Ef8C7CcB6aa81e366f0A0ccd89A298d9893E83", 14 | governedPerspective: "0x775231E5da4F548555eeE633ebf7355a83A0FC03", 15 | governorAccessControlEmergencyFactory: 16 | "0x71620376630597FA901112821455814a31d39685", 17 | irmRegistry: "0x69e47D24dE839423A94afcD01b88C1683BA4D1D0", 18 | kinkIRMFactory: "0x40739156B75b477f5b4f2D671655492B535B59d2", 19 | oracleAdapterRegistry: "0xd6238D3b8bEEd1C7f424eBF6fc1CcD7fe1b31665", 20 | oracleRouterFactory: "0xbe83f65e5e898D482FfAEA251B62647c411576F1", 21 | swapVerifier: "0xA8a4f96EC451f39Eb95913459901f39F5E1C068B", 22 | swapper: "0xAE4043937906975E95F885d8113D331133266Ee4", 23 | termsOfUseSigner: "0xA64404Dfd8Ea52ff8dA151442864C3c7C701e4A1", 24 | } as const 25 | -------------------------------------------------------------------------------- /contracts/addresses/8453/peripheryAddresses.ts: -------------------------------------------------------------------------------- 1 | export const peripheryAddresses = { 2 | adaptiveCurveIRMFactory: "0xae752d786ecAf6683f61b7D910F221edD003895b", 3 | capRiskStewardFactory: "0xD3A2b711239fC7e1c14266e71000b7360Ac9C58C", 4 | edgeFactory: "0x4B930F0222349c2092b8531A42295262cc4F0e4A", 5 | edgeFactoryPerspective: "0x6ECaCa741ec5013fc709292443b5F43A93a1deCe", 6 | escrowedCollateralPerspective: "0x977590fA311755DA2fa1421c1A944520b684f90F", 7 | lqgEarnFactoryPerspective: "0x479C8F149CD1f2dFFE0D0e07Cf441dB22934792c", 8 | lqgEarnGovernedPerspective: "0x0FAC4De8d6ff0317Aa6F8B2Dde096a08fd75c084", 9 | lqgUngoverned0xPerspective: "0x24F2b095df7c76266fd037b847360f69eD591549", 10 | lqgUngovernedNzxPerspective: "0xFff2dA17172588629Adf5BDEF275d9AbEBbA39Bd", 11 | evkFactoryPerspective: "0xFEA8e8a4d7ab8C517c3790E49E92ED7E1166F651", 12 | externalVaultRegistry: "0x6A60B3E561F0a7d9587F3210426FeC882224dF2d", 13 | feeFlowController: "0xbF4906E2F20362c3d746F7eFfF54abB8282902ed", 14 | governedPerspective: "0xafC8545c49DF2c8216305922D9753Bf60bf8c14A", 15 | governorAccessControlEmergencyFactory: 16 | "0x424d5C3e0046168C2F193Aa939c7a9aaB01eeB9A", 17 | irmRegistry: "0x384926132a5E516Bc8f79e6d7cd4301B6a887DfC", 18 | kinkIRMFactory: "0x2d94C898a17f9D8c0bA75010A51cd61BF55b402E", 19 | oracleAdapterRegistry: "0x3cD76476bB7933A99Fa5bAa05446e71e07CDe0ca", 20 | oracleRouterFactory: "0xA9287853987B107969f181Cce5e25e0D09c1c116", 21 | swapVerifier: "0x30660764A7a05B84608812C8AFC0Cb4845439EEe", 22 | swapper: "0x0D3d0F97eD816Ca3350D627AD8e57B6AD41774df", 23 | termsOfUseSigner: "0x0cE811D4171c2ab8bD8BeF5BeCf13Dc40baB0539", 24 | } as const 25 | -------------------------------------------------------------------------------- /contracts/addresses/999/peripheryAddresses.ts: -------------------------------------------------------------------------------- 1 | export const peripheryAddresses = { 2 | adaptiveCurveIRMFactory: "0xF62bFaA502E4dC83260e34aCF2B4875FdBDc31c9", 3 | capRiskStewardFactory: "0x459Fe76a4fc9406feBe3AcFdb42955197059b089", 4 | edgeFactory: "0x724904bc492959Ee175f5664d117B78DCBf2628e", 5 | edgeFactoryPerspective: "0xd15E7cD7875C77E4fA448F72476A93D409dbc033", 6 | escrowedCollateralPerspective: "0xaDaDF50246512dBA23889A1eC44611B191dfF6Fc", 7 | lqgEarnFactoryPerspective: "0xa46a0Eed57a46E2B99d93744F1EB2080dF54Ceb9", 8 | lqgEarnGovernedPerspective: "0xe27512ACd49b83b34f9af15B51f34eaB1dFaB7E5", 9 | lqgUngoverned0xPerspective: "0xb2b6c3Fc174dC99dF693876740df4939f465bb9E", 10 | lqgUngovernedNzxPerspective: "0xdf8E8Afc43AF8F2Be5CFDde0f044454DF4F0E633", 11 | evkFactoryPerspective: "0x7bd1DADB012651606cE70210c9c4d4c94e2480a3", 12 | externalVaultRegistry: "0xe09af00Dad8f1d2F056f08Ea1059aa6cA6397FEE", 13 | feeFlowController: "0x8916311B5E8056E0709163c52a51831A0f152b44", 14 | governedPerspective: "0x4936Cd82936b6862fDD66CC8c36e1828127a6b57", 15 | governorAccessControlEmergencyFactory: 16 | "0xaD9cc6ECf49376de4Ea10494Cb519a848e5e74F3", 17 | irmRegistry: "0x52930DC1b386348E9be3C9260659Dd910384A49d", 18 | kinkIRMFactory: "0xc1254039763498485a0BC11eb51437A312641bf0", 19 | oracleAdapterRegistry: "0x66390e34511DA5DbFeD572Cc5B1337Fe57AD02E7", 20 | oracleRouterFactory: "0x1CefA54ebBCb6c9Aa7347196B03364aFe9A89f7e", 21 | swapVerifier: "0x02632F49E00a996DB4e2cC114D301542e48C0641", 22 | swapper: "0x1dAbE49020104803084F67C057579a30b396206e", 23 | termsOfUseSigner: "0x8C80Fb30199d1dF899337183F3d45B333Ed38f02", 24 | } as const 25 | -------------------------------------------------------------------------------- /contracts/addresses/42161/peripheryAddresses.ts: -------------------------------------------------------------------------------- 1 | export const peripheryAddresses = { 2 | adaptiveCurveIRMFactory: "0x148B1DC3168C73907D9F00165Ceab62Fd81f3E9D", 3 | capRiskStewardFactory: "0x46a8a09dc96b35d14F556ba9462857d83002269a", 4 | edgeFactory: "0x3f7E741777A979BEB80C227949edde6814505475", 5 | edgeFactoryPerspective: "0x57E2e654d1576a02BeAaf3113C3faA9183c379eD", 6 | escrowedCollateralPerspective: "0xD775c4960c3A1B4A6A9962e37ecDe5c6b5fd56Fb", 7 | lqgEarnFactoryPerspective: "0x9AB2F207388D203fFAA75386AE0901F0B4668edC", 8 | lqgEarnGovernedPerspective: "0x382eb525f14a3301F644D607488ffaBfce041Ba9", 9 | lqgUngoverned0xPerspective: "0x068789293D461Be145D14BfC0e270941554CAC26", 10 | lqgUngovernedNzxPerspective: "0xfbB90dce4a2aCb5425b96B7886D621DE913c816D", 11 | evkFactoryPerspective: "0x03a931446F5A7e7ec1D850D8eaF95Ab68Ad9089C", 12 | externalVaultRegistry: "0xFB13aa1d7CFe1C85826f9D5e571589B13b785A6e", 13 | feeFlowController: "0xA1585dc7Cd4EF33f7a855fDE39771b37838B0bFE", 14 | governedPerspective: "0xc7693ceEf74Bc7c8Af703c5519F24bB5e6642643", 15 | governorAccessControlEmergencyFactory: 16 | "0x27369477130C8bC49CeeAe8ACb9cE50a2a7De616", 17 | irmRegistry: "0xC66887f15038db0379bb9Feb020Feab0F93D8f0E", 18 | kinkIRMFactory: "0xE055ea126c7704fFCf3Bd8a8F46aC93A6965560E", 19 | oracleAdapterRegistry: "0x3942A72f87Db5Ad9C22d8826FDe15E23b81b1cBf", 20 | oracleRouterFactory: "0x22d51Db42A59862D4F8c135C4406AEf9854ABFF3", 21 | swapVerifier: "0x7b16DAaFa76CfeC8C08D7a68aF31949B37ebfdF5", 22 | swapper: "0x6eE488A00A2ef1E2764cD7245F8a77C40060A7C7", 23 | termsOfUseSigner: "0x8259735562F02356CcEf2577c60A63391d6F48e4", 24 | } as const 25 | -------------------------------------------------------------------------------- /contracts/addresses/43114/peripheryAddresses.ts: -------------------------------------------------------------------------------- 1 | export const peripheryAddresses = { 2 | adaptiveCurveIRMFactory: "0x104BA4D746cf71F23341a7c855271A5E7dD19F58", 3 | capRiskStewardFactory: "0xC9f9209291FC1F0D6e859966B7ffB984a5e67709", 4 | edgeFactory: "0x088af3Ce37f42b6925C0C2DAa4d58b90fd186010", 5 | edgeFactoryPerspective: "0x0C13cf54c341a0F91939685dCB1C9b75c2A6f595", 6 | escrowedCollateralPerspective: "0x19747Fb40074F8cC32fd24445fAce1fCe11BD281", 7 | lqgEarnFactoryPerspective: "0x32E94331E03F2531f09427548B7712809e671344", 8 | lqgEarnGovernedPerspective: "0xc41dA37F17403E02b19010396943dc7De54c1431", 9 | lqgUngoverned0xPerspective: "0x299f86BbB552F74Be79A687c565aC52452C0a02d", 10 | lqgUngovernedNzxPerspective: "0xC2675790c775D385425D72652ded5f299Fbb2868", 11 | evkFactoryPerspective: "0x4247432b4f9c32e99ecC2Ff7bAdd98783EecFA6F", 12 | externalVaultRegistry: "0xe41338Ccac8121fb472817c58c485776E77f3Eea", 13 | feeFlowController: "0x95F21cD90057BBdC6fAc3f9b94D06b53C24B278c", 14 | governedPerspective: "0x0d1ABCcBa91F074DeA11AdCc679C61326b6145AC", 15 | governorAccessControlEmergencyFactory: 16 | "0xcA14D397219808F39724607e6401bD8C46CbF65f", 17 | irmRegistry: "0x9a05B935c2ABeD87b4d89c3E74dA253ffc49a2c1", 18 | kinkIRMFactory: "0xcad498936E09f38f18eD8375AeCD1d46689e7086", 19 | oracleAdapterRegistry: "0x0345D8a0Be83834B4611D7D20B661D0Bd2536928", 20 | oracleRouterFactory: "0x80528F014E84658e85D3C6D4896A29Fa933Be696", 21 | swapVerifier: "0x0d7938D9c31Cd7dD693752074284af133c1142de", 22 | swapper: "0x6E1C286e888Ab5911ca37aCeD81365d57eC29a06", 23 | termsOfUseSigner: "0xB1F64129ba3115DACaf294B07bCBF13CFFbBF1Af", 24 | } as const 25 | -------------------------------------------------------------------------------- /contracts/addresses/57073/peripheryAddresses.ts: -------------------------------------------------------------------------------- 1 | export const peripheryAddresses = { 2 | adaptiveCurveIRMFactory: "0x874d61F27FB1665dB7ccbcd58a87a4F909FeD0dC", 3 | capRiskStewardFactory: "0x38b16569bd743B77f9bB001B4Ab854ddb929b2DE", 4 | edgeFactory: "0xc7C437b4278387Bf8364f9B8Cd9E01FB57201fFb", 5 | edgeFactoryPerspective: "0x2e0B9384b835139E46d950fd090E07289EceD99b", 6 | escrowedCollateralPerspective: "0x32a55323402dd6A03eAF5f154d0A93812E9ce4bb", 7 | lqgEarnFactoryPerspective: "0xf3F6783B558D574f3E3D2d7f7334075F67b5C85D", 8 | lqgEarnGovernedPerspective: "0x6C00D9fb93680808c7fD178eceCCC7F83c83710f", 9 | lqgUngoverned0xPerspective: "0x4C5602F765f4e390e581E668cA26D1b73DedfFf1", 10 | lqgUngovernedNzxPerspective: "0x8d0737c74b86A5C4BC18A51a75f59Ce41338687c", 11 | evkFactoryPerspective: "0xd99365A1014AC2DA2067D0353C39d44933593212", 12 | externalVaultRegistry: "0xFE43e4E7271D21CdF136b5edEf1098A271E36825", 13 | feeFlowController: "0x544B3139cF94b88ba95cfc47A1f5d8c0c245B345", 14 | governedPerspective: "0xbF28A4A271C2ec627D9E45Ef2b5A285e70858448", 15 | governorAccessControlEmergencyFactory: 16 | "0xeE582507537b796D7CF4201Aeb302c3c4D3Bb74a", 17 | irmRegistry: "0x4eC82DAf920889123667A08be3C2adf440B281ce", 18 | kinkIRMFactory: "0x5183FB244fB36019604a630dA32247021946993c", 19 | oracleAdapterRegistry: "0xEf3caBaFeef8850C2bD743792bf5738899B2dE36", 20 | oracleRouterFactory: "0x8c210eC7B1f16b3dD81999D073a9ae9f922b1a57", 21 | swapVerifier: "0x389d4Bfa6F869542b220E4C71c74D58333B9F000", 22 | swapper: "0x4A790B1Dd4b59f07Ac31841dCbB0707d0aa2e616", 23 | termsOfUseSigner: "0xf7b32b6e4dfF68D9bb48bf3169463F0d623993Ee", 24 | } as const 25 | -------------------------------------------------------------------------------- /contracts/addresses/60808/peripheryAddresses.ts: -------------------------------------------------------------------------------- 1 | export const peripheryAddresses = { 2 | adaptiveCurveIRMFactory: "0xd399A4952A2444d20Fe97C5EdB5465Ad5dBaCe0d", 3 | capRiskStewardFactory: "0xB4Da0c6D9e6263dF98A5D29585A870ecaA0EA251", 4 | edgeFactory: "0x46B3711D973e45eaac2cc6C3d29c3Aa5b759B7AE", 5 | edgeFactoryPerspective: "0xb24B26E3091249b6d3FCed5AA30213e694f72474", 6 | escrowedCollateralPerspective: "0x44dcB151f7b091eA6C9090Ba7ad94C3e479bFE63", 7 | lqgEarnFactoryPerspective: "0xa239568b23Da02951482ddefDfa87A871145043a", 8 | lqgEarnGovernedPerspective: "0xd0B169E5822bCA444fA11AdF684C7795079F2c89", 9 | lqgUngoverned0xPerspective: "0x878343fc7AA3F3eC841D6C6A0e942B7209EF0D30", 10 | lqgUngovernedNzxPerspective: "0x6853213a8c0b66b7148B87E8D5cCfc580F60c077", 11 | evkFactoryPerspective: "0x05B98f64A31A33666cC9D2B32046a6Ca42699823", 12 | externalVaultRegistry: "0x28029B4De813866A4F7F03AeE4445732F02B3B09", 13 | feeFlowController: "0xcb3c0D131C64265099868F847face425499785A8", 14 | governedPerspective: "0xed62ebA9552dF86b5F7d995eD00C06494bBbB638", 15 | governorAccessControlEmergencyFactory: 16 | "0xD9FA1867066C3cDc50aC877FeDf505Eb2FC64dd7", 17 | irmRegistry: "0x709B4e5B081dD64101ebf6Fd111b2d5B671d8c88", 18 | kinkIRMFactory: "0x4464a3FD2A08b74324ecabA3149df421Dda3D0D0", 19 | oracleAdapterRegistry: "0xc57d019a9B57FbC9EE81019ef064960B0Dd6C741", 20 | oracleRouterFactory: "0xEFCF1F2f09163e3813f5C16346A9F2Aa21ABA74d", 21 | swapVerifier: "0x296041DbdBC92171293F23c0a31e1574b791060d", 22 | swapper: "0x697Ca30D765c1603890D88AAffBa3BeCCe72059d", 23 | termsOfUseSigner: "0x39cf8D253802cAD922bBfd2b695a83B8086D1F5f", 24 | } as const 25 | -------------------------------------------------------------------------------- /contracts/addresses/80094/peripheryAddresses.ts: -------------------------------------------------------------------------------- 1 | export const peripheryAddresses = { 2 | adaptiveCurveIRMFactory: "0xc6e28b94737f664b0be4230bd86793B6B6ed973B", 3 | capRiskStewardFactory: "0x0F0a7296e1bE7Afe30c03fB58A3F2be1cCaD36b4", 4 | edgeFactory: "0xd9137A32606E85cb39Ca760B79d184100b5C9e72", 5 | edgeFactoryPerspective: "0x749943E5Cf06c5Ff64EC475f2f220285520Ab389", 6 | escrowedCollateralPerspective: "0x766BF8aa4c90eF8df29aEf5D70C7aba1BC40Ee05", 7 | lqgEarnFactoryPerspective: "0x8b6E60d4e7FC05BcBB746A228a7f69564af1A041", 8 | lqgEarnGovernedPerspective: "0x2c18a06CCE2241F344DF8d14D8c733C30325A223", 9 | lqgUngoverned0xPerspective: "0x853ea3e0942e74B65D65275b2A2F3237B83A58d8", 10 | lqgUngovernedNzxPerspective: "0xE86e9B82788C1438b95346E7BF180AAf91AFC4bb", 11 | evkFactoryPerspective: "0xEE0CA74F3c60B7e1366e6d64AE2426E5177145cf", 12 | externalVaultRegistry: "0x73313Bc5aF05187466f42c53eaF4851816bd76CD", 13 | feeFlowController: "0x5EAe58dc72E4E374F32eCA2751cC38b573dd82c9", 14 | governedPerspective: "0xAE06ad3a165acA82AC4eFEcdE2D3875414C419b2", 15 | governorAccessControlEmergencyFactory: 16 | "0x3e3eD6B48B7fBD2518019CE53bbB02048E56f265", 17 | irmRegistry: "0x5650d5384e86C512c5Ea730D19451D3991086c7D", 18 | kinkIRMFactory: "0xeAF2a39A6D1A4C9b00Aca48eCE42C044A5a9628a", 19 | oracleAdapterRegistry: "0x50742B56E4c563d1cC3956AcBacd975d3f5309d2", 20 | oracleRouterFactory: "0x809aB347e6ECb46714917A7796E542c86f75FbF1", 21 | swapVerifier: "0x6fFf8Ac4AB123B62FF5e92aBb9fF702DCBD6C939", 22 | swapper: "0x4A35e6A872cf35623cd3fD07ebECEDFc0170D705", 23 | termsOfUseSigner: "0x295B1A5DBC76d8755e078Fe9b4D49F251321c4F2", 24 | } as const 25 | -------------------------------------------------------------------------------- /src/euler-swap.ts: -------------------------------------------------------------------------------- 1 | import { lqgSwapActivated as lqgSwapActivatedEvent, Swap as lqgSwapEvent } from '../generated/templates/lqgSwap/lqgSwap' 2 | import { lqgSwap, lqgSwapActivated } from '../generated/schema' 3 | import { loadOrCreatelqgSwapPool } from './utils/lqgSwap' 4 | export function handlelqgSwapActivated(event: lqgSwapActivatedEvent): void { 5 | let entity = new lqgSwapActivated(event.transaction.hash.concatI32(event.logIndex.toI32())) 6 | entity.asset0 = event.params.asset0 7 | entity.asset1 = event.params.asset1 8 | entity.blockNumber = event.block.number 9 | entity.blockTimestamp = event.block.timestamp 10 | entity.transactionHash = event.transaction.hash 11 | entity.save() 12 | 13 | let poolEntity = loadOrCreatelqgSwapPool(event.address) 14 | 15 | poolEntity.active = true 16 | poolEntity.save() 17 | 18 | } 19 | 20 | export function handlelqgSwap(event: lqgSwapEvent): void { 21 | let entity = new lqgSwap(event.transaction.hash.concatI32(event.logIndex.toI32())) 22 | entity.amount0In = event.params.amount0In 23 | entity.amount1In = event.params.amount1In 24 | entity.amount0Out = event.params.amount0Out 25 | entity.amount1Out = event.params.amount1Out 26 | entity.reserve0 = event.params.reserve0 27 | entity.reserve1 = event.params.reserve1 28 | entity.from = event.params.sender 29 | entity.to = event.params.to 30 | entity.pool = event.address 31 | entity.sender = event.transaction.from 32 | entity.blockNumber = event.block.number 33 | entity.blockTimestamp = event.block.timestamp 34 | entity.transactionHash = event.transaction.hash 35 | entity.save() 36 | } -------------------------------------------------------------------------------- /src/utils/clasicVaut.ts: -------------------------------------------------------------------------------- 1 | import { Address, BigInt, Bytes } from "@graphprotocol/graph-ts"; 2 | import { lqgVault } from "../../generated/schema"; 3 | import { lqgVault as lqgVaultContract } from "../../generated/templates/lqgVault/lqgVault"; 4 | 5 | export function loadOrCreatelqgVault(address: Bytes): lqgVault { 6 | let vault = lqgVault.load(address) 7 | if (!vault) { 8 | let vaultContract = lqgVaultContract.bind(Address.fromBytes(address)) 9 | vault = new lqgVault(address) 10 | vault.evc = vaultContract.EVC() 11 | vault.name = vaultContract.name() 12 | vault.decimals = BigInt.fromI32(vaultContract.decimals()) 13 | let caps = vaultContract.caps() 14 | vault.borrowCap = BigInt.fromI32(caps.value0) 15 | vault.supplyCap = BigInt.fromI32(caps.value1) 16 | vault.dToken = vaultContract.dToken() 17 | vault.evault = address 18 | vault.permit2Address = vaultContract.permit2Address() 19 | vault.interestRateModel = vaultContract.interestRateModel() 20 | vault.governonAdmin = vaultContract.governorAdmin() 21 | vault.feeReceiver = vaultContract.feeReceiver() 22 | vault.asset = vaultContract.asset() 23 | vault.oracle = vaultContract.oracle() 24 | vault.creator = vaultContract.creator() 25 | vault.symbol = vaultContract.symbol() 26 | vault.unitOfAccount = vaultContract.unitOfAccount() 27 | vault.blockNumber = BigInt.fromI32(0) 28 | vault.blockTimestamp = BigInt.fromI32(0) 29 | vault.transactionHash = Bytes.fromHexString("0x") 30 | vault.save() 31 | } 32 | return vault 33 | } 34 | 35 | -------------------------------------------------------------------------------- /contracts/abi/swapVerifierAbi.ts: -------------------------------------------------------------------------------- 1 | export const swapVerifierAbi = [ 2 | { 3 | type: "function", 4 | name: "verifyAmountMinAndSkim", 5 | inputs: [ 6 | { 7 | name: "vault", 8 | type: "address", 9 | internalType: "address", 10 | }, 11 | { 12 | name: "receiver", 13 | type: "address", 14 | internalType: "address", 15 | }, 16 | { 17 | name: "amountMin", 18 | type: "uint256", 19 | internalType: "uint256", 20 | }, 21 | { 22 | name: "deadline", 23 | type: "uint256", 24 | internalType: "uint256", 25 | }, 26 | ], 27 | outputs: [], 28 | stateMutability: "nonpayable", 29 | }, 30 | { 31 | type: "function", 32 | name: "verifyDebtMax", 33 | inputs: [ 34 | { 35 | name: "vault", 36 | type: "address", 37 | internalType: "address", 38 | }, 39 | { 40 | name: "account", 41 | type: "address", 42 | internalType: "address", 43 | }, 44 | { 45 | name: "amountMax", 46 | type: "uint256", 47 | internalType: "uint256", 48 | }, 49 | { 50 | name: "deadline", 51 | type: "uint256", 52 | internalType: "uint256", 53 | }, 54 | ], 55 | outputs: [], 56 | stateMutability: "view", 57 | }, 58 | { 59 | type: "error", 60 | name: "SwapVerifier_debtMax", 61 | inputs: [], 62 | }, 63 | { 64 | type: "error", 65 | name: "SwapVerifier_pastDeadline", 66 | inputs: [], 67 | }, 68 | { 69 | type: "error", 70 | name: "SwapVerifier_skimMin", 71 | inputs: [], 72 | }, 73 | ] as const 74 | -------------------------------------------------------------------------------- /contracts/addresses/239/peripheryAddresses.ts: -------------------------------------------------------------------------------- 1 | export const peripheryAddresses = { 2 | adaptiveCurveIRMFactory: "0x13703f8E7bAa5c99Fc9CD9EE1976dC7B562e5183", 3 | capRiskStewardFactory: "0x4eDf90a4C5d61f6415A58B3eD5b305A8b42D7c0f", 4 | edgeFactory: "0x29f43F6C0425D97250D2e529c35feDa81d35c3ac", 5 | edgeFactoryPerspective: "0x9bA5a13C6C11480F9B55E5065591E31e28379B6b", 6 | escrowedCollateralPerspective: "0x68e59139e687a45939a7504023C43d3157D28EA5", 7 | lqgEarnFactoryPerspective: "0x0000000000000000000000000000000000000000", 8 | lqgEarnGovernedPerspective: "0x0000000000000000000000000000000000000000", 9 | lqgUngoverned0xPerspective: "0xFAea47832Fd23d4BB3E3208061b76E765bAa8dBA", 10 | lqgUngovernedNzxPerspective: "0x0015d2177BF1B05648A9C39369706c8938822cbF", 11 | evkFactoryPerspective: "0xC194A7A86592C712BC155979A233B3d6F00e604a", 12 | externalVaultRegistry: "0xCe790A1800a54Ff2c558E2de0aaaA72243B4eF6c", 13 | feeFlowController: "0x9128754f3951a819528d110f3a92a2586D352463", 14 | governedPerspective: "0xb5B6AD9d08a2A6556C20AFD1D15796DEF2617e8F", 15 | governorAccessControlEmergencyFactory: 16 | "0x38d17d931FC1b6D79142Ba00e8F8ea89952cD2AB", 17 | irmRegistry: "0x71c4b9225Baaff7544a5bB29C9131365aD16Baa0", 18 | kinkIRMFactory: "0x80727c2F6A2cc64D19Ca5B7614b4bf826Dd95DcC", 19 | kinkyIRMFactory: "0x67D608256D0021b258FfB8834019FCB2152C9331", 20 | oracleAdapterRegistry: "0xE5441e9F93A9068E9a3085A2CbD33E44De56F3e3", 21 | oracleRouterFactory: "0x0512F7cbc4Fd9d8BC47FfFa3aA0372bA2375158E", 22 | swapVerifier: "0x5a8610DB17CfF800C8abEb6Da31B9bB1fF51843f", 23 | swapper: "0x5ff07e50D83769861db40C5087753124D389c1c0", 24 | termsOfUseSigner: "0x03C4A1b8b860Dd98fB3fc03c8D693EAbABC667c5", 25 | } as const 26 | -------------------------------------------------------------------------------- /src/utils/constants.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | export const EVAULT_SELECTORS = [ 4 | "0xa9059cbb", 5 | "0x23b872dd", 6 | "0xcbfdd7e1", 7 | "0x6e553f65", 8 | "0x94bf804d", 9 | "0xb460af94", 10 | "0xba087652", 11 | "0x8d56c639", 12 | "0x4b3fd148", 13 | "0xacb70815", 14 | "0xa9c8eb7e", 15 | "0xaebde56b", 16 | "0xa55526db", 17 | "0xc1342574", 18 | "0x2b5335c3", 19 | "0x2b67b570", 20 | ] 21 | 22 | export const TRANSFER_SELECTOR = "0xa9059cbb" 23 | export const TRANSFER_FROM_SELECTOR = "0x23b872dd" 24 | export const TRANSFER_FROM_MAX_SELECTOR = "0xcbfdd7e1" 25 | 26 | export const DEPOSIT_SELECTOR = "0x6e553f65" 27 | export const DEPOSIT_PERMIT_SELECTOR = "0x2b67b570" 28 | export const MINT_SELECTOR = "0x94bf804d" 29 | export const WITHDRAW_SELECTOR = "0xb460af94" 30 | export const REDEEM_SELECTOR = "0xba087652" 31 | export const SKIM_SELECTOR = "0x8d56c639" 32 | export const BORROW_SELECTOR = "0x4b3fd148" 33 | export const REPAY_SELECTOR = "0xacb70815" 34 | export const REPAY_WITH_SHARES_SELECTOR = "0xa9c8eb7e" 35 | export const PULL_DEBT_SELECTOR = "0xaebde56b" 36 | export const TOUCH_SELECTOR = "0xa55526db" 37 | export const LIQUIDATE_SELECTOR = "0xc1342574" 38 | export const CONVERT_FEES_SELECTOR = "0x2b5335c3" 39 | 40 | /* 41 | export const EVAULT_SELECTORS = new Map([ 42 | ["0xa9059cbb", "transfer"], 43 | ["0x23b872dd", "transferFrom"], 44 | ["0xcbfdd7e1", "transferFromMax"], 45 | ["0x6e553f65", "deposit"], 46 | ["0x94bf804d", "mint"], 47 | ["0xb460af94", "withdraw"], 48 | ["0xba087652", "redeem"], 49 | ["0x8d56c639", "skim"], 50 | ["0x4b3fd148", "borrow"], 51 | ["0xacb70815", "repay"], 52 | ["0xa9c8eb7e", "repayWithShares"], 53 | ["0xaebde56b", "pullDebt"], 54 | ["0xa55526db", "touch"], 55 | ["0xc1342574", "liquidate"], 56 | ["0x2b5335c3", "convertFees"], 57 | ]) 58 | 59 | */ -------------------------------------------------------------------------------- /src/utils/earnVault.ts: -------------------------------------------------------------------------------- 1 | import { Address, BigInt, Bytes } from "@graphprotocol/graph-ts"; 2 | import { lqgEarnVault } from "../../generated/schema"; 3 | import { lqgEarn as lqgEarnVaultContract } from "../../generated/templates/lqgEarn/lqgEarn"; 4 | 5 | export function loadOrCreatelqgEarnVault(address: Bytes): lqgEarnVault { 6 | let vault = lqgEarnVault.load(address) 7 | if (!vault) { 8 | let vaultContract = lqgEarnVaultContract.bind(Address.fromBytes(address)) 9 | vault = new lqgEarnVault(address) 10 | vault.evc = vaultContract.EVC() 11 | vault.name = vaultContract.name() 12 | vault.symbol = vaultContract.symbol() 13 | vault.permit2Address = vaultContract.permit2Address() 14 | vault.strategyModule = vaultContract.strategyModule() 15 | vault.owner = Address.zero() 16 | vault.asset = vaultContract.asset() 17 | vault.hooks = vaultContract.hooksModule() 18 | vault.totalAssets = vaultContract.totalAssets() 19 | vault.totalAllocated = BigInt.fromI32(0) 20 | vault.totalSupply = BigInt.fromI32(0) 21 | vault.name = vaultContract.name() 22 | vault.symbol = vaultContract.symbol() 23 | 24 | vault.blockNumber = BigInt.fromI32(0) 25 | vault.blockTimestamp = BigInt.fromI32(0) 26 | vault.transactionHash = Bytes.fromHexString("0x") 27 | 28 | vault.save() 29 | } 30 | return vault 31 | } 32 | 33 | export function updatelqgEarnVault(address: Bytes): void { 34 | let vault = loadOrCreatelqgEarnVault(address) 35 | let vaultContract = lqgEarnVaultContract.bind(Address.fromBytes(address)) 36 | vault.totalAssets = vaultContract.totalAssets() 37 | vault.totalAllocated = vaultContract.totalAllocated() 38 | vault.totalSupply = vaultContract.totalSupply() 39 | vault.save() 40 | } -------------------------------------------------------------------------------- /verify/utils/utils.ts: -------------------------------------------------------------------------------- 1 | import { getAddress } from "viem" 2 | import * as fs from 'fs' 3 | import * as path from 'path' 4 | 5 | export function toSubAccountId(address: string, subAccount: string) { 6 | return Number( 7 | BigInt(getAddress(address)) ^ BigInt(getAddress(subAccount)), 8 | ) 9 | } 10 | 11 | interface DeploymentInfo { 12 | network: string 13 | url: string 14 | version: string 15 | } 16 | 17 | export function getValidChains(): string[] { 18 | try { 19 | const deploymentsPath = path.join(process.cwd(), 'deployments.json') 20 | if (!fs.existsSync(deploymentsPath)) { 21 | console.error('deployments.json does not exist. Please generate it using:') 22 | console.error('pnpm generate:deployments') 23 | return [] 24 | } 25 | 26 | const deploymentsContent = fs.readFileSync(deploymentsPath, 'utf-8') 27 | const deployments: DeploymentInfo[] = JSON.parse(deploymentsContent) 28 | return deployments.map(d => d.network) 29 | } catch (error) { 30 | console.error(`Error reading deployments.json:`, error) 31 | return [] 32 | } 33 | } 34 | 35 | export function getSubgraphUrl(chainName: string): string { 36 | try { 37 | const deploymentsPath = path.join(process.cwd(), 'deployments.json') 38 | if (!fs.existsSync(deploymentsPath)) { 39 | console.error('deployments.json does not exist. Please generate it using:') 40 | console.error('pnpm generate:deployments') 41 | throw new Error('deployments.json not found') 42 | } 43 | 44 | const deploymentsContent = fs.readFileSync(deploymentsPath, 'utf-8') 45 | const deployments: DeploymentInfo[] = JSON.parse(deploymentsContent) 46 | 47 | const deployment = deployments.find(d => d.network === chainName) 48 | if (!deployment) { 49 | throw new Error(`Subgraph not available for chain ${chainName}`) 50 | } 51 | 52 | return deployment.url 53 | } catch (error) { 54 | console.error(`Error reading deployments.json:`, error) 55 | throw new Error(`Failed to get subgraph URL for chain ${chainName}`) 56 | } 57 | } -------------------------------------------------------------------------------- /tests/euler-earn.test.ts: -------------------------------------------------------------------------------- 1 | // import { 2 | // assert, 3 | // describe, 4 | // test, 5 | // clearStore, 6 | // beforeAll, 7 | // afterAll 8 | // } from "matchstick-as/assembly/index" 9 | // import { Address, BigInt, Bytes } from "@graphprotocol/graph-ts" 10 | // import { Approval } from "../generated/schema" 11 | // import { Approval as ApprovalEvent } from "../generated/lqgEarn/lqgEarn" 12 | // import { handleApproval } from "../src/lqg-earn" 13 | // import { createApprovalEvent } from "./lqg-earn-utils" 14 | 15 | // // Tests structure (matchstick-as >=0.5.0) 16 | // // https://thegraph.com/docs/en/developer/matchstick/#tests-structure-0-5-0 17 | 18 | // describe("Describe entity assertions", () => { 19 | // beforeAll(() => { 20 | // let owner = Address.fromString("0x0000000000000000000000000000000000000001") 21 | // let spender = Address.fromString( 22 | // "0x0000000000000000000000000000000000000001" 23 | // ) 24 | // let value = BigInt.fromI32(234) 25 | // let newApprovalEvent = createApprovalEvent(owner, spender, value) 26 | // handleApproval(newApprovalEvent) 27 | // }) 28 | 29 | // afterAll(() => { 30 | // clearStore() 31 | // }) 32 | 33 | // // For more test scenarios, see: 34 | // // https://thegraph.com/docs/en/developer/matchstick/#write-a-unit-test 35 | 36 | // test("Approval created and stored", () => { 37 | // assert.entityCount("Approval", 1) 38 | 39 | // // 0xa16081f360e3847006db660bae1c6d1b2e17ec2a is the default address used in newMockEvent() function 40 | // assert.fieldEquals( 41 | // "Approval", 42 | // "0xa16081f360e3847006db660bae1c6d1b2e17ec2a-1", 43 | // "owner", 44 | // "0x0000000000000000000000000000000000000001" 45 | // ) 46 | // assert.fieldEquals( 47 | // "Approval", 48 | // "0xa16081f360e3847006db660bae1c6d1b2e17ec2a-1", 49 | // "spender", 50 | // "0x0000000000000000000000000000000000000001" 51 | // ) 52 | // assert.fieldEquals( 53 | // "Approval", 54 | // "0xa16081f360e3847006db660bae1c6d1b2e17ec2a-1", 55 | // "value", 56 | // "234" 57 | // ) 58 | 59 | // // More assert options: 60 | // // https://thegraph.com/docs/en/developer/matchstick/#asserts 61 | // }) 62 | // }) 63 | -------------------------------------------------------------------------------- /tests/euler-earn-factory.test.ts: -------------------------------------------------------------------------------- 1 | // import { 2 | // assert, 3 | // describe, 4 | // test, 5 | // clearStore, 6 | // beforeAll, 7 | // afterAll 8 | // } from "matchstick-as/assembly/index" 9 | // import { Address } from "@graphprotocol/graph-ts" 10 | // import { DeploylqgEarn } from "../generated/schema" 11 | // import { DeploylqgEarn as DeploylqgEarnEvent } from "../generated/lqgEarnFactory/lqgEarnFactory" 12 | // import { handleDeploylqgEarn } from "../src/factories/lqg-earn-factory" 13 | // import { createDeploylqgEarnEvent } from "./lqg-earn-factory-utils" 14 | 15 | // // Tests structure (matchstick-as >=0.5.0) 16 | // // https://thegraph.com/docs/en/developer/matchstick/#tests-structure-0-5-0 17 | 18 | // describe("Describe entity assertions", () => { 19 | // beforeAll(() => { 20 | // let _owner = Address.fromString( 21 | // "0x0000000000000000000000000000000000000001" 22 | // ) 23 | // let _lqgEarnVault = Address.fromString( 24 | // "0x0000000000000000000000000000000000000001" 25 | // ) 26 | // let _asset = Address.fromString( 27 | // "0x0000000000000000000000000000000000000001" 28 | // ) 29 | // let newDeploylqgEarnEvent = createDeploylqgEarnEvent( 30 | // _owner, 31 | // _lqgEarnVault, 32 | // _asset 33 | // ) 34 | // handleDeploylqgEarn(newDeploylqgEarnEvent) 35 | // }) 36 | 37 | // afterAll(() => { 38 | // clearStore() 39 | // }) 40 | 41 | // // For more test scenarios, see: 42 | // // https://thegraph.com/docs/en/developer/matchstick/#write-a-unit-test 43 | 44 | // test("DeploylqgEarn created and stored", () => { 45 | // assert.entityCount("DeploylqgEarn", 1) 46 | 47 | // // 0xa16081f360e3847006db660bae1c6d1b2e17ec2a is the default address used in newMockEvent() function 48 | // assert.fieldEquals( 49 | // "DeploylqgEarn", 50 | // "0xa16081f360e3847006db660bae1c6d1b2e17ec2a-1", 51 | // "_owner", 52 | // "0x0000000000000000000000000000000000000001" 53 | // ) 54 | // assert.fieldEquals( 55 | // "DeploylqgEarn", 56 | // "0xa16081f360e3847006db660bae1c6d1b2e17ec2a-1", 57 | // "_lqgEarnVault", 58 | // "0x0000000000000000000000000000000000000001" 59 | // ) 60 | // assert.fieldEquals( 61 | // "DeploylqgEarn", 62 | // "0xa16081f360e3847006db660bae1c6d1b2e17ec2a-1", 63 | // "_asset", 64 | // "0x0000000000000000000000000000000000000001" 65 | // ) 66 | 67 | // // More assert options: 68 | // // https://thegraph.com/docs/en/developer/matchstick/#asserts 69 | // }) 70 | // }) 71 | -------------------------------------------------------------------------------- /scripts/generate-deployments.ts: -------------------------------------------------------------------------------- 1 | import { execSync } from 'child_process' 2 | import * as fs from 'fs' 3 | import * as path from 'path' 4 | import { Network, NETWORKS } from './config' 5 | import { parseVersion } from './utils/utils' 6 | 7 | 8 | interface DeploymentInfo { 9 | network: string 10 | url: string 11 | version: string 12 | } 13 | 14 | function getLatestDeployment(network: Network): DeploymentInfo | null { 15 | try { 16 | const result = execSync('goldsky subgraph list').toString() 17 | const lines = result.split('\n') 18 | .filter(line => line.includes(`lqg-v2-${network}`)) 19 | .map(line => { 20 | console.log(">>", line) 21 | const urlMatch = line.match(/https:\/\/[^\s]+/) 22 | const versionMatch = line.match(/(?:v|\/)((\d+)\.(\d+)\.(\d+))/) 23 | 24 | return { 25 | url: urlMatch ? urlMatch[0] : null, 26 | version: versionMatch ? versionMatch[1] : null 27 | } 28 | }) 29 | .filter(info => info.url && info.version) 30 | .sort((a, b) => { 31 | const versionA = parseVersion(a.version!) 32 | const versionB = parseVersion(b.version!) 33 | if (versionA.major !== versionB.major) return versionB.major - versionA.major 34 | if (versionA.minor !== versionB.minor) return versionB.minor - versionA.minor 35 | return versionB.patch - versionA.patch 36 | }) 37 | 38 | if (lines.length > 0) { 39 | console.log(`Latest version for ${network}:`, lines[0].version) 40 | return { 41 | network, 42 | url: lines[0].url!, 43 | version: lines[0].version! 44 | } 45 | } 46 | return null 47 | } catch (error) { 48 | console.error(`Error getting deployment for ${network}:`, error) 49 | return null 50 | } 51 | } 52 | 53 | function generateDeploymentsJson() { 54 | const deployments: DeploymentInfo[] = [] 55 | 56 | for (const network of NETWORKS) { 57 | const deployment = getLatestDeployment(network) 58 | if (deployment) { 59 | deployments.push(deployment) 60 | } 61 | } 62 | 63 | const outputPath = path.join(process.cwd(), 'deployments.json') 64 | fs.writeFileSync(outputPath, JSON.stringify(deployments, null, 2)) 65 | console.log('Deployments information has been saved to deployments.json') 66 | } 67 | 68 | generateDeploymentsJson() -------------------------------------------------------------------------------- /src/factories/euler-swap-factory.ts: -------------------------------------------------------------------------------- 1 | import { PoolDeployed as PoolDeployedEvent, PoolUninstalled as PoolUninstalledEvent, PoolConfig as PoolConfigEvent } from '../../generated/lqgSwapFactory/lqgSwapFactory' 2 | import { lqgSwapPool, lqgSwapPoolUninstalled } from '../../generated/schema' 3 | import { dataSource } from "@graphprotocol/graph-ts" 4 | import { lqgSwap as lqgSwapTemplate } from '../../generated/templates' 5 | import { loadOrCreatelqgSwapPool } from '../utils/lqgSwap' 6 | 7 | export function handlePoolDeployed(event: PoolDeployedEvent): void { 8 | 9 | let entity = loadOrCreatelqgSwapPool(event.params.pool) 10 | entity.asset0 = event.params.asset0 11 | entity.asset1 = event.params.asset1 12 | entity.lqgAccount = event.params.lqgAccount 13 | entity.pool = event.params.pool 14 | entity.blockNumber = event.block.number 15 | entity.blockTimestamp = event.block.timestamp 16 | entity.transactionHash = event.transaction.hash 17 | entity.active = false 18 | entity.save() 19 | 20 | let context = dataSource.context() 21 | lqgSwapTemplate.createWithContext(event.params.pool, context) 22 | } 23 | 24 | 25 | export function handlePoolConfig(event: PoolConfigEvent): void { 26 | 27 | let poolEntity = loadOrCreatelqgSwapPool(event.params.pool) 28 | 29 | poolEntity.vault0 = event.params.params.vault0 30 | poolEntity.vault1 = event.params.params.vault1 31 | poolEntity.fee = event.params.params.fee 32 | poolEntity.equilibriumReserve0 = event.params.params.equilibriumReserve0 33 | poolEntity.equilibriumReserve1 = event.params.params.equilibriumReserve1 34 | poolEntity.currReserve0 = event.params.initialState.currReserve0 35 | poolEntity.currReserve1 = event.params.initialState.currReserve1 36 | poolEntity.priceY = event.params.params.priceY 37 | poolEntity.priceX = event.params.params.priceX 38 | poolEntity.concentrationX = event.params.params.concentrationX 39 | poolEntity.concentrationY = event.params.params.concentrationY 40 | poolEntity.protocolFee = event.params.params.protocolFee 41 | poolEntity.protocolFeeRecipient = event.params.params.protocolFeeRecipient 42 | poolEntity.save() 43 | 44 | 45 | } 46 | 47 | 48 | export function handlePoolUninstalled(event: PoolUninstalledEvent): void { 49 | let entity = new lqgSwapPoolUninstalled( 50 | event.params.pool, 51 | ) 52 | entity.asset0 = event.params.asset0 53 | entity.asset1 = event.params.asset1 54 | entity.lqgAccount = event.params.lqgAccount 55 | entity.pool = event.params.pool 56 | entity.blockNumber = event.block.number 57 | entity.blockTimestamp = event.block.timestamp 58 | entity.transactionHash = event.transaction.hash 59 | entity.save() 60 | 61 | let poolEntity = loadOrCreatelqgSwapPool(event.params.pool) 62 | poolEntity.active = false 63 | poolEntity.save() 64 | 65 | } -------------------------------------------------------------------------------- /contracts/abi/basePerspectiveAbi.ts: -------------------------------------------------------------------------------- 1 | export const basePerspectiveAbi = [ 2 | { 3 | type: "function", 4 | name: "isVerified", 5 | inputs: [ 6 | { 7 | name: "vault", 8 | type: "address", 9 | internalType: "address", 10 | }, 11 | ], 12 | outputs: [ 13 | { 14 | name: "", 15 | type: "bool", 16 | internalType: "bool", 17 | }, 18 | ], 19 | stateMutability: "view", 20 | }, 21 | { 22 | type: "function", 23 | name: "name", 24 | inputs: [], 25 | outputs: [ 26 | { 27 | name: "", 28 | type: "string", 29 | internalType: "string", 30 | }, 31 | ], 32 | stateMutability: "view", 33 | }, 34 | { 35 | type: "function", 36 | name: "perspectiveVerify", 37 | inputs: [ 38 | { 39 | name: "vault", 40 | type: "address", 41 | internalType: "address", 42 | }, 43 | { 44 | name: "failEarly", 45 | type: "bool", 46 | internalType: "bool", 47 | }, 48 | ], 49 | outputs: [], 50 | stateMutability: "nonpayable", 51 | }, 52 | { 53 | type: "function", 54 | name: "vaultFactory", 55 | inputs: [], 56 | outputs: [ 57 | { 58 | name: "", 59 | type: "address", 60 | internalType: "contract GenericFactory", 61 | }, 62 | ], 63 | stateMutability: "view", 64 | }, 65 | { 66 | type: "function", 67 | name: "verifiedArray", 68 | inputs: [], 69 | outputs: [ 70 | { 71 | name: "", 72 | type: "address[]", 73 | internalType: "address[]", 74 | }, 75 | ], 76 | stateMutability: "view", 77 | }, 78 | { 79 | type: "function", 80 | name: "verifiedLength", 81 | inputs: [], 82 | outputs: [ 83 | { 84 | name: "", 85 | type: "uint256", 86 | internalType: "uint256", 87 | }, 88 | ], 89 | stateMutability: "view", 90 | }, 91 | { 92 | type: "event", 93 | name: "PerspectiveVerified", 94 | inputs: [ 95 | { 96 | name: "vault", 97 | type: "address", 98 | indexed: true, 99 | internalType: "address", 100 | }, 101 | ], 102 | anonymous: false, 103 | }, 104 | { 105 | type: "error", 106 | name: "PerspectiveError", 107 | inputs: [ 108 | { 109 | name: "perspective", 110 | type: "address", 111 | internalType: "address", 112 | }, 113 | { 114 | name: "vault", 115 | type: "address", 116 | internalType: "address", 117 | }, 118 | { 119 | name: "codes", 120 | type: "uint256", 121 | internalType: "uint256", 122 | }, 123 | ], 124 | }, 125 | { 126 | type: "error", 127 | name: "PerspectivePanic", 128 | inputs: [], 129 | }, 130 | ] as const 131 | -------------------------------------------------------------------------------- /contracts/abi/termsOfUseSignerAbi.ts: -------------------------------------------------------------------------------- 1 | export const termsOfUseSignerAbi = [ 2 | { 3 | type: "constructor", 4 | inputs: [ 5 | { 6 | name: "_evc", 7 | type: "address", 8 | internalType: "address", 9 | }, 10 | ], 11 | stateMutability: "nonpayable", 12 | }, 13 | { 14 | type: "function", 15 | name: "EVC", 16 | inputs: [], 17 | outputs: [ 18 | { 19 | name: "", 20 | type: "address", 21 | internalType: "address", 22 | }, 23 | ], 24 | stateMutability: "view", 25 | }, 26 | { 27 | type: "function", 28 | name: "lastTermsOfUseSignatureTimestamp", 29 | inputs: [ 30 | { 31 | name: "account", 32 | type: "address", 33 | internalType: "address", 34 | }, 35 | { 36 | name: "termsOfUseHash", 37 | type: "bytes32", 38 | internalType: "bytes32", 39 | }, 40 | ], 41 | outputs: [ 42 | { 43 | name: "", 44 | type: "uint256", 45 | internalType: "uint256", 46 | }, 47 | ], 48 | stateMutability: "view", 49 | }, 50 | { 51 | type: "function", 52 | name: "signTermsOfUse", 53 | inputs: [ 54 | { 55 | name: "termsOfUseMessage", 56 | type: "string", 57 | internalType: "string", 58 | }, 59 | { 60 | name: "termsOfUseHash", 61 | type: "bytes32", 62 | internalType: "bytes32", 63 | }, 64 | ], 65 | outputs: [], 66 | stateMutability: "nonpayable", 67 | }, 68 | { 69 | type: "event", 70 | name: "TermsOfUseSigned", 71 | inputs: [ 72 | { 73 | name: "account", 74 | type: "address", 75 | indexed: true, 76 | internalType: "address", 77 | }, 78 | { 79 | name: "termsOfUseHash", 80 | type: "bytes32", 81 | indexed: true, 82 | internalType: "bytes32", 83 | }, 84 | { 85 | name: "timestamp", 86 | type: "uint256", 87 | indexed: false, 88 | internalType: "uint256", 89 | }, 90 | { 91 | name: "message", 92 | type: "string", 93 | indexed: false, 94 | internalType: "string", 95 | }, 96 | ], 97 | anonymous: false, 98 | }, 99 | { 100 | type: "error", 101 | name: "ControllerDisabled", 102 | inputs: [], 103 | }, 104 | { 105 | type: "error", 106 | name: "EVC_InvalidAddress", 107 | inputs: [], 108 | }, 109 | { 110 | type: "error", 111 | name: "InvalidTermsOfUseHash", 112 | inputs: [ 113 | { 114 | name: "actualTermsOfUseHash", 115 | type: "bytes32", 116 | internalType: "bytes32", 117 | }, 118 | { 119 | name: "expectedTermsOfUseHash", 120 | type: "bytes32", 121 | internalType: "bytes32", 122 | }, 123 | ], 124 | }, 125 | { 126 | type: "error", 127 | name: "NotAuthorized", 128 | inputs: [], 129 | }, 130 | ] as const 131 | -------------------------------------------------------------------------------- /scripts/deploy.ts: -------------------------------------------------------------------------------- 1 | import { execSync } from 'child_process' 2 | import { Network, NETWORKS, Version } from './config' 3 | import { compareVersions, formatVersion, parseVersion } from './utils/utils' 4 | import { existsSync, readFileSync } from 'fs' 5 | 6 | const DEPLOYMENTS_FILE = 'deployments.json' 7 | function getLatestVersion(network: Network, subgraphName: string): Version { 8 | try { 9 | if (existsSync(DEPLOYMENTS_FILE)) { 10 | const deployments = JSON.parse(readFileSync(DEPLOYMENTS_FILE, 'utf8')) 11 | const deployment = deployments.find((deployment: any) => deployment.network === network) 12 | if (deployment) { 13 | return parseVersion(deployment.version) 14 | } 15 | } else { 16 | console.warn('Deployments file not found, using goldsky subgraph list') 17 | } 18 | 19 | const result = execSync('goldsky subgraph list').toString() 20 | const lines = result.split('\n') 21 | .filter(line => line.includes(subgraphName)) 22 | .map(line => { 23 | console.log(">>", line) 24 | const versionMatch = line.match(/(?:v|\/)((\d+)\.(\d+)\.(\d+))/) 25 | return versionMatch ? parseVersion(versionMatch[1]) : null 26 | }) 27 | .filter((version): version is Version => version !== null) 28 | .sort(compareVersions) 29 | if (lines.length > 0) { 30 | return lines[0] 31 | } 32 | 33 | return { major: 1, minor: 0, patch: 0 } 34 | } catch (error) { 35 | console.error('Error getting latest version:', error) 36 | return { major: 1, minor: 0, patch: 0 } 37 | } 38 | } 39 | 40 | function incrementVersion(version: Version): Version { 41 | return { 42 | major: version.major, 43 | minor: version.minor, 44 | patch: version.patch + 1 // Increment patch, keeping major and minor the same 45 | } 46 | } 47 | 48 | function deployNewVersion(network: Network, fork: string) { 49 | const subgraphName = fork ? `lqg-v2-${network}-${fork}` : `lqg-v2-${network}` 50 | const currentVersion = getLatestVersion(network, subgraphName) 51 | const newVersion = incrementVersion(currentVersion) 52 | const versionString = formatVersion(newVersion) 53 | 54 | 55 | console.log(`Current version: v${formatVersion(currentVersion)}`) 56 | console.log(`New version: v${versionString}`) 57 | try { 58 | console.log(`Deploying ${subgraphName} v${versionString}...`) 59 | console.log(`>> goldsky subgraph deploy ${subgraphName}/${versionString}`) 60 | execSync(`goldsky subgraph deploy ${subgraphName}/${versionString}`, { stdio: 'inherit' }) 61 | console.log(`Successfully deployed v${versionString}`) 62 | } catch (error) { 63 | console.error('Error deploying: version: ', versionString, ' fork: ', fork, ' error: ', error) 64 | // @ts-ignore 65 | process.exit(1) 66 | } 67 | } 68 | 69 | // Get network from command line args 70 | const network = process.argv[2] as Network 71 | const fork = process.argv[3] 72 | 73 | if (!NETWORKS.includes(network)) { 74 | console.error(`Invalid network. Must be one of: ${NETWORKS.join(', ')}`) 75 | process.exit(1) 76 | } 77 | 78 | deployNewVersion(network, fork) -------------------------------------------------------------------------------- /deployments.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "network": "mainnet", 4 | "url": "https://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/lqg-v2-mainnet/1.0.8/gn", 5 | "version": "1.0.8" 6 | }, 7 | { 8 | "network": "arbitrum", 9 | "url": "https://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/lqg-v2-arbitrum/1.0.3/gn", 10 | "version": "1.0.3" 11 | }, 12 | { 13 | "network": "base", 14 | "url": "https://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/lqg-v2-base/1.0.9/gn", 15 | "version": "1.0.9" 16 | }, 17 | { 18 | "network": "swell", 19 | "url": "https://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/lqg-v2-swell/1.0.10/gn", 20 | "version": "1.0.10" 21 | }, 22 | { 23 | "network": "sonic", 24 | "url": "https://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/lqg-v2-sonic/1.0.4/gn", 25 | "version": "1.0.4" 26 | }, 27 | { 28 | "network": "ink", 29 | "url": "https://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/lqg-v2-ink/1.0.2/gn", 30 | "version": "1.0.2" 31 | }, 32 | { 33 | "network": "unichain", 34 | "url": "https://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/lqg-v2-unichain/1.0.5/gn", 35 | "version": "1.0.5" 36 | }, 37 | { 38 | "network": "avalanche", 39 | "url": "https://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/lqg-v2-avalanche/1.0.4/gn", 40 | "version": "1.0.4" 41 | }, 42 | { 43 | "network": "berachain", 44 | "url": "https://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/lqg-v2-berachain/1.0.4/gn", 45 | "version": "1.0.4" 46 | }, 47 | { 48 | "network": "bob", 49 | "url": "https://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/lqg-v2-bob/1.0.5/gn", 50 | "version": "1.0.5" 51 | }, 52 | { 53 | "network": "bsc", 54 | "url": "https://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/lqg-v2-bsc/1.0.4/gn", 55 | "version": "1.0.4" 56 | }, 57 | { 58 | "network": "worldchain", 59 | "url": "https://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/lqg-v2-worldchain/1.0.1/gn", 60 | "version": "1.0.1" 61 | }, 62 | { 63 | "network": "hyperevm", 64 | "url": "https://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/lqg-v2-hyperevm/1.0.1/gn", 65 | "version": "1.0.1" 66 | }, 67 | { 68 | "network": "optimism", 69 | "url": "https://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/lqg-v2-optimism/1.0.1/gn", 70 | "version": "1.0.1" 71 | }, 72 | { 73 | "network": "gnosis", 74 | "url": "https://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/lqg-v2-gnosis/1.0.1/gn", 75 | "version": "1.0.1" 76 | }, 77 | { 78 | "network": "tacturin", 79 | "url": "https://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/lqg-v2-tacturin/1.0.1/gn", 80 | "version": "1.0.1" 81 | }, 82 | { 83 | "network": "tac", 84 | "url": "https://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/lqg-v2-tac/1.0.2/gn", 85 | "version": "1.0.2" 86 | } 87 | ] -------------------------------------------------------------------------------- /verify/checkAccountPositions.ts: -------------------------------------------------------------------------------- 1 | console.log('============ CHECKING POSITIONS [Account tracking] ============') 2 | import { getSubgraphUrl, toSubAccountId, getValidChains } from './utils/utils' 3 | 4 | 5 | const printTable = (mainAddress: string, data: string[], showCols?: string[]) => { 6 | const parsedData = data.reduce((acc, deposit) => { 7 | const account = deposit.substring(0, 42) 8 | const vault = `0x${deposit.substring(42, deposit.length)}` 9 | 10 | if (!acc[account]) { 11 | acc[account] = [] 12 | } 13 | 14 | acc[account].push(vault) 15 | return acc 16 | }, {}) 17 | const tableData = Object.entries(parsedData).map(([subAccount, vaults]) => ({ 18 | 'subAccountId': toSubAccountId(mainAddress, subAccount), 19 | subAccount, 20 | // @ts-ignore 21 | 'number_of_vaults': vaults.length, 22 | // @ts-ignore 23 | vaults: vaults.join(', ') 24 | })).sort((a, b) => a.subAccountId - b.subAccountId) 25 | console.table(tableData, showCols ?? ['subAccountId', 'subAccount', 'number_of_vaults']) 26 | } 27 | 28 | async function checkPositions(subgraphUrl: string, address: string) { 29 | const query = ` 30 | query GetPositions($address: String!) { 31 | trackingActiveAccount(id: $address) { 32 | mainAddress 33 | deposits 34 | borrows 35 | transactionHash 36 | blockNumber 37 | blockTimestamp 38 | } 39 | } 40 | ` 41 | 42 | try { 43 | const response = await fetch(subgraphUrl, { 44 | method: 'POST', 45 | headers: { 46 | 'Content-Type': 'application/json', 47 | }, 48 | body: JSON.stringify({ 49 | query, 50 | variables: { address }, 51 | }), 52 | }) 53 | 54 | const { data } = await response.json() 55 | 56 | if (data && data.trackingActiveAccount) { 57 | console.log(`Deposits for address: ${address}`) 58 | printTable(address, data.trackingActiveAccount.deposits) 59 | console.log(`Borrow for address: ${address}`) 60 | printTable(address, data.trackingActiveAccount.borrows, ['subAccountId', 'subAccount', 'vaults']) 61 | } else { 62 | console.log(`No tracking account found for address: ${address}`) 63 | } 64 | } catch (error) { 65 | console.error('Error fetching tracking account:', error) 66 | } 67 | } 68 | 69 | // Get the chain name and address from command line arguments 70 | const chainName = process.argv[2] 71 | const address = process.argv[3] 72 | 73 | if (!chainName || !address) { 74 | console.error('Please provide both chain name and address as arguments') 75 | console.error('Usage: pnpm run verify:positions
') 76 | process.exit(1) 77 | } 78 | 79 | // Validate chain name 80 | const validChains = getValidChains() 81 | if (validChains.length === 0) { 82 | console.error('No valid chains found. Please generate deployments.json first.') 83 | process.exit(1) 84 | } 85 | 86 | if (!validChains.includes(chainName)) { 87 | console.error(`Invalid chain name. Must be one of: ${validChains.join(', ')}`) 88 | process.exit(1) 89 | } 90 | 91 | const subgraphUrl = getSubgraphUrl(chainName) 92 | if (!subgraphUrl) { 93 | console.error(`No subgraph URL configured for chain: ${chainName}`) 94 | process.exit(1) 95 | } 96 | 97 | checkPositions(subgraphUrl, address) -------------------------------------------------------------------------------- /abis/EulerEarnFactory.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [ 4 | { "internalType": "address", "name": "_lqgEarnImpl", "type": "address" } 5 | ], 6 | "stateMutability": "nonpayable", 7 | "type": "constructor" 8 | }, 9 | { "inputs": [], "name": "FailedDeployment", "type": "error" }, 10 | { 11 | "inputs": [ 12 | { "internalType": "uint256", "name": "balance", "type": "uint256" }, 13 | { "internalType": "uint256", "name": "needed", "type": "uint256" } 14 | ], 15 | "name": "InsufficientBalance", 16 | "type": "error" 17 | }, 18 | { "inputs": [], "name": "InvalidQuery", "type": "error" }, 19 | { 20 | "anonymous": false, 21 | "inputs": [ 22 | { 23 | "indexed": true, 24 | "internalType": "address", 25 | "name": "_owner", 26 | "type": "address" 27 | }, 28 | { 29 | "indexed": false, 30 | "internalType": "address", 31 | "name": "_lqgEarnVault", 32 | "type": "address" 33 | }, 34 | { 35 | "indexed": true, 36 | "internalType": "address", 37 | "name": "_asset", 38 | "type": "address" 39 | } 40 | ], 41 | "name": "DeploylqgEarn", 42 | "type": "event" 43 | }, 44 | { 45 | "inputs": [ 46 | { "internalType": "address", "name": "_asset", "type": "address" }, 47 | { "internalType": "string", "name": "_name", "type": "string" }, 48 | { "internalType": "string", "name": "_symbol", "type": "string" }, 49 | { 50 | "internalType": "uint256", 51 | "name": "_initialCashAllocationPoints", 52 | "type": "uint256" 53 | }, 54 | { "internalType": "uint24", "name": "_smearingPeriod", "type": "uint24" } 55 | ], 56 | "name": "deploylqgEarn", 57 | "outputs": [{ "internalType": "address", "name": "", "type": "address" }], 58 | "stateMutability": "nonpayable", 59 | "type": "function" 60 | }, 61 | { 62 | "inputs": [], 63 | "name": "lqgEarnImpl", 64 | "outputs": [{ "internalType": "address", "name": "", "type": "address" }], 65 | "stateMutability": "view", 66 | "type": "function" 67 | }, 68 | { 69 | "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], 70 | "name": "lqgEarnVaults", 71 | "outputs": [{ "internalType": "address", "name": "", "type": "address" }], 72 | "stateMutability": "view", 73 | "type": "function" 74 | }, 75 | { 76 | "inputs": [], 77 | "name": "getlqgEarnVaultsListLength", 78 | "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], 79 | "stateMutability": "view", 80 | "type": "function" 81 | }, 82 | { 83 | "inputs": [ 84 | { "internalType": "uint256", "name": "_start", "type": "uint256" }, 85 | { "internalType": "uint256", "name": "_end", "type": "uint256" } 86 | ], 87 | "name": "getlqgEarnVaultsListSlice", 88 | "outputs": [ 89 | { "internalType": "address[]", "name": "", "type": "address[]" } 90 | ], 91 | "stateMutability": "view", 92 | "type": "function" 93 | }, 94 | { 95 | "inputs": [ 96 | { 97 | "internalType": "address", 98 | "name": "_earnVaultAddress", 99 | "type": "address" 100 | } 101 | ], 102 | "name": "isValidDeployment", 103 | "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], 104 | "stateMutability": "view", 105 | "type": "function" 106 | } 107 | ] 108 | -------------------------------------------------------------------------------- /scripts/abisAddressesSync.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | function process_abis() { 4 | local lqg_interfaces_path=$1 5 | local abi_path=$2 6 | shift 2 7 | 8 | local -a contracts=("${@:1:$((($#)/2))}") 9 | local -a abis=("${@:$((($#)/2+1))}") 10 | 11 | mkdir -p "$abi_path" 12 | 13 | for i in "${!contracts[@]}"; do 14 | echo "Processing ${contracts[$i]}.json -> ${abis[$i]}.ts" 15 | 16 | cp "$lqg_interfaces_path/abis/${contracts[$i]}.json" "$abi_path/${abis[$i]}.ts" 17 | 18 | sed -i '' '1s/^/export const '"${abis[$i]}"' = /' "$abi_path/${abis[$i]}.ts" 19 | sed -i '' -e '$ s/]$/] as const/' "$abi_path/${abis[$i]}.ts" 20 | 21 | npx prettier --write "$abi_path/${abis[$i]}.ts" >/dev/null 22 | sed -i '' -e '$ s/] as const;$/] as const/' "$abi_path/${abis[$i]}.ts" 23 | done 24 | 25 | create_index_ts "$abi_path" 26 | } 27 | 28 | function process_addresses() { 29 | local lqg_interfaces_path=$1 30 | local addresses_path=$2 31 | local network_id=$3 32 | shift 3 33 | 34 | local -a jsons=("${@:1:$((($#)/2))}") 35 | local -a addresses=("${@:$((($#)/2+1))}") 36 | 37 | mkdir -p "$addresses_path" 38 | 39 | for i in "${!jsons[@]}"; do 40 | echo "Processing ${jsons[$i]}.json -> ${addresses[$i]}.ts" 41 | 42 | cp "$lqg_interfaces_path/addresses/${network_id}/${jsons[$i]}.json" "$addresses_path/${addresses[$i]}.ts" 43 | 44 | sed -i '' '1s/^/export const '"${addresses[$i]}"' = /' "$addresses_path/${addresses[$i]}.ts" 45 | sed -i '' -e '$ s/}$/} as const/' "$addresses_path/${addresses[$i]}.ts" 46 | 47 | npx prettier --write "$addresses_path/${addresses[$i]}.ts" >/dev/null 48 | sed -i '' -e '$ s/;$//' "$addresses_path/${addresses[$i]}.ts" 49 | done 50 | 51 | create_index_ts "$addresses_path" 52 | } 53 | 54 | function create_index_ts() { 55 | local path=$1 56 | echo "Creating index.ts" 57 | ( 58 | for file in "$path"/*.ts; do 59 | if [ -f "$file" ] && [ "$(basename "$file")" != "index.ts" ]; then 60 | filename=$(basename "$file" .ts) 61 | echo "export * from \"./${filename}\"" 62 | fi 63 | done 64 | ) >"$path/index.ts" 65 | npx prettier --write --semi false "$path/index.ts" >/dev/null 66 | } 67 | 68 | if [ -z "$1" ]; then 69 | echo "Usage: $0 [lqg-interfaces-branch]" 70 | exit 1 71 | fi 72 | 73 | set -e 74 | trap 'rm -rf "$temp_dir"' EXIT 75 | 76 | network_id=$1 77 | lqg_interfaces_repo_name="lqg-interfaces" 78 | lqg_interfaces_repo_url="https://github.com/lqg-xyz/${lqg_interfaces_repo_name}" 79 | lqg_interfaces_branch=${2:-"master"} 80 | abi_path=contracts/abi 81 | lens_abi_path=contracts/abi/lens/${network_id} 82 | addresses_path=contracts/addresses/${network_id} 83 | temp_dir=$(mktemp -d) 84 | 85 | git clone "$lqg_interfaces_repo_url.git" "$temp_dir" 86 | 87 | cd "$temp_dir" 88 | git checkout "$lqg_interfaces_branch" 89 | cd - 90 | 91 | contracts=("BasePerspective" "EthereumVaultConnector" "EVault" "Swapper" "SwapVerifier" "TrackingRewardStreams" "TermsOfUseSigner" "RewardToken" "FeeFlowController") 92 | abis=("basePerspectiveAbi" "ethereumVaultConnectorAbi" "eVaultAbi" "swapperAbi" "swapVerifierAbi" "trackingRewardStreamsAbi" "termsOfUseSignerAbi" "rewardTokenAbi" "feeFlowControllerAbi") 93 | process_abis "$temp_dir" "$abi_path" "${contracts[@]}" "${abis[@]}" 94 | 95 | lens_contracts=("AccountLens" "VaultLens" "lqgEarnVaultLens" "UtilsLens") 96 | lens_abis=("accountLensAbi" "vaultLensAbi" "lqgEarnVaultLensAbi" "utilsLensAbi") 97 | process_abis "$temp_dir" "$lens_abi_path" "${lens_contracts[@]}" "${lens_abis[@]}" 98 | 99 | jsons=("CoreAddresses" "PeripheryAddresses" "LensAddresses" "TokenAddresses") 100 | addresses=("coreAddresses" "peripheryAddresses" "lensAddresses" "tokenAddresses") 101 | process_addresses "$temp_dir" "$addresses_path" "$network_id" "${jsons[@]}" "${addresses[@]}" 102 | -------------------------------------------------------------------------------- /scripts/config.ts: -------------------------------------------------------------------------------- 1 | import { 2 | arbitrumAddresses, 3 | avalancheAddresses, 4 | baseAddresses, 5 | berachainAddresses, 6 | bobAddresses, 7 | bscAddresses, 8 | gnosisAddresses, 9 | hyperevmAddresses, 10 | inkAddresses, 11 | mainnetAddresses, 12 | optimismAddresses, 13 | sonicAddresses, 14 | swellAddresses, 15 | tacAddresses, 16 | tacTurinAddresses, 17 | unichainAddresses, 18 | worldchainAddresses 19 | } from '../contracts/addresses' 20 | 21 | export type Network = typeof NETWORKS[number] 22 | 23 | export type Version = { major: number; minor: number; patch: number } 24 | 25 | export const networks = { 26 | mainnet: { 27 | network: 'mainnet', 28 | ...mainnetAddresses.coreAddresses, 29 | ...mainnetAddresses.swapAddresses, 30 | startBlock: 20529207 31 | }, 32 | arbitrum: { 33 | network: 'arbitrum-one', 34 | ...arbitrumAddresses.coreAddresses, 35 | ...arbitrumAddresses.swapAddresses, 36 | startBlock: 238643655 37 | }, 38 | base: { 39 | network: 'base', 40 | ...baseAddresses.coreAddresses, 41 | ...baseAddresses.swapAddresses, 42 | startBlock: 22282411 43 | }, 44 | swell: { 45 | network: 'swell', 46 | ...swellAddresses.coreAddresses, 47 | ...swellAddresses.swapAddresses, 48 | startBlock: 485376 49 | }, 50 | sonic: { 51 | network: 'sonic', 52 | ...sonicAddresses.coreAddresses, 53 | ...sonicAddresses.swapAddresses, 54 | startBlock: 5324457 55 | }, 56 | ink: { 57 | network: 'ink', 58 | ...inkAddresses.coreAddresses, 59 | ...inkAddresses.swapAddresses, 60 | startBlock: 3900333 61 | }, 62 | unichain: { 63 | network: 'unichain', 64 | ...unichainAddresses.coreAddresses, 65 | ...unichainAddresses.swapAddresses, 66 | startBlock: 8541547 67 | }, 68 | avalanche: { 69 | network: 'avalanche', 70 | ...avalancheAddresses.coreAddresses, 71 | ...avalancheAddresses.swapAddresses, 72 | startBlock: 56805796 73 | }, 74 | berachain: { 75 | network: 'berachain-mainnet', 76 | ...berachainAddresses.coreAddresses, 77 | ...berachainAddresses.swapAddresses, 78 | startBlock: 1095611 79 | }, 80 | bob: { 81 | network: 'bob', 82 | ...bobAddresses.coreAddresses, 83 | ...bobAddresses.swapAddresses, 84 | startBlock: 13157157 85 | }, 86 | bsc: { 87 | network: 'bsc', 88 | ...bscAddresses.coreAddresses, 89 | ...bscAddresses.swapAddresses, 90 | startBlock: 46370000 91 | }, 92 | worldchain: { 93 | network: 'worldchain', 94 | ...worldchainAddresses.coreAddresses, 95 | ...worldchainAddresses.swapAddresses, 96 | startBlock: 9800000 97 | }, 98 | hyperevm: { 99 | network: 'hyperevm', 100 | ...hyperevmAddresses.coreAddresses, 101 | ...hyperevmAddresses.swapAddresses, 102 | startBlock: 1 // TODO: Check if this is correct I didn't find the correct block number 103 | }, 104 | optimism: { 105 | network: 'optimism', 106 | ...optimismAddresses.coreAddresses, 107 | ...optimismAddresses.swapAddresses, 108 | startBlock: 131500000 109 | }, 110 | gnosis: { 111 | network: 'xdai', 112 | ...gnosisAddresses.coreAddresses, 113 | ...gnosisAddresses.swapAddresses, 114 | startBlock: 38380000 115 | }, 116 | tacturin: { 117 | network: 'tac-turin', 118 | ...tacTurinAddresses.coreAddresses, 119 | ...tacTurinAddresses.swapAddresses, 120 | startBlock: 5066361 121 | }, 122 | tac: { 123 | network: 'tac', 124 | ...tacAddresses.coreAddresses, 125 | ...tacAddresses.swapAddresses, 126 | startBlock: 860000 127 | } 128 | } 129 | 130 | 131 | export const NETWORKS = Object.keys(networks) 132 | -------------------------------------------------------------------------------- /src/ethereum-vault-connector.ts: -------------------------------------------------------------------------------- 1 | import { CallWithContext as CallWithContextEvent } from "../generated/EthereumVaultConnector/EthereumVaultConnector"; 2 | import { BORROW_SELECTOR, CONVERT_FEES_SELECTOR, DEPOSIT_PERMIT_SELECTOR, DEPOSIT_SELECTOR, EVAULT_SELECTORS, LIQUIDATE_SELECTOR, MINT_SELECTOR, PULL_DEBT_SELECTOR, REDEEM_SELECTOR, REPAY_SELECTOR, REPAY_WITH_SHARES_SELECTOR, SKIM_SELECTOR, TOUCH_SELECTOR, TRANSFER_FROM_MAX_SELECTOR, TRANSFER_FROM_SELECTOR, TRANSFER_SELECTOR, WITHDRAW_SELECTOR } from "./utils/constants"; 3 | import { VaultByAccount, AccountAggrVault, CallWithContext } from "../generated/schema"; 4 | import { Bytes, dataSource, log } from "@graphprotocol/graph-ts"; 5 | 6 | 7 | function updateAccount(id: Bytes, contractAddress: Bytes): void { 8 | let account = AccountAggrVault.load(id) 9 | if (!account) { 10 | account = new AccountAggrVault(id) 11 | account.accountPrefix = id 12 | account.save() 13 | } 14 | 15 | 16 | let vault = VaultByAccount.load(id.concat(contractAddress)) 17 | if (!vault) { 18 | vault = new VaultByAccount(id.concat(contractAddress)) 19 | vault.account = account.id 20 | vault.vault = contractAddress 21 | vault.save() 22 | } 23 | } 24 | 25 | function getTypeBySelector(selector: string): string { 26 | if (selector === TRANSFER_SELECTOR) { 27 | return "transfer" 28 | } else if (selector === TRANSFER_FROM_SELECTOR) { 29 | return "transfer" 30 | } else if (selector === TRANSFER_FROM_MAX_SELECTOR) { 31 | return "transfer" 32 | } else if (selector === DEPOSIT_SELECTOR) { 33 | return "deposit" 34 | } else if (selector === DEPOSIT_PERMIT_SELECTOR) { 35 | return "depositPermit" 36 | } else if (selector === MINT_SELECTOR) { 37 | return "mint" 38 | } else if (selector === WITHDRAW_SELECTOR) { 39 | return "withdraw" 40 | } else if (selector === REDEEM_SELECTOR) { 41 | return "redeem" 42 | } else if (selector === SKIM_SELECTOR) { 43 | return "skim" 44 | } else if (selector === BORROW_SELECTOR) { 45 | return "borrow" 46 | } else if (selector === REPAY_SELECTOR) { 47 | return "repay" 48 | } else if (selector === REPAY_WITH_SHARES_SELECTOR) { 49 | return "repayWithShares" 50 | } else if (selector === PULL_DEBT_SELECTOR) { 51 | return "pullDebt" 52 | } else if (selector === TOUCH_SELECTOR) { 53 | return "touch" 54 | } else if (selector === LIQUIDATE_SELECTOR) { 55 | return "liquidate" 56 | } else if (selector === CONVERT_FEES_SELECTOR) { 57 | return "pullDebt" 58 | } 59 | return "unknown" 60 | } 61 | 62 | 63 | export function loadOrCreateCallWithContext(event: CallWithContextEvent): CallWithContext { 64 | let entity = CallWithContext.load(event.transaction.hash.concat(event.params.targetContract)) 65 | if (!entity) { 66 | entity = new CallWithContext(event.transaction.hash.concat(event.params.targetContract)) 67 | entity.vault = event.params.targetContract 68 | entity.mainAddress = event.transaction.from 69 | entity.evc = event.address 70 | entity.accounts = [] 71 | } 72 | return entity 73 | } 74 | 75 | export function handleCallWithContext(event: CallWithContextEvent): void { 76 | const selector = event.params.selector.toHexString().slice(0, 10).toLowerCase() 77 | const isSelector = EVAULT_SELECTORS.includes(selector) 78 | const address = event.params.onBehalfOfAccount 79 | const from = event.transaction.from; 80 | const context = dataSource.context() 81 | log.warning("evcAddress: {}", [event.address.toHexString()]) 82 | context.setString("evcAddress", event.address.toHexString()) 83 | // If it's the same we can ignore it 84 | // This case is when for example the swap contract interact with the vault. 85 | const entity = loadOrCreateCallWithContext(event) 86 | const type = getTypeBySelector(selector) 87 | 88 | entity.selector = selector 89 | let accounts = entity.accounts 90 | // If we already have this address, we can ignore it 91 | if (!accounts.includes(address)) { 92 | entity.accounts = accounts.concat([address]) 93 | } 94 | entity.type = type 95 | entity.blockNumber = event.block.number 96 | entity.blockTimestamp = event.block.timestamp 97 | entity.transactionHash = event.transaction.hash 98 | 99 | entity.save() 100 | 101 | if (!isSelector) { 102 | log.debug("Invalid selector in tx {}", [event.transaction.hash.toHexString()]) 103 | return 104 | } 105 | 106 | updateAccount(address, event.params.targetContract) 107 | updateAccount(from, event.params.targetContract) 108 | 109 | } 110 | 111 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "lqg-v2", 3 | "license": "UNLICENSED", 4 | "packageManager": "pnpm@9.12.3", 5 | "engines": { 6 | "pnpm": "9.12.3" 7 | }, 8 | "scripts": { 9 | "codegen": "graph codegen", 10 | "build": "graph build", 11 | "build:scripts": "tsc -p tsconfig.scripts.json", 12 | "abis:sync": "./scripts/abisAddressesSync.sh", 13 | "verify:accountPositions": "bun ./verify/checkAccountPositions.ts", 14 | "verify:accountVaultBalances": "bun ./verify/checkAccountVaultBalances.ts", 15 | "test": "graph test", 16 | "tag:deployments": "bun scripts/tag-deployments.ts", 17 | "generate:deployments": "bun scripts/generate-deployments.ts", 18 | "prepare:mainnet": "bun scripts/prepare.ts mainnet", 19 | "prepare:base": "bun scripts/prepare.ts base", 20 | "prepare:arbitrum": "bun scripts/prepare.ts arbitrum", 21 | "prepare:swell": "bun scripts/prepare.ts swell", 22 | "prepare:sonic": "bun scripts/prepare.ts sonic", 23 | "prepare:ink": "bun scripts/prepare.ts ink", 24 | "prepare:berachain": "bun scripts/prepare.ts berachain", 25 | "prepare:bob": "bun scripts/prepare.ts bob", 26 | "prepare:unichain": "bun scripts/prepare.ts unichain", 27 | "prepare:avalanche": "bun scripts/prepare.ts avalanche", 28 | "prepare:bsc": "bun scripts/prepare.ts bsc", 29 | "prepare:worldchain": "bun scripts/prepare.ts worldchain", 30 | "prepare:hyperevm": "bun scripts/prepare.ts hyperevm", 31 | "prepare:optimism": "bun scripts/prepare.ts optimism", 32 | "prepare:gnosis": "bun scripts/prepare.ts gnosis", 33 | "prepare:tacturin": "bun scripts/prepare.ts tacturin", 34 | "prepare:tac": "bun scripts/prepare.ts tac", 35 | "build:mainnet": "pnpm prepare:mainnet && graph build", 36 | "build:base": "pnpm prepare:base && graph build", 37 | "build:arbitrum": "pnpm prepare:arbitrum && graph build", 38 | "build:swell": "pnpm prepare:swell && graph build", 39 | "build:sonic": "pnpm prepare:sonic && graph build", 40 | "build:ink": "pnpm prepare:ink && graph build", 41 | "build:berachain": "pnpm prepare:berachain && graph build", 42 | "build:berachain:thegraph": "pnpm prepare:berachain && graph build", 43 | "build:bob": "pnpm prepare:bob && graph build", 44 | "build:unichain": "pnpm prepare:unichain && graph build", 45 | "build:avalanche": "pnpm prepare:avalanche && graph build", 46 | "build:bsc": "pnpm prepare:bsc && graph build", 47 | "build:worldchain": "pnpm prepare:worldchain && graph build", 48 | "build:hyperevm": "pnpm prepare:hyperevm && graph build", 49 | "build:optimism": "pnpm prepare:optimism && graph build", 50 | "build:gnosis": "pnpm prepare:gnosis && graph build", 51 | "build:tacturin": "pnpm prepare:tacturin && graph build", 52 | "build:tac": "pnpm prepare:tac && graph build", 53 | "deploy:mainnet": "pnpm build:mainnet && bun scripts/deploy.ts mainnet && pnpm generate:deployments", 54 | "deploy:mainnet:test": "pnpm build:mainnet && bun scripts/deploy.ts mainnet test && pnpm generate:deployments", 55 | "deploy:mainnet:swap": "pnpm build:mainnet && bun scripts/deploy.ts mainnet swap && pnpm generate:deployments", 56 | "deploy:arbitrum": "pnpm build:arbitrum && bun scripts/deploy.ts arbitrum && pnpm generate:deployments", 57 | "deploy:base": "pnpm build:base && bun scripts/deploy.ts base && pnpm generate:deployments", 58 | "deploy:base:test": "pnpm build:base && bun scripts/deploy.ts base test && pnpm generate:deployments", 59 | "deploy:swell": "pnpm build:swell && bun scripts/deploy.ts swell && pnpm generate:deployments", 60 | "deploy:sonic": "pnpm build:sonic && bun scripts/deploy.ts sonic && pnpm generate:deployments", 61 | "deploy:ink": "pnpm build:ink && bun scripts/deploy.ts ink && pnpm generate:deployments", 62 | "deploy:berachain": "pnpm build:berachain && bun scripts/deploy.ts berachain && pnpm generate:deployments", 63 | "deploy:bob": "pnpm build:bob && bun scripts/deploy.ts bob && pnpm generate:deployments", 64 | "deploy:unichain": "pnpm build:unichain && bun scripts/deploy.ts unichain && pnpm generate:deployments", 65 | "deploy:avalanche": "pnpm build:avalanche && bun scripts/deploy.ts avalanche && pnpm generate:deployments", 66 | "deploy:bsc": "pnpm build:bsc && bun scripts/deploy.ts bsc && pnpm generate:deployments", 67 | "deploy:worldchain": "pnpm build:worldchain && bun scripts/deploy.ts worldchain && pnpm generate:deployments", 68 | "deploy:hyperevm": "pnpm build:hyperevm && bun scripts/deploy.ts hyperevm && pnpm generate:deployments", 69 | "deploy:optimism": "pnpm build:optimism && bun scripts/deploy.ts optimism && pnpm generate:deployments", 70 | "deploy:gnosis": "pnpm build:gnosis && bun scripts/deploy.ts gnosis && pnpm generate:deployments", 71 | "deploy:tacturin": "pnpm build:tacturin && bun scripts/deploy.ts tacturin && pnpm generate:deployments", 72 | "deploy:tac": "pnpm build:tac && bun scripts/deploy.ts tac && pnpm generate:deployments" 73 | }, 74 | "dependencies": { 75 | "@graphprotocol/graph-cli": "0.87.0", 76 | "@graphprotocol/graph-ts": "0.33.0", 77 | "viem": "^2.22.22", 78 | "@types/node": "^22.13.10", 79 | "env-cmd": "^10.1.0", 80 | "matchstick-as": "0.6.0", 81 | "mustache": "^4.2.0" 82 | }, 83 | "devDependencies": { 84 | "@types/node": "^22.13.10" 85 | } 86 | } -------------------------------------------------------------------------------- /abis/EulerVaultFactory.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [ 4 | { "internalType": "address", "name": "admin", "type": "address" } 5 | ], 6 | "stateMutability": "nonpayable", 7 | "type": "constructor" 8 | }, 9 | { "inputs": [], "name": "E_BadAddress", "type": "error" }, 10 | { "inputs": [], "name": "E_BadQuery", "type": "error" }, 11 | { "inputs": [], "name": "E_DeploymentFailed", "type": "error" }, 12 | { "inputs": [], "name": "E_Implementation", "type": "error" }, 13 | { "inputs": [], "name": "E_Reentrancy", "type": "error" }, 14 | { "inputs": [], "name": "E_Unauthorized", "type": "error" }, 15 | { "anonymous": false, "inputs": [], "name": "Genesis", "type": "event" }, 16 | { 17 | "anonymous": false, 18 | "inputs": [ 19 | { 20 | "indexed": true, 21 | "internalType": "address", 22 | "name": "proxy", 23 | "type": "address" 24 | }, 25 | { 26 | "indexed": false, 27 | "internalType": "bool", 28 | "name": "upgradeable", 29 | "type": "bool" 30 | }, 31 | { 32 | "indexed": false, 33 | "internalType": "address", 34 | "name": "implementation", 35 | "type": "address" 36 | }, 37 | { 38 | "indexed": false, 39 | "internalType": "bytes", 40 | "name": "trailingData", 41 | "type": "bytes" 42 | } 43 | ], 44 | "name": "ProxyCreated", 45 | "type": "event" 46 | }, 47 | { 48 | "anonymous": false, 49 | "inputs": [ 50 | { 51 | "indexed": true, 52 | "internalType": "address", 53 | "name": "newImplementation", 54 | "type": "address" 55 | } 56 | ], 57 | "name": "SetImplementation", 58 | "type": "event" 59 | }, 60 | { 61 | "anonymous": false, 62 | "inputs": [ 63 | { 64 | "indexed": true, 65 | "internalType": "address", 66 | "name": "newUpgradeAdmin", 67 | "type": "address" 68 | } 69 | ], 70 | "name": "SetUpgradeAdmin", 71 | "type": "event" 72 | }, 73 | { 74 | "inputs": [ 75 | { 76 | "internalType": "address", 77 | "name": "desiredImplementation", 78 | "type": "address" 79 | }, 80 | { "internalType": "bool", "name": "upgradeable", "type": "bool" }, 81 | { "internalType": "bytes", "name": "trailingData", "type": "bytes" } 82 | ], 83 | "name": "createProxy", 84 | "outputs": [{ "internalType": "address", "name": "", "type": "address" }], 85 | "stateMutability": "nonpayable", 86 | "type": "function" 87 | }, 88 | { 89 | "inputs": [ 90 | { "internalType": "address", "name": "proxy", "type": "address" } 91 | ], 92 | "name": "getProxyConfig", 93 | "outputs": [ 94 | { 95 | "components": [ 96 | { "internalType": "bool", "name": "upgradeable", "type": "bool" }, 97 | { 98 | "internalType": "address", 99 | "name": "implementation", 100 | "type": "address" 101 | }, 102 | { "internalType": "bytes", "name": "trailingData", "type": "bytes" } 103 | ], 104 | "internalType": "struct GenericFactory.ProxyConfig", 105 | "name": "config", 106 | "type": "tuple" 107 | } 108 | ], 109 | "stateMutability": "view", 110 | "type": "function" 111 | }, 112 | { 113 | "inputs": [], 114 | "name": "getProxyListLength", 115 | "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], 116 | "stateMutability": "view", 117 | "type": "function" 118 | }, 119 | { 120 | "inputs": [ 121 | { "internalType": "uint256", "name": "start", "type": "uint256" }, 122 | { "internalType": "uint256", "name": "end", "type": "uint256" } 123 | ], 124 | "name": "getProxyListSlice", 125 | "outputs": [ 126 | { "internalType": "address[]", "name": "list", "type": "address[]" } 127 | ], 128 | "stateMutability": "view", 129 | "type": "function" 130 | }, 131 | { 132 | "inputs": [], 133 | "name": "implementation", 134 | "outputs": [{ "internalType": "address", "name": "", "type": "address" }], 135 | "stateMutability": "view", 136 | "type": "function" 137 | }, 138 | { 139 | "inputs": [ 140 | { "internalType": "address", "name": "proxy", "type": "address" } 141 | ], 142 | "name": "isProxy", 143 | "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], 144 | "stateMutability": "view", 145 | "type": "function" 146 | }, 147 | { 148 | "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], 149 | "name": "proxyList", 150 | "outputs": [{ "internalType": "address", "name": "", "type": "address" }], 151 | "stateMutability": "view", 152 | "type": "function" 153 | }, 154 | { 155 | "inputs": [ 156 | { 157 | "internalType": "address", 158 | "name": "newImplementation", 159 | "type": "address" 160 | } 161 | ], 162 | "name": "setImplementation", 163 | "outputs": [], 164 | "stateMutability": "nonpayable", 165 | "type": "function" 166 | }, 167 | { 168 | "inputs": [ 169 | { 170 | "internalType": "address", 171 | "name": "newUpgradeAdmin", 172 | "type": "address" 173 | } 174 | ], 175 | "name": "setUpgradeAdmin", 176 | "outputs": [], 177 | "stateMutability": "nonpayable", 178 | "type": "function" 179 | }, 180 | { 181 | "inputs": [], 182 | "name": "upgradeAdmin", 183 | "outputs": [{ "internalType": "address", "name": "", "type": "address" }], 184 | "stateMutability": "view", 185 | "type": "function" 186 | } 187 | ] 188 | -------------------------------------------------------------------------------- /verify/checkAccountVaultBalances.ts: -------------------------------------------------------------------------------- 1 | console.log('============ CHECKING POSITIONS [Account tracking] ============') 2 | import { getSubgraphUrl, getValidChains, toSubAccountId } from './utils/utils' 3 | 4 | interface TrackingVaultBalance { 5 | account: string; 6 | balance: string; 7 | debt: string; 8 | mainAddress: string; 9 | vault: string; 10 | } 11 | const printTable = (mainAddress: string, data: TrackingVaultBalance[], showCols?: string[]) => { 12 | const parsedData = data.reduce((acc: { 13 | [key: string]: { 14 | vaults: string[], 15 | totalDebt: bigint, 16 | balances: { [vault: string]: string }, 17 | debts: { [vault: string]: string } 18 | } 19 | }, deposit) => { 20 | const account = deposit.account; 21 | const vault = deposit.vault; 22 | const debt = BigInt(deposit.debt); 23 | const balance = deposit.balance; 24 | 25 | 26 | if (!acc[account]) { 27 | acc[account] = { 28 | vaults: [], 29 | totalDebt: 0n, 30 | balances: {}, 31 | debts: {} 32 | }; 33 | } 34 | 35 | acc[account].vaults.push(vault); 36 | acc[account].totalDebt += debt; 37 | acc[account].balances[vault] = balance; 38 | acc[account].debts[vault] = deposit.debt; 39 | return acc; 40 | }, {}); 41 | 42 | const tableData = Object.entries(parsedData).map(([subAccount, data]) => ({ 43 | 'subAccountId': toSubAccountId(mainAddress, subAccount), 44 | subAccount, 45 | 'number_of_vaults': data.vaults.filter(v => BigInt(data.balances[v]) > 0n).length, 46 | 'total_debt': data.totalDebt.toString(), 47 | vaults: data.vaults 48 | .filter(v => BigInt(data.balances[v]) > 0n) 49 | .map(v => `${v} 50 | - balance: ${data.balances[v]}`) 51 | .join(', ') 52 | })).sort((a, b) => a.subAccountId - b.subAccountId); 53 | 54 | console.log('\nAccount Balances:'); 55 | console.log('='.repeat(100)); 56 | tableData.forEach(row => { 57 | console.log(`\nSubAccount ID: ${row.subAccountId}`); 58 | console.log(`SubAccount: ${row.subAccount}`); 59 | console.log(`Total Debt: ${row.total_debt}`); 60 | console.log(`Vaults with deposits: ${row.number_of_vaults}`); 61 | console.log('Deposited Vaults:'); 62 | // Split vaults into multiple lines for better readability 63 | row.vaults.split(', ').forEach(vault => { 64 | console.log(` - ${vault}`); 65 | }); 66 | console.log('-'.repeat(100)); 67 | }); 68 | } 69 | 70 | async function checkPositions(subgraphUrl: string, address: string) { 71 | const balanceQuery = ` 72 | query GetPositionsWithBalance($address: String!) { 73 | trackingVaultBalances(where: { mainAddress: $address, balance_gt: "0" }) { 74 | mainAddress 75 | account 76 | vault 77 | debt 78 | balance 79 | } 80 | } 81 | ` 82 | 83 | const debtQuery = ` 84 | query GetPositionsWithDebt($address: String!) { 85 | trackingVaultBalances(where: { mainAddress: $address, debt_gt: "0" }) { 86 | mainAddress 87 | account 88 | vault 89 | debt 90 | balance 91 | } 92 | } 93 | ` 94 | 95 | try { 96 | const [balanceResponse, debtResponse] = await Promise.all([ 97 | fetch(subgraphUrl, { 98 | method: 'POST', 99 | headers: { 100 | 'Content-Type': 'application/json', 101 | }, 102 | body: JSON.stringify({ 103 | query: balanceQuery, 104 | variables: { address }, 105 | }), 106 | }), 107 | fetch(subgraphUrl, { 108 | method: 'POST', 109 | headers: { 110 | 'Content-Type': 'application/json', 111 | }, 112 | body: JSON.stringify({ 113 | query: debtQuery, 114 | variables: { address }, 115 | }), 116 | }) 117 | ]); 118 | 119 | const [balanceData, debtData] = await Promise.all([ 120 | balanceResponse.json(), 121 | debtResponse.json() 122 | ]); 123 | 124 | // Combine and deduplicate results 125 | const combinedBalances = [ 126 | ...(balanceData.data?.trackingVaultBalances || []), 127 | ...(debtData.data?.trackingVaultBalances || []) 128 | ].filter((value, index, self) => 129 | index === self.findIndex((t) => ( 130 | t.account === value.account && t.vault === value.vault 131 | )) 132 | ); 133 | 134 | if (combinedBalances.length > 0) { 135 | printTable(address, combinedBalances); 136 | } else { 137 | console.log(`No tracking account found for address: ${address}`); 138 | } 139 | } catch (error) { 140 | console.error('Error fetching tracking account:', error); 141 | } 142 | } 143 | 144 | // Get the chain name and address from command line arguments 145 | const chainName = process.argv[2] 146 | const address = process.argv[3] 147 | 148 | if (!chainName || !address) { 149 | console.error('Please provide both chain name and address as arguments') 150 | console.error('Usage: pnpm run verify:positions
') 151 | process.exit(1) 152 | } 153 | 154 | // Validate chain name 155 | const validChains = getValidChains() 156 | if (!validChains.includes(chainName)) { 157 | console.error(`Invalid chain name. Must be one of: ${validChains.join(', ')}`) 158 | process.exit(1) 159 | } 160 | 161 | const subgraphUrl = getSubgraphUrl(chainName) 162 | if (!subgraphUrl) { 163 | console.error(`No subgraph URL configured for chain: ${chainName}`) 164 | process.exit(1) 165 | } 166 | 167 | checkPositions(subgraphUrl, address) -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # lqg Subgraph 2 | 3 | ## Prerequisites 4 | 5 | - Node.js (v16 or higher) 6 | - Corepack (enabled in Node.js) 7 | - Bun 8 | - Goldsky CLI (required for all deployments) 9 | 10 | ### Setting up pnpm with Corepack 11 | This project uses pnpm 9.12.3. Corepack will automatically manage the correct pnpm version for you. 12 | 13 | ```bash 14 | # Enable corepack if not already enabled 15 | corepack enable 16 | 17 | # Install pnpm 9.12.3 using corepack 18 | corepack prepare pnpm@9.12.3 --activate 19 | 20 | # First time setup 21 | pnpm install 22 | 23 | # Corepack will automatically use pnpm 9.12.3 for this project 24 | # while other projects can use their own versions 25 | ``` 26 | 27 | ## Setup 28 | 29 | 1. Install dependencies: 30 | 31 | ```bash 32 | pnpm install 33 | ``` 34 | 35 | 2. Run Sync Abis to add a new network: 36 | 37 | ```bash 38 | pnpm run abis:sync 39 | ``` 40 | 41 | 3. Update `prepare.ts` to include the new network name and start block for syncing. Then run prepare to generate the `subgraph.yaml`. 42 | 43 | ```bash 44 | pnpm run prepare:mainnet 45 | ``` 46 | 47 | 4. Generate code: 48 | 49 | ```bash 50 | pnpm run codegen 51 | ``` 52 | 53 | 6. Build the subgraph: 54 | ```bash 55 | pnpm run build:mainnet 56 | ``` 57 | 58 | Note: You can replace `mainnet` with any other supported network (base, arbitrum, swell, etc.) in the above commands. 59 | 60 | ## Available Scripts 61 | 62 | ### Build Scripts 63 | 64 | ```bash 65 | # Build for specific networks 66 | pnpm run build:mainnet 67 | pnpm run build:base 68 | pnpm run build:arbitrum 69 | pnpm run build:swell 70 | pnpm run build:sonic 71 | pnpm run build:ink 72 | pnpm run build:berachain 73 | pnpm run build:bob 74 | pnpm run build:unichain 75 | pnpm run build:avalanche 76 | pnpm run build:bsc 77 | 78 | # Build scripts with TypeScript 79 | pnpm run build:scripts 80 | ``` 81 | 82 | ### Deployment Scripts 83 | 84 | ```bash 85 | # Deploy to specific networks 86 | pnpm run deploy:mainnet 87 | pnpm run deploy:base 88 | pnpm run deploy:arbitrum 89 | pnpm run deploy:swell 90 | pnpm run deploy:sonic 91 | pnpm run deploy:ink 92 | pnpm run deploy:berachain 93 | pnpm run deploy:bob 94 | pnpm run deploy:unichain 95 | pnpm run deploy:avalanche 96 | pnpm run deploy:bsc 97 | 98 | # Deploy test versions (with -test suffix) 99 | pnpm run deploy:mainnet:test 100 | ``` 101 | 102 | ### Utility Scripts 103 | 104 | ```bash 105 | # Sync ABIs and addresses 106 | pnpm run abis:sync 107 | 108 | # Generate deployments information 109 | pnpm run generate:deployments 110 | 111 | # Prepare configurations for specific networks 112 | pnpm run prepare:mainnet 113 | pnpm run prepare:base 114 | pnpm run prepare:arbitrum 115 | pnpm run prepare:swell 116 | pnpm run prepare:sonic 117 | pnpm run prepare:ink 118 | pnpm run prepare:berachain 119 | pnpm run prepare:bob 120 | pnpm run prepare:unichain 121 | pnpm run prepare:avalanche 122 | pnpm run prepare:bsc 123 | 124 | # Verify account data 125 | pnpm run verify:accountPositions 126 | pnpm run verify:accountVaultBalances 127 | 128 | # Run tests 129 | pnpm run test 130 | ``` 131 | 132 | ## Deployment Guide 133 | 134 | ### Important Notes 135 | 136 | - All deployments are handled through Goldsky 137 | - Test deployments are available with the `:test` suffix (e.g., `deploy:mainnet:test`) 138 | - Make sure you have the Goldsky CLI installed and configured with your credentials 139 | - You can generate a JSON file with all deployment URLs using `pnpm run generate:deployments` 140 | 141 | ### Network-Specific Deployment 142 | 143 | #### Mainnet 144 | 145 | ```bash 146 | # Production deployment 147 | pnpm run deploy:mainnet 148 | 149 | # Test deployment 150 | pnpm run deploy:mainnet:test 151 | ``` 152 | 153 | #### Other Networks 154 | 155 | ```bash 156 | # Base 157 | pnpm run deploy:base 158 | 159 | # Arbitrum 160 | pnpm run deploy:arbitrum 161 | 162 | # Swell 163 | pnpm run deploy:swell 164 | 165 | # Sonic 166 | pnpm run deploy:sonic 167 | 168 | # Ink 169 | pnpm run deploy:ink 170 | 171 | # Berachain 172 | pnpm run deploy:berachain 173 | 174 | # Bob 175 | pnpm run deploy:bob 176 | 177 | # Unichain 178 | pnpm run deploy:unichain 179 | 180 | # Avalanche 181 | pnpm run deploy:avalanche 182 | 183 | # BSC 184 | pnpm run deploy:bsc 185 | ``` 186 | 187 | ### Deployments Information 188 | 189 | The `generate:deployments` command creates a `deployments.json` file that contains information about the latest deployed version of the subgraph for each supported network. This file is automatically updated after each deployment. 190 | 191 | #### File Structure 192 | 193 | ```json 194 | [ 195 | { 196 | "network": "mainnet", 197 | "url": "https://...", 198 | "version": "1.2.3" 199 | }, 200 | { 201 | "network": "base", 202 | "url": "https://...", 203 | "version": "1.2.3" 204 | } 205 | // ... other networks 206 | ] 207 | ``` 208 | 209 | #### Usage 210 | 211 | - The file is used by verification scripts to get the correct subgraph URL for each network 212 | - It's automatically updated after each deployment 213 | - It serves as a single source of truth for deployment information 214 | - Only keeps the latest version for each network 215 | - Versions are properly sorted (major.minor.patch) 216 | 217 | ### Verification 218 | 219 | To verify account data: 220 | 221 | ```bash 222 | # Verify account positions 223 | pnpm run verify:accountPositions 224 | 225 | # Verify account vault balances 226 | pnpm run verify:accountVaultBalances 227 | ``` 228 | 229 | ## Development 230 | 231 | ### TypeScript Configuration 232 | 233 | The project uses separate TypeScript configurations: 234 | 235 | - Main configuration (`tsconfig.json`): For the core subgraph code 236 | - Scripts configuration (`tsconfig.scripts.json`): For development and utility scripts 237 | 238 | ### Testing 239 | 240 | ```bash 241 | # Run tests 242 | pnpm run test 243 | ``` 244 | 245 | ## Troubleshooting 246 | 247 | - If you encounter permission issues with scripts, run: 248 | ```bash 249 | chmod +x scripts/abisAddressesSync.sh 250 | ``` 251 | - For deployment issues, check your Goldsky CLI configuration and credentials 252 | - Make sure you have the correct CLI tools installed and configured 253 | -------------------------------------------------------------------------------- /tests/tracking.test.ts: -------------------------------------------------------------------------------- 1 | import { Address, BigInt, Bytes, ethereum } from "@graphprotocol/graph-ts" 2 | 3 | import { createMockedFunction, log } from "matchstick-as" 4 | import { 5 | assert, 6 | afterEach, 7 | beforeEach, 8 | clearStore, 9 | describe, 10 | test, 11 | } from "matchstick-as/assembly/index" 12 | import { 13 | TrackingActiveAccount, 14 | TrackingVaultBalance, 15 | } from "../generated/schema" 16 | import { updateActiveAccountsInEVaults } from "../src/utils/tracking" 17 | 18 | describe("updateUserActiveAccounts", () => { 19 | beforeEach(() => { 20 | clearStore() // Clear store before each test 21 | }) 22 | 23 | test("should track deposits and borrows correctly", () => { 24 | // Setup test data 25 | let mainAddress = Address.fromString( 26 | "0x89205A3A3b2A69De6Dbf7f01ED13B2108B2c43e7", 27 | ) 28 | let account = Address.fromString( 29 | "0x0000000000000000000000000000000000000001", 30 | ) 31 | let vault = Address.fromString("0x0000000000000000000000000000000000000002") 32 | let evc = Address.fromString("0x0000000000000000000000000000000000000003") 33 | let trackingId = account.concat(vault) 34 | // Mock the EVault contract calls 35 | createMockedFunction(vault, "balanceOf", "balanceOf(address):(uint256)") 36 | // @ts-ignore: Type mismatch between graph-ts and matchstick-as 37 | .withArgs([ethereum.Value.fromAddress(account)] ) 38 | // @ts-ignore: Type mismatch between graph-ts and matchstick-as 39 | .returns([ethereum.Value.fromI32(100)] ) // Mock deposit balance of 100 40 | 41 | createMockedFunction(vault, "debtOf", "debtOf(address):(uint256)") 42 | // @ts-ignore: Type mismatch between graph-ts and matchstick-as 43 | .withArgs([ethereum.Value.fromAddress(account)] ) 44 | // @ts-ignore: Type mismatch between graph-ts and matchstick-as 45 | .returns([ethereum.Value.fromI32(50)]) // Mock debt of 50 46 | 47 | createMockedFunction(evc, "isControllerEnabled", "isControllerEnabled(address,address):(bool)") 48 | // @ts-ignore: Type mismatch between graph-ts and matchstick-as 49 | .withArgs([ethereum.Value.fromAddress(account), ethereum.Value.fromAddress(vault)]) 50 | // @ts-ignore: Type mismatch between graph-ts and matchstick-as 51 | .returns([ethereum.Value.fromBoolean(true)]) 52 | 53 | // Call the function 54 | updateActiveAccountsInEVaults( 55 | Bytes.fromHexString(mainAddress.toHexString()), 56 | Bytes.fromHexString(account.toHexString()), 57 | Bytes.fromHexString(vault.toHexString()), 58 | Bytes.fromHexString(evc.toHexString()), 59 | BigInt.fromI32(1), 60 | BigInt.fromI32(1234567), 61 | Bytes.fromHexString("0x1234"), 62 | ) 63 | // Assert TrackingActiveAccount entity 64 | let trackingEntity = TrackingActiveAccount.load(mainAddress) 65 | 66 | assert.assertNotNull(trackingEntity) 67 | log.warning('ok 0',[]) 68 | if (trackingEntity) { 69 | assert.i32Equals(trackingEntity.deposits.length, 1) 70 | assert.i32Equals(trackingEntity.borrows.length, 1) 71 | assert.bytesEquals( 72 | trackingEntity.deposits[0], 73 | trackingId, 74 | ) 75 | assert.bytesEquals( 76 | trackingEntity.borrows[0], 77 | trackingId, 78 | ) 79 | } 80 | 81 | // Assert TrackingVaultBalance entity 82 | let balanceEntity = TrackingVaultBalance.load(trackingId) 83 | assert.assertNotNull(balanceEntity) 84 | if (balanceEntity) { 85 | if(balanceEntity.balance) assert.bigIntEquals(balanceEntity.balance, BigInt.fromI32(100)) 86 | if(balanceEntity.debt) assert.bigIntEquals(balanceEntity.debt, BigInt.fromI32(50)) 87 | assert.bytesEquals( 88 | balanceEntity.mainAddress, 89 | Bytes.fromHexString(mainAddress.toHexString()), 90 | ) 91 | assert.bytesEquals( 92 | balanceEntity.account, 93 | Bytes.fromHexString(account.toHexString()), 94 | ) 95 | assert.bytesEquals( 96 | balanceEntity.vault, 97 | Bytes.fromHexString(vault.toHexString()), 98 | ) 99 | } 100 | 101 | // Test removing deposits and borrows 102 | // Mock zero balances 103 | createMockedFunction(vault, "balanceOf", "balanceOf(address):(uint256)") 104 | // @ts-ignore: Type mismatch between graph-ts and matchstick-as 105 | .withArgs([ethereum.Value.fromAddress(account)]) 106 | // @ts-ignore: Type mismatch between graph-ts and matchstick-as 107 | .returns([ethereum.Value.fromI32(0)]) 108 | 109 | createMockedFunction(vault, "debtOf", "debtOf(address):(uint256)") 110 | // @ts-ignore: Type mismatch between graph-ts and matchstick-as 111 | .withArgs([ethereum.Value.fromAddress(account)]) 112 | // @ts-ignore: Type mismatch between graph-ts and matchstick-as 113 | .returns([ethereum.Value.fromI32(0)]) 114 | 115 | createMockedFunction(evc, "isControllerEnabled", "isControllerEnabled(address,address):(bool)") 116 | // @ts-ignore: Type mismatch between graph-ts and matchstick-as 117 | .withArgs([ethereum.Value.fromAddress(account), ethereum.Value.fromAddress(vault)]) 118 | // @ts-ignore: Type mismatch between graph-ts and matchstick-as 119 | .returns([ethereum.Value.fromBoolean(false)]) 120 | // Call function again 121 | updateActiveAccountsInEVaults( 122 | Bytes.fromHexString(mainAddress.toHexString()), 123 | Bytes.fromHexString(account.toHexString()), 124 | Bytes.fromHexString(vault.toHexString()), 125 | Bytes.fromHexString(evc.toHexString()), 126 | BigInt.fromI32(2), 127 | BigInt.fromI32(1234568), 128 | Bytes.fromHexString("0x1235"), 129 | ) 130 | 131 | // Assert arrays are empty 132 | let trackingEntityRemove = TrackingActiveAccount.load( 133 | mainAddress 134 | ) 135 | assert.assertNotNull(trackingEntity) 136 | if (trackingEntityRemove) { 137 | assert.i32Equals(trackingEntityRemove.deposits.length, 0) 138 | assert.i32Equals(trackingEntityRemove.borrows.length, 0) 139 | } 140 | // Assert balance updates 141 | let balanceEntityRemove = TrackingVaultBalance.load(trackingId) 142 | assert.assertNotNull(balanceEntityRemove) 143 | if (balanceEntityRemove) { 144 | if(balanceEntityRemove.balance) assert.bigIntEquals(balanceEntityRemove.balance, BigInt.fromI32(0)) 145 | if(balanceEntityRemove.debt) assert.bigIntEquals(balanceEntityRemove.debt, BigInt.fromI32(0)) 146 | } 147 | }) 148 | }) 149 | -------------------------------------------------------------------------------- /contracts/abi/swapperAbi.ts: -------------------------------------------------------------------------------- 1 | export const swapperAbi = [ 2 | { 3 | type: "constructor", 4 | inputs: [ 5 | { 6 | name: "uniswapRouterV2", 7 | type: "address", 8 | internalType: "address", 9 | }, 10 | { 11 | name: "uniswapRouterV3", 12 | type: "address", 13 | internalType: "address", 14 | }, 15 | ], 16 | stateMutability: "nonpayable", 17 | }, 18 | { 19 | type: "function", 20 | name: "HANDLER_GENERIC", 21 | inputs: [], 22 | outputs: [ 23 | { 24 | name: "", 25 | type: "bytes32", 26 | internalType: "bytes32", 27 | }, 28 | ], 29 | stateMutability: "view", 30 | }, 31 | { 32 | type: "function", 33 | name: "HANDLER_UNISWAP_V2", 34 | inputs: [], 35 | outputs: [ 36 | { 37 | name: "", 38 | type: "bytes32", 39 | internalType: "bytes32", 40 | }, 41 | ], 42 | stateMutability: "view", 43 | }, 44 | { 45 | type: "function", 46 | name: "HANDLER_UNISWAP_V3", 47 | inputs: [], 48 | outputs: [ 49 | { 50 | name: "", 51 | type: "bytes32", 52 | internalType: "bytes32", 53 | }, 54 | ], 55 | stateMutability: "view", 56 | }, 57 | { 58 | type: "function", 59 | name: "deposit", 60 | inputs: [ 61 | { 62 | name: "token", 63 | type: "address", 64 | internalType: "address", 65 | }, 66 | { 67 | name: "vault", 68 | type: "address", 69 | internalType: "address", 70 | }, 71 | { 72 | name: "amountMin", 73 | type: "uint256", 74 | internalType: "uint256", 75 | }, 76 | { 77 | name: "account", 78 | type: "address", 79 | internalType: "address", 80 | }, 81 | ], 82 | outputs: [], 83 | stateMutability: "nonpayable", 84 | }, 85 | { 86 | type: "function", 87 | name: "multicall", 88 | inputs: [ 89 | { 90 | name: "calls", 91 | type: "bytes[]", 92 | internalType: "bytes[]", 93 | }, 94 | ], 95 | outputs: [], 96 | stateMutability: "nonpayable", 97 | }, 98 | { 99 | type: "function", 100 | name: "repay", 101 | inputs: [ 102 | { 103 | name: "token", 104 | type: "address", 105 | internalType: "address", 106 | }, 107 | { 108 | name: "vault", 109 | type: "address", 110 | internalType: "address", 111 | }, 112 | { 113 | name: "repayAmount", 114 | type: "uint256", 115 | internalType: "uint256", 116 | }, 117 | { 118 | name: "account", 119 | type: "address", 120 | internalType: "address", 121 | }, 122 | ], 123 | outputs: [], 124 | stateMutability: "nonpayable", 125 | }, 126 | { 127 | type: "function", 128 | name: "repayAndDeposit", 129 | inputs: [ 130 | { 131 | name: "token", 132 | type: "address", 133 | internalType: "address", 134 | }, 135 | { 136 | name: "vault", 137 | type: "address", 138 | internalType: "address", 139 | }, 140 | { 141 | name: "repayAmount", 142 | type: "uint256", 143 | internalType: "uint256", 144 | }, 145 | { 146 | name: "account", 147 | type: "address", 148 | internalType: "address", 149 | }, 150 | ], 151 | outputs: [], 152 | stateMutability: "nonpayable", 153 | }, 154 | { 155 | type: "function", 156 | name: "swap", 157 | inputs: [ 158 | { 159 | name: "params", 160 | type: "tuple", 161 | internalType: "struct ISwapper.SwapParams", 162 | components: [ 163 | { 164 | name: "handler", 165 | type: "bytes32", 166 | internalType: "bytes32", 167 | }, 168 | { 169 | name: "mode", 170 | type: "uint256", 171 | internalType: "uint256", 172 | }, 173 | { 174 | name: "account", 175 | type: "address", 176 | internalType: "address", 177 | }, 178 | { 179 | name: "tokenIn", 180 | type: "address", 181 | internalType: "address", 182 | }, 183 | { 184 | name: "tokenOut", 185 | type: "address", 186 | internalType: "address", 187 | }, 188 | { 189 | name: "vaultIn", 190 | type: "address", 191 | internalType: "address", 192 | }, 193 | { 194 | name: "accountIn", 195 | type: "address", 196 | internalType: "address", 197 | }, 198 | { 199 | name: "receiver", 200 | type: "address", 201 | internalType: "address", 202 | }, 203 | { 204 | name: "amountOut", 205 | type: "uint256", 206 | internalType: "uint256", 207 | }, 208 | { 209 | name: "data", 210 | type: "bytes", 211 | internalType: "bytes", 212 | }, 213 | ], 214 | }, 215 | ], 216 | outputs: [], 217 | stateMutability: "nonpayable", 218 | }, 219 | { 220 | type: "function", 221 | name: "sweep", 222 | inputs: [ 223 | { 224 | name: "token", 225 | type: "address", 226 | internalType: "address", 227 | }, 228 | { 229 | name: "amountMin", 230 | type: "uint256", 231 | internalType: "uint256", 232 | }, 233 | { 234 | name: "to", 235 | type: "address", 236 | internalType: "address", 237 | }, 238 | ], 239 | outputs: [], 240 | stateMutability: "nonpayable", 241 | }, 242 | { 243 | type: "function", 244 | name: "uniswapRouterV2", 245 | inputs: [], 246 | outputs: [ 247 | { 248 | name: "", 249 | type: "address", 250 | internalType: "address", 251 | }, 252 | ], 253 | stateMutability: "view", 254 | }, 255 | { 256 | type: "function", 257 | name: "uniswapRouterV3", 258 | inputs: [], 259 | outputs: [ 260 | { 261 | name: "", 262 | type: "address", 263 | internalType: "address", 264 | }, 265 | ], 266 | stateMutability: "view", 267 | }, 268 | { 269 | type: "error", 270 | name: "E_EmptyError", 271 | inputs: [], 272 | }, 273 | { 274 | type: "error", 275 | name: "Swapper_Reentrancy", 276 | inputs: [], 277 | }, 278 | { 279 | type: "error", 280 | name: "Swapper_SwapError", 281 | inputs: [ 282 | { 283 | name: "swapProvider", 284 | type: "address", 285 | internalType: "address", 286 | }, 287 | { 288 | name: "rawError", 289 | type: "bytes", 290 | internalType: "bytes", 291 | }, 292 | ], 293 | }, 294 | { 295 | type: "error", 296 | name: "Swapper_TargetDebt", 297 | inputs: [], 298 | }, 299 | { 300 | type: "error", 301 | name: "Swapper_UnknownHandler", 302 | inputs: [], 303 | }, 304 | { 305 | type: "error", 306 | name: "Swapper_UnknownMode", 307 | inputs: [], 308 | }, 309 | { 310 | type: "error", 311 | name: "Swapper_UnsupportedMode", 312 | inputs: [], 313 | }, 314 | { 315 | type: "error", 316 | name: "UniswapV2Handler_InvalidPath", 317 | inputs: [], 318 | }, 319 | { 320 | type: "error", 321 | name: "UniswapV3Handler_InvalidPath", 322 | inputs: [], 323 | }, 324 | ] as const 325 | -------------------------------------------------------------------------------- /src/euler-earn.ts: -------------------------------------------------------------------------------- 1 | import { 2 | Approval as ApprovalEvent, 3 | DelegateChanged as DelegateChangedEvent, 4 | DelegateVotesChanged as DelegateVotesChangedEvent, 5 | Deposit as DepositEvent, 6 | Transfer as TransferEvent, 7 | Withdraw as WithdrawEvent, 8 | } from "../generated/templates/lqgEarn/lqgEarn" 9 | import { 10 | lqgEarnApproval as Approval, 11 | lqgEarnDeposit as Deposit, 12 | lqgEarnTransfer as Transfer, 13 | lqgEarnWithdraw as Withdraw, 14 | } from "../generated/schema" 15 | import { trackActionsInEarnVaults } from "./utils/tracking" 16 | import { increaseCounter } from "./utils/counter" 17 | import { 18 | ExecuteHarvest as ExecuteHarvestEvent, 19 | Harvest as HarvestEvent, 20 | Rebalance as RebalanceEvent, 21 | InterestUpdated as InterestUpdatedEvent, 22 | } from "../generated/templates/lqgEarn/lqgEarn" 23 | import { 24 | lqgEarnExecuteHarvest, 25 | lqgEarnHarvest, 26 | lqgEarnRebalance, 27 | lqgEarnInterestUpdated, 28 | } from "../generated/schema" 29 | import { updatelqgEarnVault } from "./utils/earnVault" 30 | 31 | export function handleApproval(event: ApprovalEvent): void { 32 | let entity = new Approval( 33 | event.transaction.hash.concatI32(event.logIndex.toI32()), 34 | ) 35 | entity.owner = event.params.owner 36 | entity.spender = event.params.spender 37 | entity.value = event.params.value 38 | 39 | entity.blockNumber = event.block.number 40 | entity.blockTimestamp = event.block.timestamp 41 | entity.transactionHash = event.transaction.hash 42 | 43 | entity.save() 44 | 45 | 46 | increaseCounter( 47 | "EarnVaultApproval", 48 | event.block.number, 49 | event.block.timestamp, 50 | event.transaction.hash, 51 | ) 52 | } 53 | 54 | export function handleDeposit(event: DepositEvent): void { 55 | let entity = new Deposit( 56 | event.transaction.hash.concatI32(event.logIndex.toI32()), 57 | ) 58 | entity.sender = event.params.sender 59 | entity.owner = event.params.owner 60 | entity.assets = event.params.assets 61 | entity.shares = event.params.shares 62 | 63 | entity.blockNumber = event.block.number 64 | entity.blockTimestamp = event.block.timestamp 65 | entity.transactionHash = event.transaction.hash 66 | 67 | entity.save() 68 | 69 | increaseCounter( 70 | "EarnVaultDeposit", 71 | event.block.number, 72 | event.block.timestamp, 73 | event.transaction.hash, 74 | ) 75 | 76 | trackActionsInEarnVaults( 77 | event.params.sender, 78 | event.address, 79 | event.block.number, 80 | event.block.timestamp, 81 | event.transaction.hash, 82 | ) 83 | 84 | if (event.params.sender !== event.params.owner) { 85 | // Status from the owner 86 | trackActionsInEarnVaults( 87 | event.params.owner, 88 | event.address, 89 | event.block.number, 90 | event.block.timestamp, 91 | event.transaction.hash, 92 | ) 93 | } 94 | } 95 | 96 | export function handleTransfer(event: TransferEvent): void { 97 | let entity = new Transfer( 98 | event.transaction.hash.concatI32(event.logIndex.toI32()), 99 | ) 100 | entity.from = event.params.from 101 | entity.to = event.params.to 102 | entity.value = event.params.value 103 | 104 | entity.blockNumber = event.block.number 105 | entity.blockTimestamp = event.block.timestamp 106 | entity.transactionHash = event.transaction.hash 107 | 108 | entity.save() 109 | 110 | increaseCounter( 111 | "EarnVaultTransfer", 112 | event.block.number, 113 | event.block.timestamp, 114 | event.transaction.hash, 115 | ) 116 | 117 | trackActionsInEarnVaults( 118 | event.params.from, 119 | event.address, 120 | event.block.number, 121 | event.block.timestamp, 122 | event.transaction.hash, 123 | ) 124 | 125 | // We check the end account 126 | trackActionsInEarnVaults( 127 | event.params.to, 128 | event.address, 129 | event.block.number, 130 | event.block.timestamp, 131 | event.transaction.hash, 132 | ) 133 | } 134 | 135 | export function handleWithdraw(event: WithdrawEvent): void { 136 | let entity = new Withdraw( 137 | event.transaction.hash.concatI32(event.logIndex.toI32()), 138 | ) 139 | entity.sender = event.params.sender 140 | entity.receiver = event.params.receiver 141 | entity.owner = event.params.owner 142 | entity.assets = event.params.assets 143 | entity.shares = event.params.shares 144 | 145 | entity.blockNumber = event.block.number 146 | entity.blockTimestamp = event.block.timestamp 147 | entity.transactionHash = event.transaction.hash 148 | 149 | entity.save() 150 | 151 | increaseCounter( 152 | "EarnVaultWithdraw", 153 | event.block.number, 154 | event.block.timestamp, 155 | event.transaction.hash, 156 | ) 157 | 158 | trackActionsInEarnVaults( 159 | event.params.sender, 160 | event.address, 161 | event.block.number, 162 | event.block.timestamp, 163 | event.transaction.hash, 164 | ) 165 | 166 | // If it's a self-transfer, we only track the status from the sender 167 | if (event.params.sender !== event.params.receiver) { 168 | trackActionsInEarnVaults( 169 | event.params.receiver, 170 | event.address, 171 | event.block.number, 172 | event.block.timestamp, 173 | event.transaction.hash, 174 | ) 175 | } 176 | 177 | // If it's a self-transfer, we only track the status from the sender 178 | if (event.params.sender !== event.params.owner) { 179 | trackActionsInEarnVaults( 180 | event.params.owner, 181 | event.address, 182 | event.block.number, 183 | event.block.timestamp, 184 | event.transaction.hash, 185 | ) 186 | } 187 | } 188 | 189 | 190 | export function handleExecuteHarvest(event: ExecuteHarvestEvent): void { 191 | let entity = new lqgEarnExecuteHarvest( 192 | event.transaction.hash.concatI32(event.logIndex.toI32()) 193 | ) 194 | 195 | entity.timestamp = event.block.timestamp 196 | entity.lqgEarnVault = event.address 197 | entity.harvester = event.transaction.from 198 | entity.strategy = event.params.strategy 199 | entity.lqgEarnAssetsAmount = event.params.lqgEarnAssetsAmount 200 | entity.strategyAllocatedAmount = event.params.strategyAllocatedAmount 201 | entity.blockNumber = event.block.number 202 | entity.blockTimestamp = event.block.timestamp 203 | entity.transactionHash = event.transaction.hash 204 | 205 | entity.save() 206 | 207 | updatelqgEarnVault(event.address) 208 | } 209 | 210 | export function handleHarvest(event: HarvestEvent): void { 211 | let entity = new lqgEarnHarvest(event.transaction.hash.concatI32(event.logIndex.toI32())) 212 | 213 | entity.timestamp = event.block.timestamp 214 | entity.harvester = event.transaction.from 215 | entity.lqgEarnVault = event.address 216 | entity.totalAllocated = event.params.totalAllocated 217 | entity.totalYield = event.params.totalYield 218 | entity.totalLoss = event.params.totalLoss 219 | entity.blockNumber = event.block.number 220 | entity.blockTimestamp = event.block.timestamp 221 | entity.transactionHash = event.transaction.hash 222 | 223 | entity.save() 224 | 225 | updatelqgEarnVault(event.address) 226 | } 227 | 228 | export function handleRebalance(event: RebalanceEvent): void { 229 | let entity = new lqgEarnRebalance( 230 | event.transaction.hash.concatI32(event.logIndex.toI32()) 231 | ) 232 | 233 | entity.timestamp = event.block.timestamp 234 | entity.rebalancer = event.transaction.from 235 | entity.txHash = event.transaction.hash 236 | entity.lqgEarnVault = event.address 237 | entity.strategy = event.params.strategy 238 | entity.amountToRebalance = event.params.amountToRebalance 239 | entity.isDeposit = event.params.isDeposit 240 | entity.blockNumber = event.block.number 241 | entity.blockTimestamp = event.block.timestamp 242 | entity.transactionHash = event.transaction.hash 243 | 244 | entity.save() 245 | 246 | updatelqgEarnVault(event.address) 247 | } 248 | 249 | 250 | export function handleInterestUpdated(event: InterestUpdatedEvent): void { 251 | let entity = new lqgEarnInterestUpdated( 252 | event.transaction.hash.concatI32(event.logIndex.toI32()) 253 | ) 254 | 255 | entity.timestamp = event.block.timestamp 256 | entity.lqgEarnVault = event.address 257 | entity.interestAccrued = event.params.interestAccrued 258 | entity.interestLeft = event.params.interestLeft 259 | entity.blockNumber = event.block.number 260 | entity.blockTimestamp = event.block.timestamp 261 | entity.transactionHash = event.transaction.hash 262 | 263 | entity.save() 264 | 265 | updatelqgEarnVault(event.address) 266 | 267 | } -------------------------------------------------------------------------------- /template/subgraph.template.yaml: -------------------------------------------------------------------------------- 1 | specVersion: 2.1.0 2 | indexerHints: 3 | prune: auto 4 | schema: 5 | file: ./schema.graphql 6 | dataSources: 7 | - kind: ethereum 8 | name: EthereumVaultConnector 9 | network: {{{ network }}} 10 | source: 11 | abi: EthereumVaultConnector 12 | address: "{{{ evc }}}" 13 | startBlock: {{{ startBlock }}} 14 | mapping: 15 | kind: ethereum/events 16 | apiVersion: 0.0.7 17 | language: wasm/assemblyscript 18 | entities: 19 | - VaultAccount 20 | abis: 21 | - name: EthereumVaultConnector 22 | file: ./abis/EVC.json 23 | eventHandlers: 24 | - event: CallWithContext(indexed address,indexed bytes19,address,indexed 25 | address,bytes4) 26 | handler: handleCallWithContext 27 | file: ./src/ethereum-vault-connector.ts 28 | - kind: ethereum 29 | name: lqgVaultFactory 30 | network: {{{ network }}} 31 | context: 32 | evcAddress: 33 | type: String 34 | data: "{{{ evc }}}" 35 | source: 36 | abi: lqgVaultFactory 37 | address: "{{{ eVaultFactory }}}" 38 | startBlock: {{{ startBlock }}} 39 | mapping: 40 | kind: ethereum/events 41 | apiVersion: 0.0.7 42 | language: wasm/assemblyscript 43 | entities: 44 | - ProxyCreated 45 | abis: 46 | - name: lqgVaultFactory 47 | file: ./abis/lqgVaultFactory.json 48 | - name: lqgVault 49 | file: ./abis/lqgVault.json 50 | - name: EthereumVaultConnector 51 | file: ./abis/EVC.json 52 | eventHandlers: 53 | - event: ProxyCreated(indexed address,bool,address,bytes) 54 | handler: handleProxyCreated 55 | file: ./src/factories/lqg-vault-factory.ts 56 | - kind: ethereum 57 | name: lqgEarnFactory 58 | network: {{{ network }}} 59 | context: 60 | evcAddress: 61 | type: String 62 | data: "{{{ evc }}}" 63 | source: 64 | abi: lqgEarnFactory 65 | address: "{{{ lqgEarnFactory }}}" 66 | startBlock: {{{ startBlock }}} 67 | mapping: 68 | kind: ethereum/events 69 | apiVersion: 0.0.7 70 | language: wasm/assemblyscript 71 | entities: 72 | - DeploylqgEarn 73 | - lqgEarnVault 74 | abis: 75 | - name: lqgEarnFactory 76 | file: ./abis/lqgEarnFactory.json 77 | - name: lqgEarn 78 | file: ./abis/lqgEarn.json 79 | - name: EthereumVaultConnector 80 | file: ./abis/EVC.json 81 | eventHandlers: 82 | - event: DeploylqgEarn(indexed address,address,indexed address) 83 | handler: handleDeploylqgEarn 84 | file: ./src/factories/lqg-earn-factory.ts 85 | - kind: ethereum 86 | name: lqgSwapFactory 87 | network: {{{ network }}} 88 | context: 89 | evcAddress: 90 | type: String 91 | data: "{{{ evc }}}" 92 | source: 93 | abi: lqgSwapFactory 94 | address: "{{{ lqgSwapFactory }}}" 95 | startBlock: {{{ startBlock }}} 96 | mapping: 97 | kind: ethereum/events 98 | apiVersion: 0.0.7 99 | language: wasm/assemblyscript 100 | entities: 101 | - PoolDeployed 102 | abis: 103 | - name: lqgSwapFactory 104 | file: ./abis/lqgSwapFactory.json 105 | - name: lqgSwap 106 | file: ./abis/lqgSwap.json 107 | - name: EthereumVaultConnector 108 | file: ./abis/EVC.json 109 | eventHandlers: 110 | - event: PoolDeployed(indexed address,indexed address,indexed address,address) 111 | handler: handlePoolDeployed 112 | - event: PoolConfig(indexed address,(address,address,address,uint112,uint112,uint256,uint256,uint256,uint256,uint256,uint256,address),(uint112,uint112)) 113 | handler: handlePoolConfig 114 | - event: PoolUninstalled(indexed address,indexed address,indexed address,address) 115 | handler: handlePoolUninstalled 116 | file: ./src/factories/lqg-swap-factory.ts 117 | templates: 118 | - kind: ethereum 119 | name: lqgVault 120 | network: {{{ network }}} 121 | source: 122 | abi: lqgVault 123 | mapping: 124 | kind: ethereum/events 125 | apiVersion: 0.0.7 126 | language: wasm/assemblyscript 127 | entities: 128 | - BalanceForwarderStatus 129 | - Borrow 130 | - ConvertFees 131 | - DebtSocialized 132 | - Deposit 133 | - EVaultCreated 134 | - InterestAccrued 135 | - Liquidate 136 | - PullDebt 137 | - Repay 138 | - Transfer 139 | - VaultStatus 140 | - Withdraw 141 | abis: 142 | - name: lqgVault 143 | file: ./abis/lqgVault.json 144 | - name: lqgEarn 145 | file: ./abis/lqgEarn.json 146 | - name: EthereumVaultConnector 147 | file: ./abis/EVC.json 148 | eventHandlers: 149 | - event: BalanceForwarderStatus(indexed address,bool) 150 | handler: handleBalanceForwarderStatus 151 | - event: Borrow(indexed address,uint256) 152 | handler: handleBorrow 153 | - event: ConvertFees(indexed address,indexed address,indexed 154 | address,uint256,uint256) 155 | handler: handleConvertFees 156 | - event: DebtSocialized(indexed address,uint256) 157 | handler: handleDebtSocialized 158 | - event: Deposit(indexed address,indexed address,uint256,uint256) 159 | handler: handleDeposit 160 | - event: EVaultCreated(indexed address,indexed address,address) 161 | handler: handleEVaultCreated 162 | - event: InterestAccrued(indexed address,uint256) 163 | handler: handleInterestAccrued 164 | - event: Liquidate(indexed address,indexed address,address,uint256,uint256) 165 | handler: handleLiquidate 166 | - event: Repay(indexed address,uint256) 167 | handler: handleRepay 168 | - event: Transfer(indexed address,indexed address,uint256) 169 | handler: handleTransfer 170 | - event: VaultStatus(uint256,uint256,uint256,uint256,uint256,uint256,uint256) 171 | handler: handleVaultStatus 172 | - event: Withdraw(indexed address,indexed address,indexed address,uint256,uint256) 173 | handler: handleWithdraw 174 | file: ./src/lqg-vault.ts 175 | - kind: ethereum 176 | name: lqgEarn 177 | network: {{{ network }}} 178 | source: 179 | abi: lqgEarn 180 | mapping: 181 | kind: ethereum/events 182 | apiVersion: 0.0.7 183 | language: wasm/assemblyscript 184 | entities: 185 | - lqgEarnApproval 186 | - lqgEarnDeposit 187 | - lqgEarnTransfer 188 | - lqgEarnWithdraw 189 | - lqgEarnVault 190 | - lqgEarnHarvest 191 | - lqgEarnRebalance 192 | - lqgEarnInterestUpdated 193 | abis: 194 | - name: lqgVault 195 | file: ./abis/lqgVault.json 196 | - name: lqgEarn 197 | file: ./abis/lqgEarn.json 198 | - name: EthereumVaultConnector 199 | file: ./abis/EVC.json 200 | eventHandlers: 201 | - event: Approval(indexed address,indexed address,uint256) 202 | handler: handleApproval 203 | - event: Deposit(indexed address,indexed address,uint256,uint256) 204 | handler: handleDeposit 205 | - event: Transfer(indexed address,indexed address,uint256) 206 | handler: handleTransfer 207 | - event: Withdraw(indexed address,indexed address,indexed address,uint256,uint256) 208 | handler: handleWithdraw 209 | - event: ExecuteHarvest(indexed address,uint256,uint256) 210 | handler: handleExecuteHarvest 211 | - event: Harvest(uint256,uint256,uint256) 212 | handler: handleHarvest 213 | - event: Rebalance(indexed address,uint256,bool) 214 | handler: handleRebalance 215 | - event: InterestUpdated(uint256,uint256) 216 | handler: handleInterestUpdated 217 | file: ./src/lqg-earn.ts 218 | - kind: ethereum 219 | name: lqgSwap 220 | network: {{{ network }}} 221 | source: 222 | abi: lqgSwap 223 | mapping: 224 | kind: ethereum/events 225 | apiVersion: 0.0.7 226 | language: wasm/assemblyscript 227 | entities: 228 | - lqgSwapCreated 229 | - lqgSwap 230 | abis: 231 | - name: lqgSwap 232 | file: ./abis/lqgSwap.json 233 | - name: lqgVault 234 | file: ./abis/lqgVault.json 235 | - name: EthereumVaultConnector 236 | file: ./abis/EVC.json 237 | eventHandlers: 238 | - event: lqgSwapActivated(indexed address,indexed address) 239 | handler: handlelqgSwapActivated 240 | - event: Swap(indexed address,uint256,uint256,uint256,uint256,uint112,uint112,indexed address) 241 | handler: handlelqgSwap 242 | file: ./src/lqg-swap.ts 243 | -------------------------------------------------------------------------------- /tests/euler-earn-utils.ts: -------------------------------------------------------------------------------- 1 | // import { newMockEvent } from "matchstick-as" 2 | // import { ethereum, Address, BigInt, Bytes } from "@graphprotocol/graph-ts" 3 | // import { 4 | // Approval, 5 | // DelegateChanged, 6 | // DelegateVotesChanged, 7 | // Deposit, 8 | // EIP712DomainChanged, 9 | // Initialized, 10 | // RoleAdminChanged, 11 | // RoleGranted, 12 | // RoleRevoked, 13 | // Transfer, 14 | // Withdraw 15 | // } from "../generated/lqgEarn/lqgEarn" 16 | 17 | // export function createApprovalEvent( 18 | // owner: Address, 19 | // spender: Address, 20 | // value: BigInt 21 | // ): Approval { 22 | // let approvalEvent = changetype(newMockEvent()) 23 | 24 | // approvalEvent.parameters = new Array() 25 | 26 | // approvalEvent.parameters.push( 27 | // new ethereum.EventParam("owner", ethereum.Value.fromAddress(owner)) 28 | // ) 29 | // approvalEvent.parameters.push( 30 | // new ethereum.EventParam("spender", ethereum.Value.fromAddress(spender)) 31 | // ) 32 | // approvalEvent.parameters.push( 33 | // new ethereum.EventParam("value", ethereum.Value.fromUnsignedBigInt(value)) 34 | // ) 35 | 36 | // return approvalEvent 37 | // } 38 | 39 | // export function createDelegateChangedEvent( 40 | // delegator: Address, 41 | // fromDelegate: Address, 42 | // toDelegate: Address 43 | // ): DelegateChanged { 44 | // let delegateChangedEvent = changetype(newMockEvent()) 45 | 46 | // delegateChangedEvent.parameters = new Array() 47 | 48 | // delegateChangedEvent.parameters.push( 49 | // new ethereum.EventParam("delegator", ethereum.Value.fromAddress(delegator)) 50 | // ) 51 | // delegateChangedEvent.parameters.push( 52 | // new ethereum.EventParam( 53 | // "fromDelegate", 54 | // ethereum.Value.fromAddress(fromDelegate) 55 | // ) 56 | // ) 57 | // delegateChangedEvent.parameters.push( 58 | // new ethereum.EventParam( 59 | // "toDelegate", 60 | // ethereum.Value.fromAddress(toDelegate) 61 | // ) 62 | // ) 63 | 64 | // return delegateChangedEvent 65 | // } 66 | 67 | // export function createDelegateVotesChangedEvent( 68 | // delegate: Address, 69 | // previousVotes: BigInt, 70 | // newVotes: BigInt 71 | // ): DelegateVotesChanged { 72 | // let delegateVotesChangedEvent = changetype( 73 | // newMockEvent() 74 | // ) 75 | 76 | // delegateVotesChangedEvent.parameters = new Array() 77 | 78 | // delegateVotesChangedEvent.parameters.push( 79 | // new ethereum.EventParam("delegate", ethereum.Value.fromAddress(delegate)) 80 | // ) 81 | // delegateVotesChangedEvent.parameters.push( 82 | // new ethereum.EventParam( 83 | // "previousVotes", 84 | // ethereum.Value.fromUnsignedBigInt(previousVotes) 85 | // ) 86 | // ) 87 | // delegateVotesChangedEvent.parameters.push( 88 | // new ethereum.EventParam( 89 | // "newVotes", 90 | // ethereum.Value.fromUnsignedBigInt(newVotes) 91 | // ) 92 | // ) 93 | 94 | // return delegateVotesChangedEvent 95 | // } 96 | 97 | // export function createDepositEvent( 98 | // sender: Address, 99 | // owner: Address, 100 | // assets: BigInt, 101 | // shares: BigInt 102 | // ): Deposit { 103 | // let depositEvent = changetype(newMockEvent()) 104 | 105 | // depositEvent.parameters = new Array() 106 | 107 | // depositEvent.parameters.push( 108 | // new ethereum.EventParam("sender", ethereum.Value.fromAddress(sender)) 109 | // ) 110 | // depositEvent.parameters.push( 111 | // new ethereum.EventParam("owner", ethereum.Value.fromAddress(owner)) 112 | // ) 113 | // depositEvent.parameters.push( 114 | // new ethereum.EventParam("assets", ethereum.Value.fromUnsignedBigInt(assets)) 115 | // ) 116 | // depositEvent.parameters.push( 117 | // new ethereum.EventParam("shares", ethereum.Value.fromUnsignedBigInt(shares)) 118 | // ) 119 | 120 | // return depositEvent 121 | // } 122 | 123 | // export function createEIP712DomainChangedEvent(): EIP712DomainChanged { 124 | // let eip712DomainChangedEvent = changetype(newMockEvent()) 125 | 126 | // eip712DomainChangedEvent.parameters = new Array() 127 | 128 | // return eip712DomainChangedEvent 129 | // } 130 | 131 | // export function createInitializedEvent(version: BigInt): Initialized { 132 | // let initializedEvent = changetype(newMockEvent()) 133 | 134 | // initializedEvent.parameters = new Array() 135 | 136 | // initializedEvent.parameters.push( 137 | // new ethereum.EventParam( 138 | // "version", 139 | // ethereum.Value.fromUnsignedBigInt(version) 140 | // ) 141 | // ) 142 | 143 | // return initializedEvent 144 | // } 145 | 146 | // export function createRoleAdminChangedEvent( 147 | // role: Bytes, 148 | // previousAdminRole: Bytes, 149 | // newAdminRole: Bytes 150 | // ): RoleAdminChanged { 151 | // let roleAdminChangedEvent = changetype(newMockEvent()) 152 | 153 | // roleAdminChangedEvent.parameters = new Array() 154 | 155 | // roleAdminChangedEvent.parameters.push( 156 | // new ethereum.EventParam("role", ethereum.Value.fromFixedBytes(role)) 157 | // ) 158 | // roleAdminChangedEvent.parameters.push( 159 | // new ethereum.EventParam( 160 | // "previousAdminRole", 161 | // ethereum.Value.fromFixedBytes(previousAdminRole) 162 | // ) 163 | // ) 164 | // roleAdminChangedEvent.parameters.push( 165 | // new ethereum.EventParam( 166 | // "newAdminRole", 167 | // ethereum.Value.fromFixedBytes(newAdminRole) 168 | // ) 169 | // ) 170 | 171 | // return roleAdminChangedEvent 172 | // } 173 | 174 | // export function createRoleGrantedEvent( 175 | // role: Bytes, 176 | // account: Address, 177 | // sender: Address 178 | // ): RoleGranted { 179 | // let roleGrantedEvent = changetype(newMockEvent()) 180 | 181 | // roleGrantedEvent.parameters = new Array() 182 | 183 | // roleGrantedEvent.parameters.push( 184 | // new ethereum.EventParam("role", ethereum.Value.fromFixedBytes(role)) 185 | // ) 186 | // roleGrantedEvent.parameters.push( 187 | // new ethereum.EventParam("account", ethereum.Value.fromAddress(account)) 188 | // ) 189 | // roleGrantedEvent.parameters.push( 190 | // new ethereum.EventParam("sender", ethereum.Value.fromAddress(sender)) 191 | // ) 192 | 193 | // return roleGrantedEvent 194 | // } 195 | 196 | // export function createRoleRevokedEvent( 197 | // role: Bytes, 198 | // account: Address, 199 | // sender: Address 200 | // ): RoleRevoked { 201 | // let roleRevokedEvent = changetype(newMockEvent()) 202 | 203 | // roleRevokedEvent.parameters = new Array() 204 | 205 | // roleRevokedEvent.parameters.push( 206 | // new ethereum.EventParam("role", ethereum.Value.fromFixedBytes(role)) 207 | // ) 208 | // roleRevokedEvent.parameters.push( 209 | // new ethereum.EventParam("account", ethereum.Value.fromAddress(account)) 210 | // ) 211 | // roleRevokedEvent.parameters.push( 212 | // new ethereum.EventParam("sender", ethereum.Value.fromAddress(sender)) 213 | // ) 214 | 215 | // return roleRevokedEvent 216 | // } 217 | 218 | // export function createTransferEvent( 219 | // from: Address, 220 | // to: Address, 221 | // value: BigInt 222 | // ): Transfer { 223 | // let transferEvent = changetype(newMockEvent()) 224 | 225 | // transferEvent.parameters = new Array() 226 | 227 | // transferEvent.parameters.push( 228 | // new ethereum.EventParam("from", ethereum.Value.fromAddress(from)) 229 | // ) 230 | // transferEvent.parameters.push( 231 | // new ethereum.EventParam("to", ethereum.Value.fromAddress(to)) 232 | // ) 233 | // transferEvent.parameters.push( 234 | // new ethereum.EventParam("value", ethereum.Value.fromUnsignedBigInt(value)) 235 | // ) 236 | 237 | // return transferEvent 238 | // } 239 | 240 | // export function createWithdrawEvent( 241 | // sender: Address, 242 | // receiver: Address, 243 | // owner: Address, 244 | // assets: BigInt, 245 | // shares: BigInt 246 | // ): Withdraw { 247 | // let withdrawEvent = changetype(newMockEvent()) 248 | 249 | // withdrawEvent.parameters = new Array() 250 | 251 | // withdrawEvent.parameters.push( 252 | // new ethereum.EventParam("sender", ethereum.Value.fromAddress(sender)) 253 | // ) 254 | // withdrawEvent.parameters.push( 255 | // new ethereum.EventParam("receiver", ethereum.Value.fromAddress(receiver)) 256 | // ) 257 | // withdrawEvent.parameters.push( 258 | // new ethereum.EventParam("owner", ethereum.Value.fromAddress(owner)) 259 | // ) 260 | // withdrawEvent.parameters.push( 261 | // new ethereum.EventParam("assets", ethereum.Value.fromUnsignedBigInt(assets)) 262 | // ) 263 | // withdrawEvent.parameters.push( 264 | // new ethereum.EventParam("shares", ethereum.Value.fromUnsignedBigInt(shares)) 265 | // ) 266 | 267 | // return withdrawEvent 268 | // } 269 | -------------------------------------------------------------------------------- /contracts/abi/feeFlowControllerAbi.ts: -------------------------------------------------------------------------------- 1 | export const feeFlowControllerAbi = [ 2 | { 3 | type: "constructor", 4 | inputs: [ 5 | { 6 | name: "evc", 7 | type: "address", 8 | internalType: "address", 9 | }, 10 | { 11 | name: "initPrice", 12 | type: "uint256", 13 | internalType: "uint256", 14 | }, 15 | { 16 | name: "paymentToken_", 17 | type: "address", 18 | internalType: "address", 19 | }, 20 | { 21 | name: "paymentReceiver_", 22 | type: "address", 23 | internalType: "address", 24 | }, 25 | { 26 | name: "epochPeriod_", 27 | type: "uint256", 28 | internalType: "uint256", 29 | }, 30 | { 31 | name: "priceMultiplier_", 32 | type: "uint256", 33 | internalType: "uint256", 34 | }, 35 | { 36 | name: "minInitPrice_", 37 | type: "uint256", 38 | internalType: "uint256", 39 | }, 40 | ], 41 | stateMutability: "nonpayable", 42 | }, 43 | { 44 | type: "function", 45 | name: "ABS_MAX_INIT_PRICE", 46 | inputs: [], 47 | outputs: [ 48 | { 49 | name: "", 50 | type: "uint256", 51 | internalType: "uint256", 52 | }, 53 | ], 54 | stateMutability: "view", 55 | }, 56 | { 57 | type: "function", 58 | name: "ABS_MIN_INIT_PRICE", 59 | inputs: [], 60 | outputs: [ 61 | { 62 | name: "", 63 | type: "uint256", 64 | internalType: "uint256", 65 | }, 66 | ], 67 | stateMutability: "view", 68 | }, 69 | { 70 | type: "function", 71 | name: "EVC", 72 | inputs: [], 73 | outputs: [ 74 | { 75 | name: "", 76 | type: "address", 77 | internalType: "address", 78 | }, 79 | ], 80 | stateMutability: "view", 81 | }, 82 | { 83 | type: "function", 84 | name: "MAX_EPOCH_PERIOD", 85 | inputs: [], 86 | outputs: [ 87 | { 88 | name: "", 89 | type: "uint256", 90 | internalType: "uint256", 91 | }, 92 | ], 93 | stateMutability: "view", 94 | }, 95 | { 96 | type: "function", 97 | name: "MAX_PRICE_MULTIPLIER", 98 | inputs: [], 99 | outputs: [ 100 | { 101 | name: "", 102 | type: "uint256", 103 | internalType: "uint256", 104 | }, 105 | ], 106 | stateMutability: "view", 107 | }, 108 | { 109 | type: "function", 110 | name: "MIN_EPOCH_PERIOD", 111 | inputs: [], 112 | outputs: [ 113 | { 114 | name: "", 115 | type: "uint256", 116 | internalType: "uint256", 117 | }, 118 | ], 119 | stateMutability: "view", 120 | }, 121 | { 122 | type: "function", 123 | name: "MIN_PRICE_MULTIPLIER", 124 | inputs: [], 125 | outputs: [ 126 | { 127 | name: "", 128 | type: "uint256", 129 | internalType: "uint256", 130 | }, 131 | ], 132 | stateMutability: "view", 133 | }, 134 | { 135 | type: "function", 136 | name: "PRICE_MULTIPLIER_SCALE", 137 | inputs: [], 138 | outputs: [ 139 | { 140 | name: "", 141 | type: "uint256", 142 | internalType: "uint256", 143 | }, 144 | ], 145 | stateMutability: "view", 146 | }, 147 | { 148 | type: "function", 149 | name: "buy", 150 | inputs: [ 151 | { 152 | name: "assets", 153 | type: "address[]", 154 | internalType: "address[]", 155 | }, 156 | { 157 | name: "assetsReceiver", 158 | type: "address", 159 | internalType: "address", 160 | }, 161 | { 162 | name: "epochId", 163 | type: "uint256", 164 | internalType: "uint256", 165 | }, 166 | { 167 | name: "deadline", 168 | type: "uint256", 169 | internalType: "uint256", 170 | }, 171 | { 172 | name: "maxPaymentTokenAmount", 173 | type: "uint256", 174 | internalType: "uint256", 175 | }, 176 | ], 177 | outputs: [ 178 | { 179 | name: "paymentAmount", 180 | type: "uint256", 181 | internalType: "uint256", 182 | }, 183 | ], 184 | stateMutability: "nonpayable", 185 | }, 186 | { 187 | type: "function", 188 | name: "epochPeriod", 189 | inputs: [], 190 | outputs: [ 191 | { 192 | name: "", 193 | type: "uint256", 194 | internalType: "uint256", 195 | }, 196 | ], 197 | stateMutability: "view", 198 | }, 199 | { 200 | type: "function", 201 | name: "getPrice", 202 | inputs: [], 203 | outputs: [ 204 | { 205 | name: "", 206 | type: "uint256", 207 | internalType: "uint256", 208 | }, 209 | ], 210 | stateMutability: "view", 211 | }, 212 | { 213 | type: "function", 214 | name: "getSlot0", 215 | inputs: [], 216 | outputs: [ 217 | { 218 | name: "", 219 | type: "tuple", 220 | internalType: "struct FeeFlowController.Slot0", 221 | components: [ 222 | { 223 | name: "locked", 224 | type: "uint8", 225 | internalType: "uint8", 226 | }, 227 | { 228 | name: "epochId", 229 | type: "uint16", 230 | internalType: "uint16", 231 | }, 232 | { 233 | name: "initPrice", 234 | type: "uint192", 235 | internalType: "uint192", 236 | }, 237 | { 238 | name: "startTime", 239 | type: "uint40", 240 | internalType: "uint40", 241 | }, 242 | ], 243 | }, 244 | ], 245 | stateMutability: "view", 246 | }, 247 | { 248 | type: "function", 249 | name: "minInitPrice", 250 | inputs: [], 251 | outputs: [ 252 | { 253 | name: "", 254 | type: "uint256", 255 | internalType: "uint256", 256 | }, 257 | ], 258 | stateMutability: "view", 259 | }, 260 | { 261 | type: "function", 262 | name: "paymentReceiver", 263 | inputs: [], 264 | outputs: [ 265 | { 266 | name: "", 267 | type: "address", 268 | internalType: "address", 269 | }, 270 | ], 271 | stateMutability: "view", 272 | }, 273 | { 274 | type: "function", 275 | name: "paymentToken", 276 | inputs: [], 277 | outputs: [ 278 | { 279 | name: "", 280 | type: "address", 281 | internalType: "contract ERC20", 282 | }, 283 | ], 284 | stateMutability: "view", 285 | }, 286 | { 287 | type: "function", 288 | name: "priceMultiplier", 289 | inputs: [], 290 | outputs: [ 291 | { 292 | name: "", 293 | type: "uint256", 294 | internalType: "uint256", 295 | }, 296 | ], 297 | stateMutability: "view", 298 | }, 299 | { 300 | type: "event", 301 | name: "Buy", 302 | inputs: [ 303 | { 304 | name: "buyer", 305 | type: "address", 306 | indexed: true, 307 | internalType: "address", 308 | }, 309 | { 310 | name: "assetsReceiver", 311 | type: "address", 312 | indexed: true, 313 | internalType: "address", 314 | }, 315 | { 316 | name: "paymentAmount", 317 | type: "uint256", 318 | indexed: false, 319 | internalType: "uint256", 320 | }, 321 | ], 322 | anonymous: false, 323 | }, 324 | { 325 | type: "error", 326 | name: "ControllerDisabled", 327 | inputs: [], 328 | }, 329 | { 330 | type: "error", 331 | name: "DeadlinePassed", 332 | inputs: [], 333 | }, 334 | { 335 | type: "error", 336 | name: "EVC_InvalidAddress", 337 | inputs: [], 338 | }, 339 | { 340 | type: "error", 341 | name: "EmptyAssets", 342 | inputs: [], 343 | }, 344 | { 345 | type: "error", 346 | name: "EpochIdMismatch", 347 | inputs: [], 348 | }, 349 | { 350 | type: "error", 351 | name: "EpochPeriodBelowMin", 352 | inputs: [], 353 | }, 354 | { 355 | type: "error", 356 | name: "EpochPeriodExceedsMax", 357 | inputs: [], 358 | }, 359 | { 360 | type: "error", 361 | name: "InitPriceBelowMin", 362 | inputs: [], 363 | }, 364 | { 365 | type: "error", 366 | name: "InitPriceExceedsMax", 367 | inputs: [], 368 | }, 369 | { 370 | type: "error", 371 | name: "MaxPaymentTokenAmountExceeded", 372 | inputs: [], 373 | }, 374 | { 375 | type: "error", 376 | name: "MinInitPriceBelowMin", 377 | inputs: [], 378 | }, 379 | { 380 | type: "error", 381 | name: "MinInitPriceExceedsAbsMaxInitPrice", 382 | inputs: [], 383 | }, 384 | { 385 | type: "error", 386 | name: "NotAuthorized", 387 | inputs: [], 388 | }, 389 | { 390 | type: "error", 391 | name: "PaymentReceiverIsThis", 392 | inputs: [], 393 | }, 394 | { 395 | type: "error", 396 | name: "PriceMultiplierBelowMin", 397 | inputs: [], 398 | }, 399 | { 400 | type: "error", 401 | name: "PriceMultiplierExceedsMax", 402 | inputs: [], 403 | }, 404 | { 405 | type: "error", 406 | name: "Reentrancy", 407 | inputs: [], 408 | }, 409 | ] as const 410 | --------------------------------------------------------------------------------