diff --git a/.claude/scheduled_tasks.lock b/.claude/scheduled_tasks.lock new file mode 100644 index 00000000..2e1010f3 --- /dev/null +++ b/.claude/scheduled_tasks.lock @@ -0,0 +1 @@ +{"sessionId":"701028d5-7f99-47dc-8046-10213625b9c3","pid":5326,"procStart":"Mon May 11 16:24:29 2026","acquiredAt":1778555920954} \ No newline at end of file diff --git a/.github/workflows/release-prod.yml b/.github/workflows/release-prod.yml index 55327fbe..cabcf1b2 100644 --- a/.github/workflows/release-prod.yml +++ b/.github/workflows/release-prod.yml @@ -14,12 +14,12 @@ jobs: - name: Install Node.js uses: actions/setup-node@v4 with: - node-version: 20 + node-version: 22 - name: Install pnpm uses: pnpm/action-setup@v4 with: - version: 10 + version: 10.24.0 - name: Install squid CLI run: pnpm add -g @subsquid/cli diff --git a/.github/workflows/release-version.yml b/.github/workflows/release-version.yml index e2f05f1e..711d2246 100644 --- a/.github/workflows/release-version.yml +++ b/.github/workflows/release-version.yml @@ -14,12 +14,12 @@ jobs: - name: Install Node.js uses: actions/setup-node@v4 with: - node-version: 20 + node-version: 22 - name: Install pnpm uses: pnpm/action-setup@v4 with: - version: 10 + version: 10.24.0 - name: Install squid CLI run: pnpm add -g @subsquid/cli diff --git a/CLAUDE.md b/CLAUDE.md index 2be61f3e..138ed708 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -67,7 +67,7 @@ Entry points: `src/main-*.ts` files (e.g., `main-oeth.ts`, `main-ousd.ts`) - `src/utils/` - Shared utilities including chain-specific addresses (`addresses-*.ts`) - `src/shared/` - Shared modules (ERC20 state, post-processors) - `src/model/` - TypeORM entities (generated from GraphQL) -- `abi/` - Raw ABI JSON files +- `src/abi-json/` - Raw ABI JSON files (kept inside src/ so JSON imports don't shift tsc output into lib/src/) - `src/abi/` - Generated TypeScript ABI interfaces ### Path Aliases (tsconfig.json) @@ -89,7 +89,7 @@ Entry points: `src/main-*.ts` files (e.g., `main-oeth.ts`, `main-ousd.ts`) ## Development Workflow ### Adding New Events/Contracts -1. Add ABI JSON to `abi/` +1. Add ABI JSON to `src/abi-json/` 2. Run `pnpm run typegen` to generate TypeScript interfaces 3. Create processor in `src/[network]/processors/` or use existing template 4. Update `squid.yaml` if adding new processor diff --git a/commands.json b/commands.json index 6bf9a49a..29439ec0 100644 --- a/commands.json +++ b/commands.json @@ -41,12 +41,12 @@ "cmd": ["squid-typeorm-codegen"] }, "typegen": { - "description": "Generate data access classes for an ABI file(s) in the ./abi folder", + "description": "Generate data access classes for an ABI file(s) in the ./src/abi-json folder", "cmd": [ "squid-evm-typegen", "./src/abi", { - "glob": "./abi/*.json" + "glob": "./src/abi-json/*.json" }, "--multicall" ] diff --git a/db/migrations/1777931889628-Data.js b/db/migrations/1778710869745-Data.js similarity index 98% rename from db/migrations/1777931889628-Data.js rename to db/migrations/1778710869745-Data.js index 66c30d1f..c430d267 100644 --- a/db/migrations/1777931889628-Data.js +++ b/db/migrations/1778710869745-Data.js @@ -1,5 +1,5 @@ -module.exports = class Data1777931889628 { - name = 'Data1777931889628' +module.exports = class Data1778710869745 { + name = 'Data1778710869745' async up(db) { await db.query(`CREATE TABLE "util_cache" ("id" character varying NOT NULL, "data" jsonb NOT NULL, CONSTRAINT "PK_d8dba67b2f156e569ad7ecf21d6" PRIMARY KEY ("id"))`) @@ -136,6 +136,12 @@ module.exports = class Data1777931889628 { await db.query(`CREATE INDEX "IDX_7cbc465ce1e9ae06dfe3a8c625" ON "o_token_address" ("chain_id") `) await db.query(`CREATE INDEX "IDX_5342c499e930e396bade7faeb6" ON "o_token_address" ("otoken") `) await db.query(`CREATE INDEX "IDX_75c7d29bf71b393e99c4407885" ON "o_token_address" ("address") `) + await db.query(`CREATE TABLE "o_token_address_yield" ("id" character varying NOT NULL, "chain_id" integer NOT NULL, "otoken" text NOT NULL, "address" text NOT NULL, "date" text NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "balance" numeric NOT NULL, "cost_basis" numeric NOT NULL, "yield" numeric NOT NULL, "cumulative_yield" numeric NOT NULL, "roi" numeric NOT NULL, CONSTRAINT "PK_3a51ade95f29c46dce5ec03561b" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_18f2fa03b3cf7a2a1ad2abc50a" ON "o_token_address_yield" ("chain_id") `) + await db.query(`CREATE INDEX "IDX_a7ca43e7479fe175c4fdef6a7e" ON "o_token_address_yield" ("otoken") `) + await db.query(`CREATE INDEX "IDX_a8c0d467d13b8dd5ed32977811" ON "o_token_address_yield" ("address") `) + await db.query(`CREATE INDEX "IDX_c06dd25cbfc9dcb92655966a32" ON "o_token_address_yield" ("date") `) + await db.query(`CREATE INDEX "IDX_ca785f8a0107edadfbe8da881d" ON "o_token_address_yield" ("block_number") `) await db.query(`CREATE TABLE "o_token_apy" ("id" character varying NOT NULL, "chain_id" integer NOT NULL, "otoken" text NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "tx_hash" text, "date" text NOT NULL, "apr" numeric NOT NULL, "apy" numeric NOT NULL, "apy7_day_avg" numeric NOT NULL, "apy14_day_avg" numeric NOT NULL, "apy30_day_avg" numeric NOT NULL, "rebasing_credits_per_token" numeric NOT NULL, CONSTRAINT "PK_132f1c9570d48b38184ca5ac4cc" PRIMARY KEY ("id"))`) await db.query(`CREATE INDEX "IDX_5d9294486b1c57df8c3aad5145" ON "o_token_apy" ("chain_id") `) await db.query(`CREATE INDEX "IDX_4d4f1b0d9e7f6903a2038c6c38" ON "o_token_apy" ("otoken") `) @@ -157,7 +163,7 @@ module.exports = class Data1777931889628 { await db.query(`CREATE INDEX "IDX_95bab764e1a63ea0778dca4038" ON "o_token_rebase_option" ("block_number") `) await db.query(`CREATE INDEX "IDX_00fff31b07544c1739afce542c" ON "o_token_rebase_option" ("tx_hash") `) await db.query(`CREATE INDEX "IDX_da7296f8011232dc8675477b84" ON "o_token_rebase_option" ("address_id") `) - await db.query(`CREATE TABLE "o_token_vault" ("id" character varying NOT NULL, "chain_id" integer NOT NULL, "otoken" text NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "address" text NOT NULL, "vault_buffer" numeric NOT NULL, "total_value" numeric NOT NULL, CONSTRAINT "PK_90bb3a4df699017439cd6a44a0c" PRIMARY KEY ("id"))`) + await db.query(`CREATE TABLE "o_token_vault" ("id" character varying NOT NULL, "chain_id" integer NOT NULL, "otoken" text NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "address" text NOT NULL, "vault_buffer" numeric NOT NULL, "total_value" numeric NOT NULL, "claimable" numeric NOT NULL, CONSTRAINT "PK_90bb3a4df699017439cd6a44a0c" PRIMARY KEY ("id"))`) await db.query(`CREATE INDEX "IDX_6990f4cd71ea8db6d9d27a0db5" ON "o_token_vault" ("chain_id") `) await db.query(`CREATE INDEX "IDX_2c88ea3e889e76b037d8f59c96" ON "o_token_vault" ("otoken") `) await db.query(`CREATE INDEX "IDX_091cfbe0d977006e05144bd1fe" ON "o_token_vault" ("timestamp") `) @@ -192,7 +198,7 @@ module.exports = class Data1777931889628 { await db.query(`CREATE INDEX "IDX_f4ab790e094a77b93887966876" ON "o_token_reward_token_collected" ("block_number") `) await db.query(`CREATE INDEX "IDX_21d1addd6f0b96b016c802141f" ON "o_token_reward_token_collected" ("timestamp") `) await db.query(`CREATE INDEX "IDX_12a95d40144492a85dc15b9e57" ON "o_token_reward_token_collected" ("otoken") `) - await db.query(`CREATE TABLE "o_token_withdrawal_request" ("id" character varying NOT NULL, "chain_id" integer NOT NULL, "block_number" integer NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "otoken" text NOT NULL, "request_id" numeric NOT NULL, "withdrawer" text NOT NULL, "amount" numeric NOT NULL, "queued" numeric NOT NULL, "claimed" boolean NOT NULL, "claimed_at" TIMESTAMP WITH TIME ZONE, "queue_wait" numeric, "tx_hash" text NOT NULL, CONSTRAINT "PK_44db9244683cb58e12a51cf3c8b" PRIMARY KEY ("id"))`) + await db.query(`CREATE TABLE "o_token_withdrawal_request" ("id" character varying NOT NULL, "chain_id" integer NOT NULL, "block_number" integer NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "otoken" text NOT NULL, "request_id" numeric NOT NULL, "withdrawer" text NOT NULL, "amount" numeric NOT NULL, "queued" numeric NOT NULL, "claimed" boolean NOT NULL, "claimed_at" TIMESTAMP WITH TIME ZONE, "claimable_at" TIMESTAMP WITH TIME ZONE, "queue_wait" numeric, "tx_hash" text NOT NULL, CONSTRAINT "PK_44db9244683cb58e12a51cf3c8b" PRIMARY KEY ("id"))`) await db.query(`CREATE INDEX "IDX_d9844c17dce47a89f23917de31" ON "o_token_withdrawal_request" ("chain_id") `) await db.query(`CREATE INDEX "IDX_326e6366033bf085a34371d559" ON "o_token_withdrawal_request" ("block_number") `) await db.query(`CREATE INDEX "IDX_40e7c338b514e19f2319d768bd" ON "o_token_withdrawal_request" ("timestamp") `) @@ -209,7 +215,7 @@ module.exports = class Data1777931889628 { await db.query(`CREATE INDEX "IDX_87d21220457c7025845c0d5760" ON "morpho_vault_apy" ("block_number") `) await db.query(`CREATE INDEX "IDX_c2be559e927f6cf24bba874de4" ON "morpho_vault_apy" ("vault_address") `) await db.query(`CREATE TABLE "arm" ("id" character varying NOT NULL, "chain_id" integer NOT NULL, "address" text NOT NULL, "name" text NOT NULL, "symbol" text NOT NULL, "decimals" integer NOT NULL, "token0" text NOT NULL, "token1" text NOT NULL, CONSTRAINT "PK_711e2a749a8c4baeccf8365290c" PRIMARY KEY ("id"))`) - await db.query(`CREATE TABLE "arm_state" ("id" character varying NOT NULL, "chain_id" integer NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "address" text NOT NULL, "assets0" numeric NOT NULL, "assets1" numeric NOT NULL, "outstanding_assets1" numeric NOT NULL, "market_assets" numeric NOT NULL, "fees_accrued" numeric NOT NULL, "total_assets" numeric NOT NULL, "total_assets_cap" numeric NOT NULL, "total_supply" numeric NOT NULL, "assets_per_share" numeric NOT NULL, "total_deposits" numeric NOT NULL, "total_withdrawals" numeric NOT NULL, "total_withdrawals_claimed" numeric NOT NULL, "total_yield" numeric NOT NULL, "total_fees" numeric NOT NULL, CONSTRAINT "PK_e58fff61dd95dfeac112204c378" PRIMARY KEY ("id"))`) + await db.query(`CREATE TABLE "arm_state" ("id" character varying NOT NULL, "chain_id" integer NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "address" text NOT NULL, "assets0" numeric NOT NULL, "assets1" numeric NOT NULL, "outstanding_assets1" numeric NOT NULL, "market_assets" numeric NOT NULL, "fees_accrued" numeric NOT NULL, "total_assets" numeric NOT NULL, "total_assets_cap" numeric NOT NULL, "total_supply" numeric NOT NULL, "assets_per_share" numeric NOT NULL, "total_deposits" numeric NOT NULL, "total_withdrawals" numeric NOT NULL, "total_withdrawals_claimed" numeric NOT NULL, "total_yield" numeric NOT NULL, "total_fees" numeric NOT NULL, "claimable" numeric NOT NULL, CONSTRAINT "PK_e58fff61dd95dfeac112204c378" PRIMARY KEY ("id"))`) await db.query(`CREATE INDEX "IDX_68943c1b73a665919e9377027e" ON "arm_state" ("chain_id") `) await db.query(`CREATE INDEX "IDX_85852cf19a3ddc86a4762398dd" ON "arm_state" ("timestamp") `) await db.query(`CREATE INDEX "IDX_d9779389f627b43d2f746323de" ON "arm_state" ("block_number") `) @@ -226,7 +232,7 @@ module.exports = class Data1777931889628 { await db.query(`CREATE INDEX "IDX_8fabfa2b0691f4d6ae283bb638" ON "arm_address_yield" ("address") `) await db.query(`CREATE INDEX "IDX_1706616a44b8303752ec76a045" ON "arm_address_yield" ("date") `) await db.query(`CREATE INDEX "IDX_d4540a0c059efb82d22fe0e412" ON "arm_address_yield" ("block_number") `) - await db.query(`CREATE TABLE "arm_withdrawal_request" ("id" character varying NOT NULL, "chain_id" integer NOT NULL, "tx_hash" text NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "address" text NOT NULL, "account" text NOT NULL, "request_id" numeric NOT NULL, "amount" numeric NOT NULL, "queued" numeric NOT NULL, "claimed" boolean NOT NULL, "claimed_at" TIMESTAMP WITH TIME ZONE, CONSTRAINT "PK_13dc23b0e4ee7f803645e930896" PRIMARY KEY ("id"))`) + await db.query(`CREATE TABLE "arm_withdrawal_request" ("id" character varying NOT NULL, "chain_id" integer NOT NULL, "tx_hash" text NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "block_number" integer NOT NULL, "address" text NOT NULL, "account" text NOT NULL, "request_id" numeric NOT NULL, "amount" numeric NOT NULL, "queued" numeric NOT NULL, "claimed" boolean NOT NULL, "claimed_at" TIMESTAMP WITH TIME ZONE, "claimable_at" TIMESTAMP WITH TIME ZONE, CONSTRAINT "PK_13dc23b0e4ee7f803645e930896" PRIMARY KEY ("id"))`) await db.query(`CREATE INDEX "IDX_330af8826e0e9369301bebc3e7" ON "arm_withdrawal_request" ("chain_id") `) await db.query(`CREATE INDEX "IDX_501cc246901cfad5d624da98d6" ON "arm_withdrawal_request" ("tx_hash") `) await db.query(`CREATE INDEX "IDX_f0634f8590f80c00f646b82867" ON "arm_withdrawal_request" ("timestamp") `) @@ -639,6 +645,12 @@ module.exports = class Data1777931889628 { await db.query(`DROP INDEX "public"."IDX_7cbc465ce1e9ae06dfe3a8c625"`) await db.query(`DROP INDEX "public"."IDX_5342c499e930e396bade7faeb6"`) await db.query(`DROP INDEX "public"."IDX_75c7d29bf71b393e99c4407885"`) + await db.query(`DROP TABLE "o_token_address_yield"`) + await db.query(`DROP INDEX "public"."IDX_18f2fa03b3cf7a2a1ad2abc50a"`) + await db.query(`DROP INDEX "public"."IDX_a7ca43e7479fe175c4fdef6a7e"`) + await db.query(`DROP INDEX "public"."IDX_a8c0d467d13b8dd5ed32977811"`) + await db.query(`DROP INDEX "public"."IDX_c06dd25cbfc9dcb92655966a32"`) + await db.query(`DROP INDEX "public"."IDX_ca785f8a0107edadfbe8da881d"`) await db.query(`DROP TABLE "o_token_apy"`) await db.query(`DROP INDEX "public"."IDX_5d9294486b1c57df8c3aad5145"`) await db.query(`DROP INDEX "public"."IDX_4d4f1b0d9e7f6903a2038c6c38"`) diff --git a/package.json b/package.json index c934301b..97d82edf 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,7 @@ { "name": "origin-squid", "private": true, + "packageManager": "pnpm@10.24.0", "scripts": { "codegen": "echo '# GENERATED, DO NOT MODIFY\n' > schema.graphql && cat $(find src -name '*.graphql') >> schema.graphql && sqd codegen && git add src/model/generated/*", "migration:generate": "sqd down && sqd up && sqd migration:generate && git add db/migrations/*", @@ -26,7 +27,7 @@ "process:hyperevm": "sqd process:hyperevm", "process:test": "sqd process:test", "process": "sqd process", - "generate:validations": "ts-node --require tsconfig-paths/register scripts/generate-validations.ts", + "generate:validations": "ts-node --require ./scripts/register-js-ts.js --require tsconfig-paths/register scripts/generate-validations.ts", "log:processing-times": "ts-node --require tsconfig-paths/register scripts/check-processing-times.ts", "postdeploy": "sh -c 'pnpm run log:processing-times $1 && pnpm run generate:validations $1 $2' --", "lint": "eslint \"src/**/*.ts\"", @@ -38,11 +39,11 @@ "@lavamoat/preinstall-always-fail": "^2.1.1", "@originprotocol/squid-utils": "github:OriginProtocol/squid-utils#main", "@subsquid/big-decimal": "^1.0.0", - "@subsquid/evm-processor": "^1.27.3", - "@subsquid/graphql-server": "^4.11.0", - "@subsquid/rpc-client": "4.14.0", - "@subsquid/typeorm-migration": "^1.3.0", - "@subsquid/typeorm-store": "^1.5.1", + "@subsquid/evm-processor": "^1.30.1", + "@subsquid/graphql-server": "^4.12.0", + "@subsquid/rpc-client": "4.15.0", + "@subsquid/typeorm-migration": "^1.3.1", + "@subsquid/typeorm-store": "^1.9.1", "@tanstack/query-core": "^5.32.0", "@types/lodash": "^4.14.200", "chai": "^4.3.10", @@ -66,10 +67,10 @@ }, "devDependencies": { "@lavamoat/allow-scripts": "^3.3.4", - "@subsquid/evm-abi": "0.3.1", - "@subsquid/evm-codec": "0.3.0", - "@subsquid/evm-typegen": "^4.5.1", - "@subsquid/typeorm-codegen": "^2.0.2", + "@subsquid/evm-abi": "1.0.0", + "@subsquid/evm-codec": "1.0.0", + "@subsquid/evm-typegen": "^5.0.0", + "@subsquid/typeorm-codegen": "^2.2.0", "@trivago/prettier-plugin-sort-imports": "^4.2.0", "@types/chai": "^4.3.11", "@types/js-yaml": "^4.0.8", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 74785fbc..fefcaf33 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -16,25 +16,25 @@ importers: version: 2.1.1 '@originprotocol/squid-utils': specifier: github:OriginProtocol/squid-utils#main - version: https://codeload.github.com/OriginProtocol/squid-utils/tar.gz/aa198564e0332229c5563290c43774bdc731e9ed(@subsquid/big-decimal@1.0.0)(bufferutil@4.0.9)(encoding@0.1.13)(typeorm@0.3.26(ioredis@5.7.0)(pg@8.16.3)(reflect-metadata@0.1.14)(ts-node@10.9.2(@types/node@18.19.126)(typescript@5.9.2)))(typescript@5.9.2)(utf-8-validate@5.0.10) + version: https://codeload.github.com/OriginProtocol/squid-utils/tar.gz/27627bfc16a21cb91e332c6e283446e3bf3901db(@subsquid/big-decimal@1.0.0)(bufferutil@4.0.9)(encoding@0.1.13)(typeorm@0.3.26(ioredis@5.7.0)(pg@8.16.3)(reflect-metadata@0.1.14)(ts-node@10.9.2(@types/node@18.19.126)(typescript@5.9.2)))(typescript@5.9.2)(utf-8-validate@5.0.10) '@subsquid/big-decimal': specifier: ^1.0.0 version: 1.0.0 '@subsquid/evm-processor': - specifier: ^1.27.3 - version: 1.27.3 + specifier: ^1.30.1 + version: 1.30.1 '@subsquid/graphql-server': - specifier: ^4.11.0 - version: 4.11.0(@subsquid/big-decimal@1.0.0)(bufferutil@4.0.9)(class-validator@0.14.2)(encoding@0.1.13)(type-graphql@1.2.0-rc.1(class-validator@0.14.2)(graphql@15.10.1))(typeorm@0.3.26(ioredis@5.7.0)(pg@8.16.3)(reflect-metadata@0.1.14)(ts-node@10.9.2(@types/node@18.19.126)(typescript@5.9.2)))(utf-8-validate@5.0.10) + specifier: ^4.12.0 + version: 4.12.0(@subsquid/big-decimal@1.0.0)(bufferutil@4.0.9)(class-validator@0.14.2)(encoding@0.1.13)(type-graphql@1.2.0-rc.1(class-validator@0.14.2)(graphql@15.10.1))(typeorm@0.3.26(ioredis@5.7.0)(pg@8.16.3)(reflect-metadata@0.1.14)(ts-node@10.9.2(@types/node@18.19.126)(typescript@5.9.2)))(utf-8-validate@5.0.10) '@subsquid/rpc-client': - specifier: 4.14.0 - version: 4.14.0 + specifier: 4.15.0 + version: 4.15.0 '@subsquid/typeorm-migration': - specifier: ^1.3.0 - version: 1.3.0(typeorm@0.3.26(ioredis@5.7.0)(pg@8.16.3)(reflect-metadata@0.1.14)(ts-node@10.9.2(@types/node@18.19.126)(typescript@5.9.2))) + specifier: ^1.3.1 + version: 1.3.1(typeorm@0.3.26(ioredis@5.7.0)(pg@8.16.3)(reflect-metadata@0.1.14)(ts-node@10.9.2(@types/node@18.19.126)(typescript@5.9.2))) '@subsquid/typeorm-store': - specifier: ^1.5.1 - version: 1.5.1(@subsquid/big-decimal@1.0.0)(typeorm@0.3.26(ioredis@5.7.0)(pg@8.16.3)(reflect-metadata@0.1.14)(ts-node@10.9.2(@types/node@18.19.126)(typescript@5.9.2))) + specifier: ^1.9.1 + version: 1.9.1(@subsquid/big-decimal@1.0.0)(typeorm@0.3.26(ioredis@5.7.0)(pg@8.16.3)(reflect-metadata@0.1.14)(ts-node@10.9.2(@types/node@18.19.126)(typescript@5.9.2))) '@tanstack/query-core': specifier: ^5.32.0 version: 5.89.0 @@ -100,17 +100,17 @@ importers: specifier: ^3.3.4 version: 3.3.5 '@subsquid/evm-abi': - specifier: 0.3.1 - version: 0.3.1 + specifier: 1.0.0 + version: 1.0.0 '@subsquid/evm-codec': - specifier: 0.3.0 - version: 0.3.0 + specifier: 1.0.0 + version: 1.0.0 '@subsquid/evm-typegen': - specifier: ^4.5.1 - version: 4.5.1 + specifier: ^5.0.0 + version: 5.0.0 '@subsquid/typeorm-codegen': - specifier: ^2.0.2 - version: 2.0.2(@subsquid/big-decimal@1.0.0)(bufferutil@4.0.9)(encoding@0.1.13)(utf-8-validate@5.0.10) + specifier: ^2.2.0 + version: 2.2.0(@subsquid/big-decimal@1.0.0)(bufferutil@4.0.9)(encoding@0.1.13)(utf-8-validate@5.0.10) '@trivago/prettier-plugin-sort-imports': specifier: ^4.2.0 version: 4.3.0(prettier@3.6.2) @@ -828,8 +828,8 @@ packages: resolution: {integrity: sha512-y7efHHwghQfk28G2z3tlZ67pLG0XdfYbcVG26r7YIXALRsrVQcTq4/tdenSmdOrEsNahIYA/eh8aEVROWGFUDg==} engines: {node: ^16.14.0 || >=18.0.0} - '@originprotocol/squid-utils@https://codeload.github.com/OriginProtocol/squid-utils/tar.gz/aa198564e0332229c5563290c43774bdc731e9ed': - resolution: {tarball: https://codeload.github.com/OriginProtocol/squid-utils/tar.gz/aa198564e0332229c5563290c43774bdc731e9ed} + '@originprotocol/squid-utils@https://codeload.github.com/OriginProtocol/squid-utils/tar.gz/27627bfc16a21cb91e332c6e283446e3bf3901db': + resolution: {tarball: https://codeload.github.com/OriginProtocol/squid-utils/tar.gz/27627bfc16a21cb91e332c6e283446e3bf3901db} version: 1.0.0 '@pkgjs/parseargs@0.11.0': @@ -1123,24 +1123,27 @@ packages: '@subsquid/big-decimal@1.0.0': resolution: {integrity: sha512-/wyZEYC4Mlcm7jQWGhZnCvYpIosRmDSlNbv9SJBphE88aaFe8bOxl4sYwM/olzJgCn4Ir45nBsPU0ebF1+nXog==} - '@subsquid/evm-abi@0.3.1': - resolution: {integrity: sha512-kWD8KjPBj4bR7u2Ct0xZmmVVkto0DKbSv9LQoh3fdGpS1UXbMg1jt4idupd970U8O7u3JJoTosgtApaXbKfoig==} + '@subsquid/evm-abi@1.0.0': + resolution: {integrity: sha512-FEOkrhLeRcVpbjisN2Iw9BzPSLtTPpNlkB2B9pfnzCKzPdQcEhgPUYL58hEnXKISGqk+/JMipMzf0JEfnV4Leg==} - '@subsquid/evm-codec@0.3.0': - resolution: {integrity: sha512-W6EIiC7MJN2oWdbgzpUSDop+UtROdFAlvsrzc10g3AnCAaK31nH59tkTjylRxgECewWFCFWZrwsVp+a+lwvXMA==} + '@subsquid/evm-codec@1.0.0': + resolution: {integrity: sha512-3+FIqEnd8OkeHd03v99r7TIytUv8MIzka/Luz6fSEUA18YfZd5K0T+kq6Siy+UbU+jLslirSRSaKLt/bj5hDug==} - '@subsquid/evm-processor@1.27.3': - resolution: {integrity: sha512-Ace1/G4DKXFK8Wr56TmEkszJCwyhzMT6yeoVXUzdY2bqGSGh2bWCQEvtwfo2vxfkuPbix3seucQ7g+kH2BVIig==} + '@subsquid/evm-processor@1.28.0-portal-api.721f49': + resolution: {integrity: sha512-FNs/tcbFgLA+5FODWthiQC1v3qHJ3NIqSGNHnkA7hxFlZ4AIbwwjSrif8B1bpMawKpb9LAeXLiHHAzHPUqqniA==} - '@subsquid/evm-typegen@4.5.1': - resolution: {integrity: sha512-82LJ0qUj3bc5hFYZ+OegKKVbJruOtfhIHKwoq9ui395DuRkTO71FOtHusHdIMaUmS1Sx3nGOzcjbMStLkum+Eg==} + '@subsquid/evm-processor@1.30.1': + resolution: {integrity: sha512-7wOZaaw2lBVfSnhiDBDwUTf93jv7G6A6AdmqV4OWs9GWXLcQAdmL8PgcCFTKguMFvxgXsSx5y+uWs7llWDecLA==} + + '@subsquid/evm-typegen@5.0.0': + resolution: {integrity: sha512-2jz9YoWvP5XSUWeCvEWlqPF+gFQ14O6hh0vECe5hmr+PcnC3n0FMd+qVKgix46LqHmEX13s0Vkyz+Akqbzd0xw==} hasBin: true '@subsquid/graphiql-console@0.3.0': resolution: {integrity: sha512-C89mus6IXnNi0xMQrZqUFBZwLj8tbuq9lye8Gq/lHmmERAUpi6UsWEyLdJLx2mneZzF3JtY8eNiiZ16jmjtvfw==} - '@subsquid/graphql-server@4.11.0': - resolution: {integrity: sha512-QXQxT1zP2optQKaJU53Y4XxNEhrFO3F2KPPN6ZN/0C/hYui50wdtMAS6HTzeCKvlUTvqRio0fzzSEtFmNpjg/A==} + '@subsquid/graphql-server@4.12.0': + resolution: {integrity: sha512-42UOU9L5eKV8sZEbShH0g/fao1BoNhVP0XqxvbJJTOVBO6pvp7Bimrv3i6UVTCXZpKRHYNUh4UuJsjsoda2xFQ==} hasBin: true peerDependencies: '@subsquid/big-decimal': ^1.0.0 @@ -1157,17 +1160,17 @@ packages: typeorm: optional: true - '@subsquid/http-client@1.6.1': - resolution: {integrity: sha512-jzHUxNopsEfHQilS0v/T9oSKTRcooT7ezSG1/sRILAMtYR4b11VUkrxVCFWCUDEwahfDDPw1g/Cw68rMnRqkzg==} - - '@subsquid/http-client@1.8.0': - resolution: {integrity: sha512-HEwKjxBWoFdOT+BeC8j0aKCsNsNq8M4YO8peGlqAAYFw2Uhaztd5bWtygOhOYNrku9E8xm1mnH9p4ciKdyIK/Q==} + '@subsquid/http-client@1.8.1': + resolution: {integrity: sha512-JDOqZ2DxhOfmZaoeo0+l3MOseTbbhVAz+3VkNBAhfOdenHTKHTYrywjC1AbqtzFZCswW7ErSFsEsIk+y5GsbGQ==} '@subsquid/logger@1.4.0': resolution: {integrity: sha512-Yep4hzpLfmm4pJMXuTnd3n7Hlo18Dce8vwKZduGE9n/p56cHq4BTbAuaXLK50vYKWx7Lyt2obVbJ4otVMWkyYg==} - '@subsquid/openreader@5.3.0': - resolution: {integrity: sha512-nX5x7Fu7qHVxARTae0JzEOY2vj0MSDP09SBNQDvVSh4azlAcaIzGkzpX7GIGe0wUtt1fz5wXMn5/zyCc5nxHuQ==} + '@subsquid/logger@1.6.0': + resolution: {integrity: sha512-k33Cw1uO+Boha08arS8nhr0VHfT+bTWGe/hTZDeCDMoa2i0SUgkiDGDkgqTQof6y/N/kl30KzPvAAGqwJ6MJNw==} + + '@subsquid/openreader@5.5.0': + resolution: {integrity: sha512-+O+rQIxGPFeGC1R+IzeoAvNmufJ6QXUzGB+Exi3aTGoddbqjSnuUc3qiNa/lIIOuKGtJT3qK8wbA5vMsv5pGmQ==} hasBin: true peerDependencies: '@subsquid/big-decimal': ^1.0.0 @@ -1175,11 +1178,16 @@ packages: '@subsquid/big-decimal': optional: true - '@subsquid/rpc-client@4.14.0': - resolution: {integrity: sha512-YquFxFWc517A3G2peQYvSyK3ksmGYvlErOCMyREEGQTb9GwUl4DBaTi/+NO9ioy6Hk9Acg5hTeZzKxGnzqhBdQ==} + '@subsquid/portal-client@0.3.2': + resolution: {integrity: sha512-FSB6rfLAlTMCy6N0vSck/yz69h6sMCaTKdgxfM/RuQA1WYIFfJtm4jbiNpDIvRd/CguKyg41iWWbWJXrvOUJvw==} + peerDependencies: + '@subsquid/http-client': ^1.7.0 + + '@subsquid/rpc-client@4.15.0': + resolution: {integrity: sha512-RwE0TNvX6fyUKk5DB4xXKlZgTLeENkYEHWeCIJH4GJylO4Os2GXYaytzr3NeZc8of7E49qz/HMFSxQvw//Hxyw==} - '@subsquid/typeorm-codegen@2.0.2': - resolution: {integrity: sha512-MDeA4LrqbRIYpmlwRdO1GyPzq+pfIS17VAgkMbYx2LtyqMbSvIaYU5D+iE0QMJr/XvO4bXC8+qZ6Fx4kIMuvfw==} + '@subsquid/typeorm-codegen@2.2.0': + resolution: {integrity: sha512-ZW0U9bSghzZjEiFqxtWWU7b95TZGJLC00C+QvEcWfc5y1Wx/RPIjhu1+x/z6djRgO1p1UzKNhoXe/652OftdDg==} hasBin: true '@subsquid/typeorm-config@4.1.1': @@ -1190,14 +1198,14 @@ packages: typeorm: optional: true - '@subsquid/typeorm-migration@1.3.0': - resolution: {integrity: sha512-+xyOvN5asKdSEUMjKRuuwLDaOSRBBCRc2LIVdsyv5nnXXcmtOShfQsHQNX9EdKD2xx4cH2bnD7ol3PY63Q2xQw==} + '@subsquid/typeorm-migration@1.3.1': + resolution: {integrity: sha512-5N9+1VuCo5VGk1F/mi3RHHy5w9mvnLYzUviBvV6fRkYrssyfeetq4hH5Ubv1WGX+yMy9NqL5nGcat5pLlUuoVw==} hasBin: true peerDependencies: typeorm: ^0.3.17 - '@subsquid/typeorm-store@1.5.1': - resolution: {integrity: sha512-XIhc/4qotnJP+8RDxWjUdsSCr+LOPOAp9U+u0VCqnyXx5rN13MDS0L5KSkIGinr/OQtK1CBWmRpDLF4ExWcWCw==} + '@subsquid/typeorm-store@1.9.1': + resolution: {integrity: sha512-9zGNVCy5tJ+NVYxsnPQXjIk/f7fd+CDLzqplhrcgLJRxjWoA3ANvhCUiERmf/PJs0bHEl84yontARmUs0TGxxg==} peerDependencies: '@subsquid/big-decimal': ^1.0.0 typeorm: ^0.3.17 @@ -1211,6 +1219,15 @@ packages: '@subsquid/logger': optional: true + '@subsquid/util-internal-archive-client@0.2.1': + resolution: {integrity: sha512-jGO3revw8fPSnbEDOZ1ciyZ6sbk9oPbieC8O0n9LipF5Bpc7BBIN6SyTfG9r3bXL86AzN4iMtCKuLtUbkvaFlw==} + peerDependencies: + '@subsquid/http-client': ^1.8.0 + '@subsquid/logger': ^1.5.0 + peerDependenciesMeta: + '@subsquid/logger': + optional: true + '@subsquid/util-internal-binary-heap@1.0.0': resolution: {integrity: sha512-88auuc8yNFmCZugmJSTYzS7WM/nN2obKGQCgrl8Jty5rJUFbqazGSi8icqftKhv6MPtUMJ3PSTRLiTFXAUGnAA==} @@ -1228,13 +1245,19 @@ packages: '@subsquid/util-internal-hex@1.2.2': resolution: {integrity: sha512-E43HVqf23jP5hvtWF9GsiN8luANjnJ1daR2SVTwaIUAYU/uNjv1Bi6tHz2uexlflBhyxAgBDmHgunXZ45wQTIw==} + '@subsquid/util-internal-hex@1.2.3': + resolution: {integrity: sha512-rGIQKHP+RpriJR56oL/AD43H/KX1EQwsvUy8nP6IHnk/vmaLyC2ECTp5n0jB7kq4NYK4C2VotP3lXHR0vWpa0A==} + '@subsquid/util-internal-http-server@2.0.0': resolution: {integrity: sha512-MUAJGMuDjbA3B+KQFZmMkm9FuWVx067pINt+EWuq3fSZqYPr1kRkTCTSJK7uT6Q8omqJtJFRWveyOWlXmixvfg==} - '@subsquid/util-internal-ingest-tools@1.1.4': - resolution: {integrity: sha512-2xWyqfg0mITsNdsYuGi3++UTy/D04N69KovyW5Rd71zCDSEedV0ePX5hQl/IT/o+H/u++HcXPggwJMVl09g6kQ==} + '@subsquid/util-internal-http-server@2.0.1': + resolution: {integrity: sha512-qDR1k+vCoLTtQX0O9cXg5kFmBqHf4708EKQLqH3IaQ4XiK1d/QFBQy8cDNZxXA6WxmkwJy4u9jaCZcpd2BrBQw==} + + '@subsquid/util-internal-ingest-tools@1.1.5': + resolution: {integrity: sha512-cn5aUkoI/HCxKYcMuCUYJ12M42QSaFQ40U7+9WyPSYoxA8IyOHdOMa+qNNatLxSadnIXSE4JqsuVXoer4kDehg==} peerDependencies: - '@subsquid/util-internal-archive-client': ^0.1.2 + '@subsquid/util-internal-archive-client': ^0.2.0 peerDependenciesMeta: '@subsquid/util-internal-archive-client': optional: true @@ -1245,8 +1268,8 @@ packages: '@subsquid/util-internal-json@1.2.3': resolution: {integrity: sha512-H5qW5kG20IzVMpb7GhPbVRxGuACEf1DPIXE1+LNXYxt8t/GX4zQREQWHRvCB3lck+RORLJD3WJbQUtxN5UYB3Q==} - '@subsquid/util-internal-processor-tools@4.2.1': - resolution: {integrity: sha512-+iNmKZ9u69TsPdF96UlPSUIEYyALcY1SAVlM+tY/e+x5ZPCnZLOFF9jCYRnqDnYLmBtAw4hSEobMFv6d8S5z2g==} + '@subsquid/util-internal-processor-tools@4.4.0': + resolution: {integrity: sha512-Ov2gFOcaGr7qVhYoqx+EIUjskGLRJRImQaEal5e0uNjX1sLG1bKfz+rXh1YMYCIUFwKd86fAGyLjVWwvnG0V8w==} '@subsquid/util-internal-prometheus-server@1.3.0': resolution: {integrity: sha512-E/ch5mxBg1CIGPsuAqUAQ7vVln2oTPm+Rl+0WYweH8JeZ81rD01XAmxhDuZzZnMMMzfZd9W4NlE4mCXbhSY1Ug==} @@ -1270,12 +1293,23 @@ packages: '@subsquid/logger': optional: true + '@subsquid/util-internal-validation@0.9.0': + resolution: {integrity: sha512-S9j/o1gmKz4qTf0O8B9mpGV6Z+WhIe6xDLhKvpzJ7IaMqkDUHTu386Hx8IXyTJf/RY9ABunfGLI9q9uJln9wSA==} + peerDependencies: + '@subsquid/logger': ^1.6.0 + peerDependenciesMeta: + '@subsquid/logger': + optional: true + '@subsquid/util-internal@1.1.0': resolution: {integrity: sha512-O6m666RDcWEw4vb3bmeNZKlAa1rGOHQvS0nhZFTBXnxZpqK/pU5N0jrQ7X/3is0pY2RKxFoxTurZjhv4QdxtqA==} '@subsquid/util-internal@3.2.0': resolution: {integrity: sha512-foNCjOmZaP8MKMa9sNe2GXTjFSDM9UqA0I0C0/ZvCxM1lCmG3mxZb70f8Wyi7TePXC/eV8eARbIqFyz0GjQmzA==} + '@subsquid/util-internal@3.3.0': + resolution: {integrity: sha512-WmMPHnqJcVIjM7BRNSd5uGYHVqlakr4fbyUIM2vQmfVx8V2ks+EWoreV0vsnSIyvDEqnoGJl8945xVhYkGkE3A==} + '@subsquid/util-naming@1.3.0': resolution: {integrity: sha512-PfYg1uFHwb7e6egbkzIbQTWf7DVlZIQr2gHy4VE35ZNiA15R9wkJLo/Mym6OkwLQyjJwhhq7pCFhkz6tm19m+A==} @@ -1636,9 +1670,6 @@ packages: bintrees@1.0.2: resolution: {integrity: sha512-VOMgTMwjAaUG580SXn3LacVgjurrbMme7ZZNYGSSV7mmtY6QQRh0Eg3pwIcntQ77DErK1L0NxkbetjcoXzVwKw==} - bn.js@5.2.2: - resolution: {integrity: sha512-v2YAxEmKaBLahNwE1mjp4WON6huMNeuDvagFZW+ASCuA/ku0bXR9hSMw0XpiqMoA3+rmnyck/tPRSFQkoC9Cuw==} - body-parser@1.20.3: resolution: {integrity: sha512-7rAxByjUMqQ3/bHJy7D6OGXvx/MMc4IqBn/X0fcM1QUcAItpZrBEYhWGem+tzXH90c+G01ypMcYJBO9Y30203g==} engines: {node: '>= 0.8', npm: 1.2.8000 || >= 1.4.16} @@ -2072,6 +2103,10 @@ packages: resolution: {integrity: sha512-pfX9uG9Ki0yekDHx2SiuRIyFdyAr1kMIMitPvb0YBo8SUfKvia7w7FIyd/l6av85pFYRhZscS75MwMnbvY+hcQ==} hasBin: true + fastest-levenshtein@1.0.16: + resolution: {integrity: sha512-eRnCtTTtGZFpQCwhJiUOuxPQWRXVKYDn0b2PeHfXL6/Zi53SLAzAHfVhVWK2AryC/WH05kGfxhFIPvTF0SXQzg==} + engines: {node: '>= 4.9.1'} + fastq@1.19.1: resolution: {integrity: sha512-GwLTyxkCXjXbxqIhTsMI2Nui8huMPtnxg7krajPJAjnEG/iiOS7i+zCtWGZR9G0NBKbXKh6X9m9UIsYX/N6vvQ==} @@ -2471,6 +2506,9 @@ packages: javascript-natural-sort@0.7.1: resolution: {integrity: sha512-nO6jcEfZWQXDhOiBtG2KvKyEptz7RVbpGP4vTD2hLBdmNQSsCiicO2Ioinv6UI4y9ukqnBpy+XZ9H6uLNgJTlw==} + js-sha3@0.9.3: + resolution: {integrity: sha512-BcJPCQeLg6WjEx3FE591wVAevlli8lxsxm9/FzV4HXkV49TmBH38Yvrpce6fjbADGMKFrBMGTqrVz3qPIZ88Gg==} + js-tokens@4.0.0: resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==} @@ -2509,13 +2547,6 @@ packages: just-extend@6.2.0: resolution: {integrity: sha512-cYofQu2Xpom82S6qD778jBDpwvvy39s1l/hrYij2u9AMdQcGRpaBu6kY4mVhuno5kJVi1DAz4aiphA2WI1/OAw==} - keccak256@1.0.6: - resolution: {integrity: sha512-8GLiM01PkdJVGUhR1e6M/AvWnSqYS0HaERI+K/QtStGDGlSTx2B1zTqZk4Zlqu5TxHJNTxWAdP9Y+WI50OApUw==} - - keccak@3.0.4: - resolution: {integrity: sha512-3vKuW0jV8J3XNTzvfyicFR5qvxrSAGl7KIhvgOu5cmWwM7tZRj3fMbj/pfIf4be7aznbc+prBWGjywox/g2Y6Q==} - engines: {node: '>=10.0.0'} - keyv@4.5.4: resolution: {integrity: sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==} @@ -2707,9 +2738,6 @@ packages: node-abort-controller@3.1.1: resolution: {integrity: sha512-AGK2yQKIjRuqnc6VkX2Xj5d+QW8xZ87pa1UK6yA6ouUyuxfHuMP6umE5QK7UmTeOAymo+Zx1Fxiuw9rVx8taHQ==} - node-addon-api@2.0.2: - resolution: {integrity: sha512-Ntyt4AIXyaLIuMHF6IOoTakB3K+RWxwtsHNRxllEoA6vPwP9o4866g6YWDLUdnucilZhmkxiHwHr11gAENw+QA==} - node-domexception@1.0.0: resolution: {integrity: sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==} engines: {node: '>=10.5.0'} @@ -2982,10 +3010,6 @@ packages: resolution: {integrity: sha512-yILWifhaSEEytfXI76kB9xEEiG1AiozaCJZ83A87ytjRiN+jVibXjedjCRNjoZviinhG+4UkalO3mWTd8u5O0Q==} engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} - readable-stream@3.6.2: - resolution: {integrity: sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==} - engines: {node: '>= 6'} - readdirp@3.6.0: resolution: {integrity: sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==} engines: {node: '>=8.10.0'} @@ -3170,9 +3194,6 @@ packages: resolution: {integrity: sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==} engines: {node: '>=12'} - string_decoder@1.3.0: - resolution: {integrity: sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==} - strip-ansi@6.0.1: resolution: {integrity: sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==} engines: {node: '>=8'} @@ -3387,9 +3408,6 @@ packages: resolution: {integrity: sha512-Z6czzLq4u8fPOyx7TU6X3dvUZVvoJmxSQ+IcrlmagKhilxlhZgxPK6C5Jqbkw1IDUmFTM+cz9QDnnLTwDz/2gQ==} engines: {node: '>=6.14.2'} - util-deprecate@1.0.2: - resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==} - utils-merge@1.0.1: resolution: {integrity: sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==} engines: {node: '>= 0.4.0'} @@ -4560,13 +4578,13 @@ snapshots: - bluebird - supports-color - '@originprotocol/squid-utils@https://codeload.github.com/OriginProtocol/squid-utils/tar.gz/aa198564e0332229c5563290c43774bdc731e9ed(@subsquid/big-decimal@1.0.0)(bufferutil@4.0.9)(encoding@0.1.13)(typeorm@0.3.26(ioredis@5.7.0)(pg@8.16.3)(reflect-metadata@0.1.14)(ts-node@10.9.2(@types/node@18.19.126)(typescript@5.9.2)))(typescript@5.9.2)(utf-8-validate@5.0.10)': + '@originprotocol/squid-utils@https://codeload.github.com/OriginProtocol/squid-utils/tar.gz/27627bfc16a21cb91e332c6e283446e3bf3901db(@subsquid/big-decimal@1.0.0)(bufferutil@4.0.9)(encoding@0.1.13)(typeorm@0.3.26(ioredis@5.7.0)(pg@8.16.3)(reflect-metadata@0.1.14)(ts-node@10.9.2(@types/node@18.19.126)(typescript@5.9.2)))(typescript@5.9.2)(utf-8-validate@5.0.10)': dependencies: '@subsquid/archive-registry': 3.3.2(encoding@0.1.13) - '@subsquid/evm-abi': 0.3.1 - '@subsquid/evm-codec': 0.3.0 - '@subsquid/evm-processor': 1.27.3 - '@subsquid/typeorm-store': 1.5.1(@subsquid/big-decimal@1.0.0)(typeorm@0.3.26(ioredis@5.7.0)(pg@8.16.3)(reflect-metadata@0.1.14)(ts-node@10.9.2(@types/node@18.19.126)(typescript@5.9.2))) + '@subsquid/evm-abi': 1.0.0 + '@subsquid/evm-codec': 1.0.0 + '@subsquid/evm-processor': 1.28.0-portal-api.721f49 + '@subsquid/typeorm-store': 1.9.1(@subsquid/big-decimal@1.0.0)(typeorm@0.3.26(ioredis@5.7.0)(pg@8.16.3)(reflect-metadata@0.1.14)(ts-node@10.9.2(@types/node@18.19.126)(typescript@5.9.2))) dayjs: 1.11.18 lodash: 4.17.21 node-fetch: 2.7.0(encoding@0.1.13) @@ -5034,45 +5052,64 @@ snapshots: dependencies: big.js: 6.2.2 - '@subsquid/evm-abi@0.3.1': + '@subsquid/evm-abi@1.0.0': dependencies: - '@subsquid/evm-codec': 0.3.0 - keccak256: 1.0.6 + '@subsquid/evm-codec': 1.0.0 + '@subsquid/util-internal-hex': 1.2.3 + js-sha3: 0.9.3 - '@subsquid/evm-codec@0.3.0': + '@subsquid/evm-codec@1.0.0': dependencies: - '@subsquid/util-internal-hex': 1.2.2 + '@subsquid/util-internal-hex': 1.2.3 - '@subsquid/evm-processor@1.27.3': + '@subsquid/evm-processor@1.28.0-portal-api.721f49': dependencies: - '@subsquid/http-client': 1.6.1 - '@subsquid/logger': 1.4.0 - '@subsquid/rpc-client': 4.14.0 - '@subsquid/util-internal': 3.2.0 - '@subsquid/util-internal-archive-client': 0.1.2(@subsquid/http-client@1.6.1)(@subsquid/logger@1.4.0) - '@subsquid/util-internal-hex': 1.2.2 - '@subsquid/util-internal-ingest-tools': 1.1.4(@subsquid/util-internal-archive-client@0.1.2(@subsquid/http-client@1.6.1)(@subsquid/logger@1.4.0)) - '@subsquid/util-internal-processor-tools': 4.2.1 + '@subsquid/http-client': 1.8.1 + '@subsquid/logger': 1.6.0 + '@subsquid/portal-client': 0.3.2(@subsquid/http-client@1.8.1)(@subsquid/logger@1.6.0) + '@subsquid/rpc-client': 4.15.0 + '@subsquid/util-internal': 3.3.0 + '@subsquid/util-internal-archive-client': 0.1.2(@subsquid/http-client@1.8.1)(@subsquid/logger@1.6.0) + '@subsquid/util-internal-hex': 1.2.3 + '@subsquid/util-internal-ingest-tools': 1.1.5(@subsquid/util-internal-archive-client@0.1.2(@subsquid/http-client@1.8.1)(@subsquid/logger@1.6.0)) + '@subsquid/util-internal-processor-tools': 4.4.0 '@subsquid/util-internal-range': 0.3.0 - '@subsquid/util-internal-validation': 0.8.0(@subsquid/logger@1.4.0) + '@subsquid/util-internal-validation': 0.8.0(@subsquid/logger@1.6.0) '@subsquid/util-timeout': 2.3.2 transitivePeerDependencies: - supports-color - '@subsquid/evm-typegen@4.5.1': + '@subsquid/evm-processor@1.30.1': dependencies: - '@subsquid/evm-abi': 0.3.1 - '@subsquid/evm-codec': 0.3.0 - '@subsquid/http-client': 1.8.0 - '@subsquid/logger': 1.4.0 - '@subsquid/util-internal': 3.2.0 + '@subsquid/http-client': 1.8.1 + '@subsquid/logger': 1.6.0 + '@subsquid/rpc-client': 4.15.0 + '@subsquid/util-internal': 3.3.0 + '@subsquid/util-internal-archive-client': 0.2.1(@subsquid/http-client@1.8.1)(@subsquid/logger@1.6.0) + '@subsquid/util-internal-hex': 1.2.3 + '@subsquid/util-internal-ingest-tools': 1.1.5(@subsquid/util-internal-archive-client@0.2.1(@subsquid/http-client@1.8.1)(@subsquid/logger@1.6.0)) + '@subsquid/util-internal-processor-tools': 4.4.0 + '@subsquid/util-internal-range': 0.3.0 + '@subsquid/util-internal-validation': 0.9.0(@subsquid/logger@1.6.0) + '@subsquid/util-timeout': 2.3.2 + transitivePeerDependencies: + - supports-color + + '@subsquid/evm-typegen@5.0.0': + dependencies: + '@subsquid/evm-abi': 1.0.0 + '@subsquid/evm-codec': 1.0.0 + '@subsquid/http-client': 1.8.1 + '@subsquid/logger': 1.6.0 + '@subsquid/util-internal': 3.3.0 '@subsquid/util-internal-code-printer': 1.2.2 '@subsquid/util-internal-commander': 1.4.0(commander@11.1.0) commander: 11.1.0 + fastest-levenshtein: 1.0.16 '@subsquid/graphiql-console@0.3.0': {} - '@subsquid/graphql-server@4.11.0(@subsquid/big-decimal@1.0.0)(bufferutil@4.0.9)(class-validator@0.14.2)(encoding@0.1.13)(type-graphql@1.2.0-rc.1(class-validator@0.14.2)(graphql@15.10.1))(typeorm@0.3.26(ioredis@5.7.0)(pg@8.16.3)(reflect-metadata@0.1.14)(ts-node@10.9.2(@types/node@18.19.126)(typescript@5.9.2)))(utf-8-validate@5.0.10)': + '@subsquid/graphql-server@4.12.0(@subsquid/big-decimal@1.0.0)(bufferutil@4.0.9)(class-validator@0.14.2)(encoding@0.1.13)(type-graphql@1.2.0-rc.1(class-validator@0.14.2)(graphql@15.10.1))(typeorm@0.3.26(ioredis@5.7.0)(pg@8.16.3)(reflect-metadata@0.1.14)(ts-node@10.9.2(@types/node@18.19.126)(typescript@5.9.2)))(utf-8-validate@5.0.10)': dependencies: '@apollo/utils.keyvadapter': 1.1.2 '@apollo/utils.keyvaluecache': 1.0.2 @@ -5082,12 +5119,12 @@ snapshots: '@keyv/redis': 2.5.8 '@subsquid/apollo-server-core': 3.14.0(encoding@0.1.13)(graphql@15.10.1) '@subsquid/apollo-server-express': 3.14.1(encoding@0.1.13)(express@4.21.2)(graphql@15.10.1) - '@subsquid/logger': 1.4.0 - '@subsquid/openreader': 5.3.0(@subsquid/big-decimal@1.0.0)(bufferutil@4.0.9)(encoding@0.1.13)(utf-8-validate@5.0.10) + '@subsquid/logger': 1.6.0 + '@subsquid/openreader': 5.5.0(@subsquid/big-decimal@1.0.0)(bufferutil@4.0.9)(encoding@0.1.13)(utf-8-validate@5.0.10) '@subsquid/typeorm-config': 4.1.1(typeorm@0.3.26(ioredis@5.7.0)(pg@8.16.3)(reflect-metadata@0.1.14)(ts-node@10.9.2(@types/node@18.19.126)(typescript@5.9.2))) '@subsquid/util-internal': 3.2.0 '@subsquid/util-internal-commander': 1.4.0(commander@11.1.0) - '@subsquid/util-internal-http-server': 2.0.0 + '@subsquid/util-internal-http-server': 2.0.1 '@subsquid/util-internal-ts-node': 0.0.0 apollo-server-plugin-response-cache: 3.7.1(encoding@0.1.13)(graphql@15.10.1) commander: 11.1.0 @@ -5110,16 +5147,10 @@ snapshots: - supports-color - utf-8-validate - '@subsquid/http-client@1.6.1': + '@subsquid/http-client@1.8.1': dependencies: - '@subsquid/logger': 1.4.0 - '@subsquid/util-internal': 3.2.0 - node-fetch: 3.3.2 - - '@subsquid/http-client@1.8.0': - dependencies: - '@subsquid/logger': 1.4.0 - '@subsquid/util-internal': 3.2.0 + '@subsquid/logger': 1.6.0 + '@subsquid/util-internal': 3.3.0 node-fetch: 3.3.2 '@subsquid/logger@1.4.0': @@ -5128,17 +5159,23 @@ snapshots: '@subsquid/util-internal-json': 1.2.3 supports-color: 8.1.1 - '@subsquid/openreader@5.3.0(@subsquid/big-decimal@1.0.0)(bufferutil@4.0.9)(encoding@0.1.13)(utf-8-validate@5.0.10)': + '@subsquid/logger@1.6.0': + dependencies: + '@subsquid/util-internal-hex': 1.2.3 + '@subsquid/util-internal-json': 1.2.3 + supports-color: 8.1.1 + + '@subsquid/openreader@5.5.0(@subsquid/big-decimal@1.0.0)(bufferutil@4.0.9)(encoding@0.1.13)(utf-8-validate@5.0.10)': dependencies: '@graphql-tools/merge': 9.1.1(graphql@15.10.1) '@subsquid/apollo-server-core': 3.14.0(encoding@0.1.13)(graphql@15.10.1) '@subsquid/apollo-server-express': 3.14.1(encoding@0.1.13)(express@4.21.2)(graphql@15.10.1) '@subsquid/graphiql-console': 0.3.0 - '@subsquid/logger': 1.4.0 + '@subsquid/logger': 1.6.0 '@subsquid/util-internal': 3.2.0 '@subsquid/util-internal-commander': 1.4.0(commander@11.1.0) '@subsquid/util-internal-hex': 1.2.2 - '@subsquid/util-internal-http-server': 2.0.0 + '@subsquid/util-internal-http-server': 2.0.1 '@subsquid/util-naming': 1.3.0 commander: 11.1.0 deep-equal: 2.2.3 @@ -5158,11 +5195,19 @@ snapshots: - supports-color - utf-8-validate - '@subsquid/rpc-client@4.14.0': + '@subsquid/portal-client@0.3.2(@subsquid/http-client@1.8.1)(@subsquid/logger@1.6.0)': dependencies: - '@subsquid/http-client': 1.8.0 - '@subsquid/logger': 1.4.0 - '@subsquid/util-internal': 3.2.0 + '@subsquid/http-client': 1.8.1 + '@subsquid/util-internal': 3.3.0 + '@subsquid/util-internal-validation': 0.8.0(@subsquid/logger@1.6.0) + transitivePeerDependencies: + - '@subsquid/logger' + + '@subsquid/rpc-client@4.15.0': + dependencies: + '@subsquid/http-client': 1.8.1 + '@subsquid/logger': 1.6.0 + '@subsquid/util-internal': 3.3.0 '@subsquid/util-internal-binary-heap': 1.0.0 '@subsquid/util-internal-counters': 1.3.2 '@subsquid/util-internal-json-fix-unsafe-integers': 0.0.0 @@ -5170,9 +5215,9 @@ snapshots: transitivePeerDependencies: - supports-color - '@subsquid/typeorm-codegen@2.0.2(@subsquid/big-decimal@1.0.0)(bufferutil@4.0.9)(encoding@0.1.13)(utf-8-validate@5.0.10)': + '@subsquid/typeorm-codegen@2.2.0(@subsquid/big-decimal@1.0.0)(bufferutil@4.0.9)(encoding@0.1.13)(utf-8-validate@5.0.10)': dependencies: - '@subsquid/openreader': 5.3.0(@subsquid/big-decimal@1.0.0)(bufferutil@4.0.9)(encoding@0.1.13)(utf-8-validate@5.0.10) + '@subsquid/openreader': 5.5.0(@subsquid/big-decimal@1.0.0)(bufferutil@4.0.9)(encoding@0.1.13)(utf-8-validate@5.0.10) '@subsquid/util-internal': 3.2.0 '@subsquid/util-internal-code-printer': 1.2.2 '@subsquid/util-naming': 1.3.0 @@ -5187,13 +5232,13 @@ snapshots: '@subsquid/typeorm-config@4.1.1(typeorm@0.3.26(ioredis@5.7.0)(pg@8.16.3)(reflect-metadata@0.1.14)(ts-node@10.9.2(@types/node@18.19.126)(typescript@5.9.2)))': dependencies: - '@subsquid/logger': 1.4.0 + '@subsquid/logger': 1.6.0 '@subsquid/util-internal-ts-node': 0.0.0 '@subsquid/util-naming': 1.3.0 optionalDependencies: typeorm: 0.3.26(ioredis@5.7.0)(pg@8.16.3)(reflect-metadata@0.1.14)(ts-node@10.9.2(@types/node@18.19.126)(typescript@5.9.2)) - '@subsquid/typeorm-migration@1.3.0(typeorm@0.3.26(ioredis@5.7.0)(pg@8.16.3)(reflect-metadata@0.1.14)(ts-node@10.9.2(@types/node@18.19.126)(typescript@5.9.2)))': + '@subsquid/typeorm-migration@1.3.1(typeorm@0.3.26(ioredis@5.7.0)(pg@8.16.3)(reflect-metadata@0.1.14)(ts-node@10.9.2(@types/node@18.19.126)(typescript@5.9.2)))': dependencies: '@subsquid/typeorm-config': 4.1.1(typeorm@0.3.26(ioredis@5.7.0)(pg@8.16.3)(reflect-metadata@0.1.14)(ts-node@10.9.2(@types/node@18.19.126)(typescript@5.9.2))) '@subsquid/util-internal': 3.2.0 @@ -5203,20 +5248,28 @@ snapshots: dotenv: 16.6.1 typeorm: 0.3.26(ioredis@5.7.0)(pg@8.16.3)(reflect-metadata@0.1.14)(ts-node@10.9.2(@types/node@18.19.126)(typescript@5.9.2)) - '@subsquid/typeorm-store@1.5.1(@subsquid/big-decimal@1.0.0)(typeorm@0.3.26(ioredis@5.7.0)(pg@8.16.3)(reflect-metadata@0.1.14)(ts-node@10.9.2(@types/node@18.19.126)(typescript@5.9.2)))': + '@subsquid/typeorm-store@1.9.1(@subsquid/big-decimal@1.0.0)(typeorm@0.3.26(ioredis@5.7.0)(pg@8.16.3)(reflect-metadata@0.1.14)(ts-node@10.9.2(@types/node@18.19.126)(typescript@5.9.2)))': dependencies: '@subsquid/big-decimal': 1.0.0 '@subsquid/typeorm-config': 4.1.1(typeorm@0.3.26(ioredis@5.7.0)(pg@8.16.3)(reflect-metadata@0.1.14)(ts-node@10.9.2(@types/node@18.19.126)(typescript@5.9.2))) - '@subsquid/util-internal': 3.2.0 + '@subsquid/util-internal': 3.3.0 typeorm: 0.3.26(ioredis@5.7.0)(pg@8.16.3)(reflect-metadata@0.1.14)(ts-node@10.9.2(@types/node@18.19.126)(typescript@5.9.2)) - '@subsquid/util-internal-archive-client@0.1.2(@subsquid/http-client@1.6.1)(@subsquid/logger@1.4.0)': + '@subsquid/util-internal-archive-client@0.1.2(@subsquid/http-client@1.8.1)(@subsquid/logger@1.6.0)': dependencies: - '@subsquid/http-client': 1.6.1 - '@subsquid/util-internal': 3.2.0 + '@subsquid/http-client': 1.8.1 + '@subsquid/util-internal': 3.3.0 '@subsquid/util-internal-range': 0.3.0 optionalDependencies: - '@subsquid/logger': 1.4.0 + '@subsquid/logger': 1.6.0 + + '@subsquid/util-internal-archive-client@0.2.1(@subsquid/http-client@1.8.1)(@subsquid/logger@1.6.0)': + dependencies: + '@subsquid/http-client': 1.8.1 + '@subsquid/util-internal': 3.3.0 + '@subsquid/util-internal-range': 0.3.0 + optionalDependencies: + '@subsquid/logger': 1.6.0 '@subsquid/util-internal-binary-heap@1.0.0': {} @@ -5230,18 +5283,33 @@ snapshots: '@subsquid/util-internal-hex@1.2.2': {} + '@subsquid/util-internal-hex@1.2.3': {} + '@subsquid/util-internal-http-server@2.0.0': dependencies: '@subsquid/logger': 1.4.0 stoppable: 1.1.0 - '@subsquid/util-internal-ingest-tools@1.1.4(@subsquid/util-internal-archive-client@0.1.2(@subsquid/http-client@1.6.1)(@subsquid/logger@1.4.0))': + '@subsquid/util-internal-http-server@2.0.1': dependencies: - '@subsquid/logger': 1.4.0 - '@subsquid/util-internal': 3.2.0 + '@subsquid/logger': 1.6.0 + stoppable: 1.1.0 + + '@subsquid/util-internal-ingest-tools@1.1.5(@subsquid/util-internal-archive-client@0.1.2(@subsquid/http-client@1.8.1)(@subsquid/logger@1.6.0))': + dependencies: + '@subsquid/logger': 1.6.0 + '@subsquid/util-internal': 3.3.0 + '@subsquid/util-internal-range': 0.3.0 + optionalDependencies: + '@subsquid/util-internal-archive-client': 0.1.2(@subsquid/http-client@1.8.1)(@subsquid/logger@1.6.0) + + '@subsquid/util-internal-ingest-tools@1.1.5(@subsquid/util-internal-archive-client@0.2.1(@subsquid/http-client@1.8.1)(@subsquid/logger@1.6.0))': + dependencies: + '@subsquid/logger': 1.6.0 + '@subsquid/util-internal': 3.3.0 '@subsquid/util-internal-range': 0.3.0 optionalDependencies: - '@subsquid/util-internal-archive-client': 0.1.2(@subsquid/http-client@1.6.1)(@subsquid/logger@1.4.0) + '@subsquid/util-internal-archive-client': 0.2.1(@subsquid/http-client@1.8.1)(@subsquid/logger@1.6.0) '@subsquid/util-internal-json-fix-unsafe-integers@0.0.0': {} @@ -5249,10 +5317,10 @@ snapshots: dependencies: '@subsquid/util-internal-hex': 1.2.2 - '@subsquid/util-internal-processor-tools@4.2.1': + '@subsquid/util-internal-processor-tools@4.4.0': dependencies: - '@subsquid/logger': 1.4.0 - '@subsquid/util-internal': 3.2.0 + '@subsquid/logger': 1.6.0 + '@subsquid/util-internal': 3.3.0 '@subsquid/util-internal-counters': 1.3.2 '@subsquid/util-internal-prometheus-server': 1.3.0(prom-client@14.2.0) '@subsquid/util-internal-range': 0.3.0 @@ -5273,14 +5341,20 @@ snapshots: '@subsquid/util-internal-ts-node@0.0.0': {} - '@subsquid/util-internal-validation@0.8.0(@subsquid/logger@1.4.0)': + '@subsquid/util-internal-validation@0.8.0(@subsquid/logger@1.6.0)': optionalDependencies: - '@subsquid/logger': 1.4.0 + '@subsquid/logger': 1.6.0 + + '@subsquid/util-internal-validation@0.9.0(@subsquid/logger@1.6.0)': + optionalDependencies: + '@subsquid/logger': 1.6.0 '@subsquid/util-internal@1.1.0': {} '@subsquid/util-internal@3.2.0': {} + '@subsquid/util-internal@3.3.0': {} + '@subsquid/util-naming@1.3.0': dependencies: camelcase: 6.3.0 @@ -5664,8 +5738,6 @@ snapshots: bintrees@1.0.2: {} - bn.js@5.2.2: {} - body-parser@1.20.3: dependencies: bytes: 3.1.2 @@ -6211,6 +6283,8 @@ snapshots: dependencies: strnum: 2.1.1 + fastest-levenshtein@1.0.16: {} + fastq@1.19.1: dependencies: reusify: 1.1.0 @@ -6613,6 +6687,8 @@ snapshots: javascript-natural-sort@0.7.1: {} + js-sha3@0.9.3: {} + js-tokens@4.0.0: {} js-yaml@4.1.0: @@ -6635,18 +6711,6 @@ snapshots: just-extend@6.2.0: {} - keccak256@1.0.6: - dependencies: - bn.js: 5.2.2 - buffer: 6.0.3 - keccak: 3.0.4 - - keccak@3.0.4: - dependencies: - node-addon-api: 2.0.2 - node-gyp-build: 4.8.4 - readable-stream: 3.6.2 - keyv@4.5.4: dependencies: json-buffer: 3.0.1 @@ -6839,8 +6903,6 @@ snapshots: node-abort-controller@3.1.1: {} - node-addon-api@2.0.2: {} - node-domexception@1.0.0: {} node-fetch@2.7.0(encoding@0.1.13): @@ -7097,12 +7159,6 @@ snapshots: read-cmd-shim@4.0.0: {} - readable-stream@3.6.2: - dependencies: - inherits: 2.0.4 - string_decoder: 1.3.0 - util-deprecate: 1.0.2 - readdirp@3.6.0: dependencies: picomatch: 2.3.1 @@ -7318,10 +7374,6 @@ snapshots: emoji-regex: 9.2.2 strip-ansi: 7.1.2 - string_decoder@1.3.0: - dependencies: - safe-buffer: 5.2.1 - strip-ansi@6.0.1: dependencies: ansi-regex: 5.0.1 @@ -7502,8 +7554,6 @@ snapshots: dependencies: node-gyp-build: 4.8.4 - util-deprecate@1.0.2: {} - utils-merge@1.0.1: {} uuid@11.1.0: {} diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml new file mode 100644 index 00000000..327c2bfe --- /dev/null +++ b/pnpm-workspace.yaml @@ -0,0 +1,10 @@ +allowBuilds: + '@apollo/protobufjs': true + '@lavamoat/preinstall-always-fail': false + "@originprotocol/squid-utils": true + bufferutil: true + es5-ext: true + esbuild: true + keccak: true + type-graphql: true + utf-8-validate: true diff --git a/processing-times.log b/processing-times.log index 3329d191..6b13cac6 100644 --- a/processing-times.log +++ b/processing-times.log @@ -1,15 +1,15 @@ Processing Times ============================== -Version: v151 -Date: 2026-05-06T20:05:42.986Z +Version: v152 +Date: 2026-05-15T00:51:32.161Z ============================== -arbitrum: 163.19 minutes -base: 366.49 minutes -hyperevm: 1.05 minutes -mainnet: 1400.86 minutes -oeth: 46.49 minutes -oethb: 127.09 minutes -ogv: 48.61 minutes -os: 32.96 minutes -ousd: 53.24 minutes -sonic: 98.72 minutes +arbitrum: 5.39 minutes +base: 135.17 minutes +hyperevm: 2.97 minutes +mainnet: 112.76 minutes +oeth: 11.52 minutes +oethb: 15.47 minutes +ogv: 40.91 minutes +os: 29.61 minutes +ousd: 30.61 minutes +sonic: 77.74 minutes diff --git a/schema.graphql b/schema.graphql index 3cef3d3f..a2f8f08d 100644 --- a/schema.graphql +++ b/schema.graphql @@ -432,6 +432,21 @@ type OTokenAddress @entity { history: [OTokenHistory!]! @derivedFrom(field: "address") } +type OTokenAddressYield @entity { + id: ID! + chainId: Int! @index + otoken: String! @index + address: String! @index + date: String! @index + timestamp: DateTime! + blockNumber: Int! @index + balance: BigInt! + costBasis: BigInt! + yield: BigInt! + cumulativeYield: BigInt! + roi: Float! +} + type OTokenHistory @entity { id: ID! chainId: Int! @index @@ -501,6 +516,7 @@ type OTokenVault @entity { address: String! @index vaultBuffer: BigInt! totalValue: BigInt! + claimable: BigInt! } type OTokenActivity @entity { @@ -622,6 +638,7 @@ type OTokenWithdrawalRequest @entity { queued: BigInt! claimed: Boolean! claimedAt: DateTime + claimableAt: DateTime queueWait: BigInt txHash: String! @index } @@ -706,6 +723,7 @@ type ArmState @entity { totalWithdrawalsClaimed: BigInt! totalYield: BigInt! totalFees: BigInt! + claimable: BigInt! } type ArmDailyStat @entity { @@ -769,6 +787,7 @@ type ArmWithdrawalRequest @entity { queued: BigInt! claimed: Boolean! claimedAt: DateTime + claimableAt: DateTime } type ArmSwap @entity { diff --git a/scripts/check-unused-abis.ts b/scripts/check-unused-abis.ts index 1031cbe6..ef7df394 100644 --- a/scripts/check-unused-abis.ts +++ b/scripts/check-unused-abis.ts @@ -6,18 +6,18 @@ import { execSync } from 'child_process' * Checks for unused ABI files in the codebase. * * ABI workflow: - * 1. JSON ABI files live in /abi/ + * 1. JSON ABI files live in /src/abi-json/ * 2. They get typegenned into /src/abi/ * 3. Code imports from @abi/filename * * This script finds which ABIs in src/abi/ are not imported * anywhere outside of src/abi/, and reports the corresponding - * JSON files in abi/ that can be deleted. + * JSON files in src/abi-json/ that can be deleted. */ const ROOT_DIR = path.resolve(__dirname, '..') const SRC_ABI_DIR = path.join(ROOT_DIR, 'src', 'abi') -const ABI_JSON_DIR = path.join(ROOT_DIR, 'abi') +const ABI_JSON_DIR = path.join(ROOT_DIR, 'src', 'abi-json') const SRC_DIR = path.join(ROOT_DIR, 'src') // ABIs to ignore (auto-generated or intentionally kept without direct imports) @@ -116,7 +116,7 @@ function main() { for (const { tsFile, jsonFile } of unused) { console.log(` src/abi/${tsFile}.ts`) if (jsonFile) { - console.log(` -> abi/${jsonFile}`) + console.log(` -> src/abi-json/${jsonFile}`) } } @@ -129,7 +129,7 @@ function main() { console.log('Commands to delete unused files:') console.log('```') for (const jsonFile of jsonFiles) { - console.log(`rm abi/${jsonFile}`) + console.log(`rm src/abi-json/${jsonFile}`) } for (const srcFile of srcFiles) { console.log(`rm src/abi/${srcFile}`) diff --git a/scripts/create-db-dump.ts b/scripts/create-db-dump.ts index f873bfbb..1454d774 100644 --- a/scripts/create-db-dump.ts +++ b/scripts/create-db-dump.ts @@ -5,6 +5,7 @@ import * as fs from 'fs' import { createServer } from 'net' import * as path from 'path' import { Pool } from 'pg' +import { createInterface } from 'readline' import { setTimeout as delay } from 'timers/promises' import { createPublicClient, http } from 'viem' @@ -22,13 +23,14 @@ type ProcessorName = function parseArgs() { const args = process.argv.slice(2) if (args.length === 0) { - console.error('Usage: tsx create-db-dump.ts [--profile ] [--continue]') + console.error('Usage: tsx create-db-dump.ts [--profile ] [--continue] [-y|--yes]') process.exit(1) } const processorName = args[0] as ProcessorName let awsProfile: string | undefined let continueRun = false + let assumeYes = false for (let i = 1; i < args.length; i++) { const arg = args[i] @@ -40,9 +42,12 @@ function parseArgs() { if (arg === '--continue') { continueRun = true } + if (arg === '-y' || arg === '--yes') { + assumeYes = true + } } - return { processorName, awsProfile, continueRun } + return { processorName, awsProfile, continueRun, assumeYes } } function getProcessorAlias(processorName: ProcessorName): string { @@ -131,6 +136,23 @@ async function findFreePort(preferredStart = 24000, preferredEnd = 65000): Promi throw new Error('No free port found') } +async function promptYNC(message: string): Promise<'y' | 'n' | 'c'> { + if (!process.stdin.isTTY) { + console.error('Non-interactive shell: refusing to wipe existing data. Re-run with --continue or use -y.') + process.exit(1) + } + const rl = createInterface({ input: process.stdin, output: process.stdout }) + try { + const answer: string = await new Promise((resolve) => rl.question(message, resolve)) + const a = answer.trim().toLowerCase() + if (a === 'y' || a === 'yes') return 'y' + if (a === 'c' || a === 'continue') return 'c' + return 'n' + } finally { + rl.close() + } +} + async function getExistingDbPort(composeProject: string): Promise { try { const { stdout } = await runCmd(`docker ps --filter "name=^\/${composeProject}-db-1$" --format "{{.Ports}}"`, { @@ -227,7 +249,9 @@ async function main() { dotenv.config({ path: devEnvPath, override: false }) } - const { processorName, awsProfile, continueRun } = parseArgs() + const parsed = parseArgs() + const { processorName, awsProfile, assumeYes } = parsed + let continueRun = parsed.continueRun const alias = getProcessorAlias(processorName) // Determine RPC URL for the chain @@ -255,13 +279,41 @@ async function main() { const composeProject = `squid_${alias}` let DB_PORT = 0 let startedCompose = false + const existingPort = await getExistingDbPort(composeProject) + + // Guard against the common mistake: forgetting --continue, which would wipe the in-progress dump. + if (existingPort && !continueRun && !assumeYes) { + console.warn(``) + console.warn(`Existing dockerized Postgres found for '${processorName}'`) + console.warn(` compose project: ${composeProject}`) + console.warn(` port: ${existingPort}`) + console.warn(``) + console.warn(`Running without --continue would WIPE this data (--volumes) and restart from scratch.`) + console.warn(`Each full reprocess takes hours — this is almost certainly NOT what you want.`) + console.warn(``) + console.warn(` [y] yes, wipe and start over from scratch`) + console.warn(` [c] continue from existing data (acts as if --continue was passed)`) + console.warn(` [n] no, abort (default)`) + console.warn(``) + const choice = await promptYNC(`choice [y/c/N]: `) + if (choice === 'n') { + console.log('Aborted.') + process.exit(0) + } + if (choice === 'c') { + console.log(`→ continuing from existing data`) + continueRun = true + } else { + console.log(`→ wiping existing data and starting over`) + } + } + if (continueRun) { - const existingPort = await getExistingDbPort(composeProject) if (existingPort) { DB_PORT = existingPort console.log(`Reusing existing dockerized Postgres at port ${DB_PORT} (project ${composeProject})...`) } else { - console.log(`No existing Postgres found.`) + console.log(`No existing Postgres found; --continue requires existing data. Aborting.`) process.exit(1) } } else { diff --git a/scripts/generate-abi-exports.ts b/scripts/generate-abi-exports.ts index 0e00bd5f..60604b06 100644 --- a/scripts/generate-abi-exports.ts +++ b/scripts/generate-abi-exports.ts @@ -1,5 +1,5 @@ /** - * Generate .abi.ts files from raw JSON ABIs in ./abi/. + * Generate .abi.ts files from raw JSON ABIs in ./src/abi-json/. * Each generated file re-exports the ABI with `as const` for proper viem type inference. * * Usage: ts-node scripts/generate-abi-exports.ts @@ -8,7 +8,7 @@ import fs from 'fs' import path from 'path' -const abiDir = path.resolve(__dirname, '../abi') +const abiDir = path.resolve(__dirname, '../src/abi-json') const outDir = path.resolve(__dirname, '../src/abi') const jsonFiles = fs.readdirSync(abiDir).filter((f) => f.endsWith('.json')) diff --git a/scripts/generate-validations.ts b/scripts/generate-validations.ts index 4ae2652b..10bef3c2 100644 --- a/scripts/generate-validations.ts +++ b/scripts/generate-validations.ts @@ -998,7 +998,7 @@ const bridging = () => { bridgeTransferStates: bridgeTransferStates( limit: ${LIMIT}, orderBy: [blockNumber_ASC, id_ASC], - ) { + ) { blockNumber id state @@ -1255,48 +1255,62 @@ const main = async () => { console.log('Total queries:', queries.length) - for (let i = 0; i < queries.length; i++) { - const query = queries[i] - console.log(`Executing: \`${query.replace(/(\n|\s)+/g, ' ').slice(0, 80)}\`...`) - const result = await retry(() => executeQuery(query), 5) - if (!result.data) { - console.log(result) - throw new Error('Query failed') + const runConcurrently = async (fns: (() => Promise)[], concurrency: number) => { + const queue = [...fns] + while (queue.length > 0) { + const batch = queue.splice(0, concurrency) + await Promise.all(batch.map((fn) => fn())) } + } - const takeAll = ['ognDailyStats'] - for (const key of Object.keys(result.data)) { - let validationData - const rawData = result.data[key] - - // If there are fewer than 20 total entries, save them all - if (rawData.length < 20 || takeAll.includes(key)) { - validationData = rawData - } else if (key === 'exchangeRates' || key === 'exchangeRateDailies') { - // Special handling for exchange rates: ensure at least one of every pair - validationData = takeExchangeRateValidationEntries(rawData) - } else { - // Otherwise, filter to validation entries - validationData = takeValidationEntries(rawData) - if (validationData.length < 5) { - validationData = takeEvery(rawData, 50) - } + const fns: (() => Promise)[] = [] + for (let i = 0; i < queries.length; i++) { + const fn = async () => { + const query = queries[i] + console.log(`Executing: \`${query.replace(/(\n|\s)+/g, ' ').slice(0, 80)}\`...`) + const result = await retry(() => executeQuery(query), 5) + if (!result.data) { + console.log(result) + throw new Error('Query failed') } - const filePath = getFilePathForEntity(key) - const dir = path.dirname(filePath) + const takeAll = ['ognDailyStats'] + for (const key of Object.keys(result.data)) { + let validationData + const rawData = result.data[key] + + // If there are fewer than 20 total entries, save them all + if (rawData.length < 20 || takeAll.includes(key)) { + validationData = rawData + } else if (key === 'exchangeRates' || key === 'exchangeRateDailies') { + // Special handling for exchange rates: ensure at least one of every pair + validationData = takeExchangeRateValidationEntries(rawData) + } else { + // Otherwise, filter to validation entries + validationData = takeValidationEntries(rawData) + if (validationData.length < 5) { + validationData = takeEvery(rawData, 50) + } + } - // Ensure directory exists - if (!fs.existsSync(dir)) { - fs.mkdirSync(dir, { recursive: true }) - } + const filePath = getFilePathForEntity(key) + const dir = path.dirname(filePath) + + // Ensure directory exists + if (!fs.existsSync(dir)) { + fs.mkdirSync(dir, { recursive: true }) + } - // Write the file - fs.writeFileSync(filePath, JSON.stringify(validationData, null, 2)) - console.log(` ✓ Wrote ${validationData.length} entries to ${path.relative(__dirname + '/..', filePath)}`) + // Write the file + fs.writeFileSync(filePath, JSON.stringify(validationData, null, 2)) + console.log(` ✓ Wrote ${validationData.length} entries to ${path.relative(__dirname + '/..', filePath)}`) + } } + fns.push(fn) } + await runConcurrently(fns, 10) + console.log('\n✓ All validation files generated successfully') } diff --git a/squid.yaml b/squid.yaml index 1d295d77..6ac8b585 100644 --- a/squid.yaml +++ b/squid.yaml @@ -7,6 +7,12 @@ deploy: env: TS_NODE_BASEURL: './lib' IGNORE_VALIDATION: 'true' + # PORTAL_URL_ETHEREUM: ${{ addons.portal.ethereum_mainnet.http }} + # PORTAL_URL_BASE: ${{ addons.portal.base_mainnet.http }} + # PORTAL_URL_SONIC: ${{ addons.portal.sonic_mainnet.http }} + # PORTAL_URL_ARBITRUM: ${{ addons.portal.arbitrum_one.http }} + # PORTAL_URL_HYPEREVM: ${{ addons.portal.hyperliquid_mainnet.http }} + # DEBUG_PERF: 'true' addons: postgres: diff --git a/abi/README.md b/src/abi-json/README.md similarity index 100% rename from abi/README.md rename to src/abi-json/README.md diff --git a/abi/aave-lending-pool.json b/src/abi-json/aave-lending-pool.json similarity index 100% rename from abi/aave-lending-pool.json rename to src/abi-json/aave-lending-pool.json diff --git a/abi/aerodrome-amo-strategy.json b/src/abi-json/aerodrome-amo-strategy.json similarity index 100% rename from abi/aerodrome-amo-strategy.json rename to src/abi-json/aerodrome-amo-strategy.json diff --git a/abi/aerodrome-cl-gauge.json b/src/abi-json/aerodrome-cl-gauge.json similarity index 100% rename from abi/aerodrome-cl-gauge.json rename to src/abi-json/aerodrome-cl-gauge.json diff --git a/abi/aerodrome-cl-pool-factory.json b/src/abi-json/aerodrome-cl-pool-factory.json similarity index 100% rename from abi/aerodrome-cl-pool-factory.json rename to src/abi-json/aerodrome-cl-pool-factory.json diff --git a/abi/aerodrome-cl-pool.json b/src/abi-json/aerodrome-cl-pool.json similarity index 100% rename from abi/aerodrome-cl-pool.json rename to src/abi-json/aerodrome-cl-pool.json diff --git a/abi/aerodrome-gauge.json b/src/abi-json/aerodrome-gauge.json similarity index 100% rename from abi/aerodrome-gauge.json rename to src/abi-json/aerodrome-gauge.json diff --git a/abi/aerodrome-lp-sugar-v3.json b/src/abi-json/aerodrome-lp-sugar-v3.json similarity index 100% rename from abi/aerodrome-lp-sugar-v3.json rename to src/abi-json/aerodrome-lp-sugar-v3.json diff --git a/abi/aerodrome-mixed-quoter.json b/src/abi-json/aerodrome-mixed-quoter.json similarity index 100% rename from abi/aerodrome-mixed-quoter.json rename to src/abi-json/aerodrome-mixed-quoter.json diff --git a/abi/aerodrome-pool-factory.json b/src/abi-json/aerodrome-pool-factory.json similarity index 100% rename from abi/aerodrome-pool-factory.json rename to src/abi-json/aerodrome-pool-factory.json diff --git a/abi/aerodrome-pool.json b/src/abi-json/aerodrome-pool.json similarity index 100% rename from abi/aerodrome-pool.json rename to src/abi-json/aerodrome-pool.json diff --git a/abi/aerodrome-voter.json b/src/abi-json/aerodrome-voter.json similarity index 100% rename from abi/aerodrome-voter.json rename to src/abi-json/aerodrome-voter.json diff --git a/abi/algebra-v4-factory.json b/src/abi-json/algebra-v4-factory.json similarity index 100% rename from abi/algebra-v4-factory.json rename to src/abi-json/algebra-v4-factory.json diff --git a/abi/algebra-v4-pool.json b/src/abi-json/algebra-v4-pool.json similarity index 100% rename from abi/algebra-v4-pool.json rename to src/abi-json/algebra-v4-pool.json diff --git a/abi/balancer-meta-pool-strategy.json b/src/abi-json/balancer-meta-pool-strategy.json similarity index 100% rename from abi/balancer-meta-pool-strategy.json rename to src/abi-json/balancer-meta-pool-strategy.json diff --git a/abi/balancer-meta-stable-pool.json b/src/abi-json/balancer-meta-stable-pool.json similarity index 100% rename from abi/balancer-meta-stable-pool.json rename to src/abi-json/balancer-meta-stable-pool.json diff --git a/abi/balancer-rate-provider.json b/src/abi-json/balancer-rate-provider.json similarity index 100% rename from abi/balancer-rate-provider.json rename to src/abi-json/balancer-rate-provider.json diff --git a/abi/balancer-vault.json b/src/abi-json/balancer-vault.json similarity index 100% rename from abi/balancer-vault.json rename to src/abi-json/balancer-vault.json diff --git a/abi/base-reward-pool.json b/src/abi-json/base-reward-pool.json similarity index 100% rename from abi/base-reward-pool.json rename to src/abi-json/base-reward-pool.json diff --git a/abi/beacon-deposit-contract.json b/src/abi-json/beacon-deposit-contract.json similarity index 100% rename from abi/beacon-deposit-contract.json rename to src/abi-json/beacon-deposit-contract.json diff --git a/abi/ccip-evm2evmofframp.json b/src/abi-json/ccip-evm2evmofframp.json similarity index 100% rename from abi/ccip-evm2evmofframp.json rename to src/abi-json/ccip-evm2evmofframp.json diff --git a/abi/ccip-evm2evmonramp.json b/src/abi-json/ccip-evm2evmonramp.json similarity index 100% rename from abi/ccip-evm2evmonramp.json rename to src/abi-json/ccip-evm2evmonramp.json diff --git a/abi/ccip-router.json b/src/abi-json/ccip-router.json similarity index 100% rename from abi/ccip-router.json rename to src/abi-json/ccip-router.json diff --git a/abi/chainlink-feed-registry.json b/src/abi-json/chainlink-feed-registry.json similarity index 100% rename from abi/chainlink-feed-registry.json rename to src/abi-json/chainlink-feed-registry.json diff --git a/abi/cow-swap-settlement.json b/src/abi-json/cow-swap-settlement.json similarity index 100% rename from abi/cow-swap-settlement.json rename to src/abi-json/cow-swap-settlement.json diff --git a/abi/curve-lp-token.json b/src/abi-json/curve-lp-token.json similarity index 100% rename from abi/curve-lp-token.json rename to src/abi-json/curve-lp-token.json diff --git a/abi/curve-stable-swap-factory-ng.json b/src/abi-json/curve-stable-swap-factory-ng.json similarity index 100% rename from abi/curve-stable-swap-factory-ng.json rename to src/abi-json/curve-stable-swap-factory-ng.json diff --git a/abi/curve-stable-swap-meta-ng.json b/src/abi-json/curve-stable-swap-meta-ng.json similarity index 100% rename from abi/curve-stable-swap-meta-ng.json rename to src/abi-json/curve-stable-swap-meta-ng.json diff --git a/abi/curve-stable-swap-ng.json b/src/abi-json/curve-stable-swap-ng.json similarity index 100% rename from abi/curve-stable-swap-ng.json rename to src/abi-json/curve-stable-swap-ng.json diff --git a/abi/curve-tricrypto-factory.json b/src/abi-json/curve-tricrypto-factory.json similarity index 100% rename from abi/curve-tricrypto-factory.json rename to src/abi-json/curve-tricrypto-factory.json diff --git a/abi/curve-twocrypto-factory.json b/src/abi-json/curve-twocrypto-factory.json similarity index 100% rename from abi/curve-twocrypto-factory.json rename to src/abi-json/curve-twocrypto-factory.json diff --git a/abi/dia-oracle.json b/src/abi-json/dia-oracle.json similarity index 100% rename from abi/dia-oracle.json rename to src/abi-json/dia-oracle.json diff --git a/abi/eac-aggregator-proxy.json b/src/abi-json/eac-aggregator-proxy.json similarity index 100% rename from abi/eac-aggregator-proxy.json rename to src/abi-json/eac-aggregator-proxy.json diff --git a/abi/erc20.json b/src/abi-json/erc20.json similarity index 100% rename from abi/erc20.json rename to src/abi-json/erc20.json diff --git a/abi/exponential-staking.json b/src/abi-json/exponential-staking.json similarity index 100% rename from abi/exponential-staking.json rename to src/abi-json/exponential-staking.json diff --git a/abi/fee-accumulator.json b/src/abi-json/fee-accumulator.json similarity index 100% rename from abi/fee-accumulator.json rename to src/abi-json/fee-accumulator.json diff --git a/abi/fixed-rate-rewards-source.json b/src/abi-json/fixed-rate-rewards-source.json similarity index 100% rename from abi/fixed-rate-rewards-source.json rename to src/abi-json/fixed-rate-rewards-source.json diff --git a/abi/frx-eth-frax-oracle.json b/src/abi-json/frx-eth-frax-oracle.json similarity index 100% rename from abi/frx-eth-frax-oracle.json rename to src/abi-json/frx-eth-frax-oracle.json diff --git a/abi/governance.json b/src/abi-json/governance.json similarity index 100% rename from abi/governance.json rename to src/abi-json/governance.json diff --git a/abi/governed-upgradeability-proxy.json b/src/abi-json/governed-upgradeability-proxy.json similarity index 100% rename from abi/governed-upgradeability-proxy.json rename to src/abi-json/governed-upgradeability-proxy.json diff --git a/abi/initializable-abstract-strategy.json b/src/abi-json/initializable-abstract-strategy.json similarity index 100% rename from abi/initializable-abstract-strategy.json rename to src/abi-json/initializable-abstract-strategy.json diff --git a/abi/irm-adaptive-curve.json b/src/abi-json/irm-adaptive-curve.json similarity index 100% rename from abi/irm-adaptive-curve.json rename to src/abi-json/irm-adaptive-curve.json diff --git a/abi/legacy-staking.json b/src/abi-json/legacy-staking.json similarity index 100% rename from abi/legacy-staking.json rename to src/abi-json/legacy-staking.json diff --git a/abi/maverick-v2-factory.json b/src/abi-json/maverick-v2-factory.json similarity index 100% rename from abi/maverick-v2-factory.json rename to src/abi-json/maverick-v2-factory.json diff --git a/abi/meta-morpho.json b/src/abi-json/meta-morpho.json similarity index 100% rename from abi/meta-morpho.json rename to src/abi-json/meta-morpho.json diff --git a/abi/metropolis-lb-factory.json b/src/abi-json/metropolis-lb-factory.json similarity index 100% rename from abi/metropolis-lb-factory.json rename to src/abi-json/metropolis-lb-factory.json diff --git a/abi/metropolis-v2-factory.json b/src/abi-json/metropolis-v2-factory.json similarity index 100% rename from abi/metropolis-v2-factory.json rename to src/abi-json/metropolis-v2-factory.json diff --git a/abi/morpho.json b/src/abi-json/morpho.json similarity index 100% rename from abi/morpho.json rename to src/abi-json/morpho.json diff --git a/abi/oeth-oracle-router.json b/src/abi-json/oeth-oracle-router.json similarity index 100% rename from abi/oeth-oracle-router.json rename to src/abi-json/oeth-oracle-router.json diff --git a/abi/oeth-zapper.json b/src/abi-json/oeth-zapper.json similarity index 100% rename from abi/oeth-zapper.json rename to src/abi-json/oeth-zapper.json diff --git a/src/abi-json/origin-arm.json b/src/abi-json/origin-arm.json new file mode 100644 index 00000000..a0e499ee --- /dev/null +++ b/src/abi-json/origin-arm.json @@ -0,0 +1,767 @@ +[ + { + "inputs": [ + { "internalType": "address", "name": "_otoken", "type": "address" }, + { "internalType": "address", "name": "_liquidityAsset", "type": "address" }, + { "internalType": "address", "name": "_vault", "type": "address" }, + { "internalType": "uint256", "name": "_claimDelay", "type": "uint256" }, + { "internalType": "uint256", "name": "_minSharesToRedeem", "type": "uint256" } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { "internalType": "address", "name": "spender", "type": "address" }, + { "internalType": "uint256", "name": "allowance", "type": "uint256" }, + { "internalType": "uint256", "name": "needed", "type": "uint256" } + ], + "name": "ERC20InsufficientAllowance", + "type": "error" + }, + { + "inputs": [ + { "internalType": "address", "name": "sender", "type": "address" }, + { "internalType": "uint256", "name": "balance", "type": "uint256" }, + { "internalType": "uint256", "name": "needed", "type": "uint256" } + ], + "name": "ERC20InsufficientBalance", + "type": "error" + }, + { + "inputs": [{ "internalType": "address", "name": "approver", "type": "address" }], + "name": "ERC20InvalidApprover", + "type": "error" + }, + { + "inputs": [{ "internalType": "address", "name": "receiver", "type": "address" }], + "name": "ERC20InvalidReceiver", + "type": "error" + }, + { + "inputs": [{ "internalType": "address", "name": "sender", "type": "address" }], + "name": "ERC20InvalidSender", + "type": "error" + }, + { + "inputs": [{ "internalType": "address", "name": "spender", "type": "address" }], + "name": "ERC20InvalidSpender", + "type": "error" + }, + { "inputs": [], "name": "InvalidInitialization", "type": "error" }, + { "inputs": [], "name": "NotInitializing", "type": "error" }, + { + "inputs": [ + { "internalType": "uint8", "name": "bits", "type": "uint8" }, + { "internalType": "int256", "name": "value", "type": "int256" } + ], + "name": "SafeCastOverflowedIntDowncast", + "type": "error" + }, + { + "inputs": [{ "internalType": "int256", "name": "value", "type": "int256" }], + "name": "SafeCastOverflowedIntToUint", + "type": "error" + }, + { + "inputs": [ + { "internalType": "uint8", "name": "bits", "type": "uint8" }, + { "internalType": "uint256", "name": "value", "type": "uint256" } + ], + "name": "SafeCastOverflowedUintDowncast", + "type": "error" + }, + { + "inputs": [{ "internalType": "uint256", "name": "value", "type": "uint256" }], + "name": "SafeCastOverflowedUintToInt", + "type": "error" + }, + { + "anonymous": false, + "inputs": [{ "indexed": false, "internalType": "uint256", "name": "armBuffer", "type": "uint256" }], + "name": "ARMBufferUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [{ "indexed": true, "internalType": "address", "name": "market", "type": "address" }], + "name": "ActiveMarketUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "previousAdmin", "type": "address" }, + { "indexed": false, "internalType": "address", "name": "newAdmin", "type": "address" } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "market", "type": "address" }, + { "indexed": false, "internalType": "int256", "name": "assets", "type": "int256" } + ], + "name": "Allocated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "owner", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "spender", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [{ "indexed": true, "internalType": "address", "name": "capManager", "type": "address" }], + "name": "CapManagerUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "uint256[]", "name": "requestIds", "type": "uint256[]" }, + { "indexed": false, "internalType": "uint256", "name": "amountClaimed", "type": "uint256" } + ], + "name": "ClaimOriginWithdrawals", + "type": "event" + }, + { + "anonymous": false, + "inputs": [{ "indexed": false, "internalType": "uint256", "name": "crossPrice", "type": "uint256" }], + "name": "CrossPriceUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "owner", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "assets", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "shares", "type": "uint256" } + ], + "name": "Deposit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "feeCollector", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "fee", "type": "uint256" } + ], + "name": "FeeCollected", + "type": "event" + }, + { + "anonymous": false, + "inputs": [{ "indexed": true, "internalType": "address", "name": "newFeeCollector", "type": "address" }], + "name": "FeeCollectorUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [{ "indexed": false, "internalType": "uint256", "name": "fee", "type": "uint256" }], + "name": "FeeUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [{ "indexed": false, "internalType": "uint64", "name": "version", "type": "uint64" }], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [{ "indexed": true, "internalType": "address", "name": "market", "type": "address" }], + "name": "MarketAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [{ "indexed": true, "internalType": "address", "name": "market", "type": "address" }], + "name": "MarketRemoved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [{ "indexed": false, "internalType": "address", "name": "newAdmin", "type": "address" }], + "name": "OperatorChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "withdrawer", "type": "address" }, + { "indexed": true, "internalType": "uint256", "name": "requestId", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "assets", "type": "uint256" } + ], + "name": "RedeemClaimed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "withdrawer", "type": "address" }, + { "indexed": true, "internalType": "uint256", "name": "requestId", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "assets", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "queued", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "claimTimestamp", "type": "uint256" } + ], + "name": "RedeemRequested", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "requestId", "type": "uint256" } + ], + "name": "RequestOriginWithdrawal", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "uint256", "name": "traderate0", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "traderate1", "type": "uint256" } + ], + "name": "TraderateChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "from", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "to", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" } + ], + "name": "Transfer", + "type": "event" + }, + { + "inputs": [], + "name": "FEE_SCALE", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MAX_CROSS_PRICE_DEVIATION", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "PRICE_SCALE", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "activeMarket", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address[]", "name": "_markets", "type": "address[]" }], + "name": "addMarkets", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { "inputs": [], "name": "allocate", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { "internalType": "address", "name": "owner", "type": "address" }, + { "internalType": "address", "name": "spender", "type": "address" } + ], + "name": "allowance", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "spender", "type": "address" }, + { "internalType": "uint256", "name": "value", "type": "uint256" } + ], + "name": "approve", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "armBuffer", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], + "name": "balanceOf", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "baseAsset", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "capManager", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "claimDelay", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256[]", "name": "requestIds", "type": "uint256[]" }], + "name": "claimOriginWithdrawals", + "outputs": [{ "internalType": "uint256", "name": "amountClaimed", "type": "uint256" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "requestId", "type": "uint256" }], + "name": "claimRedeem", + "outputs": [{ "internalType": "uint256", "name": "assets", "type": "uint256" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "claimable", + "outputs": [{ "internalType": "uint256", "name": "claimableAmount", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "collectFees", + "outputs": [{ "internalType": "uint256", "name": "fees", "type": "uint256" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "shares", "type": "uint256" }], + "name": "convertToAssets", + "outputs": [{ "internalType": "uint256", "name": "assets", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "assets", "type": "uint256" }], + "name": "convertToShares", + "outputs": [{ "internalType": "uint256", "name": "shares", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "crossPrice", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "assets", "type": "uint256" }, + { "internalType": "address", "name": "receiver", "type": "address" } + ], + "name": "deposit", + "outputs": [{ "internalType": "uint256", "name": "shares", "type": "uint256" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "assets", "type": "uint256" }], + "name": "deposit", + "outputs": [{ "internalType": "uint256", "name": "shares", "type": "uint256" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "fee", + "outputs": [{ "internalType": "uint16", "name": "", "type": "uint16" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "feeCollector", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "feesAccrued", + "outputs": [{ "internalType": "uint256", "name": "fees", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "string", "name": "_name", "type": "string" }, + { "internalType": "string", "name": "_symbol", "type": "string" }, + { "internalType": "address", "name": "_operator", "type": "address" }, + { "internalType": "uint256", "name": "_fee", "type": "uint256" }, + { "internalType": "address", "name": "_feeCollector", "type": "address" }, + { "internalType": "address", "name": "_capManager", "type": "address" } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "lastAvailableAssets", + "outputs": [{ "internalType": "int128", "name": "", "type": "int128" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "liquidityAsset", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "minSharesToRedeem", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "nextWithdrawalIndex", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "operator", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "assets", "type": "uint256" }], + "name": "previewDeposit", + "outputs": [{ "internalType": "uint256", "name": "shares", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "shares", "type": "uint256" }], + "name": "previewRedeem", + "outputs": [{ "internalType": "uint256", "name": "assets", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "_market", "type": "address" }], + "name": "removeMarket", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "amount", "type": "uint256" }], + "name": "requestOriginWithdrawal", + "outputs": [{ "internalType": "uint256", "name": "requestId", "type": "uint256" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "shares", "type": "uint256" }], + "name": "requestRedeem", + "outputs": [ + { "internalType": "uint256", "name": "requestId", "type": "uint256" }, + { "internalType": "uint256", "name": "assets", "type": "uint256" } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "_armBuffer", "type": "uint256" }], + "name": "setARMBuffer", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "_market", "type": "address" }], + "name": "setActiveMarket", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "_capManager", "type": "address" }], + "name": "setCapManager", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "newCrossPrice", "type": "uint256" }], + "name": "setCrossPrice", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "_fee", "type": "uint256" }], + "name": "setFee", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "_feeCollector", "type": "address" }], + "name": "setFeeCollector", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "newOperator", "type": "address" }], + "name": "setOperator", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "newOwner", "type": "address" }], + "name": "setOwner", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "buyT1", "type": "uint256" }, + { "internalType": "uint256", "name": "sellT1", "type": "uint256" } + ], + "name": "setPrices", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "market", "type": "address" }], + "name": "supportedMarkets", + "outputs": [{ "internalType": "bool", "name": "supported", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "amountIn", "type": "uint256" }, + { "internalType": "uint256", "name": "amountOutMin", "type": "uint256" }, + { "internalType": "address[]", "name": "path", "type": "address[]" }, + { "internalType": "address", "name": "to", "type": "address" }, + { "internalType": "uint256", "name": "deadline", "type": "uint256" } + ], + "name": "swapExactTokensForTokens", + "outputs": [{ "internalType": "uint256[]", "name": "amounts", "type": "uint256[]" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "contract IERC20", "name": "inToken", "type": "address" }, + { "internalType": "contract IERC20", "name": "outToken", "type": "address" }, + { "internalType": "uint256", "name": "amountIn", "type": "uint256" }, + { "internalType": "uint256", "name": "amountOutMin", "type": "uint256" }, + { "internalType": "address", "name": "to", "type": "address" } + ], + "name": "swapExactTokensForTokens", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "amountOut", "type": "uint256" }, + { "internalType": "uint256", "name": "amountInMax", "type": "uint256" }, + { "internalType": "address[]", "name": "path", "type": "address[]" }, + { "internalType": "address", "name": "to", "type": "address" }, + { "internalType": "uint256", "name": "deadline", "type": "uint256" } + ], + "name": "swapTokensForExactTokens", + "outputs": [{ "internalType": "uint256[]", "name": "amounts", "type": "uint256[]" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "contract IERC20", "name": "inToken", "type": "address" }, + { "internalType": "contract IERC20", "name": "outToken", "type": "address" }, + { "internalType": "uint256", "name": "amountOut", "type": "uint256" }, + { "internalType": "uint256", "name": "amountInMax", "type": "uint256" }, + { "internalType": "address", "name": "to", "type": "address" } + ], + "name": "swapTokensForExactTokens", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "token0", + "outputs": [{ "internalType": "contract IERC20", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "token1", + "outputs": [{ "internalType": "contract IERC20", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalAssets", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "traderate0", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "traderate1", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "to", "type": "address" }, + { "internalType": "uint256", "name": "value", "type": "uint256" } + ], + "name": "transfer", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "from", "type": "address" }, + { "internalType": "address", "name": "to", "type": "address" }, + { "internalType": "uint256", "name": "value", "type": "uint256" } + ], + "name": "transferFrom", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "vault", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "vaultWithdrawalAmount", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "requestId", "type": "uint256" }], + "name": "withdrawalRequests", + "outputs": [ + { "internalType": "address", "name": "withdrawer", "type": "address" }, + { "internalType": "bool", "name": "claimed", "type": "bool" }, + { "internalType": "uint40", "name": "claimTimestamp", "type": "uint40" }, + { "internalType": "uint128", "name": "assets", "type": "uint128" }, + { "internalType": "uint128", "name": "queued", "type": "uint128" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "withdrawsClaimed", + "outputs": [{ "internalType": "uint128", "name": "", "type": "uint128" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "withdrawsQueued", + "outputs": [{ "internalType": "uint128", "name": "", "type": "uint128" }], + "stateMutability": "view", + "type": "function" + } +] diff --git a/abi/origin-ethena-arm.json b/src/abi-json/origin-ethena-arm.json similarity index 100% rename from abi/origin-ethena-arm.json rename to src/abi-json/origin-ethena-arm.json diff --git a/abi/origin-etherfi-arm.json b/src/abi-json/origin-etherfi-arm.json similarity index 100% rename from abi/origin-etherfi-arm.json rename to src/abi-json/origin-etherfi-arm.json diff --git a/abi/origin-lido-arm-cap-manager.json b/src/abi-json/origin-lido-arm-cap-manager.json similarity index 100% rename from abi/origin-lido-arm-cap-manager.json rename to src/abi-json/origin-lido-arm-cap-manager.json diff --git a/abi/origin-lido-arm.json b/src/abi-json/origin-lido-arm.json similarity index 100% rename from abi/origin-lido-arm.json rename to src/abi-json/origin-lido-arm.json diff --git a/src/abi-json/otoken-2024-12-21.json b/src/abi-json/otoken-2024-12-21.json new file mode 100644 index 00000000..95946dbe --- /dev/null +++ b/src/abi-json/otoken-2024-12-21.json @@ -0,0 +1,712 @@ +[ + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "AccountRebasingDisabled", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "AccountRebasingEnabled", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousGovernor", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newGovernor", + "type": "address" + } + ], + "name": "GovernorshipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousGovernor", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newGovernor", + "type": "address" + } + ], + "name": "PendingGovernorshipTransfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "rebasingCredits", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "rebasingCreditsPerToken", + "type": "uint256" + } + ], + "name": "TotalSupplyUpdatedHighres", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "inputs": [], + "name": "_totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_owner", + "type": "address" + }, + { + "internalType": "address", + "name": "_spender", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_value", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_account", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "burn", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_newTotalSupply", + "type": "uint256" + } + ], + "name": "changeSupply", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "claimGovernance", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_account", + "type": "address" + } + ], + "name": "creditsBalanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_account", + "type": "address" + } + ], + "name": "creditsBalanceOfHighres", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_subtractedValue", + "type": "uint256" + } + ], + "name": "decreaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_account", + "type": "address" + } + ], + "name": "governanceRebaseOptIn", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "governor", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_addedValue", + "type": "uint256" + } + ], + "name": "increaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "_nameArg", + "type": "string" + }, + { + "internalType": "string", + "name": "_symbolArg", + "type": "string" + }, + { + "internalType": "address", + "name": "_vaultAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_initialCreditsPerToken", + "type": "uint256" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "isGovernor", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "isUpgraded", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "mint", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "nonRebasingCreditsPerToken", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "nonRebasingSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "rebaseOptIn", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "rebaseOptOut", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "rebaseState", + "outputs": [ + { + "internalType": "enum OUSD.RebaseOptions", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "rebasingCredits", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "rebasingCreditsHighres", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "rebasingCreditsPerToken", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "rebasingCreditsPerTokenHighres", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_value", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_from", + "type": "address" + }, + { + "internalType": "address", + "name": "_to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_value", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_newGovernor", + "type": "address" + } + ], + "name": "transferGovernance", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "vaultAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + } +] diff --git a/abi/otoken-base-harvester.json b/src/abi-json/otoken-base-harvester.json similarity index 100% rename from abi/otoken-base-harvester.json rename to src/abi-json/otoken-base-harvester.json diff --git a/abi/otoken-dripper.json b/src/abi-json/otoken-dripper.json similarity index 100% rename from abi/otoken-dripper.json rename to src/abi-json/otoken-dripper.json diff --git a/src/abi-json/otoken-upgradeAccounts.json b/src/abi-json/otoken-upgradeAccounts.json new file mode 100644 index 00000000..124b4fa3 --- /dev/null +++ b/src/abi-json/otoken-upgradeAccounts.json @@ -0,0 +1,15 @@ +[ + { + "type": "function", + "name": "upgradeAccounts", + "stateMutability": "nonpayable", + "inputs": [ + { + "name": "accounts", + "type": "address[]", + "internalType": "address[]" + } + ], + "outputs": [] + } +] diff --git a/abi/otoken-vault.json b/src/abi-json/otoken-vault.json similarity index 100% rename from abi/otoken-vault.json rename to src/abi-json/otoken-vault.json diff --git a/abi/otoken.json b/src/abi-json/otoken.json similarity index 100% rename from abi/otoken.json rename to src/abi-json/otoken.json diff --git a/abi/pool-booster-central-registry.json b/src/abi-json/pool-booster-central-registry.json similarity index 100% rename from abi/pool-booster-central-registry.json rename to src/abi-json/pool-booster-central-registry.json diff --git a/abi/pool-booster.json b/src/abi-json/pool-booster.json similarity index 100% rename from abi/pool-booster.json rename to src/abi-json/pool-booster.json diff --git a/src/abi-json/sfrx-eth.json b/src/abi-json/sfrx-eth.json new file mode 100644 index 00000000..983d80f5 --- /dev/null +++ b/src/abi-json/sfrx-eth.json @@ -0,0 +1,850 @@ +[ + { + "inputs": [ + { + "internalType": "contract ERC20", + "name": "_underlying", + "type": "address" + }, + { + "internalType": "uint32", + "name": "_rewardsCycleLength", + "type": "uint32" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "SyncError", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "caller", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "assets", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "shares", + "type": "uint256" + } + ], + "name": "Deposit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint32", + "name": "cycleEnd", + "type": "uint32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "rewardAmount", + "type": "uint256" + } + ], + "name": "NewRewardsCycle", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "caller", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "assets", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "shares", + "type": "uint256" + } + ], + "name": "Withdraw", + "type": "event" + }, + { + "inputs": [], + "name": "DOMAIN_SEPARATOR", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "asset", + "outputs": [ + { + "internalType": "contract ERC20", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + } + ], + "name": "convertToAssets", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "assets", + "type": "uint256" + } + ], + "name": "convertToShares", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "assets", + "type": "uint256" + }, + { + "internalType": "address", + "name": "receiver", + "type": "address" + } + ], + "name": "deposit", + "outputs": [ + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "assets", + "type": "uint256" + }, + { + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "approveMax", + "type": "bool" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "name": "depositWithSignature", + "outputs": [ + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "lastRewardAmount", + "outputs": [ + { + "internalType": "uint192", + "name": "", + "type": "uint192" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "lastSync", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "maxDeposit", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "maxMint", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "maxRedeem", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "maxWithdraw", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + }, + { + "internalType": "address", + "name": "receiver", + "type": "address" + } + ], + "name": "mint", + "outputs": [ + { + "internalType": "uint256", + "name": "assets", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "nonces", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "name": "permit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "assets", + "type": "uint256" + } + ], + "name": "previewDeposit", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + } + ], + "name": "previewMint", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + } + ], + "name": "previewRedeem", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "assets", + "type": "uint256" + } + ], + "name": "previewWithdraw", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pricePerShare", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + }, + { + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "redeem", + "outputs": [ + { + "internalType": "uint256", + "name": "assets", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "rewardsCycleEnd", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "rewardsCycleLength", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "syncRewards", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "totalAssets", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "assets", + "type": "uint256" + }, + { + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "withdraw", + "outputs": [ + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/abi/shadow-pair-factory.json b/src/abi-json/shadow-pair-factory.json similarity index 100% rename from abi/shadow-pair-factory.json rename to src/abi-json/shadow-pair-factory.json diff --git a/abi/shadow-v3-factory.json b/src/abi-json/shadow-v3-factory.json similarity index 100% rename from abi/shadow-v3-factory.json rename to src/abi-json/shadow-v3-factory.json diff --git a/abi/sonic-sfc.json b/src/abi-json/sonic-sfc.json similarity index 100% rename from abi/sonic-sfc.json rename to src/abi-json/sonic-sfc.json diff --git a/abi/strategy-bridged-woeth.json b/src/abi-json/strategy-bridged-woeth.json similarity index 100% rename from abi/strategy-bridged-woeth.json rename to src/abi-json/strategy-bridged-woeth.json diff --git a/abi/strategy-compound-staking-ssv.json b/src/abi-json/strategy-compound-staking-ssv.json similarity index 100% rename from abi/strategy-compound-staking-ssv.json rename to src/abi-json/strategy-compound-staking-ssv.json diff --git a/abi/strategy-native-staking.json b/src/abi-json/strategy-native-staking.json similarity index 100% rename from abi/strategy-native-staking.json rename to src/abi-json/strategy-native-staking.json diff --git a/abi/swapx-pair-factory.json b/src/abi-json/swapx-pair-factory.json similarity index 100% rename from abi/swapx-pair-factory.json rename to src/abi-json/swapx-pair-factory.json diff --git a/abi/uniswap-v3.json b/src/abi-json/uniswap-v3.json similarity index 100% rename from abi/uniswap-v3.json rename to src/abi-json/uniswap-v3.json diff --git a/abi/veogv.json b/src/abi-json/veogv.json similarity index 100% rename from abi/veogv.json rename to src/abi-json/veogv.json diff --git a/abi/woeth.json b/src/abi-json/woeth.json similarity index 100% rename from abi/woeth.json rename to src/abi-json/woeth.json diff --git a/src/abi/aave-lending-pool.ts b/src/abi/aave-lending-pool.ts deleted file mode 100644 index 97d70026..00000000 --- a/src/abi/aave-lending-pool.ts +++ /dev/null @@ -1,212 +0,0 @@ -import * as p from '@subsquid/evm-codec' -import { event, fun, viewFun, indexed, ContractBase } from '@subsquid/evm-abi' -import type { EventParams as EParams, FunctionArguments, FunctionReturn } from '@subsquid/evm-abi' - -export const events = { - Borrow: event("0xc6a898309e823ee50bac64e45ca8adba6690e99e7841c45d754e2a38e9019d9b", "Borrow(address,address,address,uint256,uint256,uint256,uint16)", {"reserve": indexed(p.address), "user": p.address, "onBehalfOf": indexed(p.address), "amount": p.uint256, "borrowRateMode": p.uint256, "borrowRate": p.uint256, "referral": indexed(p.uint16)}), - Deposit: event("0xde6857219544bb5b7746f48ed30be6386fefc61b2f864cacf559893bf50fd951", "Deposit(address,address,address,uint256,uint16)", {"reserve": indexed(p.address), "user": p.address, "onBehalfOf": indexed(p.address), "amount": p.uint256, "referral": indexed(p.uint16)}), - FlashLoan: event("0x631042c832b07452973831137f2d73e395028b44b250dedc5abb0ee766e168ac", "FlashLoan(address,address,address,uint256,uint256,uint16)", {"target": indexed(p.address), "initiator": indexed(p.address), "asset": indexed(p.address), "amount": p.uint256, "premium": p.uint256, "referralCode": p.uint16}), - LiquidationCall: event("0xe413a321e8681d831f4dbccbca790d2952b56f977908e45be37335533e005286", "LiquidationCall(address,address,address,uint256,uint256,address,bool)", {"collateralAsset": indexed(p.address), "debtAsset": indexed(p.address), "user": indexed(p.address), "debtToCover": p.uint256, "liquidatedCollateralAmount": p.uint256, "liquidator": p.address, "receiveAToken": p.bool}), - Paused: event("0x9e87fac88ff661f02d44f95383c817fece4bce600a3dab7a54406878b965e752", "Paused()", {}), - RebalanceStableBorrowRate: event("0x9f439ae0c81e41a04d3fdfe07aed54e6a179fb0db15be7702eb66fa8ef6f5300", "RebalanceStableBorrowRate(address,address)", {"reserve": indexed(p.address), "user": indexed(p.address)}), - Repay: event("0x4cdde6e09bb755c9a5589ebaec640bbfedff1362d4b255ebf8339782b9942faa", "Repay(address,address,address,uint256)", {"reserve": indexed(p.address), "user": indexed(p.address), "repayer": indexed(p.address), "amount": p.uint256}), - ReserveDataUpdated: event("0x804c9b842b2748a22bb64b345453a3de7ca54a6ca45ce00d415894979e22897a", "ReserveDataUpdated(address,uint256,uint256,uint256,uint256,uint256)", {"reserve": indexed(p.address), "liquidityRate": p.uint256, "stableBorrowRate": p.uint256, "variableBorrowRate": p.uint256, "liquidityIndex": p.uint256, "variableBorrowIndex": p.uint256}), - ReserveUsedAsCollateralDisabled: event("0x44c58d81365b66dd4b1a7f36c25aa97b8c71c361ee4937adc1a00000227db5dd", "ReserveUsedAsCollateralDisabled(address,address)", {"reserve": indexed(p.address), "user": indexed(p.address)}), - ReserveUsedAsCollateralEnabled: event("0x00058a56ea94653cdf4f152d227ace22d4c00ad99e2a43f58cb7d9e3feb295f2", "ReserveUsedAsCollateralEnabled(address,address)", {"reserve": indexed(p.address), "user": indexed(p.address)}), - Swap: event("0xea368a40e9570069bb8e6511d668293ad2e1f03b0d982431fd223de9f3b70ca6", "Swap(address,address,uint256)", {"reserve": indexed(p.address), "user": indexed(p.address), "rateMode": p.uint256}), - TokensRescued: event("0x77023e19c7343ad491fd706c36335ca0e738340a91f29b1fd81e2673d44896c4", "TokensRescued(address,address,uint256)", {"tokenRescued": indexed(p.address), "receiver": indexed(p.address), "amountRescued": p.uint256}), - Unpaused: event("0xa45f47fdea8a1efdd9029a5691c7f759c32b7c698632b563573e155625d16933", "Unpaused()", {}), - Withdraw: event("0x3115d1449a7b732c986cba18244e897a450f61e1bb8d589cd2e69e6c8924f9f7", "Withdraw(address,address,address,uint256)", {"reserve": indexed(p.address), "user": indexed(p.address), "to": indexed(p.address), "amount": p.uint256}), -} - -export const functions = { - FLASHLOAN_PREMIUM_TOTAL: viewFun("0x074b2e43", "FLASHLOAN_PREMIUM_TOTAL()", {}, p.uint256), - LENDINGPOOL_REVISION: viewFun("0x8afaff02", "LENDINGPOOL_REVISION()", {}, p.uint256), - MAX_NUMBER_RESERVES: viewFun("0xf8119d51", "MAX_NUMBER_RESERVES()", {}, p.uint256), - MAX_STABLE_RATE_BORROW_SIZE_PERCENT: viewFun("0xe82fec2f", "MAX_STABLE_RATE_BORROW_SIZE_PERCENT()", {}, p.uint256), - borrow: fun("0xa415bcad", "borrow(address,uint256,uint256,uint16,address)", {"asset": p.address, "amount": p.uint256, "interestRateMode": p.uint256, "referralCode": p.uint16, "onBehalfOf": p.address}, ), - deposit: fun("0xe8eda9df", "deposit(address,uint256,address,uint16)", {"asset": p.address, "amount": p.uint256, "onBehalfOf": p.address, "referralCode": p.uint16}, ), - finalizeTransfer: fun("0xd5ed3933", "finalizeTransfer(address,address,address,uint256,uint256,uint256)", {"asset": p.address, "from": p.address, "to": p.address, "amount": p.uint256, "balanceFromBefore": p.uint256, "balanceToBefore": p.uint256}, ), - flashLoan: fun("0xab9c4b5d", "flashLoan(address,address[],uint256[],uint256[],address,bytes,uint16)", {"receiverAddress": p.address, "assets": p.array(p.address), "amounts": p.array(p.uint256), "modes": p.array(p.uint256), "onBehalfOf": p.address, "params": p.bytes, "referralCode": p.uint16}, ), - getAddressesProvider: viewFun("0xfe65acfe", "getAddressesProvider()", {}, p.address), - getConfiguration: viewFun("0xc44b11f7", "getConfiguration(address)", {"asset": p.address}, p.struct({"data": p.uint256})), - getReserveData: viewFun("0x35ea6a75", "getReserveData(address)", {"asset": p.address}, p.struct({"configuration": p.struct({"data": p.uint256}), "liquidityIndex": p.uint128, "variableBorrowIndex": p.uint128, "currentLiquidityRate": p.uint128, "currentVariableBorrowRate": p.uint128, "currentStableBorrowRate": p.uint128, "lastUpdateTimestamp": p.uint40, "aTokenAddress": p.address, "stableDebtTokenAddress": p.address, "variableDebtTokenAddress": p.address, "interestRateStrategyAddress": p.address, "id": p.uint8})), - getReserveNormalizedIncome: viewFun("0xd15e0053", "getReserveNormalizedIncome(address)", {"asset": p.address}, p.uint256), - getReserveNormalizedVariableDebt: viewFun("0x386497fd", "getReserveNormalizedVariableDebt(address)", {"asset": p.address}, p.uint256), - getReservesList: viewFun("0xd1946dbc", "getReservesList()", {}, p.array(p.address)), - getUserAccountData: viewFun("0xbf92857c", "getUserAccountData(address)", {"user": p.address}, {"totalCollateralETH": p.uint256, "totalDebtETH": p.uint256, "availableBorrowsETH": p.uint256, "currentLiquidationThreshold": p.uint256, "ltv": p.uint256, "healthFactor": p.uint256}), - getUserConfiguration: viewFun("0x4417a583", "getUserConfiguration(address)", {"user": p.address}, p.struct({"data": p.uint256})), - initReserve: fun("0x7a708e92", "initReserve(address,address,address,address,address)", {"asset": p.address, "aTokenAddress": p.address, "stableDebtAddress": p.address, "variableDebtAddress": p.address, "interestRateStrategyAddress": p.address}, ), - initialize: fun("0xc4d66de8", "initialize(address)", {"provider": p.address}, ), - liquidationCall: fun("0x00a718a9", "liquidationCall(address,address,address,uint256,bool)", {"collateralAsset": p.address, "debtAsset": p.address, "user": p.address, "debtToCover": p.uint256, "receiveAToken": p.bool}, ), - paused: viewFun("0x5c975abb", "paused()", {}, p.bool), - rebalanceStableBorrowRate: fun("0xcd112382", "rebalanceStableBorrowRate(address,address)", {"asset": p.address, "user": p.address}, ), - repay: fun("0x573ade81", "repay(address,uint256,uint256,address)", {"asset": p.address, "amount": p.uint256, "rateMode": p.uint256, "onBehalfOf": p.address}, p.uint256), - rescueTokens: fun("0xcea9d26f", "rescueTokens(address,address,uint256)", {"token": p.address, "to": p.address, "amount": p.uint256}, ), - setConfiguration: fun("0xb8d29276", "setConfiguration(address,uint256)", {"asset": p.address, "configuration": p.uint256}, ), - setPause: fun("0xbedb86fb", "setPause(bool)", {"val": p.bool}, ), - setReserveInterestRateStrategyAddress: fun("0x1d2118f9", "setReserveInterestRateStrategyAddress(address,address)", {"asset": p.address, "rateStrategyAddress": p.address}, ), - setUserUseReserveAsCollateral: fun("0x5a3b74b9", "setUserUseReserveAsCollateral(address,bool)", {"asset": p.address, "useAsCollateral": p.bool}, ), - swapBorrowRateMode: fun("0x94ba89a2", "swapBorrowRateMode(address,uint256)", {"asset": p.address, "rateMode": p.uint256}, ), - withdraw: fun("0x69328dec", "withdraw(address,uint256,address)", {"asset": p.address, "amount": p.uint256, "to": p.address}, p.uint256), -} - -export class Contract extends ContractBase { - - FLASHLOAN_PREMIUM_TOTAL() { - return this.eth_call(functions.FLASHLOAN_PREMIUM_TOTAL, {}) - } - - LENDINGPOOL_REVISION() { - return this.eth_call(functions.LENDINGPOOL_REVISION, {}) - } - - MAX_NUMBER_RESERVES() { - return this.eth_call(functions.MAX_NUMBER_RESERVES, {}) - } - - MAX_STABLE_RATE_BORROW_SIZE_PERCENT() { - return this.eth_call(functions.MAX_STABLE_RATE_BORROW_SIZE_PERCENT, {}) - } - - getAddressesProvider() { - return this.eth_call(functions.getAddressesProvider, {}) - } - - getConfiguration(asset: GetConfigurationParams["asset"]) { - return this.eth_call(functions.getConfiguration, {asset}) - } - - getReserveData(asset: GetReserveDataParams["asset"]) { - return this.eth_call(functions.getReserveData, {asset}) - } - - getReserveNormalizedIncome(asset: GetReserveNormalizedIncomeParams["asset"]) { - return this.eth_call(functions.getReserveNormalizedIncome, {asset}) - } - - getReserveNormalizedVariableDebt(asset: GetReserveNormalizedVariableDebtParams["asset"]) { - return this.eth_call(functions.getReserveNormalizedVariableDebt, {asset}) - } - - getReservesList() { - return this.eth_call(functions.getReservesList, {}) - } - - getUserAccountData(user: GetUserAccountDataParams["user"]) { - return this.eth_call(functions.getUserAccountData, {user}) - } - - getUserConfiguration(user: GetUserConfigurationParams["user"]) { - return this.eth_call(functions.getUserConfiguration, {user}) - } - - paused() { - return this.eth_call(functions.paused, {}) - } -} - -/// Event types -export type BorrowEventArgs = EParams -export type DepositEventArgs = EParams -export type FlashLoanEventArgs = EParams -export type LiquidationCallEventArgs = EParams -export type PausedEventArgs = EParams -export type RebalanceStableBorrowRateEventArgs = EParams -export type RepayEventArgs = EParams -export type ReserveDataUpdatedEventArgs = EParams -export type ReserveUsedAsCollateralDisabledEventArgs = EParams -export type ReserveUsedAsCollateralEnabledEventArgs = EParams -export type SwapEventArgs = EParams -export type TokensRescuedEventArgs = EParams -export type UnpausedEventArgs = EParams -export type WithdrawEventArgs = EParams - -/// Function types -export type FLASHLOAN_PREMIUM_TOTALParams = FunctionArguments -export type FLASHLOAN_PREMIUM_TOTALReturn = FunctionReturn - -export type LENDINGPOOL_REVISIONParams = FunctionArguments -export type LENDINGPOOL_REVISIONReturn = FunctionReturn - -export type MAX_NUMBER_RESERVESParams = FunctionArguments -export type MAX_NUMBER_RESERVESReturn = FunctionReturn - -export type MAX_STABLE_RATE_BORROW_SIZE_PERCENTParams = FunctionArguments -export type MAX_STABLE_RATE_BORROW_SIZE_PERCENTReturn = FunctionReturn - -export type BorrowParams = FunctionArguments -export type BorrowReturn = FunctionReturn - -export type DepositParams = FunctionArguments -export type DepositReturn = FunctionReturn - -export type FinalizeTransferParams = FunctionArguments -export type FinalizeTransferReturn = FunctionReturn - -export type FlashLoanParams = FunctionArguments -export type FlashLoanReturn = FunctionReturn - -export type GetAddressesProviderParams = FunctionArguments -export type GetAddressesProviderReturn = FunctionReturn - -export type GetConfigurationParams = FunctionArguments -export type GetConfigurationReturn = FunctionReturn - -export type GetReserveDataParams = FunctionArguments -export type GetReserveDataReturn = FunctionReturn - -export type GetReserveNormalizedIncomeParams = FunctionArguments -export type GetReserveNormalizedIncomeReturn = FunctionReturn - -export type GetReserveNormalizedVariableDebtParams = FunctionArguments -export type GetReserveNormalizedVariableDebtReturn = FunctionReturn - -export type GetReservesListParams = FunctionArguments -export type GetReservesListReturn = FunctionReturn - -export type GetUserAccountDataParams = FunctionArguments -export type GetUserAccountDataReturn = FunctionReturn - -export type GetUserConfigurationParams = FunctionArguments -export type GetUserConfigurationReturn = FunctionReturn - -export type InitReserveParams = FunctionArguments -export type InitReserveReturn = FunctionReturn - -export type InitializeParams = FunctionArguments -export type InitializeReturn = FunctionReturn - -export type LiquidationCallParams = FunctionArguments -export type LiquidationCallReturn = FunctionReturn - -export type PausedParams = FunctionArguments -export type PausedReturn = FunctionReturn - -export type RebalanceStableBorrowRateParams = FunctionArguments -export type RebalanceStableBorrowRateReturn = FunctionReturn - -export type RepayParams = FunctionArguments -export type RepayReturn = FunctionReturn - -export type RescueTokensParams = FunctionArguments -export type RescueTokensReturn = FunctionReturn - -export type SetConfigurationParams = FunctionArguments -export type SetConfigurationReturn = FunctionReturn - -export type SetPauseParams = FunctionArguments -export type SetPauseReturn = FunctionReturn - -export type SetReserveInterestRateStrategyAddressParams = FunctionArguments -export type SetReserveInterestRateStrategyAddressReturn = FunctionReturn - -export type SetUserUseReserveAsCollateralParams = FunctionArguments -export type SetUserUseReserveAsCollateralReturn = FunctionReturn - -export type SwapBorrowRateModeParams = FunctionArguments -export type SwapBorrowRateModeReturn = FunctionReturn - -export type WithdrawParams = FunctionArguments -export type WithdrawReturn = FunctionReturn - diff --git a/src/abi/aave-lending-pool/contract.ts b/src/abi/aave-lending-pool/contract.ts new file mode 100644 index 00000000..64992e1d --- /dev/null +++ b/src/abi/aave-lending-pool/contract.ts @@ -0,0 +1,65 @@ +import { ContractBase } from '../abi.support.js' +import { FLASHLOAN_PREMIUM_TOTAL, LENDINGPOOL_REVISION, MAX_NUMBER_RESERVES, MAX_STABLE_RATE_BORROW_SIZE_PERCENT, getAddressesProvider, getConfiguration, getReserveData, getReserveNormalizedIncome, getReserveNormalizedVariableDebt, getReservesList, getUserAccountData, getUserConfiguration, paused, repay, withdraw } from './functions.js' +import type { GetConfigurationParams, GetReserveDataParams, GetReserveNormalizedIncomeParams, GetReserveNormalizedVariableDebtParams, GetUserAccountDataParams, GetUserConfigurationParams, RepayParams, WithdrawParams } from './functions.js' + +export class Contract extends ContractBase { + FLASHLOAN_PREMIUM_TOTAL() { + return this.eth_call(FLASHLOAN_PREMIUM_TOTAL, {}) + } + + LENDINGPOOL_REVISION() { + return this.eth_call(LENDINGPOOL_REVISION, {}) + } + + MAX_NUMBER_RESERVES() { + return this.eth_call(MAX_NUMBER_RESERVES, {}) + } + + MAX_STABLE_RATE_BORROW_SIZE_PERCENT() { + return this.eth_call(MAX_STABLE_RATE_BORROW_SIZE_PERCENT, {}) + } + + getAddressesProvider() { + return this.eth_call(getAddressesProvider, {}) + } + + getConfiguration(asset: GetConfigurationParams["asset"]) { + return this.eth_call(getConfiguration, {asset}) + } + + getReserveData(asset: GetReserveDataParams["asset"]) { + return this.eth_call(getReserveData, {asset}) + } + + getReserveNormalizedIncome(asset: GetReserveNormalizedIncomeParams["asset"]) { + return this.eth_call(getReserveNormalizedIncome, {asset}) + } + + getReserveNormalizedVariableDebt(asset: GetReserveNormalizedVariableDebtParams["asset"]) { + return this.eth_call(getReserveNormalizedVariableDebt, {asset}) + } + + getReservesList() { + return this.eth_call(getReservesList, {}) + } + + getUserAccountData(user: GetUserAccountDataParams["user"]) { + return this.eth_call(getUserAccountData, {user}) + } + + getUserConfiguration(user: GetUserConfigurationParams["user"]) { + return this.eth_call(getUserConfiguration, {user}) + } + + paused() { + return this.eth_call(paused, {}) + } + + repay(asset: RepayParams["asset"], amount: RepayParams["amount"], rateMode: RepayParams["rateMode"], onBehalfOf: RepayParams["onBehalfOf"]) { + return this.eth_call(repay, {asset, amount, rateMode, onBehalfOf}) + } + + withdraw(asset: WithdrawParams["asset"], amount: WithdrawParams["amount"], to: WithdrawParams["to"]) { + return this.eth_call(withdraw, {asset, amount, to}) + } +} diff --git a/src/abi/aave-lending-pool/events.ts b/src/abi/aave-lending-pool/events.ts new file mode 100644 index 00000000..6074e5bc --- /dev/null +++ b/src/abi/aave-lending-pool/events.ts @@ -0,0 +1,122 @@ +import { address, bool, uint16, uint256 } from '@subsquid/evm-codec' +import { event, indexed } from '../abi.support.js' +import type { EventParams as EParams } from '../abi.support.js' + +/** Borrow(address,address,address,uint256,uint256,uint256,uint16) */ +export const Borrow = event('0xc6a898309e823ee50bac64e45ca8adba6690e99e7841c45d754e2a38e9019d9b', { + reserve: indexed(address), + user: address, + onBehalfOf: indexed(address), + amount: uint256, + borrowRateMode: uint256, + borrowRate: uint256, + referral: indexed(uint16), +}) +export type BorrowEventArgs = EParams + +/** Deposit(address,address,address,uint256,uint16) */ +export const Deposit = event('0xde6857219544bb5b7746f48ed30be6386fefc61b2f864cacf559893bf50fd951', { + reserve: indexed(address), + user: address, + onBehalfOf: indexed(address), + amount: uint256, + referral: indexed(uint16), +}) +export type DepositEventArgs = EParams + +/** FlashLoan(address,address,address,uint256,uint256,uint16) */ +export const FlashLoan = event('0x631042c832b07452973831137f2d73e395028b44b250dedc5abb0ee766e168ac', { + target: indexed(address), + initiator: indexed(address), + asset: indexed(address), + amount: uint256, + premium: uint256, + referralCode: uint16, +}) +export type FlashLoanEventArgs = EParams + +/** LiquidationCall(address,address,address,uint256,uint256,address,bool) */ +export const LiquidationCall = event('0xe413a321e8681d831f4dbccbca790d2952b56f977908e45be37335533e005286', { + collateralAsset: indexed(address), + debtAsset: indexed(address), + user: indexed(address), + debtToCover: uint256, + liquidatedCollateralAmount: uint256, + liquidator: address, + receiveAToken: bool, +}) +export type LiquidationCallEventArgs = EParams + +/** Paused() */ +export const Paused = event('0x9e87fac88ff661f02d44f95383c817fece4bce600a3dab7a54406878b965e752', {}) +export type PausedEventArgs = EParams + +/** RebalanceStableBorrowRate(address,address) */ +export const RebalanceStableBorrowRate = event('0x9f439ae0c81e41a04d3fdfe07aed54e6a179fb0db15be7702eb66fa8ef6f5300', { + reserve: indexed(address), + user: indexed(address), +}) +export type RebalanceStableBorrowRateEventArgs = EParams + +/** Repay(address,address,address,uint256) */ +export const Repay = event('0x4cdde6e09bb755c9a5589ebaec640bbfedff1362d4b255ebf8339782b9942faa', { + reserve: indexed(address), + user: indexed(address), + repayer: indexed(address), + amount: uint256, +}) +export type RepayEventArgs = EParams + +/** ReserveDataUpdated(address,uint256,uint256,uint256,uint256,uint256) */ +export const ReserveDataUpdated = event('0x804c9b842b2748a22bb64b345453a3de7ca54a6ca45ce00d415894979e22897a', { + reserve: indexed(address), + liquidityRate: uint256, + stableBorrowRate: uint256, + variableBorrowRate: uint256, + liquidityIndex: uint256, + variableBorrowIndex: uint256, +}) +export type ReserveDataUpdatedEventArgs = EParams + +/** ReserveUsedAsCollateralDisabled(address,address) */ +export const ReserveUsedAsCollateralDisabled = event('0x44c58d81365b66dd4b1a7f36c25aa97b8c71c361ee4937adc1a00000227db5dd', { + reserve: indexed(address), + user: indexed(address), +}) +export type ReserveUsedAsCollateralDisabledEventArgs = EParams + +/** ReserveUsedAsCollateralEnabled(address,address) */ +export const ReserveUsedAsCollateralEnabled = event('0x00058a56ea94653cdf4f152d227ace22d4c00ad99e2a43f58cb7d9e3feb295f2', { + reserve: indexed(address), + user: indexed(address), +}) +export type ReserveUsedAsCollateralEnabledEventArgs = EParams + +/** Swap(address,address,uint256) */ +export const Swap = event('0xea368a40e9570069bb8e6511d668293ad2e1f03b0d982431fd223de9f3b70ca6', { + reserve: indexed(address), + user: indexed(address), + rateMode: uint256, +}) +export type SwapEventArgs = EParams + +/** TokensRescued(address,address,uint256) */ +export const TokensRescued = event('0x77023e19c7343ad491fd706c36335ca0e738340a91f29b1fd81e2673d44896c4', { + tokenRescued: indexed(address), + receiver: indexed(address), + amountRescued: uint256, +}) +export type TokensRescuedEventArgs = EParams + +/** Unpaused() */ +export const Unpaused = event('0xa45f47fdea8a1efdd9029a5691c7f759c32b7c698632b563573e155625d16933', {}) +export type UnpausedEventArgs = EParams + +/** Withdraw(address,address,address,uint256) */ +export const Withdraw = event('0x3115d1449a7b732c986cba18244e897a450f61e1bb8d589cd2e69e6c8924f9f7', { + reserve: indexed(address), + user: indexed(address), + to: indexed(address), + amount: uint256, +}) +export type WithdrawEventArgs = EParams diff --git a/src/abi/aave-lending-pool/functions.ts b/src/abi/aave-lending-pool/functions.ts new file mode 100644 index 00000000..4d7b1ef5 --- /dev/null +++ b/src/abi/aave-lending-pool/functions.ts @@ -0,0 +1,256 @@ +import { address, array, bool, bytes, struct, uint128, uint16, uint256, uint40, uint8 } from '@subsquid/evm-codec' +import { func } from '../abi.support.js' +import type { FunctionArguments, FunctionReturn } from '../abi.support.js' + +/** FLASHLOAN_PREMIUM_TOTAL() */ +export const FLASHLOAN_PREMIUM_TOTAL = func('0x074b2e43', {}, uint256) +export type FLASHLOAN_PREMIUM_TOTALParams = FunctionArguments +export type FLASHLOAN_PREMIUM_TOTALReturn = FunctionReturn + +/** LENDINGPOOL_REVISION() */ +export const LENDINGPOOL_REVISION = func('0x8afaff02', {}, uint256) +export type LENDINGPOOL_REVISIONParams = FunctionArguments +export type LENDINGPOOL_REVISIONReturn = FunctionReturn + +/** MAX_NUMBER_RESERVES() */ +export const MAX_NUMBER_RESERVES = func('0xf8119d51', {}, uint256) +export type MAX_NUMBER_RESERVESParams = FunctionArguments +export type MAX_NUMBER_RESERVESReturn = FunctionReturn + +/** MAX_STABLE_RATE_BORROW_SIZE_PERCENT() */ +export const MAX_STABLE_RATE_BORROW_SIZE_PERCENT = func('0xe82fec2f', {}, uint256) +export type MAX_STABLE_RATE_BORROW_SIZE_PERCENTParams = FunctionArguments +export type MAX_STABLE_RATE_BORROW_SIZE_PERCENTReturn = FunctionReturn + +/** borrow(address,uint256,uint256,uint16,address) */ +export const borrow = func('0xa415bcad', { + asset: address, + amount: uint256, + interestRateMode: uint256, + referralCode: uint16, + onBehalfOf: address, +}) +export type BorrowParams = FunctionArguments +export type BorrowReturn = FunctionReturn + +/** deposit(address,uint256,address,uint16) */ +export const deposit = func('0xe8eda9df', { + asset: address, + amount: uint256, + onBehalfOf: address, + referralCode: uint16, +}) +export type DepositParams = FunctionArguments +export type DepositReturn = FunctionReturn + +/** finalizeTransfer(address,address,address,uint256,uint256,uint256) */ +export const finalizeTransfer = func('0xd5ed3933', { + asset: address, + from: address, + to: address, + amount: uint256, + balanceFromBefore: uint256, + balanceToBefore: uint256, +}) +export type FinalizeTransferParams = FunctionArguments +export type FinalizeTransferReturn = FunctionReturn + +/** flashLoan(address,address[],uint256[],uint256[],address,bytes,uint16) */ +export const flashLoan = func('0xab9c4b5d', { + receiverAddress: address, + assets: array(address), + amounts: array(uint256), + modes: array(uint256), + onBehalfOf: address, + params: bytes, + referralCode: uint16, +}) +export type FlashLoanParams = FunctionArguments +export type FlashLoanReturn = FunctionReturn + +/** getAddressesProvider() */ +export const getAddressesProvider = func('0xfe65acfe', {}, address) +export type GetAddressesProviderParams = FunctionArguments +export type GetAddressesProviderReturn = FunctionReturn + +/** getConfiguration(address) */ +export const getConfiguration = func('0xc44b11f7', { + asset: address, +}, struct({ + data: uint256, +})) +export type GetConfigurationParams = FunctionArguments +export type GetConfigurationReturn = FunctionReturn + +/** getReserveData(address) */ +export const getReserveData = func('0x35ea6a75', { + asset: address, +}, struct({ + configuration: struct({ + data: uint256, + }), + liquidityIndex: uint128, + variableBorrowIndex: uint128, + currentLiquidityRate: uint128, + currentVariableBorrowRate: uint128, + currentStableBorrowRate: uint128, + lastUpdateTimestamp: uint40, + aTokenAddress: address, + stableDebtTokenAddress: address, + variableDebtTokenAddress: address, + interestRateStrategyAddress: address, + id: uint8, +})) +export type GetReserveDataParams = FunctionArguments +export type GetReserveDataReturn = FunctionReturn + +/** getReserveNormalizedIncome(address) */ +export const getReserveNormalizedIncome = func('0xd15e0053', { + asset: address, +}, uint256) +export type GetReserveNormalizedIncomeParams = FunctionArguments +export type GetReserveNormalizedIncomeReturn = FunctionReturn + +/** getReserveNormalizedVariableDebt(address) */ +export const getReserveNormalizedVariableDebt = func('0x386497fd', { + asset: address, +}, uint256) +export type GetReserveNormalizedVariableDebtParams = FunctionArguments +export type GetReserveNormalizedVariableDebtReturn = FunctionReturn + +/** getReservesList() */ +export const getReservesList = func('0xd1946dbc', {}, array(address)) +export type GetReservesListParams = FunctionArguments +export type GetReservesListReturn = FunctionReturn + +/** getUserAccountData(address) */ +export const getUserAccountData = func('0xbf92857c', { + user: address, +}, struct({ + totalCollateralETH: uint256, + totalDebtETH: uint256, + availableBorrowsETH: uint256, + currentLiquidationThreshold: uint256, + ltv: uint256, + healthFactor: uint256, +})) +export type GetUserAccountDataParams = FunctionArguments +export type GetUserAccountDataReturn = FunctionReturn + +/** getUserConfiguration(address) */ +export const getUserConfiguration = func('0x4417a583', { + user: address, +}, struct({ + data: uint256, +})) +export type GetUserConfigurationParams = FunctionArguments +export type GetUserConfigurationReturn = FunctionReturn + +/** initReserve(address,address,address,address,address) */ +export const initReserve = func('0x7a708e92', { + asset: address, + aTokenAddress: address, + stableDebtAddress: address, + variableDebtAddress: address, + interestRateStrategyAddress: address, +}) +export type InitReserveParams = FunctionArguments +export type InitReserveReturn = FunctionReturn + +/** initialize(address) */ +export const initialize = func('0xc4d66de8', { + provider: address, +}) +export type InitializeParams = FunctionArguments +export type InitializeReturn = FunctionReturn + +/** liquidationCall(address,address,address,uint256,bool) */ +export const liquidationCall = func('0x00a718a9', { + collateralAsset: address, + debtAsset: address, + user: address, + debtToCover: uint256, + receiveAToken: bool, +}) +export type LiquidationCallParams = FunctionArguments +export type LiquidationCallReturn = FunctionReturn + +/** paused() */ +export const paused = func('0x5c975abb', {}, bool) +export type PausedParams = FunctionArguments +export type PausedReturn = FunctionReturn + +/** rebalanceStableBorrowRate(address,address) */ +export const rebalanceStableBorrowRate = func('0xcd112382', { + asset: address, + user: address, +}) +export type RebalanceStableBorrowRateParams = FunctionArguments +export type RebalanceStableBorrowRateReturn = FunctionReturn + +/** repay(address,uint256,uint256,address) */ +export const repay = func('0x573ade81', { + asset: address, + amount: uint256, + rateMode: uint256, + onBehalfOf: address, +}, uint256) +export type RepayParams = FunctionArguments +export type RepayReturn = FunctionReturn + +/** rescueTokens(address,address,uint256) */ +export const rescueTokens = func('0xcea9d26f', { + token: address, + to: address, + amount: uint256, +}) +export type RescueTokensParams = FunctionArguments +export type RescueTokensReturn = FunctionReturn + +/** setConfiguration(address,uint256) */ +export const setConfiguration = func('0xb8d29276', { + asset: address, + configuration: uint256, +}) +export type SetConfigurationParams = FunctionArguments +export type SetConfigurationReturn = FunctionReturn + +/** setPause(bool) */ +export const setPause = func('0xbedb86fb', { + val: bool, +}) +export type SetPauseParams = FunctionArguments +export type SetPauseReturn = FunctionReturn + +/** setReserveInterestRateStrategyAddress(address,address) */ +export const setReserveInterestRateStrategyAddress = func('0x1d2118f9', { + asset: address, + rateStrategyAddress: address, +}) +export type SetReserveInterestRateStrategyAddressParams = FunctionArguments +export type SetReserveInterestRateStrategyAddressReturn = FunctionReturn + +/** setUserUseReserveAsCollateral(address,bool) */ +export const setUserUseReserveAsCollateral = func('0x5a3b74b9', { + asset: address, + useAsCollateral: bool, +}) +export type SetUserUseReserveAsCollateralParams = FunctionArguments +export type SetUserUseReserveAsCollateralReturn = FunctionReturn + +/** swapBorrowRateMode(address,uint256) */ +export const swapBorrowRateMode = func('0x94ba89a2', { + asset: address, + rateMode: uint256, +}) +export type SwapBorrowRateModeParams = FunctionArguments +export type SwapBorrowRateModeReturn = FunctionReturn + +/** withdraw(address,uint256,address) */ +export const withdraw = func('0x69328dec', { + asset: address, + amount: uint256, + to: address, +}, uint256) +export type WithdrawParams = FunctionArguments +export type WithdrawReturn = FunctionReturn diff --git a/src/abi/aave-lending-pool/index.ts b/src/abi/aave-lending-pool/index.ts new file mode 100644 index 00000000..11829d6e --- /dev/null +++ b/src/abi/aave-lending-pool/index.ts @@ -0,0 +1,4 @@ +export * as events from './events.js' +export * as functions from './functions.js' + +export { Contract } from './contract.js' diff --git a/src/abi/aave-token.abi.ts b/src/abi/aave-token.abi.ts deleted file mode 100644 index 9732279e..00000000 --- a/src/abi/aave-token.abi.ts +++ /dev/null @@ -1,825 +0,0 @@ -export const ABI_JSON = [ - { - "type": "constructor", - "stateMutability": "undefined", - "payable": false, - "inputs": [ - { - "type": "address", - "name": "pool" - }, - { - "type": "address", - "name": "underlyingAssetAddress" - }, - { - "type": "address", - "name": "reserveTreasuryAddress" - }, - { - "type": "string", - "name": "tokenName" - }, - { - "type": "string", - "name": "tokenSymbol" - }, - { - "type": "address", - "name": "incentivesController" - } - ] - }, - { - "type": "event", - "anonymous": false, - "name": "Approval", - "inputs": [ - { - "type": "address", - "name": "owner", - "indexed": true - }, - { - "type": "address", - "name": "spender", - "indexed": true - }, - { - "type": "uint256", - "name": "value", - "indexed": false - } - ] - }, - { - "type": "event", - "anonymous": false, - "name": "BalanceTransfer", - "inputs": [ - { - "type": "address", - "name": "from", - "indexed": true - }, - { - "type": "address", - "name": "to", - "indexed": true - }, - { - "type": "uint256", - "name": "value", - "indexed": false - }, - { - "type": "uint256", - "name": "index", - "indexed": false - } - ] - }, - { - "type": "event", - "anonymous": false, - "name": "Burn", - "inputs": [ - { - "type": "address", - "name": "from", - "indexed": true - }, - { - "type": "address", - "name": "target", - "indexed": true - }, - { - "type": "uint256", - "name": "value", - "indexed": false - }, - { - "type": "uint256", - "name": "index", - "indexed": false - } - ] - }, - { - "type": "event", - "anonymous": false, - "name": "Initialized", - "inputs": [ - { - "type": "address", - "name": "underlyingAsset", - "indexed": true - }, - { - "type": "address", - "name": "pool", - "indexed": true - }, - { - "type": "address", - "name": "treasury", - "indexed": false - }, - { - "type": "address", - "name": "incentivesController", - "indexed": false - }, - { - "type": "uint8", - "name": "aTokenDecimals", - "indexed": false - }, - { - "type": "string", - "name": "aTokenName", - "indexed": false - }, - { - "type": "string", - "name": "aTokenSymbol", - "indexed": false - }, - { - "type": "bytes", - "name": "params", - "indexed": false - } - ] - }, - { - "type": "event", - "anonymous": false, - "name": "Mint", - "inputs": [ - { - "type": "address", - "name": "from", - "indexed": true - }, - { - "type": "uint256", - "name": "value", - "indexed": false - }, - { - "type": "uint256", - "name": "index", - "indexed": false - } - ] - }, - { - "type": "event", - "anonymous": false, - "name": "TokensRescued", - "inputs": [ - { - "type": "address", - "name": "tokenRescued", - "indexed": true - }, - { - "type": "address", - "name": "receiver", - "indexed": true - }, - { - "type": "uint256", - "name": "amountRescued", - "indexed": false - } - ] - }, - { - "type": "event", - "anonymous": false, - "name": "Transfer", - "inputs": [ - { - "type": "address", - "name": "from", - "indexed": true - }, - { - "type": "address", - "name": "to", - "indexed": true - }, - { - "type": "uint256", - "name": "value", - "indexed": false - } - ] - }, - { - "type": "function", - "name": "ATOKEN_REVISION", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [ - { - "type": "uint256", - "name": "" - } - ] - }, - { - "type": "function", - "name": "DOMAIN_SEPARATOR", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [ - { - "type": "bytes32", - "name": "" - } - ] - }, - { - "type": "function", - "name": "EIP712_REVISION", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [ - { - "type": "bytes", - "name": "" - } - ] - }, - { - "type": "function", - "name": "PERMIT_TYPEHASH", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [ - { - "type": "bytes32", - "name": "" - } - ] - }, - { - "type": "function", - "name": "POOL", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [ - { - "type": "address", - "name": "" - } - ] - }, - { - "type": "function", - "name": "RESERVE_TREASURY_ADDRESS", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [ - { - "type": "address", - "name": "" - } - ] - }, - { - "type": "function", - "name": "UINT_MAX_VALUE", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [ - { - "type": "uint256", - "name": "" - } - ] - }, - { - "type": "function", - "name": "UNDERLYING_ASSET_ADDRESS", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [ - { - "type": "address", - "name": "" - } - ] - }, - { - "type": "function", - "name": "_nonces", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [ - { - "type": "address", - "name": "" - } - ], - "outputs": [ - { - "type": "uint256", - "name": "" - } - ] - }, - { - "type": "function", - "name": "allowance", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [ - { - "type": "address", - "name": "owner" - }, - { - "type": "address", - "name": "spender" - } - ], - "outputs": [ - { - "type": "uint256", - "name": "" - } - ] - }, - { - "type": "function", - "name": "approve", - "constant": false, - "payable": false, - "inputs": [ - { - "type": "address", - "name": "spender" - }, - { - "type": "uint256", - "name": "amount" - } - ], - "outputs": [ - { - "type": "bool", - "name": "" - } - ] - }, - { - "type": "function", - "name": "balanceOf", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [ - { - "type": "address", - "name": "user" - } - ], - "outputs": [ - { - "type": "uint256", - "name": "" - } - ] - }, - { - "type": "function", - "name": "burn", - "constant": false, - "payable": false, - "inputs": [ - { - "type": "address", - "name": "user" - }, - { - "type": "address", - "name": "receiverOfUnderlying" - }, - { - "type": "uint256", - "name": "amount" - }, - { - "type": "uint256", - "name": "index" - } - ], - "outputs": [] - }, - { - "type": "function", - "name": "decimals", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [ - { - "type": "uint8", - "name": "" - } - ] - }, - { - "type": "function", - "name": "decreaseAllowance", - "constant": false, - "payable": false, - "inputs": [ - { - "type": "address", - "name": "spender" - }, - { - "type": "uint256", - "name": "subtractedValue" - } - ], - "outputs": [ - { - "type": "bool", - "name": "" - } - ] - }, - { - "type": "function", - "name": "getIncentivesController", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [ - { - "type": "address", - "name": "" - } - ] - }, - { - "type": "function", - "name": "getScaledUserBalanceAndSupply", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [ - { - "type": "address", - "name": "user" - } - ], - "outputs": [ - { - "type": "uint256", - "name": "" - }, - { - "type": "uint256", - "name": "" - } - ] - }, - { - "type": "function", - "name": "increaseAllowance", - "constant": false, - "payable": false, - "inputs": [ - { - "type": "address", - "name": "spender" - }, - { - "type": "uint256", - "name": "addedValue" - } - ], - "outputs": [ - { - "type": "bool", - "name": "" - } - ] - }, - { - "type": "function", - "name": "initialize", - "constant": false, - "payable": false, - "inputs": [ - { - "type": "uint8", - "name": "underlyingAssetDecimals" - }, - { - "type": "string", - "name": "tokenName" - }, - { - "type": "string", - "name": "tokenSymbol" - } - ], - "outputs": [] - }, - { - "type": "function", - "name": "mint", - "constant": false, - "payable": false, - "inputs": [ - { - "type": "address", - "name": "user" - }, - { - "type": "uint256", - "name": "amount" - }, - { - "type": "uint256", - "name": "index" - } - ], - "outputs": [ - { - "type": "bool", - "name": "" - } - ] - }, - { - "type": "function", - "name": "mintToTreasury", - "constant": false, - "payable": false, - "inputs": [ - { - "type": "uint256", - "name": "amount" - }, - { - "type": "uint256", - "name": "index" - } - ], - "outputs": [] - }, - { - "type": "function", - "name": "name", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [ - { - "type": "string", - "name": "" - } - ] - }, - { - "type": "function", - "name": "permit", - "constant": false, - "payable": false, - "inputs": [ - { - "type": "address", - "name": "owner" - }, - { - "type": "address", - "name": "spender" - }, - { - "type": "uint256", - "name": "value" - }, - { - "type": "uint256", - "name": "deadline" - }, - { - "type": "uint8", - "name": "v" - }, - { - "type": "bytes32", - "name": "r" - }, - { - "type": "bytes32", - "name": "s" - } - ], - "outputs": [] - }, - { - "type": "function", - "name": "rescueTokens", - "constant": false, - "payable": false, - "inputs": [ - { - "type": "address", - "name": "token" - }, - { - "type": "address", - "name": "to" - }, - { - "type": "uint256", - "name": "amount" - } - ], - "outputs": [] - }, - { - "type": "function", - "name": "scaledBalanceOf", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [ - { - "type": "address", - "name": "user" - } - ], - "outputs": [ - { - "type": "uint256", - "name": "" - } - ] - }, - { - "type": "function", - "name": "scaledTotalSupply", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [ - { - "type": "uint256", - "name": "" - } - ] - }, - { - "type": "function", - "name": "symbol", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [ - { - "type": "string", - "name": "" - } - ] - }, - { - "type": "function", - "name": "totalSupply", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [ - { - "type": "uint256", - "name": "" - } - ] - }, - { - "type": "function", - "name": "transfer", - "constant": false, - "payable": false, - "inputs": [ - { - "type": "address", - "name": "recipient" - }, - { - "type": "uint256", - "name": "amount" - } - ], - "outputs": [ - { - "type": "bool", - "name": "" - } - ] - }, - { - "type": "function", - "name": "transferFrom", - "constant": false, - "payable": false, - "inputs": [ - { - "type": "address", - "name": "sender" - }, - { - "type": "address", - "name": "recipient" - }, - { - "type": "uint256", - "name": "amount" - } - ], - "outputs": [ - { - "type": "bool", - "name": "" - } - ] - }, - { - "type": "function", - "name": "transferOnLiquidation", - "constant": false, - "payable": false, - "inputs": [ - { - "type": "address", - "name": "from" - }, - { - "type": "address", - "name": "to" - }, - { - "type": "uint256", - "name": "value" - } - ], - "outputs": [] - }, - { - "type": "function", - "name": "transferUnderlyingTo", - "constant": false, - "payable": false, - "inputs": [ - { - "type": "address", - "name": "target" - }, - { - "type": "uint256", - "name": "amount" - } - ], - "outputs": [ - { - "type": "uint256", - "name": "" - } - ] - } -] as const diff --git a/src/abi/abi.support.ts b/src/abi/abi.support.ts new file mode 100644 index 00000000..d543a54e --- /dev/null +++ b/src/abi/abi.support.ts @@ -0,0 +1,2 @@ +export {event, func, indexed, ContractBase} from '@subsquid/evm-abi' +export type {EventParams, EventArgumentsInput, FunctionArguments, FunctionReturn, TopicFilter, IndexedTopicFilter} from '@subsquid/evm-abi' diff --git a/src/abi/aerodrome-amo-strategy.ts b/src/abi/aerodrome-amo-strategy.ts deleted file mode 100644 index fef301ed..00000000 --- a/src/abi/aerodrome-amo-strategy.ts +++ /dev/null @@ -1,368 +0,0 @@ -import * as p from '@subsquid/evm-codec' -import { event, fun, viewFun, indexed, ContractBase } from '@subsquid/evm-abi' -import type { EventParams as EParams, FunctionArguments, FunctionReturn } from '@subsquid/evm-abi' - -export const events = { - Deposit: event("0x5548c837ab068cf56a2c2479df0882a4922fd203edb7517321831d95078c5f62", "Deposit(address,address,uint256)", {"_asset": indexed(p.address), "_pToken": p.address, "_amount": p.uint256}), - GovernorshipTransferred: event("0xc7c0c772add429241571afb3805861fb3cfa2af374534088b76cdb4325a87e9a", "GovernorshipTransferred(address,address)", {"previousGovernor": indexed(p.address), "newGovernor": indexed(p.address)}), - HarvesterAddressesUpdated: event("0xe48386b84419f4d36e0f96c10cc3510b6fb1a33795620c5098b22472bbe90796", "HarvesterAddressesUpdated(address,address)", {"_oldHarvesterAddress": p.address, "_newHarvesterAddress": p.address}), - LiquidityAdded: event("0x1530ec748a27514ffab0987654233a80256393e127bdf02d94e32ff3c7148ec6", "LiquidityAdded(uint256,uint256,uint256,uint256,uint256,uint256)", {"wethAmountDesired": p.uint256, "oethbAmountDesired": p.uint256, "wethAmountSupplied": p.uint256, "oethbAmountSupplied": p.uint256, "tokenId": p.uint256, "underlyingAssets": p.uint256}), - LiquidityRemoved: event("0xede5d7a610050b00dde41dd385fe2d91a558dde29318267aa4e011678b58cfc5", "LiquidityRemoved(uint256,uint256,uint256,uint256,uint256,uint256)", {"withdrawLiquidityShare": p.uint256, "removedWETHAmount": p.uint256, "removedOETHbAmount": p.uint256, "wethAmountCollected": p.uint256, "oethbAmountCollected": p.uint256, "underlyingAssets": p.uint256}), - PTokenAdded: event("0xef6485b84315f9b1483beffa32aae9a0596890395e3d7521f1c5fbb51790e765", "PTokenAdded(address,address)", {"_asset": indexed(p.address), "_pToken": p.address}), - PTokenRemoved: event("0x16b7600acff27e39a8a96056b3d533045298de927507f5c1d97e4accde60488c", "PTokenRemoved(address,address)", {"_asset": indexed(p.address), "_pToken": p.address}), - PendingGovernorshipTransfer: event("0xa39cc5eb22d0f34d8beaefee8a3f17cc229c1a1d1ef87a5ad47313487b1c4f0d", "PendingGovernorshipTransfer(address,address)", {"previousGovernor": indexed(p.address), "newGovernor": indexed(p.address)}), - PoolRebalanced: event("0x0d0d42e29eda809becae4f120dfbc3799e17df829fa338f8035c724579423b89", "PoolRebalanced(uint256)", {"currentPoolWethShare": p.uint256}), - PoolWethShareIntervalUpdated: event("0xfb25072e740f40f37c0adb21abfa08b090c754a216aa3dce33b68fab089eff91", "PoolWethShareIntervalUpdated(uint256,uint256)", {"allowedWethShareStart": p.uint256, "allowedWethShareEnd": p.uint256}), - RewardTokenAddressesUpdated: event("0x04c0b9649497d316554306e53678d5f5f5dbc3a06f97dec13ff4cfe98b986bbc", "RewardTokenAddressesUpdated(address[],address[])", {"_oldAddresses": p.array(p.address), "_newAddresses": p.array(p.address)}), - RewardTokenCollected: event("0xf6c07a063ed4e63808eb8da7112d46dbcd38de2b40a73dbcc9353c5a94c72353", "RewardTokenCollected(address,address,uint256)", {"recipient": p.address, "rewardToken": p.address, "amount": p.uint256}), - UnderlyingAssetsUpdated: event("0xab1ece054738c773b84a8a32f5f969323c50dc7e28634302f91c7b75cb838782", "UnderlyingAssetsUpdated(uint256)", {"underlyingAssets": p.uint256}), - Withdrawal: event("0x2717ead6b9200dd235aad468c9809ea400fe33ac69b5bfaa6d3e90fc922b6398", "Withdrawal(address,address,uint256)", {"_asset": indexed(p.address), "_pToken": p.address, "_amount": p.uint256}), -} - -export const functions = { - OETHb: viewFun("0x7b3b6068", "OETHb()", {}, p.address), - SOLVENCY_THRESHOLD: viewFun("0x1b91d0cc", "SOLVENCY_THRESHOLD()", {}, p.uint256), - WETH: viewFun("0xad5c4648", "WETH()", {}, p.address), - allowedWethShareEnd: viewFun("0x042e586e", "allowedWethShareEnd()", {}, p.uint256), - allowedWethShareStart: viewFun("0x571fbf60", "allowedWethShareStart()", {}, p.uint256), - assetToPToken: viewFun("0x0fc3b4c4", "assetToPToken(address)", {"_0": p.address}, p.address), - checkBalance: viewFun("0x5f515226", "checkBalance(address)", {"_asset": p.address}, p.uint256), - clGauge: viewFun("0x3d6953d7", "clGauge()", {}, p.address), - clPool: viewFun("0x4c0339b4", "clPool()", {}, p.address), - claimGovernance: fun("0x5d36b190", "claimGovernance()", {}, ), - collectRewardTokens: fun("0x5a063f63", "collectRewardTokens()", {}, ), - deposit: fun("0x47e7ef24", "deposit(address,uint256)", {"_asset": p.address, "_amount": p.uint256}, ), - depositAll: fun("0xde5f6268", "depositAll()", {}, ), - getCurrentTradingTick: viewFun("0x30dbda18", "getCurrentTradingTick()", {}, p.int24), - getPoolX96Price: viewFun("0x30c83576", "getPoolX96Price()", {}, p.uint160), - getPositionPrincipal: viewFun("0x45557c1f", "getPositionPrincipal()", {}, {"_amountWeth": p.uint256, "_amountOethb": p.uint256}), - getRewardTokenAddresses: viewFun("0xf6ca71b0", "getRewardTokenAddresses()", {}, p.array(p.address)), - getWETHShare: viewFun("0xcd8b36c7", "getWETHShare()", {}, p.uint256), - governor: viewFun("0x0c340a24", "governor()", {}, p.address), - harvesterAddress: viewFun("0x67c7066c", "harvesterAddress()", {}, p.address), - helper: viewFun("0x63b0e66a", "helper()", {}, p.address), - initialize: fun("0xa224cee7", "initialize(address[])", {"_rewardTokenAddresses": p.array(p.address)}, ), - isGovernor: viewFun("0xc7af3352", "isGovernor()", {}, p.bool), - lowerTick: viewFun("0x9b1344ac", "lowerTick()", {}, p.int24), - onERC721Received: fun("0x150b7a02", "onERC721Received(address,address,uint256,bytes)", {"_0": p.address, "_1": p.address, "_2": p.uint256, "_3": p.bytes}, p.bytes4), - platformAddress: viewFun("0xdbe55e56", "platformAddress()", {}, p.address), - positionManager: viewFun("0x791b98bc", "positionManager()", {}, p.address), - rebalance: fun("0x7f1a327c", "rebalance(uint256,bool,uint256)", {"_amountToSwap": p.uint256, "_swapWeth": p.bool, "_minTokenReceived": p.uint256}, ), - removePToken: fun("0x9136616a", "removePToken(uint256)", {"_0": p.uint256}, ), - rewardTokenAddresses: viewFun("0x7b2d9b2c", "rewardTokenAddresses(uint256)", {"_0": p.uint256}, p.address), - safeApproveAllTokens: fun("0xad1728cb", "safeApproveAllTokens()", {}, ), - setAllowedPoolWethShareInterval: fun("0x01701fe9", "setAllowedPoolWethShareInterval(uint256,uint256)", {"_allowedWethShareStart": p.uint256, "_allowedWethShareEnd": p.uint256}, ), - setHarvesterAddress: fun("0xc2e1e3f4", "setHarvesterAddress(address)", {"_harvesterAddress": p.address}, ), - setPTokenAddress: fun("0x0ed57b3a", "setPTokenAddress(address,address)", {"_0": p.address, "_1": p.address}, ), - setRewardTokenAddresses: fun("0x96d538bb", "setRewardTokenAddresses(address[])", {"_rewardTokenAddresses": p.array(p.address)}, ), - sqrtRatioX96TickClosestToParity: viewFun("0x4bc9c477", "sqrtRatioX96TickClosestToParity()", {}, p.uint160), - sqrtRatioX96TickHigher: viewFun("0x65f1389d", "sqrtRatioX96TickHigher()", {}, p.uint160), - sqrtRatioX96TickLower: viewFun("0x153eb6d1", "sqrtRatioX96TickLower()", {}, p.uint160), - supportsAsset: viewFun("0xaa388af6", "supportsAsset(address)", {"_asset": p.address}, p.bool), - swapRouter: viewFun("0xc31c9c07", "swapRouter()", {}, p.address), - tickSpacing: viewFun("0xd0c93a7c", "tickSpacing()", {}, p.int24), - tokenId: viewFun("0x17d70f7c", "tokenId()", {}, p.uint256), - transferGovernance: fun("0xd38bfff4", "transferGovernance(address)", {"_newGovernor": p.address}, ), - transferToken: fun("0x1072cbea", "transferToken(address,uint256)", {"_asset": p.address, "_amount": p.uint256}, ), - underlyingAssets: viewFun("0x9c1eb3da", "underlyingAssets()", {}, p.uint256), - upperTick: viewFun("0x727dd228", "upperTick()", {}, p.int24), - vaultAddress: viewFun("0x430bf08a", "vaultAddress()", {}, p.address), - withdraw: fun("0xd9caed12", "withdraw(address,address,uint256)", {"_recipient": p.address, "_asset": p.address, "_amount": p.uint256}, ), - withdrawAll: fun("0x853828b6", "withdrawAll()", {}, ), -} - -export class Contract extends ContractBase { - - OETHb() { - return this.eth_call(functions.OETHb, {}) - } - - SOLVENCY_THRESHOLD() { - return this.eth_call(functions.SOLVENCY_THRESHOLD, {}) - } - - WETH() { - return this.eth_call(functions.WETH, {}) - } - - allowedWethShareEnd() { - return this.eth_call(functions.allowedWethShareEnd, {}) - } - - allowedWethShareStart() { - return this.eth_call(functions.allowedWethShareStart, {}) - } - - assetToPToken(_0: AssetToPTokenParams["_0"]) { - return this.eth_call(functions.assetToPToken, {_0}) - } - - checkBalance(_asset: CheckBalanceParams["_asset"]) { - return this.eth_call(functions.checkBalance, {_asset}) - } - - clGauge() { - return this.eth_call(functions.clGauge, {}) - } - - clPool() { - return this.eth_call(functions.clPool, {}) - } - - getCurrentTradingTick() { - return this.eth_call(functions.getCurrentTradingTick, {}) - } - - getPoolX96Price() { - return this.eth_call(functions.getPoolX96Price, {}) - } - - getPositionPrincipal() { - return this.eth_call(functions.getPositionPrincipal, {}) - } - - getRewardTokenAddresses() { - return this.eth_call(functions.getRewardTokenAddresses, {}) - } - - getWETHShare() { - return this.eth_call(functions.getWETHShare, {}) - } - - governor() { - return this.eth_call(functions.governor, {}) - } - - harvesterAddress() { - return this.eth_call(functions.harvesterAddress, {}) - } - - helper() { - return this.eth_call(functions.helper, {}) - } - - isGovernor() { - return this.eth_call(functions.isGovernor, {}) - } - - lowerTick() { - return this.eth_call(functions.lowerTick, {}) - } - - platformAddress() { - return this.eth_call(functions.platformAddress, {}) - } - - positionManager() { - return this.eth_call(functions.positionManager, {}) - } - - rewardTokenAddresses(_0: RewardTokenAddressesParams["_0"]) { - return this.eth_call(functions.rewardTokenAddresses, {_0}) - } - - sqrtRatioX96TickClosestToParity() { - return this.eth_call(functions.sqrtRatioX96TickClosestToParity, {}) - } - - sqrtRatioX96TickHigher() { - return this.eth_call(functions.sqrtRatioX96TickHigher, {}) - } - - sqrtRatioX96TickLower() { - return this.eth_call(functions.sqrtRatioX96TickLower, {}) - } - - supportsAsset(_asset: SupportsAssetParams["_asset"]) { - return this.eth_call(functions.supportsAsset, {_asset}) - } - - swapRouter() { - return this.eth_call(functions.swapRouter, {}) - } - - tickSpacing() { - return this.eth_call(functions.tickSpacing, {}) - } - - tokenId() { - return this.eth_call(functions.tokenId, {}) - } - - underlyingAssets() { - return this.eth_call(functions.underlyingAssets, {}) - } - - upperTick() { - return this.eth_call(functions.upperTick, {}) - } - - vaultAddress() { - return this.eth_call(functions.vaultAddress, {}) - } -} - -/// Event types -export type DepositEventArgs = EParams -export type GovernorshipTransferredEventArgs = EParams -export type HarvesterAddressesUpdatedEventArgs = EParams -export type LiquidityAddedEventArgs = EParams -export type LiquidityRemovedEventArgs = EParams -export type PTokenAddedEventArgs = EParams -export type PTokenRemovedEventArgs = EParams -export type PendingGovernorshipTransferEventArgs = EParams -export type PoolRebalancedEventArgs = EParams -export type PoolWethShareIntervalUpdatedEventArgs = EParams -export type RewardTokenAddressesUpdatedEventArgs = EParams -export type RewardTokenCollectedEventArgs = EParams -export type UnderlyingAssetsUpdatedEventArgs = EParams -export type WithdrawalEventArgs = EParams - -/// Function types -export type OETHbParams = FunctionArguments -export type OETHbReturn = FunctionReturn - -export type SOLVENCY_THRESHOLDParams = FunctionArguments -export type SOLVENCY_THRESHOLDReturn = FunctionReturn - -export type WETHParams = FunctionArguments -export type WETHReturn = FunctionReturn - -export type AllowedWethShareEndParams = FunctionArguments -export type AllowedWethShareEndReturn = FunctionReturn - -export type AllowedWethShareStartParams = FunctionArguments -export type AllowedWethShareStartReturn = FunctionReturn - -export type AssetToPTokenParams = FunctionArguments -export type AssetToPTokenReturn = FunctionReturn - -export type CheckBalanceParams = FunctionArguments -export type CheckBalanceReturn = FunctionReturn - -export type ClGaugeParams = FunctionArguments -export type ClGaugeReturn = FunctionReturn - -export type ClPoolParams = FunctionArguments -export type ClPoolReturn = FunctionReturn - -export type ClaimGovernanceParams = FunctionArguments -export type ClaimGovernanceReturn = FunctionReturn - -export type CollectRewardTokensParams = FunctionArguments -export type CollectRewardTokensReturn = FunctionReturn - -export type DepositParams = FunctionArguments -export type DepositReturn = FunctionReturn - -export type DepositAllParams = FunctionArguments -export type DepositAllReturn = FunctionReturn - -export type GetCurrentTradingTickParams = FunctionArguments -export type GetCurrentTradingTickReturn = FunctionReturn - -export type GetPoolX96PriceParams = FunctionArguments -export type GetPoolX96PriceReturn = FunctionReturn - -export type GetPositionPrincipalParams = FunctionArguments -export type GetPositionPrincipalReturn = FunctionReturn - -export type GetRewardTokenAddressesParams = FunctionArguments -export type GetRewardTokenAddressesReturn = FunctionReturn - -export type GetWETHShareParams = FunctionArguments -export type GetWETHShareReturn = FunctionReturn - -export type GovernorParams = FunctionArguments -export type GovernorReturn = FunctionReturn - -export type HarvesterAddressParams = FunctionArguments -export type HarvesterAddressReturn = FunctionReturn - -export type HelperParams = FunctionArguments -export type HelperReturn = FunctionReturn - -export type InitializeParams = FunctionArguments -export type InitializeReturn = FunctionReturn - -export type IsGovernorParams = FunctionArguments -export type IsGovernorReturn = FunctionReturn - -export type LowerTickParams = FunctionArguments -export type LowerTickReturn = FunctionReturn - -export type OnERC721ReceivedParams = FunctionArguments -export type OnERC721ReceivedReturn = FunctionReturn - -export type PlatformAddressParams = FunctionArguments -export type PlatformAddressReturn = FunctionReturn - -export type PositionManagerParams = FunctionArguments -export type PositionManagerReturn = FunctionReturn - -export type RebalanceParams = FunctionArguments -export type RebalanceReturn = FunctionReturn - -export type RemovePTokenParams = FunctionArguments -export type RemovePTokenReturn = FunctionReturn - -export type RewardTokenAddressesParams = FunctionArguments -export type RewardTokenAddressesReturn = FunctionReturn - -export type SafeApproveAllTokensParams = FunctionArguments -export type SafeApproveAllTokensReturn = FunctionReturn - -export type SetAllowedPoolWethShareIntervalParams = FunctionArguments -export type SetAllowedPoolWethShareIntervalReturn = FunctionReturn - -export type SetHarvesterAddressParams = FunctionArguments -export type SetHarvesterAddressReturn = FunctionReturn - -export type SetPTokenAddressParams = FunctionArguments -export type SetPTokenAddressReturn = FunctionReturn - -export type SetRewardTokenAddressesParams = FunctionArguments -export type SetRewardTokenAddressesReturn = FunctionReturn - -export type SqrtRatioX96TickClosestToParityParams = FunctionArguments -export type SqrtRatioX96TickClosestToParityReturn = FunctionReturn - -export type SqrtRatioX96TickHigherParams = FunctionArguments -export type SqrtRatioX96TickHigherReturn = FunctionReturn - -export type SqrtRatioX96TickLowerParams = FunctionArguments -export type SqrtRatioX96TickLowerReturn = FunctionReturn - -export type SupportsAssetParams = FunctionArguments -export type SupportsAssetReturn = FunctionReturn - -export type SwapRouterParams = FunctionArguments -export type SwapRouterReturn = FunctionReturn - -export type TickSpacingParams = FunctionArguments -export type TickSpacingReturn = FunctionReturn - -export type TokenIdParams = FunctionArguments -export type TokenIdReturn = FunctionReturn - -export type TransferGovernanceParams = FunctionArguments -export type TransferGovernanceReturn = FunctionReturn - -export type TransferTokenParams = FunctionArguments -export type TransferTokenReturn = FunctionReturn - -export type UnderlyingAssetsParams = FunctionArguments -export type UnderlyingAssetsReturn = FunctionReturn - -export type UpperTickParams = FunctionArguments -export type UpperTickReturn = FunctionReturn - -export type VaultAddressParams = FunctionArguments -export type VaultAddressReturn = FunctionReturn - -export type WithdrawParams = FunctionArguments -export type WithdrawReturn = FunctionReturn - -export type WithdrawAllParams = FunctionArguments -export type WithdrawAllReturn = FunctionReturn - diff --git a/src/abi/aerodrome-amo-strategy/contract.ts b/src/abi/aerodrome-amo-strategy/contract.ts new file mode 100644 index 00000000..d7de15ce --- /dev/null +++ b/src/abi/aerodrome-amo-strategy/contract.ts @@ -0,0 +1,137 @@ +import { ContractBase } from '../abi.support.js' +import { OETHb, SOLVENCY_THRESHOLD, WETH, allowedWethShareEnd, allowedWethShareStart, assetToPToken, checkBalance, clGauge, clPool, getCurrentTradingTick, getPoolX96Price, getPositionPrincipal, getRewardTokenAddresses, getWETHShare, governor, harvesterAddress, helper, isGovernor, lowerTick, onERC721Received, platformAddress, positionManager, rewardTokenAddresses, sqrtRatioX96TickClosestToParity, sqrtRatioX96TickHigher, sqrtRatioX96TickLower, supportsAsset, swapRouter, tickSpacing, tokenId, underlyingAssets, upperTick, vaultAddress } from './functions.js' +import type { AssetToPTokenParams, CheckBalanceParams, OnERC721ReceivedParams, RewardTokenAddressesParams, SupportsAssetParams } from './functions.js' + +export class Contract extends ContractBase { + OETHb() { + return this.eth_call(OETHb, {}) + } + + SOLVENCY_THRESHOLD() { + return this.eth_call(SOLVENCY_THRESHOLD, {}) + } + + WETH() { + return this.eth_call(WETH, {}) + } + + allowedWethShareEnd() { + return this.eth_call(allowedWethShareEnd, {}) + } + + allowedWethShareStart() { + return this.eth_call(allowedWethShareStart, {}) + } + + assetToPToken(_0: AssetToPTokenParams["_0"]) { + return this.eth_call(assetToPToken, {_0}) + } + + checkBalance(_asset: CheckBalanceParams["_asset"]) { + return this.eth_call(checkBalance, {_asset}) + } + + clGauge() { + return this.eth_call(clGauge, {}) + } + + clPool() { + return this.eth_call(clPool, {}) + } + + getCurrentTradingTick() { + return this.eth_call(getCurrentTradingTick, {}) + } + + getPoolX96Price() { + return this.eth_call(getPoolX96Price, {}) + } + + getPositionPrincipal() { + return this.eth_call(getPositionPrincipal, {}) + } + + getRewardTokenAddresses() { + return this.eth_call(getRewardTokenAddresses, {}) + } + + getWETHShare() { + return this.eth_call(getWETHShare, {}) + } + + governor() { + return this.eth_call(governor, {}) + } + + harvesterAddress() { + return this.eth_call(harvesterAddress, {}) + } + + helper() { + return this.eth_call(helper, {}) + } + + isGovernor() { + return this.eth_call(isGovernor, {}) + } + + lowerTick() { + return this.eth_call(lowerTick, {}) + } + + onERC721Received(_0: OnERC721ReceivedParams["_0"], _1: OnERC721ReceivedParams["_1"], _2: OnERC721ReceivedParams["_2"], _3: OnERC721ReceivedParams["_3"]) { + return this.eth_call(onERC721Received, {_0, _1, _2, _3}) + } + + platformAddress() { + return this.eth_call(platformAddress, {}) + } + + positionManager() { + return this.eth_call(positionManager, {}) + } + + rewardTokenAddresses(_0: RewardTokenAddressesParams["_0"]) { + return this.eth_call(rewardTokenAddresses, {_0}) + } + + sqrtRatioX96TickClosestToParity() { + return this.eth_call(sqrtRatioX96TickClosestToParity, {}) + } + + sqrtRatioX96TickHigher() { + return this.eth_call(sqrtRatioX96TickHigher, {}) + } + + sqrtRatioX96TickLower() { + return this.eth_call(sqrtRatioX96TickLower, {}) + } + + supportsAsset(_asset: SupportsAssetParams["_asset"]) { + return this.eth_call(supportsAsset, {_asset}) + } + + swapRouter() { + return this.eth_call(swapRouter, {}) + } + + tickSpacing() { + return this.eth_call(tickSpacing, {}) + } + + tokenId() { + return this.eth_call(tokenId, {}) + } + + underlyingAssets() { + return this.eth_call(underlyingAssets, {}) + } + + upperTick() { + return this.eth_call(upperTick, {}) + } + + vaultAddress() { + return this.eth_call(vaultAddress, {}) + } +} diff --git a/src/abi/aerodrome-amo-strategy/events.ts b/src/abi/aerodrome-amo-strategy/events.ts new file mode 100644 index 00000000..091302f0 --- /dev/null +++ b/src/abi/aerodrome-amo-strategy/events.ts @@ -0,0 +1,110 @@ +import { address, array, uint256 } from '@subsquid/evm-codec' +import { event, indexed } from '../abi.support.js' +import type { EventParams as EParams } from '../abi.support.js' + +/** Deposit(address,address,uint256) */ +export const Deposit = event('0x5548c837ab068cf56a2c2479df0882a4922fd203edb7517321831d95078c5f62', { + _asset: indexed(address), + _pToken: address, + _amount: uint256, +}) +export type DepositEventArgs = EParams + +/** GovernorshipTransferred(address,address) */ +export const GovernorshipTransferred = event('0xc7c0c772add429241571afb3805861fb3cfa2af374534088b76cdb4325a87e9a', { + previousGovernor: indexed(address), + newGovernor: indexed(address), +}) +export type GovernorshipTransferredEventArgs = EParams + +/** HarvesterAddressesUpdated(address,address) */ +export const HarvesterAddressesUpdated = event('0xe48386b84419f4d36e0f96c10cc3510b6fb1a33795620c5098b22472bbe90796', { + _oldHarvesterAddress: address, + _newHarvesterAddress: address, +}) +export type HarvesterAddressesUpdatedEventArgs = EParams + +/** LiquidityAdded(uint256,uint256,uint256,uint256,uint256,uint256) */ +export const LiquidityAdded = event('0x1530ec748a27514ffab0987654233a80256393e127bdf02d94e32ff3c7148ec6', { + wethAmountDesired: uint256, + oethbAmountDesired: uint256, + wethAmountSupplied: uint256, + oethbAmountSupplied: uint256, + tokenId: uint256, + underlyingAssets: uint256, +}) +export type LiquidityAddedEventArgs = EParams + +/** LiquidityRemoved(uint256,uint256,uint256,uint256,uint256,uint256) */ +export const LiquidityRemoved = event('0xede5d7a610050b00dde41dd385fe2d91a558dde29318267aa4e011678b58cfc5', { + withdrawLiquidityShare: uint256, + removedWETHAmount: uint256, + removedOETHbAmount: uint256, + wethAmountCollected: uint256, + oethbAmountCollected: uint256, + underlyingAssets: uint256, +}) +export type LiquidityRemovedEventArgs = EParams + +/** PTokenAdded(address,address) */ +export const PTokenAdded = event('0xef6485b84315f9b1483beffa32aae9a0596890395e3d7521f1c5fbb51790e765', { + _asset: indexed(address), + _pToken: address, +}) +export type PTokenAddedEventArgs = EParams + +/** PTokenRemoved(address,address) */ +export const PTokenRemoved = event('0x16b7600acff27e39a8a96056b3d533045298de927507f5c1d97e4accde60488c', { + _asset: indexed(address), + _pToken: address, +}) +export type PTokenRemovedEventArgs = EParams + +/** PendingGovernorshipTransfer(address,address) */ +export const PendingGovernorshipTransfer = event('0xa39cc5eb22d0f34d8beaefee8a3f17cc229c1a1d1ef87a5ad47313487b1c4f0d', { + previousGovernor: indexed(address), + newGovernor: indexed(address), +}) +export type PendingGovernorshipTransferEventArgs = EParams + +/** PoolRebalanced(uint256) */ +export const PoolRebalanced = event('0x0d0d42e29eda809becae4f120dfbc3799e17df829fa338f8035c724579423b89', { + currentPoolWethShare: uint256, +}) +export type PoolRebalancedEventArgs = EParams + +/** PoolWethShareIntervalUpdated(uint256,uint256) */ +export const PoolWethShareIntervalUpdated = event('0xfb25072e740f40f37c0adb21abfa08b090c754a216aa3dce33b68fab089eff91', { + allowedWethShareStart: uint256, + allowedWethShareEnd: uint256, +}) +export type PoolWethShareIntervalUpdatedEventArgs = EParams + +/** RewardTokenAddressesUpdated(address[],address[]) */ +export const RewardTokenAddressesUpdated = event('0x04c0b9649497d316554306e53678d5f5f5dbc3a06f97dec13ff4cfe98b986bbc', { + _oldAddresses: array(address), + _newAddresses: array(address), +}) +export type RewardTokenAddressesUpdatedEventArgs = EParams + +/** RewardTokenCollected(address,address,uint256) */ +export const RewardTokenCollected = event('0xf6c07a063ed4e63808eb8da7112d46dbcd38de2b40a73dbcc9353c5a94c72353', { + recipient: address, + rewardToken: address, + amount: uint256, +}) +export type RewardTokenCollectedEventArgs = EParams + +/** UnderlyingAssetsUpdated(uint256) */ +export const UnderlyingAssetsUpdated = event('0xab1ece054738c773b84a8a32f5f969323c50dc7e28634302f91c7b75cb838782', { + underlyingAssets: uint256, +}) +export type UnderlyingAssetsUpdatedEventArgs = EParams + +/** Withdrawal(address,address,uint256) */ +export const Withdrawal = event('0x2717ead6b9200dd235aad468c9809ea400fe33ac69b5bfaa6d3e90fc922b6398', { + _asset: indexed(address), + _pToken: address, + _amount: uint256, +}) +export type WithdrawalEventArgs = EParams diff --git a/src/abi/aerodrome-amo-strategy/functions.ts b/src/abi/aerodrome-amo-strategy/functions.ts new file mode 100644 index 00000000..4462a53e --- /dev/null +++ b/src/abi/aerodrome-amo-strategy/functions.ts @@ -0,0 +1,294 @@ +import { address, array, bool, bytes, bytes4, int24, struct, uint160, uint256 } from '@subsquid/evm-codec' +import { func } from '../abi.support.js' +import type { FunctionArguments, FunctionReturn } from '../abi.support.js' + +/** OETHb() */ +export const OETHb = func('0x7b3b6068', {}, address) +export type OETHbParams = FunctionArguments +export type OETHbReturn = FunctionReturn + +/** SOLVENCY_THRESHOLD() */ +export const SOLVENCY_THRESHOLD = func('0x1b91d0cc', {}, uint256) +export type SOLVENCY_THRESHOLDParams = FunctionArguments +export type SOLVENCY_THRESHOLDReturn = FunctionReturn + +/** WETH() */ +export const WETH = func('0xad5c4648', {}, address) +export type WETHParams = FunctionArguments +export type WETHReturn = FunctionReturn + +/** allowedWethShareEnd() */ +export const allowedWethShareEnd = func('0x042e586e', {}, uint256) +export type AllowedWethShareEndParams = FunctionArguments +export type AllowedWethShareEndReturn = FunctionReturn + +/** allowedWethShareStart() */ +export const allowedWethShareStart = func('0x571fbf60', {}, uint256) +export type AllowedWethShareStartParams = FunctionArguments +export type AllowedWethShareStartReturn = FunctionReturn + +/** assetToPToken(address) */ +export const assetToPToken = func('0x0fc3b4c4', { + _0: address, +}, address) +export type AssetToPTokenParams = FunctionArguments +export type AssetToPTokenReturn = FunctionReturn + +/** checkBalance(address) */ +export const checkBalance = func('0x5f515226', { + _asset: address, +}, uint256) +export type CheckBalanceParams = FunctionArguments +export type CheckBalanceReturn = FunctionReturn + +/** clGauge() */ +export const clGauge = func('0x3d6953d7', {}, address) +export type ClGaugeParams = FunctionArguments +export type ClGaugeReturn = FunctionReturn + +/** clPool() */ +export const clPool = func('0x4c0339b4', {}, address) +export type ClPoolParams = FunctionArguments +export type ClPoolReturn = FunctionReturn + +/** claimGovernance() */ +export const claimGovernance = func('0x5d36b190', {}) +export type ClaimGovernanceParams = FunctionArguments +export type ClaimGovernanceReturn = FunctionReturn + +/** collectRewardTokens() */ +export const collectRewardTokens = func('0x5a063f63', {}) +export type CollectRewardTokensParams = FunctionArguments +export type CollectRewardTokensReturn = FunctionReturn + +/** deposit(address,uint256) */ +export const deposit = func('0x47e7ef24', { + _asset: address, + _amount: uint256, +}) +export type DepositParams = FunctionArguments +export type DepositReturn = FunctionReturn + +/** depositAll() */ +export const depositAll = func('0xde5f6268', {}) +export type DepositAllParams = FunctionArguments +export type DepositAllReturn = FunctionReturn + +/** getCurrentTradingTick() */ +export const getCurrentTradingTick = func('0x30dbda18', {}, int24) +export type GetCurrentTradingTickParams = FunctionArguments +export type GetCurrentTradingTickReturn = FunctionReturn + +/** getPoolX96Price() */ +export const getPoolX96Price = func('0x30c83576', {}, uint160) +export type GetPoolX96PriceParams = FunctionArguments +export type GetPoolX96PriceReturn = FunctionReturn + +/** getPositionPrincipal() */ +export const getPositionPrincipal = func('0x45557c1f', {}, struct({ + _amountWeth: uint256, + _amountOethb: uint256, +})) +export type GetPositionPrincipalParams = FunctionArguments +export type GetPositionPrincipalReturn = FunctionReturn + +/** getRewardTokenAddresses() */ +export const getRewardTokenAddresses = func('0xf6ca71b0', {}, array(address)) +export type GetRewardTokenAddressesParams = FunctionArguments +export type GetRewardTokenAddressesReturn = FunctionReturn + +/** getWETHShare() */ +export const getWETHShare = func('0xcd8b36c7', {}, uint256) +export type GetWETHShareParams = FunctionArguments +export type GetWETHShareReturn = FunctionReturn + +/** governor() */ +export const governor = func('0x0c340a24', {}, address) +export type GovernorParams = FunctionArguments +export type GovernorReturn = FunctionReturn + +/** harvesterAddress() */ +export const harvesterAddress = func('0x67c7066c', {}, address) +export type HarvesterAddressParams = FunctionArguments +export type HarvesterAddressReturn = FunctionReturn + +/** helper() */ +export const helper = func('0x63b0e66a', {}, address) +export type HelperParams = FunctionArguments +export type HelperReturn = FunctionReturn + +/** initialize(address[]) */ +export const initialize = func('0xa224cee7', { + _rewardTokenAddresses: array(address), +}) +export type InitializeParams = FunctionArguments +export type InitializeReturn = FunctionReturn + +/** isGovernor() */ +export const isGovernor = func('0xc7af3352', {}, bool) +export type IsGovernorParams = FunctionArguments +export type IsGovernorReturn = FunctionReturn + +/** lowerTick() */ +export const lowerTick = func('0x9b1344ac', {}, int24) +export type LowerTickParams = FunctionArguments +export type LowerTickReturn = FunctionReturn + +/** onERC721Received(address,address,uint256,bytes) */ +export const onERC721Received = func('0x150b7a02', { + _0: address, + _1: address, + _2: uint256, + _3: bytes, +}, bytes4) +export type OnERC721ReceivedParams = FunctionArguments +export type OnERC721ReceivedReturn = FunctionReturn + +/** platformAddress() */ +export const platformAddress = func('0xdbe55e56', {}, address) +export type PlatformAddressParams = FunctionArguments +export type PlatformAddressReturn = FunctionReturn + +/** positionManager() */ +export const positionManager = func('0x791b98bc', {}, address) +export type PositionManagerParams = FunctionArguments +export type PositionManagerReturn = FunctionReturn + +/** rebalance(uint256,bool,uint256) */ +export const rebalance = func('0x7f1a327c', { + _amountToSwap: uint256, + _swapWeth: bool, + _minTokenReceived: uint256, +}) +export type RebalanceParams = FunctionArguments +export type RebalanceReturn = FunctionReturn + +/** removePToken(uint256) */ +export const removePToken = func('0x9136616a', { + _0: uint256, +}) +export type RemovePTokenParams = FunctionArguments +export type RemovePTokenReturn = FunctionReturn + +/** rewardTokenAddresses(uint256) */ +export const rewardTokenAddresses = func('0x7b2d9b2c', { + _0: uint256, +}, address) +export type RewardTokenAddressesParams = FunctionArguments +export type RewardTokenAddressesReturn = FunctionReturn + +/** safeApproveAllTokens() */ +export const safeApproveAllTokens = func('0xad1728cb', {}) +export type SafeApproveAllTokensParams = FunctionArguments +export type SafeApproveAllTokensReturn = FunctionReturn + +/** setAllowedPoolWethShareInterval(uint256,uint256) */ +export const setAllowedPoolWethShareInterval = func('0x01701fe9', { + _allowedWethShareStart: uint256, + _allowedWethShareEnd: uint256, +}) +export type SetAllowedPoolWethShareIntervalParams = FunctionArguments +export type SetAllowedPoolWethShareIntervalReturn = FunctionReturn + +/** setHarvesterAddress(address) */ +export const setHarvesterAddress = func('0xc2e1e3f4', { + _harvesterAddress: address, +}) +export type SetHarvesterAddressParams = FunctionArguments +export type SetHarvesterAddressReturn = FunctionReturn + +/** setPTokenAddress(address,address) */ +export const setPTokenAddress = func('0x0ed57b3a', { + _0: address, + _1: address, +}) +export type SetPTokenAddressParams = FunctionArguments +export type SetPTokenAddressReturn = FunctionReturn + +/** setRewardTokenAddresses(address[]) */ +export const setRewardTokenAddresses = func('0x96d538bb', { + _rewardTokenAddresses: array(address), +}) +export type SetRewardTokenAddressesParams = FunctionArguments +export type SetRewardTokenAddressesReturn = FunctionReturn + +/** sqrtRatioX96TickClosestToParity() */ +export const sqrtRatioX96TickClosestToParity = func('0x4bc9c477', {}, uint160) +export type SqrtRatioX96TickClosestToParityParams = FunctionArguments +export type SqrtRatioX96TickClosestToParityReturn = FunctionReturn + +/** sqrtRatioX96TickHigher() */ +export const sqrtRatioX96TickHigher = func('0x65f1389d', {}, uint160) +export type SqrtRatioX96TickHigherParams = FunctionArguments +export type SqrtRatioX96TickHigherReturn = FunctionReturn + +/** sqrtRatioX96TickLower() */ +export const sqrtRatioX96TickLower = func('0x153eb6d1', {}, uint160) +export type SqrtRatioX96TickLowerParams = FunctionArguments +export type SqrtRatioX96TickLowerReturn = FunctionReturn + +/** supportsAsset(address) */ +export const supportsAsset = func('0xaa388af6', { + _asset: address, +}, bool) +export type SupportsAssetParams = FunctionArguments +export type SupportsAssetReturn = FunctionReturn + +/** swapRouter() */ +export const swapRouter = func('0xc31c9c07', {}, address) +export type SwapRouterParams = FunctionArguments +export type SwapRouterReturn = FunctionReturn + +/** tickSpacing() */ +export const tickSpacing = func('0xd0c93a7c', {}, int24) +export type TickSpacingParams = FunctionArguments +export type TickSpacingReturn = FunctionReturn + +/** tokenId() */ +export const tokenId = func('0x17d70f7c', {}, uint256) +export type TokenIdParams = FunctionArguments +export type TokenIdReturn = FunctionReturn + +/** transferGovernance(address) */ +export const transferGovernance = func('0xd38bfff4', { + _newGovernor: address, +}) +export type TransferGovernanceParams = FunctionArguments +export type TransferGovernanceReturn = FunctionReturn + +/** transferToken(address,uint256) */ +export const transferToken = func('0x1072cbea', { + _asset: address, + _amount: uint256, +}) +export type TransferTokenParams = FunctionArguments +export type TransferTokenReturn = FunctionReturn + +/** underlyingAssets() */ +export const underlyingAssets = func('0x9c1eb3da', {}, uint256) +export type UnderlyingAssetsParams = FunctionArguments +export type UnderlyingAssetsReturn = FunctionReturn + +/** upperTick() */ +export const upperTick = func('0x727dd228', {}, int24) +export type UpperTickParams = FunctionArguments +export type UpperTickReturn = FunctionReturn + +/** vaultAddress() */ +export const vaultAddress = func('0x430bf08a', {}, address) +export type VaultAddressParams = FunctionArguments +export type VaultAddressReturn = FunctionReturn + +/** withdraw(address,address,uint256) */ +export const withdraw = func('0xd9caed12', { + _recipient: address, + _asset: address, + _amount: uint256, +}) +export type WithdrawParams = FunctionArguments +export type WithdrawReturn = FunctionReturn + +/** withdrawAll() */ +export const withdrawAll = func('0x853828b6', {}) +export type WithdrawAllParams = FunctionArguments +export type WithdrawAllReturn = FunctionReturn diff --git a/src/abi/aerodrome-amo-strategy/index.ts b/src/abi/aerodrome-amo-strategy/index.ts new file mode 100644 index 00000000..11829d6e --- /dev/null +++ b/src/abi/aerodrome-amo-strategy/index.ts @@ -0,0 +1,4 @@ +export * as events from './events.js' +export * as functions from './functions.js' + +export { Contract } from './contract.js' diff --git a/src/abi/aerodrome-cl-gauge.ts b/src/abi/aerodrome-cl-gauge.ts deleted file mode 100644 index 8bc50933..00000000 --- a/src/abi/aerodrome-cl-gauge.ts +++ /dev/null @@ -1,266 +0,0 @@ -import * as p from '@subsquid/evm-codec' -import { event, fun, viewFun, indexed, ContractBase } from '@subsquid/evm-abi' -import type { EventParams as EParams, FunctionArguments, FunctionReturn } from '@subsquid/evm-abi' - -export const events = { - ClaimFees: event("0xbc567d6cbad26368064baa0ab5a757be46aae4d70f707f9203d9d9b6c8ccbfa3", "ClaimFees(address,uint256,uint256)", {"from": indexed(p.address), "claimed0": p.uint256, "claimed1": p.uint256}), - ClaimRewards: event("0x1f89f96333d3133000ee447473151fa9606543368f02271c9d95ae14f13bcc67", "ClaimRewards(address,uint256)", {"from": indexed(p.address), "amount": p.uint256}), - Deposit: event("0x1c8ab8c7f45390d58f58f1d655213a82cca5d12179761a87c16f098813b8f211", "Deposit(address,uint256,uint128)", {"user": indexed(p.address), "tokenId": indexed(p.uint256), "liquidityToStake": indexed(p.uint128)}), - NotifyReward: event("0x095667752957714306e1a6ad83495404412df6fdb932fca6dc849a7ee910d4c1", "NotifyReward(address,uint256)", {"from": indexed(p.address), "amount": p.uint256}), - Withdraw: event("0x8903a5b5d08a841e7f68438387f1da20c84dea756379ed37e633ff3854b99b84", "Withdraw(address,uint256,uint128)", {"user": indexed(p.address), "tokenId": indexed(p.uint256), "liquidityToStake": indexed(p.uint128)}), -} - -export const functions = { - WETH9: viewFun("0x4aa4a4fc", "WETH9()", {}, p.address), - deposit: fun("0xb6b55f25", "deposit(uint256)", {"tokenId": p.uint256}, ), - earned: viewFun("0x3e491d47", "earned(address,uint256)", {"account": p.address, "tokenId": p.uint256}, p.uint256), - fees0: viewFun("0x93f1c442", "fees0()", {}, p.uint256), - fees1: viewFun("0x4c02a21c", "fees1()", {}, p.uint256), - feesVotingReward: viewFun("0x0fe2f711", "feesVotingReward()", {}, p.address), - gaugeFactory: viewFun("0x0d52333c", "gaugeFactory()", {}, p.address), - 'getReward(uint256)': fun("0x1c4b774b", "getReward(uint256)", {"tokenId": p.uint256}, ), - 'getReward(address)': fun("0xc00007b0", "getReward(address)", {"account": p.address}, ), - initialize: fun("0x391ffff8", "initialize(address,address,address,address,address,address,address,int24,bool)", {"_pool": p.address, "_feesVotingReward": p.address, "_rewardToken": p.address, "_voter": p.address, "_nft": p.address, "_token0": p.address, "_token1": p.address, "_tickSpacing": p.int24, "_isPool": p.bool}, ), - isPool: viewFun("0xe2e1c6db", "isPool()", {}, p.bool), - lastUpdateTime: viewFun("0x4bcddb1f", "lastUpdateTime(uint256)", {"_0": p.uint256}, p.uint256), - left: viewFun("0x16e64048", "left()", {}, p.uint256), - nft: viewFun("0x47ccca02", "nft()", {}, p.address), - notifyRewardAmount: fun("0x3c6b16ab", "notifyRewardAmount(uint256)", {"_amount": p.uint256}, ), - notifyRewardWithoutClaim: fun("0xdcdc18dc", "notifyRewardWithoutClaim(uint256)", {"_amount": p.uint256}, ), - onERC721Received: fun("0x150b7a02", "onERC721Received(address,address,uint256,bytes)", {"_0": p.address, "_1": p.address, "_2": p.uint256, "_3": p.bytes}, p.bytes4), - periodFinish: viewFun("0xebe2b12b", "periodFinish()", {}, p.uint256), - pool: viewFun("0x16f0115b", "pool()", {}, p.address), - rewardGrowthInside: viewFun("0xac789c08", "rewardGrowthInside(uint256)", {"_0": p.uint256}, p.uint256), - rewardRate: viewFun("0x7b0a47ee", "rewardRate()", {}, p.uint256), - rewardRateByEpoch: viewFun("0x94af5b63", "rewardRateByEpoch(uint256)", {"_0": p.uint256}, p.uint256), - rewardToken: viewFun("0xf7c618c1", "rewardToken()", {}, p.address), - rewards: viewFun("0xf301af42", "rewards(uint256)", {"_0": p.uint256}, p.uint256), - stakedByIndex: viewFun("0x38463937", "stakedByIndex(address,uint256)", {"depositor": p.address, "index": p.uint256}, p.uint256), - stakedContains: viewFun("0xc69deec5", "stakedContains(address,uint256)", {"depositor": p.address, "tokenId": p.uint256}, p.bool), - stakedLength: viewFun("0xae775c32", "stakedLength(address)", {"depositor": p.address}, p.uint256), - stakedValues: viewFun("0x4b937763", "stakedValues(address)", {"depositor": p.address}, p.array(p.uint256)), - supportsPayable: viewFun("0x55b29a0e", "supportsPayable()", {}, p.bool), - tickSpacing: viewFun("0xd0c93a7c", "tickSpacing()", {}, p.int24), - token0: viewFun("0x0dfe1681", "token0()", {}, p.address), - token1: viewFun("0xd21220a7", "token1()", {}, p.address), - voter: viewFun("0x46c96aac", "voter()", {}, p.address), - withdraw: fun("0x2e1a7d4d", "withdraw(uint256)", {"tokenId": p.uint256}, ), -} - -export class Contract extends ContractBase { - - WETH9() { - return this.eth_call(functions.WETH9, {}) - } - - earned(account: EarnedParams["account"], tokenId: EarnedParams["tokenId"]) { - return this.eth_call(functions.earned, {account, tokenId}) - } - - fees0() { - return this.eth_call(functions.fees0, {}) - } - - fees1() { - return this.eth_call(functions.fees1, {}) - } - - feesVotingReward() { - return this.eth_call(functions.feesVotingReward, {}) - } - - gaugeFactory() { - return this.eth_call(functions.gaugeFactory, {}) - } - - isPool() { - return this.eth_call(functions.isPool, {}) - } - - lastUpdateTime(_0: LastUpdateTimeParams["_0"]) { - return this.eth_call(functions.lastUpdateTime, {_0}) - } - - left() { - return this.eth_call(functions.left, {}) - } - - nft() { - return this.eth_call(functions.nft, {}) - } - - periodFinish() { - return this.eth_call(functions.periodFinish, {}) - } - - pool() { - return this.eth_call(functions.pool, {}) - } - - rewardGrowthInside(_0: RewardGrowthInsideParams["_0"]) { - return this.eth_call(functions.rewardGrowthInside, {_0}) - } - - rewardRate() { - return this.eth_call(functions.rewardRate, {}) - } - - rewardRateByEpoch(_0: RewardRateByEpochParams["_0"]) { - return this.eth_call(functions.rewardRateByEpoch, {_0}) - } - - rewardToken() { - return this.eth_call(functions.rewardToken, {}) - } - - rewards(_0: RewardsParams["_0"]) { - return this.eth_call(functions.rewards, {_0}) - } - - stakedByIndex(depositor: StakedByIndexParams["depositor"], index: StakedByIndexParams["index"]) { - return this.eth_call(functions.stakedByIndex, {depositor, index}) - } - - stakedContains(depositor: StakedContainsParams["depositor"], tokenId: StakedContainsParams["tokenId"]) { - return this.eth_call(functions.stakedContains, {depositor, tokenId}) - } - - stakedLength(depositor: StakedLengthParams["depositor"]) { - return this.eth_call(functions.stakedLength, {depositor}) - } - - stakedValues(depositor: StakedValuesParams["depositor"]) { - return this.eth_call(functions.stakedValues, {depositor}) - } - - supportsPayable() { - return this.eth_call(functions.supportsPayable, {}) - } - - tickSpacing() { - return this.eth_call(functions.tickSpacing, {}) - } - - token0() { - return this.eth_call(functions.token0, {}) - } - - token1() { - return this.eth_call(functions.token1, {}) - } - - voter() { - return this.eth_call(functions.voter, {}) - } -} - -/// Event types -export type ClaimFeesEventArgs = EParams -export type ClaimRewardsEventArgs = EParams -export type DepositEventArgs = EParams -export type NotifyRewardEventArgs = EParams -export type WithdrawEventArgs = EParams - -/// Function types -export type WETH9Params = FunctionArguments -export type WETH9Return = FunctionReturn - -export type DepositParams = FunctionArguments -export type DepositReturn = FunctionReturn - -export type EarnedParams = FunctionArguments -export type EarnedReturn = FunctionReturn - -export type Fees0Params = FunctionArguments -export type Fees0Return = FunctionReturn - -export type Fees1Params = FunctionArguments -export type Fees1Return = FunctionReturn - -export type FeesVotingRewardParams = FunctionArguments -export type FeesVotingRewardReturn = FunctionReturn - -export type GaugeFactoryParams = FunctionArguments -export type GaugeFactoryReturn = FunctionReturn - -export type GetRewardParams_0 = FunctionArguments -export type GetRewardReturn_0 = FunctionReturn - -export type GetRewardParams_1 = FunctionArguments -export type GetRewardReturn_1 = FunctionReturn - -export type InitializeParams = FunctionArguments -export type InitializeReturn = FunctionReturn - -export type IsPoolParams = FunctionArguments -export type IsPoolReturn = FunctionReturn - -export type LastUpdateTimeParams = FunctionArguments -export type LastUpdateTimeReturn = FunctionReturn - -export type LeftParams = FunctionArguments -export type LeftReturn = FunctionReturn - -export type NftParams = FunctionArguments -export type NftReturn = FunctionReturn - -export type NotifyRewardAmountParams = FunctionArguments -export type NotifyRewardAmountReturn = FunctionReturn - -export type NotifyRewardWithoutClaimParams = FunctionArguments -export type NotifyRewardWithoutClaimReturn = FunctionReturn - -export type OnERC721ReceivedParams = FunctionArguments -export type OnERC721ReceivedReturn = FunctionReturn - -export type PeriodFinishParams = FunctionArguments -export type PeriodFinishReturn = FunctionReturn - -export type PoolParams = FunctionArguments -export type PoolReturn = FunctionReturn - -export type RewardGrowthInsideParams = FunctionArguments -export type RewardGrowthInsideReturn = FunctionReturn - -export type RewardRateParams = FunctionArguments -export type RewardRateReturn = FunctionReturn - -export type RewardRateByEpochParams = FunctionArguments -export type RewardRateByEpochReturn = FunctionReturn - -export type RewardTokenParams = FunctionArguments -export type RewardTokenReturn = FunctionReturn - -export type RewardsParams = FunctionArguments -export type RewardsReturn = FunctionReturn - -export type StakedByIndexParams = FunctionArguments -export type StakedByIndexReturn = FunctionReturn - -export type StakedContainsParams = FunctionArguments -export type StakedContainsReturn = FunctionReturn - -export type StakedLengthParams = FunctionArguments -export type StakedLengthReturn = FunctionReturn - -export type StakedValuesParams = FunctionArguments -export type StakedValuesReturn = FunctionReturn - -export type SupportsPayableParams = FunctionArguments -export type SupportsPayableReturn = FunctionReturn - -export type TickSpacingParams = FunctionArguments -export type TickSpacingReturn = FunctionReturn - -export type Token0Params = FunctionArguments -export type Token0Return = FunctionReturn - -export type Token1Params = FunctionArguments -export type Token1Return = FunctionReturn - -export type VoterParams = FunctionArguments -export type VoterReturn = FunctionReturn - -export type WithdrawParams = FunctionArguments -export type WithdrawReturn = FunctionReturn - diff --git a/src/abi/aerodrome-cl-gauge/contract.ts b/src/abi/aerodrome-cl-gauge/contract.ts new file mode 100644 index 00000000..553330e2 --- /dev/null +++ b/src/abi/aerodrome-cl-gauge/contract.ts @@ -0,0 +1,113 @@ +import { ContractBase } from '../abi.support.js' +import { WETH9, earned, fees0, fees1, feesVotingReward, gaugeFactory, isPool, lastUpdateTime, left, nft, onERC721Received, periodFinish, pool, rewardGrowthInside, rewardRate, rewardRateByEpoch, rewardToken, rewards, stakedByIndex, stakedContains, stakedLength, stakedValues, supportsPayable, tickSpacing, token0, token1, voter } from './functions.js' +import type { EarnedParams, LastUpdateTimeParams, OnERC721ReceivedParams, RewardGrowthInsideParams, RewardRateByEpochParams, RewardsParams, StakedByIndexParams, StakedContainsParams, StakedLengthParams, StakedValuesParams } from './functions.js' + +export class Contract extends ContractBase { + WETH9() { + return this.eth_call(WETH9, {}) + } + + earned(account: EarnedParams["account"], tokenId: EarnedParams["tokenId"]) { + return this.eth_call(earned, {account, tokenId}) + } + + fees0() { + return this.eth_call(fees0, {}) + } + + fees1() { + return this.eth_call(fees1, {}) + } + + feesVotingReward() { + return this.eth_call(feesVotingReward, {}) + } + + gaugeFactory() { + return this.eth_call(gaugeFactory, {}) + } + + isPool() { + return this.eth_call(isPool, {}) + } + + lastUpdateTime(_0: LastUpdateTimeParams["_0"]) { + return this.eth_call(lastUpdateTime, {_0}) + } + + left() { + return this.eth_call(left, {}) + } + + nft() { + return this.eth_call(nft, {}) + } + + onERC721Received(_0: OnERC721ReceivedParams["_0"], _1: OnERC721ReceivedParams["_1"], _2: OnERC721ReceivedParams["_2"], _3: OnERC721ReceivedParams["_3"]) { + return this.eth_call(onERC721Received, {_0, _1, _2, _3}) + } + + periodFinish() { + return this.eth_call(periodFinish, {}) + } + + pool() { + return this.eth_call(pool, {}) + } + + rewardGrowthInside(_0: RewardGrowthInsideParams["_0"]) { + return this.eth_call(rewardGrowthInside, {_0}) + } + + rewardRate() { + return this.eth_call(rewardRate, {}) + } + + rewardRateByEpoch(_0: RewardRateByEpochParams["_0"]) { + return this.eth_call(rewardRateByEpoch, {_0}) + } + + rewardToken() { + return this.eth_call(rewardToken, {}) + } + + rewards(_0: RewardsParams["_0"]) { + return this.eth_call(rewards, {_0}) + } + + stakedByIndex(depositor: StakedByIndexParams["depositor"], index: StakedByIndexParams["index"]) { + return this.eth_call(stakedByIndex, {depositor, index}) + } + + stakedContains(depositor: StakedContainsParams["depositor"], tokenId: StakedContainsParams["tokenId"]) { + return this.eth_call(stakedContains, {depositor, tokenId}) + } + + stakedLength(depositor: StakedLengthParams["depositor"]) { + return this.eth_call(stakedLength, {depositor}) + } + + stakedValues(depositor: StakedValuesParams["depositor"]) { + return this.eth_call(stakedValues, {depositor}) + } + + supportsPayable() { + return this.eth_call(supportsPayable, {}) + } + + tickSpacing() { + return this.eth_call(tickSpacing, {}) + } + + token0() { + return this.eth_call(token0, {}) + } + + token1() { + return this.eth_call(token1, {}) + } + + voter() { + return this.eth_call(voter, {}) + } +} diff --git a/src/abi/aerodrome-cl-gauge/events.ts b/src/abi/aerodrome-cl-gauge/events.ts new file mode 100644 index 00000000..05694534 --- /dev/null +++ b/src/abi/aerodrome-cl-gauge/events.ts @@ -0,0 +1,41 @@ +import { address, uint128, uint256 } from '@subsquid/evm-codec' +import { event, indexed } from '../abi.support.js' +import type { EventParams as EParams } from '../abi.support.js' + +/** ClaimFees(address,uint256,uint256) */ +export const ClaimFees = event('0xbc567d6cbad26368064baa0ab5a757be46aae4d70f707f9203d9d9b6c8ccbfa3', { + from: indexed(address), + claimed0: uint256, + claimed1: uint256, +}) +export type ClaimFeesEventArgs = EParams + +/** ClaimRewards(address,uint256) */ +export const ClaimRewards = event('0x1f89f96333d3133000ee447473151fa9606543368f02271c9d95ae14f13bcc67', { + from: indexed(address), + amount: uint256, +}) +export type ClaimRewardsEventArgs = EParams + +/** Deposit(address,uint256,uint128) */ +export const Deposit = event('0x1c8ab8c7f45390d58f58f1d655213a82cca5d12179761a87c16f098813b8f211', { + user: indexed(address), + tokenId: indexed(uint256), + liquidityToStake: indexed(uint128), +}) +export type DepositEventArgs = EParams + +/** NotifyReward(address,uint256) */ +export const NotifyReward = event('0x095667752957714306e1a6ad83495404412df6fdb932fca6dc849a7ee910d4c1', { + from: indexed(address), + amount: uint256, +}) +export type NotifyRewardEventArgs = EParams + +/** Withdraw(address,uint256,uint128) */ +export const Withdraw = event('0x8903a5b5d08a841e7f68438387f1da20c84dea756379ed37e633ff3854b99b84', { + user: indexed(address), + tokenId: indexed(uint256), + liquidityToStake: indexed(uint128), +}) +export type WithdrawEventArgs = EParams diff --git a/src/abi/aerodrome-cl-gauge/functions.ts b/src/abi/aerodrome-cl-gauge/functions.ts new file mode 100644 index 00000000..2911adcf --- /dev/null +++ b/src/abi/aerodrome-cl-gauge/functions.ts @@ -0,0 +1,221 @@ +import { address, array, bool, bytes, bytes4, int24, uint256 } from '@subsquid/evm-codec' +import { func } from '../abi.support.js' +import type { FunctionArguments, FunctionReturn } from '../abi.support.js' + +/** WETH9() */ +export const WETH9 = func('0x4aa4a4fc', {}, address) +export type WETH9Params = FunctionArguments +export type WETH9Return = FunctionReturn + +/** deposit(uint256) */ +export const deposit = func('0xb6b55f25', { + tokenId: uint256, +}) +export type DepositParams = FunctionArguments +export type DepositReturn = FunctionReturn + +/** earned(address,uint256) */ +export const earned = func('0x3e491d47', { + account: address, + tokenId: uint256, +}, uint256) +export type EarnedParams = FunctionArguments +export type EarnedReturn = FunctionReturn + +/** fees0() */ +export const fees0 = func('0x93f1c442', {}, uint256) +export type Fees0Params = FunctionArguments +export type Fees0Return = FunctionReturn + +/** fees1() */ +export const fees1 = func('0x4c02a21c', {}, uint256) +export type Fees1Params = FunctionArguments +export type Fees1Return = FunctionReturn + +/** feesVotingReward() */ +export const feesVotingReward = func('0x0fe2f711', {}, address) +export type FeesVotingRewardParams = FunctionArguments +export type FeesVotingRewardReturn = FunctionReturn + +/** gaugeFactory() */ +export const gaugeFactory = func('0x0d52333c', {}, address) +export type GaugeFactoryParams = FunctionArguments +export type GaugeFactoryReturn = FunctionReturn + +/** getReward(uint256) */ +export const getReward = func('0x1c4b774b', { + tokenId: uint256, +}) +export type GetRewardParams = FunctionArguments +export type GetRewardReturn = FunctionReturn + +/** getReward(address) */ +export const getReward_1 = func('0xc00007b0', { + account: address, +}) +export type GetRewardParams_1 = FunctionArguments +export type GetRewardReturn_1 = FunctionReturn + +/** initialize(address,address,address,address,address,address,address,int24,bool) */ +export const initialize = func('0x391ffff8', { + _pool: address, + _feesVotingReward: address, + _rewardToken: address, + _voter: address, + _nft: address, + _token0: address, + _token1: address, + _tickSpacing: int24, + _isPool: bool, +}) +export type InitializeParams = FunctionArguments +export type InitializeReturn = FunctionReturn + +/** isPool() */ +export const isPool = func('0xe2e1c6db', {}, bool) +export type IsPoolParams = FunctionArguments +export type IsPoolReturn = FunctionReturn + +/** lastUpdateTime(uint256) */ +export const lastUpdateTime = func('0x4bcddb1f', { + _0: uint256, +}, uint256) +export type LastUpdateTimeParams = FunctionArguments +export type LastUpdateTimeReturn = FunctionReturn + +/** left() */ +export const left = func('0x16e64048', {}, uint256) +export type LeftParams = FunctionArguments +export type LeftReturn = FunctionReturn + +/** nft() */ +export const nft = func('0x47ccca02', {}, address) +export type NftParams = FunctionArguments +export type NftReturn = FunctionReturn + +/** notifyRewardAmount(uint256) */ +export const notifyRewardAmount = func('0x3c6b16ab', { + _amount: uint256, +}) +export type NotifyRewardAmountParams = FunctionArguments +export type NotifyRewardAmountReturn = FunctionReturn + +/** notifyRewardWithoutClaim(uint256) */ +export const notifyRewardWithoutClaim = func('0xdcdc18dc', { + _amount: uint256, +}) +export type NotifyRewardWithoutClaimParams = FunctionArguments +export type NotifyRewardWithoutClaimReturn = FunctionReturn + +/** onERC721Received(address,address,uint256,bytes) */ +export const onERC721Received = func('0x150b7a02', { + _0: address, + _1: address, + _2: uint256, + _3: bytes, +}, bytes4) +export type OnERC721ReceivedParams = FunctionArguments +export type OnERC721ReceivedReturn = FunctionReturn + +/** periodFinish() */ +export const periodFinish = func('0xebe2b12b', {}, uint256) +export type PeriodFinishParams = FunctionArguments +export type PeriodFinishReturn = FunctionReturn + +/** pool() */ +export const pool = func('0x16f0115b', {}, address) +export type PoolParams = FunctionArguments +export type PoolReturn = FunctionReturn + +/** rewardGrowthInside(uint256) */ +export const rewardGrowthInside = func('0xac789c08', { + _0: uint256, +}, uint256) +export type RewardGrowthInsideParams = FunctionArguments +export type RewardGrowthInsideReturn = FunctionReturn + +/** rewardRate() */ +export const rewardRate = func('0x7b0a47ee', {}, uint256) +export type RewardRateParams = FunctionArguments +export type RewardRateReturn = FunctionReturn + +/** rewardRateByEpoch(uint256) */ +export const rewardRateByEpoch = func('0x94af5b63', { + _0: uint256, +}, uint256) +export type RewardRateByEpochParams = FunctionArguments +export type RewardRateByEpochReturn = FunctionReturn + +/** rewardToken() */ +export const rewardToken = func('0xf7c618c1', {}, address) +export type RewardTokenParams = FunctionArguments +export type RewardTokenReturn = FunctionReturn + +/** rewards(uint256) */ +export const rewards = func('0xf301af42', { + _0: uint256, +}, uint256) +export type RewardsParams = FunctionArguments +export type RewardsReturn = FunctionReturn + +/** stakedByIndex(address,uint256) */ +export const stakedByIndex = func('0x38463937', { + depositor: address, + index: uint256, +}, uint256) +export type StakedByIndexParams = FunctionArguments +export type StakedByIndexReturn = FunctionReturn + +/** stakedContains(address,uint256) */ +export const stakedContains = func('0xc69deec5', { + depositor: address, + tokenId: uint256, +}, bool) +export type StakedContainsParams = FunctionArguments +export type StakedContainsReturn = FunctionReturn + +/** stakedLength(address) */ +export const stakedLength = func('0xae775c32', { + depositor: address, +}, uint256) +export type StakedLengthParams = FunctionArguments +export type StakedLengthReturn = FunctionReturn + +/** stakedValues(address) */ +export const stakedValues = func('0x4b937763', { + depositor: address, +}, array(uint256)) +export type StakedValuesParams = FunctionArguments +export type StakedValuesReturn = FunctionReturn + +/** supportsPayable() */ +export const supportsPayable = func('0x55b29a0e', {}, bool) +export type SupportsPayableParams = FunctionArguments +export type SupportsPayableReturn = FunctionReturn + +/** tickSpacing() */ +export const tickSpacing = func('0xd0c93a7c', {}, int24) +export type TickSpacingParams = FunctionArguments +export type TickSpacingReturn = FunctionReturn + +/** token0() */ +export const token0 = func('0x0dfe1681', {}, address) +export type Token0Params = FunctionArguments +export type Token0Return = FunctionReturn + +/** token1() */ +export const token1 = func('0xd21220a7', {}, address) +export type Token1Params = FunctionArguments +export type Token1Return = FunctionReturn + +/** voter() */ +export const voter = func('0x46c96aac', {}, address) +export type VoterParams = FunctionArguments +export type VoterReturn = FunctionReturn + +/** withdraw(uint256) */ +export const withdraw = func('0x2e1a7d4d', { + tokenId: uint256, +}) +export type WithdrawParams = FunctionArguments +export type WithdrawReturn = FunctionReturn diff --git a/src/abi/aerodrome-cl-gauge/index.ts b/src/abi/aerodrome-cl-gauge/index.ts new file mode 100644 index 00000000..11829d6e --- /dev/null +++ b/src/abi/aerodrome-cl-gauge/index.ts @@ -0,0 +1,4 @@ +export * as events from './events.js' +export * as functions from './functions.js' + +export { Contract } from './contract.js' diff --git a/src/abi/aerodrome-cl-pool-factory.ts b/src/abi/aerodrome-cl-pool-factory.ts deleted file mode 100644 index 801cff01..00000000 --- a/src/abi/aerodrome-cl-pool-factory.ts +++ /dev/null @@ -1,200 +0,0 @@ -import * as p from '@subsquid/evm-codec' -import { event, fun, viewFun, indexed, ContractBase } from '@subsquid/evm-abi' -import type { EventParams as EParams, FunctionArguments, FunctionReturn } from '@subsquid/evm-abi' - -export const events = { - DefaultUnstakedFeeChanged: event("0xcbca61144322b913ada4febfb591864cad7617559d7ee0d3e29b48eb93fcc78e", "DefaultUnstakedFeeChanged(uint24,uint24)", {"oldUnstakedFee": indexed(p.uint24), "newUnstakedFee": indexed(p.uint24)}), - OwnerChanged: event("0xb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c", "OwnerChanged(address,address)", {"oldOwner": indexed(p.address), "newOwner": indexed(p.address)}), - PoolCreated: event("0xab0d57f0df537bb25e80245ef7748fa62353808c54d6e528a9dd20887aed9ac2", "PoolCreated(address,address,int24,address)", {"token0": indexed(p.address), "token1": indexed(p.address), "tickSpacing": indexed(p.int24), "pool": p.address}), - SwapFeeManagerChanged: event("0x7ae0007229b3333719d97e8ef5829c888f560776012974f87409c158e5b7eb91", "SwapFeeManagerChanged(address,address)", {"oldFeeManager": indexed(p.address), "newFeeManager": indexed(p.address)}), - SwapFeeModuleChanged: event("0xdf24ed64a7bcd761cf1132e79f94ea269a1d570e7a6ca0ab99a8f5ccd6f5022f", "SwapFeeModuleChanged(address,address)", {"oldFeeModule": indexed(p.address), "newFeeModule": indexed(p.address)}), - TickSpacingEnabled: event("0xebafae466a4a780a1d87f5fab2f52fad33be9151a7f69d099e8934c8de85b747", "TickSpacingEnabled(int24,uint24)", {"tickSpacing": indexed(p.int24), "fee": indexed(p.uint24)}), - UnstakedFeeManagerChanged: event("0x3d7ebe96182c99643ca0c997a416a2a3409baab225f85f50c29fcf0591c820c1", "UnstakedFeeManagerChanged(address,address)", {"oldFeeManager": indexed(p.address), "newFeeManager": indexed(p.address)}), - UnstakedFeeModuleChanged: event("0x6520f404f3831947cee8673060459cdfb181b7332aa7580bcce9bf90ef1f0e20", "UnstakedFeeModuleChanged(address,address)", {"oldFeeModule": indexed(p.address), "newFeeModule": indexed(p.address)}), -} - -export const functions = { - allPools: viewFun("0x41d1de97", "allPools(uint256)", {"_0": p.uint256}, p.address), - allPoolsLength: viewFun("0xefde4e64", "allPoolsLength()", {}, p.uint256), - createPool: fun("0x232aa5ac", "createPool(address,address,int24,uint160)", {"tokenA": p.address, "tokenB": p.address, "tickSpacing": p.int24, "sqrtPriceX96": p.uint160}, p.address), - defaultUnstakedFee: viewFun("0xe2824832", "defaultUnstakedFee()", {}, p.uint24), - enableTickSpacing: fun("0xeee0fdb4", "enableTickSpacing(int24,uint24)", {"tickSpacing": p.int24, "fee": p.uint24}, ), - factoryRegistry: viewFun("0x3bf0c9fb", "factoryRegistry()", {}, p.address), - getPool: viewFun("0x28af8d0b", "getPool(address,address,int24)", {"_0": p.address, "_1": p.address, "_2": p.int24}, p.address), - getSwapFee: viewFun("0x35458dcc", "getSwapFee(address)", {"pool": p.address}, p.uint24), - getUnstakedFee: viewFun("0x48cf7a43", "getUnstakedFee(address)", {"pool": p.address}, p.uint24), - isPool: viewFun("0x5b16ebb7", "isPool(address)", {"pool": p.address}, p.bool), - owner: viewFun("0x8da5cb5b", "owner()", {}, p.address), - poolImplementation: viewFun("0xcefa7799", "poolImplementation()", {}, p.address), - setDefaultUnstakedFee: fun("0xa2f97f42", "setDefaultUnstakedFee(uint24)", {"_defaultUnstakedFee": p.uint24}, ), - setOwner: fun("0x13af4035", "setOwner(address)", {"_owner": p.address}, ), - setSwapFeeManager: fun("0xffb4d9d1", "setSwapFeeManager(address)", {"_swapFeeManager": p.address}, ), - setSwapFeeModule: fun("0x61b9c3ec", "setSwapFeeModule(address)", {"_swapFeeModule": p.address}, ), - setUnstakedFeeManager: fun("0x93ce8627", "setUnstakedFeeManager(address)", {"_unstakedFeeManager": p.address}, ), - setUnstakedFeeModule: fun("0x1b31d878", "setUnstakedFeeModule(address)", {"_unstakedFeeModule": p.address}, ), - swapFeeManager: viewFun("0xd574afa9", "swapFeeManager()", {}, p.address), - swapFeeModule: viewFun("0x23c43a51", "swapFeeModule()", {}, p.address), - tickSpacingToFee: viewFun("0x380dc1c2", "tickSpacingToFee(int24)", {"_0": p.int24}, p.uint24), - tickSpacings: viewFun("0x9cbbbe86", "tickSpacings()", {}, p.array(p.int24)), - unstakedFeeManager: viewFun("0x82e189e0", "unstakedFeeManager()", {}, p.address), - unstakedFeeModule: viewFun("0x7693bc11", "unstakedFeeModule()", {}, p.address), - voter: viewFun("0x46c96aac", "voter()", {}, p.address), -} - -export class Contract extends ContractBase { - - allPools(_0: AllPoolsParams["_0"]) { - return this.eth_call(functions.allPools, {_0}) - } - - allPoolsLength() { - return this.eth_call(functions.allPoolsLength, {}) - } - - defaultUnstakedFee() { - return this.eth_call(functions.defaultUnstakedFee, {}) - } - - factoryRegistry() { - return this.eth_call(functions.factoryRegistry, {}) - } - - getPool(_0: GetPoolParams["_0"], _1: GetPoolParams["_1"], _2: GetPoolParams["_2"]) { - return this.eth_call(functions.getPool, {_0, _1, _2}) - } - - getSwapFee(pool: GetSwapFeeParams["pool"]) { - return this.eth_call(functions.getSwapFee, {pool}) - } - - getUnstakedFee(pool: GetUnstakedFeeParams["pool"]) { - return this.eth_call(functions.getUnstakedFee, {pool}) - } - - isPool(pool: IsPoolParams["pool"]) { - return this.eth_call(functions.isPool, {pool}) - } - - owner() { - return this.eth_call(functions.owner, {}) - } - - poolImplementation() { - return this.eth_call(functions.poolImplementation, {}) - } - - swapFeeManager() { - return this.eth_call(functions.swapFeeManager, {}) - } - - swapFeeModule() { - return this.eth_call(functions.swapFeeModule, {}) - } - - tickSpacingToFee(_0: TickSpacingToFeeParams["_0"]) { - return this.eth_call(functions.tickSpacingToFee, {_0}) - } - - tickSpacings() { - return this.eth_call(functions.tickSpacings, {}) - } - - unstakedFeeManager() { - return this.eth_call(functions.unstakedFeeManager, {}) - } - - unstakedFeeModule() { - return this.eth_call(functions.unstakedFeeModule, {}) - } - - voter() { - return this.eth_call(functions.voter, {}) - } -} - -/// Event types -export type DefaultUnstakedFeeChangedEventArgs = EParams -export type OwnerChangedEventArgs = EParams -export type PoolCreatedEventArgs = EParams -export type SwapFeeManagerChangedEventArgs = EParams -export type SwapFeeModuleChangedEventArgs = EParams -export type TickSpacingEnabledEventArgs = EParams -export type UnstakedFeeManagerChangedEventArgs = EParams -export type UnstakedFeeModuleChangedEventArgs = EParams - -/// Function types -export type AllPoolsParams = FunctionArguments -export type AllPoolsReturn = FunctionReturn - -export type AllPoolsLengthParams = FunctionArguments -export type AllPoolsLengthReturn = FunctionReturn - -export type CreatePoolParams = FunctionArguments -export type CreatePoolReturn = FunctionReturn - -export type DefaultUnstakedFeeParams = FunctionArguments -export type DefaultUnstakedFeeReturn = FunctionReturn - -export type EnableTickSpacingParams = FunctionArguments -export type EnableTickSpacingReturn = FunctionReturn - -export type FactoryRegistryParams = FunctionArguments -export type FactoryRegistryReturn = FunctionReturn - -export type GetPoolParams = FunctionArguments -export type GetPoolReturn = FunctionReturn - -export type GetSwapFeeParams = FunctionArguments -export type GetSwapFeeReturn = FunctionReturn - -export type GetUnstakedFeeParams = FunctionArguments -export type GetUnstakedFeeReturn = FunctionReturn - -export type IsPoolParams = FunctionArguments -export type IsPoolReturn = FunctionReturn - -export type OwnerParams = FunctionArguments -export type OwnerReturn = FunctionReturn - -export type PoolImplementationParams = FunctionArguments -export type PoolImplementationReturn = FunctionReturn - -export type SetDefaultUnstakedFeeParams = FunctionArguments -export type SetDefaultUnstakedFeeReturn = FunctionReturn - -export type SetOwnerParams = FunctionArguments -export type SetOwnerReturn = FunctionReturn - -export type SetSwapFeeManagerParams = FunctionArguments -export type SetSwapFeeManagerReturn = FunctionReturn - -export type SetSwapFeeModuleParams = FunctionArguments -export type SetSwapFeeModuleReturn = FunctionReturn - -export type SetUnstakedFeeManagerParams = FunctionArguments -export type SetUnstakedFeeManagerReturn = FunctionReturn - -export type SetUnstakedFeeModuleParams = FunctionArguments -export type SetUnstakedFeeModuleReturn = FunctionReturn - -export type SwapFeeManagerParams = FunctionArguments -export type SwapFeeManagerReturn = FunctionReturn - -export type SwapFeeModuleParams = FunctionArguments -export type SwapFeeModuleReturn = FunctionReturn - -export type TickSpacingToFeeParams = FunctionArguments -export type TickSpacingToFeeReturn = FunctionReturn - -export type TickSpacingsParams = FunctionArguments -export type TickSpacingsReturn = FunctionReturn - -export type UnstakedFeeManagerParams = FunctionArguments -export type UnstakedFeeManagerReturn = FunctionReturn - -export type UnstakedFeeModuleParams = FunctionArguments -export type UnstakedFeeModuleReturn = FunctionReturn - -export type VoterParams = FunctionArguments -export type VoterReturn = FunctionReturn - diff --git a/src/abi/aerodrome-cl-pool-factory/contract.ts b/src/abi/aerodrome-cl-pool-factory/contract.ts new file mode 100644 index 00000000..aca6972f --- /dev/null +++ b/src/abi/aerodrome-cl-pool-factory/contract.ts @@ -0,0 +1,77 @@ +import { ContractBase } from '../abi.support.js' +import { allPools, allPoolsLength, createPool, defaultUnstakedFee, factoryRegistry, getPool, getSwapFee, getUnstakedFee, isPool, owner, poolImplementation, swapFeeManager, swapFeeModule, tickSpacingToFee, tickSpacings, unstakedFeeManager, unstakedFeeModule, voter } from './functions.js' +import type { AllPoolsParams, CreatePoolParams, GetPoolParams, GetSwapFeeParams, GetUnstakedFeeParams, IsPoolParams, TickSpacingToFeeParams } from './functions.js' + +export class Contract extends ContractBase { + allPools(_0: AllPoolsParams["_0"]) { + return this.eth_call(allPools, {_0}) + } + + allPoolsLength() { + return this.eth_call(allPoolsLength, {}) + } + + createPool(tokenA: CreatePoolParams["tokenA"], tokenB: CreatePoolParams["tokenB"], tickSpacing: CreatePoolParams["tickSpacing"], sqrtPriceX96: CreatePoolParams["sqrtPriceX96"]) { + return this.eth_call(createPool, {tokenA, tokenB, tickSpacing, sqrtPriceX96}) + } + + defaultUnstakedFee() { + return this.eth_call(defaultUnstakedFee, {}) + } + + factoryRegistry() { + return this.eth_call(factoryRegistry, {}) + } + + getPool(_0: GetPoolParams["_0"], _1: GetPoolParams["_1"], _2: GetPoolParams["_2"]) { + return this.eth_call(getPool, {_0, _1, _2}) + } + + getSwapFee(pool: GetSwapFeeParams["pool"]) { + return this.eth_call(getSwapFee, {pool}) + } + + getUnstakedFee(pool: GetUnstakedFeeParams["pool"]) { + return this.eth_call(getUnstakedFee, {pool}) + } + + isPool(pool: IsPoolParams["pool"]) { + return this.eth_call(isPool, {pool}) + } + + owner() { + return this.eth_call(owner, {}) + } + + poolImplementation() { + return this.eth_call(poolImplementation, {}) + } + + swapFeeManager() { + return this.eth_call(swapFeeManager, {}) + } + + swapFeeModule() { + return this.eth_call(swapFeeModule, {}) + } + + tickSpacingToFee(_0: TickSpacingToFeeParams["_0"]) { + return this.eth_call(tickSpacingToFee, {_0}) + } + + tickSpacings() { + return this.eth_call(tickSpacings, {}) + } + + unstakedFeeManager() { + return this.eth_call(unstakedFeeManager, {}) + } + + unstakedFeeModule() { + return this.eth_call(unstakedFeeModule, {}) + } + + voter() { + return this.eth_call(voter, {}) + } +} diff --git a/src/abi/aerodrome-cl-pool-factory/events.ts b/src/abi/aerodrome-cl-pool-factory/events.ts new file mode 100644 index 00000000..e4a8c64b --- /dev/null +++ b/src/abi/aerodrome-cl-pool-factory/events.ts @@ -0,0 +1,61 @@ +import { address, int24, uint24 } from '@subsquid/evm-codec' +import { event, indexed } from '../abi.support.js' +import type { EventParams as EParams } from '../abi.support.js' + +/** DefaultUnstakedFeeChanged(uint24,uint24) */ +export const DefaultUnstakedFeeChanged = event('0xcbca61144322b913ada4febfb591864cad7617559d7ee0d3e29b48eb93fcc78e', { + oldUnstakedFee: indexed(uint24), + newUnstakedFee: indexed(uint24), +}) +export type DefaultUnstakedFeeChangedEventArgs = EParams + +/** OwnerChanged(address,address) */ +export const OwnerChanged = event('0xb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c', { + oldOwner: indexed(address), + newOwner: indexed(address), +}) +export type OwnerChangedEventArgs = EParams + +/** PoolCreated(address,address,int24,address) */ +export const PoolCreated = event('0xab0d57f0df537bb25e80245ef7748fa62353808c54d6e528a9dd20887aed9ac2', { + token0: indexed(address), + token1: indexed(address), + tickSpacing: indexed(int24), + pool: address, +}) +export type PoolCreatedEventArgs = EParams + +/** SwapFeeManagerChanged(address,address) */ +export const SwapFeeManagerChanged = event('0x7ae0007229b3333719d97e8ef5829c888f560776012974f87409c158e5b7eb91', { + oldFeeManager: indexed(address), + newFeeManager: indexed(address), +}) +export type SwapFeeManagerChangedEventArgs = EParams + +/** SwapFeeModuleChanged(address,address) */ +export const SwapFeeModuleChanged = event('0xdf24ed64a7bcd761cf1132e79f94ea269a1d570e7a6ca0ab99a8f5ccd6f5022f', { + oldFeeModule: indexed(address), + newFeeModule: indexed(address), +}) +export type SwapFeeModuleChangedEventArgs = EParams + +/** TickSpacingEnabled(int24,uint24) */ +export const TickSpacingEnabled = event('0xebafae466a4a780a1d87f5fab2f52fad33be9151a7f69d099e8934c8de85b747', { + tickSpacing: indexed(int24), + fee: indexed(uint24), +}) +export type TickSpacingEnabledEventArgs = EParams + +/** UnstakedFeeManagerChanged(address,address) */ +export const UnstakedFeeManagerChanged = event('0x3d7ebe96182c99643ca0c997a416a2a3409baab225f85f50c29fcf0591c820c1', { + oldFeeManager: indexed(address), + newFeeManager: indexed(address), +}) +export type UnstakedFeeManagerChangedEventArgs = EParams + +/** UnstakedFeeModuleChanged(address,address) */ +export const UnstakedFeeModuleChanged = event('0x6520f404f3831947cee8673060459cdfb181b7332aa7580bcce9bf90ef1f0e20', { + oldFeeModule: indexed(address), + newFeeModule: indexed(address), +}) +export type UnstakedFeeModuleChangedEventArgs = EParams diff --git a/src/abi/aerodrome-cl-pool-factory/functions.ts b/src/abi/aerodrome-cl-pool-factory/functions.ts new file mode 100644 index 00000000..e74f0678 --- /dev/null +++ b/src/abi/aerodrome-cl-pool-factory/functions.ts @@ -0,0 +1,162 @@ +import { address, array, bool, int24, uint160, uint24, uint256 } from '@subsquid/evm-codec' +import { func } from '../abi.support.js' +import type { FunctionArguments, FunctionReturn } from '../abi.support.js' + +/** allPools(uint256) */ +export const allPools = func('0x41d1de97', { + _0: uint256, +}, address) +export type AllPoolsParams = FunctionArguments +export type AllPoolsReturn = FunctionReturn + +/** allPoolsLength() */ +export const allPoolsLength = func('0xefde4e64', {}, uint256) +export type AllPoolsLengthParams = FunctionArguments +export type AllPoolsLengthReturn = FunctionReturn + +/** createPool(address,address,int24,uint160) */ +export const createPool = func('0x232aa5ac', { + tokenA: address, + tokenB: address, + tickSpacing: int24, + sqrtPriceX96: uint160, +}, address) +export type CreatePoolParams = FunctionArguments +export type CreatePoolReturn = FunctionReturn + +/** defaultUnstakedFee() */ +export const defaultUnstakedFee = func('0xe2824832', {}, uint24) +export type DefaultUnstakedFeeParams = FunctionArguments +export type DefaultUnstakedFeeReturn = FunctionReturn + +/** enableTickSpacing(int24,uint24) */ +export const enableTickSpacing = func('0xeee0fdb4', { + tickSpacing: int24, + fee: uint24, +}) +export type EnableTickSpacingParams = FunctionArguments +export type EnableTickSpacingReturn = FunctionReturn + +/** factoryRegistry() */ +export const factoryRegistry = func('0x3bf0c9fb', {}, address) +export type FactoryRegistryParams = FunctionArguments +export type FactoryRegistryReturn = FunctionReturn + +/** getPool(address,address,int24) */ +export const getPool = func('0x28af8d0b', { + _0: address, + _1: address, + _2: int24, +}, address) +export type GetPoolParams = FunctionArguments +export type GetPoolReturn = FunctionReturn + +/** getSwapFee(address) */ +export const getSwapFee = func('0x35458dcc', { + pool: address, +}, uint24) +export type GetSwapFeeParams = FunctionArguments +export type GetSwapFeeReturn = FunctionReturn + +/** getUnstakedFee(address) */ +export const getUnstakedFee = func('0x48cf7a43', { + pool: address, +}, uint24) +export type GetUnstakedFeeParams = FunctionArguments +export type GetUnstakedFeeReturn = FunctionReturn + +/** isPool(address) */ +export const isPool = func('0x5b16ebb7', { + pool: address, +}, bool) +export type IsPoolParams = FunctionArguments +export type IsPoolReturn = FunctionReturn + +/** owner() */ +export const owner = func('0x8da5cb5b', {}, address) +export type OwnerParams = FunctionArguments +export type OwnerReturn = FunctionReturn + +/** poolImplementation() */ +export const poolImplementation = func('0xcefa7799', {}, address) +export type PoolImplementationParams = FunctionArguments +export type PoolImplementationReturn = FunctionReturn + +/** setDefaultUnstakedFee(uint24) */ +export const setDefaultUnstakedFee = func('0xa2f97f42', { + _defaultUnstakedFee: uint24, +}) +export type SetDefaultUnstakedFeeParams = FunctionArguments +export type SetDefaultUnstakedFeeReturn = FunctionReturn + +/** setOwner(address) */ +export const setOwner = func('0x13af4035', { + _owner: address, +}) +export type SetOwnerParams = FunctionArguments +export type SetOwnerReturn = FunctionReturn + +/** setSwapFeeManager(address) */ +export const setSwapFeeManager = func('0xffb4d9d1', { + _swapFeeManager: address, +}) +export type SetSwapFeeManagerParams = FunctionArguments +export type SetSwapFeeManagerReturn = FunctionReturn + +/** setSwapFeeModule(address) */ +export const setSwapFeeModule = func('0x61b9c3ec', { + _swapFeeModule: address, +}) +export type SetSwapFeeModuleParams = FunctionArguments +export type SetSwapFeeModuleReturn = FunctionReturn + +/** setUnstakedFeeManager(address) */ +export const setUnstakedFeeManager = func('0x93ce8627', { + _unstakedFeeManager: address, +}) +export type SetUnstakedFeeManagerParams = FunctionArguments +export type SetUnstakedFeeManagerReturn = FunctionReturn + +/** setUnstakedFeeModule(address) */ +export const setUnstakedFeeModule = func('0x1b31d878', { + _unstakedFeeModule: address, +}) +export type SetUnstakedFeeModuleParams = FunctionArguments +export type SetUnstakedFeeModuleReturn = FunctionReturn + +/** swapFeeManager() */ +export const swapFeeManager = func('0xd574afa9', {}, address) +export type SwapFeeManagerParams = FunctionArguments +export type SwapFeeManagerReturn = FunctionReturn + +/** swapFeeModule() */ +export const swapFeeModule = func('0x23c43a51', {}, address) +export type SwapFeeModuleParams = FunctionArguments +export type SwapFeeModuleReturn = FunctionReturn + +/** tickSpacingToFee(int24) */ +export const tickSpacingToFee = func('0x380dc1c2', { + _0: int24, +}, uint24) +export type TickSpacingToFeeParams = FunctionArguments +export type TickSpacingToFeeReturn = FunctionReturn + +/** tickSpacings() */ +export const tickSpacings = func('0x9cbbbe86', {}, array(int24)) +export type TickSpacingsParams = FunctionArguments +export type TickSpacingsReturn = FunctionReturn + +/** unstakedFeeManager() */ +export const unstakedFeeManager = func('0x82e189e0', {}, address) +export type UnstakedFeeManagerParams = FunctionArguments +export type UnstakedFeeManagerReturn = FunctionReturn + +/** unstakedFeeModule() */ +export const unstakedFeeModule = func('0x7693bc11', {}, address) +export type UnstakedFeeModuleParams = FunctionArguments +export type UnstakedFeeModuleReturn = FunctionReturn + +/** voter() */ +export const voter = func('0x46c96aac', {}, address) +export type VoterParams = FunctionArguments +export type VoterReturn = FunctionReturn diff --git a/src/abi/aerodrome-cl-pool-factory/index.ts b/src/abi/aerodrome-cl-pool-factory/index.ts new file mode 100644 index 00000000..11829d6e --- /dev/null +++ b/src/abi/aerodrome-cl-pool-factory/index.ts @@ -0,0 +1,4 @@ +export * as events from './events.js' +export * as functions from './functions.js' + +export { Contract } from './contract.js' diff --git a/src/abi/aerodrome-cl-pool.ts b/src/abi/aerodrome-cl-pool.ts deleted file mode 100644 index ecb1a550..00000000 --- a/src/abi/aerodrome-cl-pool.ts +++ /dev/null @@ -1,322 +0,0 @@ -import * as p from '@subsquid/evm-codec' -import { event, fun, viewFun, indexed, ContractBase } from '@subsquid/evm-abi' -import type { EventParams as EParams, FunctionArguments, FunctionReturn } from '@subsquid/evm-abi' - -export const events = { - Burn: event("0x0c396cd989a39f4459b5fa1aed6a9a8dcdbc45908acfd67e028cd568da98982c", "Burn(address,int24,int24,uint128,uint256,uint256)", {"owner": indexed(p.address), "tickLower": indexed(p.int24), "tickUpper": indexed(p.int24), "amount": p.uint128, "amount0": p.uint256, "amount1": p.uint256}), - Collect: event("0x70935338e69775456a85ddef226c395fb668b63fa0115f5f20610b388e6ca9c0", "Collect(address,address,int24,int24,uint128,uint128)", {"owner": indexed(p.address), "recipient": p.address, "tickLower": indexed(p.int24), "tickUpper": indexed(p.int24), "amount0": p.uint128, "amount1": p.uint128}), - CollectFees: event("0x205860e66845f2bbc0966bfab80db9bf93fca93862ea2b9fcf6945748352b4a3", "CollectFees(address,uint128,uint128)", {"recipient": indexed(p.address), "amount0": p.uint128, "amount1": p.uint128}), - Flash: event("0xbdbdb71d7860376ba52b25a5028beea23581364a40522f6bcfb86bb1f2dca633", "Flash(address,address,uint256,uint256,uint256,uint256)", {"sender": indexed(p.address), "recipient": indexed(p.address), "amount0": p.uint256, "amount1": p.uint256, "paid0": p.uint256, "paid1": p.uint256}), - IncreaseObservationCardinalityNext: event("0xac49e518f90a358f652e4400164f05a5d8f7e35e7747279bc3a93dbf584e125a", "IncreaseObservationCardinalityNext(uint16,uint16)", {"observationCardinalityNextOld": p.uint16, "observationCardinalityNextNew": p.uint16}), - Initialize: event("0x98636036cb66a9c19a37435efc1e90142190214e8abeb821bdba3f2990dd4c95", "Initialize(uint160,int24)", {"sqrtPriceX96": p.uint160, "tick": p.int24}), - Mint: event("0x7a53080ba414158be7ec69b987b5fb7d07dee101fe85488f0853ae16239d0bde", "Mint(address,address,int24,int24,uint128,uint256,uint256)", {"sender": p.address, "owner": indexed(p.address), "tickLower": indexed(p.int24), "tickUpper": indexed(p.int24), "amount": p.uint128, "amount0": p.uint256, "amount1": p.uint256}), - SetFeeProtocol: event("0x973d8d92bb299f4af6ce49b52a8adb85ae46b9f214c4c4fc06ac77401237b133", "SetFeeProtocol(uint8,uint8,uint8,uint8)", {"feeProtocol0Old": p.uint8, "feeProtocol1Old": p.uint8, "feeProtocol0New": p.uint8, "feeProtocol1New": p.uint8}), - Swap: event("0xc42079f94a6350d7e6235f29174924f928cc2ac818eb64fed8004e115fbcca67", "Swap(address,address,int256,int256,uint160,uint128,int24)", {"sender": indexed(p.address), "recipient": indexed(p.address), "amount0": p.int256, "amount1": p.int256, "sqrtPriceX96": p.uint160, "liquidity": p.uint128, "tick": p.int24}), -} - -export const functions = { - 'burn(int24,int24,uint128,address)': fun("0x6f89244c", "burn(int24,int24,uint128,address)", {"tickLower": p.int24, "tickUpper": p.int24, "amount": p.uint128, "owner": p.address}, {"amount0": p.uint256, "amount1": p.uint256}), - 'burn(int24,int24,uint128)': fun("0xa34123a7", "burn(int24,int24,uint128)", {"tickLower": p.int24, "tickUpper": p.int24, "amount": p.uint128}, {"amount0": p.uint256, "amount1": p.uint256}), - 'collect(address,int24,int24,uint128,uint128,address)': fun("0x31338374", "collect(address,int24,int24,uint128,uint128,address)", {"recipient": p.address, "tickLower": p.int24, "tickUpper": p.int24, "amount0Requested": p.uint128, "amount1Requested": p.uint128, "owner": p.address}, {"amount0": p.uint128, "amount1": p.uint128}), - 'collect(address,int24,int24,uint128,uint128)': fun("0x4f1eb3d8", "collect(address,int24,int24,uint128,uint128)", {"recipient": p.address, "tickLower": p.int24, "tickUpper": p.int24, "amount0Requested": p.uint128, "amount1Requested": p.uint128}, {"amount0": p.uint128, "amount1": p.uint128}), - collectFees: fun("0xc8796572", "collectFees()", {}, {"amount0": p.uint128, "amount1": p.uint128}), - factory: viewFun("0xc45a0155", "factory()", {}, p.address), - factoryRegistry: viewFun("0x3bf0c9fb", "factoryRegistry()", {}, p.address), - fee: viewFun("0xddca3f43", "fee()", {}, p.uint24), - feeGrowthGlobal0X128: viewFun("0xf3058399", "feeGrowthGlobal0X128()", {}, p.uint256), - feeGrowthGlobal1X128: viewFun("0x46141319", "feeGrowthGlobal1X128()", {}, p.uint256), - flash: fun("0x490e6cbc", "flash(address,uint256,uint256,bytes)", {"recipient": p.address, "amount0": p.uint256, "amount1": p.uint256, "data": p.bytes}, ), - gauge: viewFun("0xa6f19c84", "gauge()", {}, p.address), - gaugeFees: viewFun("0x293833ba", "gaugeFees()", {}, {"token0": p.uint128, "token1": p.uint128}), - getRewardGrowthInside: viewFun("0xa16368c9", "getRewardGrowthInside(int24,int24,uint256)", {"tickLower": p.int24, "tickUpper": p.int24, "_rewardGrowthGlobalX128": p.uint256}, p.uint256), - increaseObservationCardinalityNext: fun("0x32148f67", "increaseObservationCardinalityNext(uint16)", {"observationCardinalityNext": p.uint16}, ), - initialize: fun("0x2071d884", "initialize(address,address,address,int24,address,uint160)", {"_factory": p.address, "_token0": p.address, "_token1": p.address, "_tickSpacing": p.int24, "_factoryRegistry": p.address, "_sqrtPriceX96": p.uint160}, ), - lastUpdated: viewFun("0xd0b06f5d", "lastUpdated()", {}, p.uint32), - liquidity: viewFun("0x1a686502", "liquidity()", {}, p.uint128), - maxLiquidityPerTick: viewFun("0x70cf754a", "maxLiquidityPerTick()", {}, p.uint128), - mint: fun("0x3c8a7d8d", "mint(address,int24,int24,uint128,bytes)", {"recipient": p.address, "tickLower": p.int24, "tickUpper": p.int24, "amount": p.uint128, "data": p.bytes}, {"amount0": p.uint256, "amount1": p.uint256}), - nft: viewFun("0x47ccca02", "nft()", {}, p.address), - observations: viewFun("0x252c09d7", "observations(uint256)", {"_0": p.uint256}, {"blockTimestamp": p.uint32, "tickCumulative": p.int56, "secondsPerLiquidityCumulativeX128": p.uint160, "initialized": p.bool}), - observe: viewFun("0x883bdbfd", "observe(uint32[])", {"secondsAgos": p.array(p.uint32)}, {"tickCumulatives": p.array(p.int56), "secondsPerLiquidityCumulativeX128s": p.array(p.uint160)}), - periodFinish: viewFun("0xebe2b12b", "periodFinish()", {}, p.uint256), - positions: viewFun("0x514ea4bf", "positions(bytes32)", {"_0": p.bytes32}, {"liquidity": p.uint128, "feeGrowthInside0LastX128": p.uint256, "feeGrowthInside1LastX128": p.uint256, "tokensOwed0": p.uint128, "tokensOwed1": p.uint128}), - rewardGrowthGlobalX128: viewFun("0x57806ada", "rewardGrowthGlobalX128()", {}, p.uint256), - rewardRate: viewFun("0x7b0a47ee", "rewardRate()", {}, p.uint256), - rewardReserve: viewFun("0xcab64bcd", "rewardReserve()", {}, p.uint256), - rollover: viewFun("0xb056b49a", "rollover()", {}, p.uint256), - setGaugeAndPositionManager: fun("0x1f7c3568", "setGaugeAndPositionManager(address,address)", {"_gauge": p.address, "_nft": p.address}, ), - slot0: viewFun("0x3850c7bd", "slot0()", {}, {"sqrtPriceX96": p.uint160, "tick": p.int24, "observationIndex": p.uint16, "observationCardinality": p.uint16, "observationCardinalityNext": p.uint16, "unlocked": p.bool}), - snapshotCumulativesInside: viewFun("0xa38807f2", "snapshotCumulativesInside(int24,int24)", {"tickLower": p.int24, "tickUpper": p.int24}, {"tickCumulativeInside": p.int56, "secondsPerLiquidityInsideX128": p.uint160, "secondsInside": p.uint32}), - stake: fun("0x4ed6210f", "stake(int128,int24,int24,bool)", {"stakedLiquidityDelta": p.int128, "tickLower": p.int24, "tickUpper": p.int24, "positionUpdate": p.bool}, ), - stakedLiquidity: viewFun("0x3ab04b20", "stakedLiquidity()", {}, p.uint128), - swap: fun("0x128acb08", "swap(address,bool,int256,uint160,bytes)", {"recipient": p.address, "zeroForOne": p.bool, "amountSpecified": p.int256, "sqrtPriceLimitX96": p.uint160, "data": p.bytes}, {"amount0": p.int256, "amount1": p.int256}), - syncReward: fun("0x60a73f9b", "syncReward(uint256,uint256,uint256)", {"_rewardRate": p.uint256, "_rewardReserve": p.uint256, "_periodFinish": p.uint256}, ), - tickBitmap: viewFun("0x5339c296", "tickBitmap(int16)", {"_0": p.int16}, p.uint256), - tickSpacing: viewFun("0xd0c93a7c", "tickSpacing()", {}, p.int24), - ticks: viewFun("0xf30dba93", "ticks(int24)", {"_0": p.int24}, {"liquidityGross": p.uint128, "liquidityNet": p.int128, "stakedLiquidityNet": p.int128, "feeGrowthOutside0X128": p.uint256, "feeGrowthOutside1X128": p.uint256, "rewardGrowthOutsideX128": p.uint256, "tickCumulativeOutside": p.int56, "secondsPerLiquidityOutsideX128": p.uint160, "secondsOutside": p.uint32, "initialized": p.bool}), - token0: viewFun("0x0dfe1681", "token0()", {}, p.address), - token1: viewFun("0xd21220a7", "token1()", {}, p.address), - unstakedFee: viewFun("0xb64cc67b", "unstakedFee()", {}, p.uint24), - updateRewardsGrowthGlobal: fun("0x1b410960", "updateRewardsGrowthGlobal()", {}, ), -} - -export class Contract extends ContractBase { - - factory() { - return this.eth_call(functions.factory, {}) - } - - factoryRegistry() { - return this.eth_call(functions.factoryRegistry, {}) - } - - fee() { - return this.eth_call(functions.fee, {}) - } - - feeGrowthGlobal0X128() { - return this.eth_call(functions.feeGrowthGlobal0X128, {}) - } - - feeGrowthGlobal1X128() { - return this.eth_call(functions.feeGrowthGlobal1X128, {}) - } - - gauge() { - return this.eth_call(functions.gauge, {}) - } - - gaugeFees() { - return this.eth_call(functions.gaugeFees, {}) - } - - getRewardGrowthInside(tickLower: GetRewardGrowthInsideParams["tickLower"], tickUpper: GetRewardGrowthInsideParams["tickUpper"], _rewardGrowthGlobalX128: GetRewardGrowthInsideParams["_rewardGrowthGlobalX128"]) { - return this.eth_call(functions.getRewardGrowthInside, {tickLower, tickUpper, _rewardGrowthGlobalX128}) - } - - lastUpdated() { - return this.eth_call(functions.lastUpdated, {}) - } - - liquidity() { - return this.eth_call(functions.liquidity, {}) - } - - maxLiquidityPerTick() { - return this.eth_call(functions.maxLiquidityPerTick, {}) - } - - nft() { - return this.eth_call(functions.nft, {}) - } - - observations(_0: ObservationsParams["_0"]) { - return this.eth_call(functions.observations, {_0}) - } - - observe(secondsAgos: ObserveParams["secondsAgos"]) { - return this.eth_call(functions.observe, {secondsAgos}) - } - - periodFinish() { - return this.eth_call(functions.periodFinish, {}) - } - - positions(_0: PositionsParams["_0"]) { - return this.eth_call(functions.positions, {_0}) - } - - rewardGrowthGlobalX128() { - return this.eth_call(functions.rewardGrowthGlobalX128, {}) - } - - rewardRate() { - return this.eth_call(functions.rewardRate, {}) - } - - rewardReserve() { - return this.eth_call(functions.rewardReserve, {}) - } - - rollover() { - return this.eth_call(functions.rollover, {}) - } - - slot0() { - return this.eth_call(functions.slot0, {}) - } - - snapshotCumulativesInside(tickLower: SnapshotCumulativesInsideParams["tickLower"], tickUpper: SnapshotCumulativesInsideParams["tickUpper"]) { - return this.eth_call(functions.snapshotCumulativesInside, {tickLower, tickUpper}) - } - - stakedLiquidity() { - return this.eth_call(functions.stakedLiquidity, {}) - } - - tickBitmap(_0: TickBitmapParams["_0"]) { - return this.eth_call(functions.tickBitmap, {_0}) - } - - tickSpacing() { - return this.eth_call(functions.tickSpacing, {}) - } - - ticks(_0: TicksParams["_0"]) { - return this.eth_call(functions.ticks, {_0}) - } - - token0() { - return this.eth_call(functions.token0, {}) - } - - token1() { - return this.eth_call(functions.token1, {}) - } - - unstakedFee() { - return this.eth_call(functions.unstakedFee, {}) - } -} - -/// Event types -export type BurnEventArgs = EParams -export type CollectEventArgs = EParams -export type CollectFeesEventArgs = EParams -export type FlashEventArgs = EParams -export type IncreaseObservationCardinalityNextEventArgs = EParams -export type InitializeEventArgs = EParams -export type MintEventArgs = EParams -export type SetFeeProtocolEventArgs = EParams -export type SwapEventArgs = EParams - -/// Function types -export type BurnParams_0 = FunctionArguments -export type BurnReturn_0 = FunctionReturn - -export type BurnParams_1 = FunctionArguments -export type BurnReturn_1 = FunctionReturn - -export type CollectParams_0 = FunctionArguments -export type CollectReturn_0 = FunctionReturn - -export type CollectParams_1 = FunctionArguments -export type CollectReturn_1 = FunctionReturn - -export type CollectFeesParams = FunctionArguments -export type CollectFeesReturn = FunctionReturn - -export type FactoryParams = FunctionArguments -export type FactoryReturn = FunctionReturn - -export type FactoryRegistryParams = FunctionArguments -export type FactoryRegistryReturn = FunctionReturn - -export type FeeParams = FunctionArguments -export type FeeReturn = FunctionReturn - -export type FeeGrowthGlobal0X128Params = FunctionArguments -export type FeeGrowthGlobal0X128Return = FunctionReturn - -export type FeeGrowthGlobal1X128Params = FunctionArguments -export type FeeGrowthGlobal1X128Return = FunctionReturn - -export type FlashParams = FunctionArguments -export type FlashReturn = FunctionReturn - -export type GaugeParams = FunctionArguments -export type GaugeReturn = FunctionReturn - -export type GaugeFeesParams = FunctionArguments -export type GaugeFeesReturn = FunctionReturn - -export type GetRewardGrowthInsideParams = FunctionArguments -export type GetRewardGrowthInsideReturn = FunctionReturn - -export type IncreaseObservationCardinalityNextParams = FunctionArguments -export type IncreaseObservationCardinalityNextReturn = FunctionReturn - -export type InitializeParams = FunctionArguments -export type InitializeReturn = FunctionReturn - -export type LastUpdatedParams = FunctionArguments -export type LastUpdatedReturn = FunctionReturn - -export type LiquidityParams = FunctionArguments -export type LiquidityReturn = FunctionReturn - -export type MaxLiquidityPerTickParams = FunctionArguments -export type MaxLiquidityPerTickReturn = FunctionReturn - -export type MintParams = FunctionArguments -export type MintReturn = FunctionReturn - -export type NftParams = FunctionArguments -export type NftReturn = FunctionReturn - -export type ObservationsParams = FunctionArguments -export type ObservationsReturn = FunctionReturn - -export type ObserveParams = FunctionArguments -export type ObserveReturn = FunctionReturn - -export type PeriodFinishParams = FunctionArguments -export type PeriodFinishReturn = FunctionReturn - -export type PositionsParams = FunctionArguments -export type PositionsReturn = FunctionReturn - -export type RewardGrowthGlobalX128Params = FunctionArguments -export type RewardGrowthGlobalX128Return = FunctionReturn - -export type RewardRateParams = FunctionArguments -export type RewardRateReturn = FunctionReturn - -export type RewardReserveParams = FunctionArguments -export type RewardReserveReturn = FunctionReturn - -export type RolloverParams = FunctionArguments -export type RolloverReturn = FunctionReturn - -export type SetGaugeAndPositionManagerParams = FunctionArguments -export type SetGaugeAndPositionManagerReturn = FunctionReturn - -export type Slot0Params = FunctionArguments -export type Slot0Return = FunctionReturn - -export type SnapshotCumulativesInsideParams = FunctionArguments -export type SnapshotCumulativesInsideReturn = FunctionReturn - -export type StakeParams = FunctionArguments -export type StakeReturn = FunctionReturn - -export type StakedLiquidityParams = FunctionArguments -export type StakedLiquidityReturn = FunctionReturn - -export type SwapParams = FunctionArguments -export type SwapReturn = FunctionReturn - -export type SyncRewardParams = FunctionArguments -export type SyncRewardReturn = FunctionReturn - -export type TickBitmapParams = FunctionArguments -export type TickBitmapReturn = FunctionReturn - -export type TickSpacingParams = FunctionArguments -export type TickSpacingReturn = FunctionReturn - -export type TicksParams = FunctionArguments -export type TicksReturn = FunctionReturn - -export type Token0Params = FunctionArguments -export type Token0Return = FunctionReturn - -export type Token1Params = FunctionArguments -export type Token1Return = FunctionReturn - -export type UnstakedFeeParams = FunctionArguments -export type UnstakedFeeReturn = FunctionReturn - -export type UpdateRewardsGrowthGlobalParams = FunctionArguments -export type UpdateRewardsGrowthGlobalReturn = FunctionReturn - diff --git a/src/abi/aerodrome-cl-pool/contract.ts b/src/abi/aerodrome-cl-pool/contract.ts new file mode 100644 index 00000000..d4f40a8a --- /dev/null +++ b/src/abi/aerodrome-cl-pool/contract.ts @@ -0,0 +1,149 @@ +import { ContractBase } from '../abi.support.js' +import { burn, burn_1, collect, collectFees, collect_1, factory, factoryRegistry, fee, feeGrowthGlobal0X128, feeGrowthGlobal1X128, gauge, gaugeFees, getRewardGrowthInside, lastUpdated, liquidity, maxLiquidityPerTick, mint, nft, observations, observe, periodFinish, positions, rewardGrowthGlobalX128, rewardRate, rewardReserve, rollover, slot0, snapshotCumulativesInside, stakedLiquidity, swap, tickBitmap, tickSpacing, ticks, token0, token1, unstakedFee } from './functions.js' +import type { BurnParams, BurnParams_1, CollectParams, CollectParams_1, GetRewardGrowthInsideParams, MintParams, ObservationsParams, ObserveParams, PositionsParams, SnapshotCumulativesInsideParams, SwapParams, TickBitmapParams, TicksParams } from './functions.js' + +export class Contract extends ContractBase { + burn(tickLower: BurnParams["tickLower"], tickUpper: BurnParams["tickUpper"], amount: BurnParams["amount"], owner: BurnParams["owner"]) { + return this.eth_call(burn, {tickLower, tickUpper, amount, owner}) + } + + burn_1(tickLower: BurnParams_1["tickLower"], tickUpper: BurnParams_1["tickUpper"], amount: BurnParams_1["amount"]) { + return this.eth_call(burn_1, {tickLower, tickUpper, amount}) + } + + collect(recipient: CollectParams["recipient"], tickLower: CollectParams["tickLower"], tickUpper: CollectParams["tickUpper"], amount0Requested: CollectParams["amount0Requested"], amount1Requested: CollectParams["amount1Requested"], owner: CollectParams["owner"]) { + return this.eth_call(collect, {recipient, tickLower, tickUpper, amount0Requested, amount1Requested, owner}) + } + + collect_1(recipient: CollectParams_1["recipient"], tickLower: CollectParams_1["tickLower"], tickUpper: CollectParams_1["tickUpper"], amount0Requested: CollectParams_1["amount0Requested"], amount1Requested: CollectParams_1["amount1Requested"]) { + return this.eth_call(collect_1, {recipient, tickLower, tickUpper, amount0Requested, amount1Requested}) + } + + collectFees() { + return this.eth_call(collectFees, {}) + } + + factory() { + return this.eth_call(factory, {}) + } + + factoryRegistry() { + return this.eth_call(factoryRegistry, {}) + } + + fee() { + return this.eth_call(fee, {}) + } + + feeGrowthGlobal0X128() { + return this.eth_call(feeGrowthGlobal0X128, {}) + } + + feeGrowthGlobal1X128() { + return this.eth_call(feeGrowthGlobal1X128, {}) + } + + gauge() { + return this.eth_call(gauge, {}) + } + + gaugeFees() { + return this.eth_call(gaugeFees, {}) + } + + getRewardGrowthInside(tickLower: GetRewardGrowthInsideParams["tickLower"], tickUpper: GetRewardGrowthInsideParams["tickUpper"], _rewardGrowthGlobalX128: GetRewardGrowthInsideParams["_rewardGrowthGlobalX128"]) { + return this.eth_call(getRewardGrowthInside, {tickLower, tickUpper, _rewardGrowthGlobalX128}) + } + + lastUpdated() { + return this.eth_call(lastUpdated, {}) + } + + liquidity() { + return this.eth_call(liquidity, {}) + } + + maxLiquidityPerTick() { + return this.eth_call(maxLiquidityPerTick, {}) + } + + mint(recipient: MintParams["recipient"], tickLower: MintParams["tickLower"], tickUpper: MintParams["tickUpper"], amount: MintParams["amount"], data: MintParams["data"]) { + return this.eth_call(mint, {recipient, tickLower, tickUpper, amount, data}) + } + + nft() { + return this.eth_call(nft, {}) + } + + observations(_0: ObservationsParams["_0"]) { + return this.eth_call(observations, {_0}) + } + + observe(secondsAgos: ObserveParams["secondsAgos"]) { + return this.eth_call(observe, {secondsAgos}) + } + + periodFinish() { + return this.eth_call(periodFinish, {}) + } + + positions(_0: PositionsParams["_0"]) { + return this.eth_call(positions, {_0}) + } + + rewardGrowthGlobalX128() { + return this.eth_call(rewardGrowthGlobalX128, {}) + } + + rewardRate() { + return this.eth_call(rewardRate, {}) + } + + rewardReserve() { + return this.eth_call(rewardReserve, {}) + } + + rollover() { + return this.eth_call(rollover, {}) + } + + slot0() { + return this.eth_call(slot0, {}) + } + + snapshotCumulativesInside(tickLower: SnapshotCumulativesInsideParams["tickLower"], tickUpper: SnapshotCumulativesInsideParams["tickUpper"]) { + return this.eth_call(snapshotCumulativesInside, {tickLower, tickUpper}) + } + + stakedLiquidity() { + return this.eth_call(stakedLiquidity, {}) + } + + swap(recipient: SwapParams["recipient"], zeroForOne: SwapParams["zeroForOne"], amountSpecified: SwapParams["amountSpecified"], sqrtPriceLimitX96: SwapParams["sqrtPriceLimitX96"], data: SwapParams["data"]) { + return this.eth_call(swap, {recipient, zeroForOne, amountSpecified, sqrtPriceLimitX96, data}) + } + + tickBitmap(_0: TickBitmapParams["_0"]) { + return this.eth_call(tickBitmap, {_0}) + } + + tickSpacing() { + return this.eth_call(tickSpacing, {}) + } + + ticks(_0: TicksParams["_0"]) { + return this.eth_call(ticks, {_0}) + } + + token0() { + return this.eth_call(token0, {}) + } + + token1() { + return this.eth_call(token1, {}) + } + + unstakedFee() { + return this.eth_call(unstakedFee, {}) + } +} diff --git a/src/abi/aerodrome-cl-pool/events.ts b/src/abi/aerodrome-cl-pool/events.ts new file mode 100644 index 00000000..a32e48e6 --- /dev/null +++ b/src/abi/aerodrome-cl-pool/events.ts @@ -0,0 +1,91 @@ +import { address, int24, int256, uint128, uint16, uint160, uint256, uint8 } from '@subsquid/evm-codec' +import { event, indexed } from '../abi.support.js' +import type { EventParams as EParams } from '../abi.support.js' + +/** Burn(address,int24,int24,uint128,uint256,uint256) */ +export const Burn = event('0x0c396cd989a39f4459b5fa1aed6a9a8dcdbc45908acfd67e028cd568da98982c', { + owner: indexed(address), + tickLower: indexed(int24), + tickUpper: indexed(int24), + amount: uint128, + amount0: uint256, + amount1: uint256, +}) +export type BurnEventArgs = EParams + +/** Collect(address,address,int24,int24,uint128,uint128) */ +export const Collect = event('0x70935338e69775456a85ddef226c395fb668b63fa0115f5f20610b388e6ca9c0', { + owner: indexed(address), + recipient: address, + tickLower: indexed(int24), + tickUpper: indexed(int24), + amount0: uint128, + amount1: uint128, +}) +export type CollectEventArgs = EParams + +/** CollectFees(address,uint128,uint128) */ +export const CollectFees = event('0x205860e66845f2bbc0966bfab80db9bf93fca93862ea2b9fcf6945748352b4a3', { + recipient: indexed(address), + amount0: uint128, + amount1: uint128, +}) +export type CollectFeesEventArgs = EParams + +/** Flash(address,address,uint256,uint256,uint256,uint256) */ +export const Flash = event('0xbdbdb71d7860376ba52b25a5028beea23581364a40522f6bcfb86bb1f2dca633', { + sender: indexed(address), + recipient: indexed(address), + amount0: uint256, + amount1: uint256, + paid0: uint256, + paid1: uint256, +}) +export type FlashEventArgs = EParams + +/** IncreaseObservationCardinalityNext(uint16,uint16) */ +export const IncreaseObservationCardinalityNext = event('0xac49e518f90a358f652e4400164f05a5d8f7e35e7747279bc3a93dbf584e125a', { + observationCardinalityNextOld: uint16, + observationCardinalityNextNew: uint16, +}) +export type IncreaseObservationCardinalityNextEventArgs = EParams + +/** Initialize(uint160,int24) */ +export const Initialize = event('0x98636036cb66a9c19a37435efc1e90142190214e8abeb821bdba3f2990dd4c95', { + sqrtPriceX96: uint160, + tick: int24, +}) +export type InitializeEventArgs = EParams + +/** Mint(address,address,int24,int24,uint128,uint256,uint256) */ +export const Mint = event('0x7a53080ba414158be7ec69b987b5fb7d07dee101fe85488f0853ae16239d0bde', { + sender: address, + owner: indexed(address), + tickLower: indexed(int24), + tickUpper: indexed(int24), + amount: uint128, + amount0: uint256, + amount1: uint256, +}) +export type MintEventArgs = EParams + +/** SetFeeProtocol(uint8,uint8,uint8,uint8) */ +export const SetFeeProtocol = event('0x973d8d92bb299f4af6ce49b52a8adb85ae46b9f214c4c4fc06ac77401237b133', { + feeProtocol0Old: uint8, + feeProtocol1Old: uint8, + feeProtocol0New: uint8, + feeProtocol1New: uint8, +}) +export type SetFeeProtocolEventArgs = EParams + +/** Swap(address,address,int256,int256,uint160,uint128,int24) */ +export const Swap = event('0xc42079f94a6350d7e6235f29174924f928cc2ac818eb64fed8004e115fbcca67', { + sender: indexed(address), + recipient: indexed(address), + amount0: int256, + amount1: int256, + sqrtPriceX96: uint160, + liquidity: uint128, + tick: int24, +}) +export type SwapEventArgs = EParams diff --git a/src/abi/aerodrome-cl-pool/functions.ts b/src/abi/aerodrome-cl-pool/functions.ts new file mode 100644 index 00000000..9438a5c9 --- /dev/null +++ b/src/abi/aerodrome-cl-pool/functions.ts @@ -0,0 +1,355 @@ +import { address, array, bool, bytes, bytes32, int128, int16, int24, int256, int56, struct, uint128, uint16, uint160, uint24, uint256, uint32 } from '@subsquid/evm-codec' +import { func } from '../abi.support.js' +import type { FunctionArguments, FunctionReturn } from '../abi.support.js' + +/** burn(int24,int24,uint128,address) */ +export const burn = func('0x6f89244c', { + tickLower: int24, + tickUpper: int24, + amount: uint128, + owner: address, +}, struct({ + amount0: uint256, + amount1: uint256, +})) +export type BurnParams = FunctionArguments +export type BurnReturn = FunctionReturn + +/** burn(int24,int24,uint128) */ +export const burn_1 = func('0xa34123a7', { + tickLower: int24, + tickUpper: int24, + amount: uint128, +}, struct({ + amount0: uint256, + amount1: uint256, +})) +export type BurnParams_1 = FunctionArguments +export type BurnReturn_1 = FunctionReturn + +/** collect(address,int24,int24,uint128,uint128,address) */ +export const collect = func('0x31338374', { + recipient: address, + tickLower: int24, + tickUpper: int24, + amount0Requested: uint128, + amount1Requested: uint128, + owner: address, +}, struct({ + amount0: uint128, + amount1: uint128, +})) +export type CollectParams = FunctionArguments +export type CollectReturn = FunctionReturn + +/** collect(address,int24,int24,uint128,uint128) */ +export const collect_1 = func('0x4f1eb3d8', { + recipient: address, + tickLower: int24, + tickUpper: int24, + amount0Requested: uint128, + amount1Requested: uint128, +}, struct({ + amount0: uint128, + amount1: uint128, +})) +export type CollectParams_1 = FunctionArguments +export type CollectReturn_1 = FunctionReturn + +/** collectFees() */ +export const collectFees = func('0xc8796572', {}, struct({ + amount0: uint128, + amount1: uint128, +})) +export type CollectFeesParams = FunctionArguments +export type CollectFeesReturn = FunctionReturn + +/** factory() */ +export const factory = func('0xc45a0155', {}, address) +export type FactoryParams = FunctionArguments +export type FactoryReturn = FunctionReturn + +/** factoryRegistry() */ +export const factoryRegistry = func('0x3bf0c9fb', {}, address) +export type FactoryRegistryParams = FunctionArguments +export type FactoryRegistryReturn = FunctionReturn + +/** fee() */ +export const fee = func('0xddca3f43', {}, uint24) +export type FeeParams = FunctionArguments +export type FeeReturn = FunctionReturn + +/** feeGrowthGlobal0X128() */ +export const feeGrowthGlobal0X128 = func('0xf3058399', {}, uint256) +export type FeeGrowthGlobal0X128Params = FunctionArguments +export type FeeGrowthGlobal0X128Return = FunctionReturn + +/** feeGrowthGlobal1X128() */ +export const feeGrowthGlobal1X128 = func('0x46141319', {}, uint256) +export type FeeGrowthGlobal1X128Params = FunctionArguments +export type FeeGrowthGlobal1X128Return = FunctionReturn + +/** flash(address,uint256,uint256,bytes) */ +export const flash = func('0x490e6cbc', { + recipient: address, + amount0: uint256, + amount1: uint256, + data: bytes, +}) +export type FlashParams = FunctionArguments +export type FlashReturn = FunctionReturn + +/** gauge() */ +export const gauge = func('0xa6f19c84', {}, address) +export type GaugeParams = FunctionArguments +export type GaugeReturn = FunctionReturn + +/** gaugeFees() */ +export const gaugeFees = func('0x293833ba', {}, struct({ + token0: uint128, + token1: uint128, +})) +export type GaugeFeesParams = FunctionArguments +export type GaugeFeesReturn = FunctionReturn + +/** getRewardGrowthInside(int24,int24,uint256) */ +export const getRewardGrowthInside = func('0xa16368c9', { + tickLower: int24, + tickUpper: int24, + _rewardGrowthGlobalX128: uint256, +}, uint256) +export type GetRewardGrowthInsideParams = FunctionArguments +export type GetRewardGrowthInsideReturn = FunctionReturn + +/** increaseObservationCardinalityNext(uint16) */ +export const increaseObservationCardinalityNext = func('0x32148f67', { + observationCardinalityNext: uint16, +}) +export type IncreaseObservationCardinalityNextParams = FunctionArguments +export type IncreaseObservationCardinalityNextReturn = FunctionReturn + +/** initialize(address,address,address,int24,address,uint160) */ +export const initialize = func('0x2071d884', { + _factory: address, + _token0: address, + _token1: address, + _tickSpacing: int24, + _factoryRegistry: address, + _sqrtPriceX96: uint160, +}) +export type InitializeParams = FunctionArguments +export type InitializeReturn = FunctionReturn + +/** lastUpdated() */ +export const lastUpdated = func('0xd0b06f5d', {}, uint32) +export type LastUpdatedParams = FunctionArguments +export type LastUpdatedReturn = FunctionReturn + +/** liquidity() */ +export const liquidity = func('0x1a686502', {}, uint128) +export type LiquidityParams = FunctionArguments +export type LiquidityReturn = FunctionReturn + +/** maxLiquidityPerTick() */ +export const maxLiquidityPerTick = func('0x70cf754a', {}, uint128) +export type MaxLiquidityPerTickParams = FunctionArguments +export type MaxLiquidityPerTickReturn = FunctionReturn + +/** mint(address,int24,int24,uint128,bytes) */ +export const mint = func('0x3c8a7d8d', { + recipient: address, + tickLower: int24, + tickUpper: int24, + amount: uint128, + data: bytes, +}, struct({ + amount0: uint256, + amount1: uint256, +})) +export type MintParams = FunctionArguments +export type MintReturn = FunctionReturn + +/** nft() */ +export const nft = func('0x47ccca02', {}, address) +export type NftParams = FunctionArguments +export type NftReturn = FunctionReturn + +/** observations(uint256) */ +export const observations = func('0x252c09d7', { + _0: uint256, +}, struct({ + blockTimestamp: uint32, + tickCumulative: int56, + secondsPerLiquidityCumulativeX128: uint160, + initialized: bool, +})) +export type ObservationsParams = FunctionArguments +export type ObservationsReturn = FunctionReturn + +/** observe(uint32[]) */ +export const observe = func('0x883bdbfd', { + secondsAgos: array(uint32), +}, struct({ + tickCumulatives: array(int56), + secondsPerLiquidityCumulativeX128s: array(uint160), +})) +export type ObserveParams = FunctionArguments +export type ObserveReturn = FunctionReturn + +/** periodFinish() */ +export const periodFinish = func('0xebe2b12b', {}, uint256) +export type PeriodFinishParams = FunctionArguments +export type PeriodFinishReturn = FunctionReturn + +/** positions(bytes32) */ +export const positions = func('0x514ea4bf', { + _0: bytes32, +}, struct({ + liquidity: uint128, + feeGrowthInside0LastX128: uint256, + feeGrowthInside1LastX128: uint256, + tokensOwed0: uint128, + tokensOwed1: uint128, +})) +export type PositionsParams = FunctionArguments +export type PositionsReturn = FunctionReturn + +/** rewardGrowthGlobalX128() */ +export const rewardGrowthGlobalX128 = func('0x57806ada', {}, uint256) +export type RewardGrowthGlobalX128Params = FunctionArguments +export type RewardGrowthGlobalX128Return = FunctionReturn + +/** rewardRate() */ +export const rewardRate = func('0x7b0a47ee', {}, uint256) +export type RewardRateParams = FunctionArguments +export type RewardRateReturn = FunctionReturn + +/** rewardReserve() */ +export const rewardReserve = func('0xcab64bcd', {}, uint256) +export type RewardReserveParams = FunctionArguments +export type RewardReserveReturn = FunctionReturn + +/** rollover() */ +export const rollover = func('0xb056b49a', {}, uint256) +export type RolloverParams = FunctionArguments +export type RolloverReturn = FunctionReturn + +/** setGaugeAndPositionManager(address,address) */ +export const setGaugeAndPositionManager = func('0x1f7c3568', { + _gauge: address, + _nft: address, +}) +export type SetGaugeAndPositionManagerParams = FunctionArguments +export type SetGaugeAndPositionManagerReturn = FunctionReturn + +/** slot0() */ +export const slot0 = func('0x3850c7bd', {}, struct({ + sqrtPriceX96: uint160, + tick: int24, + observationIndex: uint16, + observationCardinality: uint16, + observationCardinalityNext: uint16, + unlocked: bool, +})) +export type Slot0Params = FunctionArguments +export type Slot0Return = FunctionReturn + +/** snapshotCumulativesInside(int24,int24) */ +export const snapshotCumulativesInside = func('0xa38807f2', { + tickLower: int24, + tickUpper: int24, +}, struct({ + tickCumulativeInside: int56, + secondsPerLiquidityInsideX128: uint160, + secondsInside: uint32, +})) +export type SnapshotCumulativesInsideParams = FunctionArguments +export type SnapshotCumulativesInsideReturn = FunctionReturn + +/** stake(int128,int24,int24,bool) */ +export const stake = func('0x4ed6210f', { + stakedLiquidityDelta: int128, + tickLower: int24, + tickUpper: int24, + positionUpdate: bool, +}) +export type StakeParams = FunctionArguments +export type StakeReturn = FunctionReturn + +/** stakedLiquidity() */ +export const stakedLiquidity = func('0x3ab04b20', {}, uint128) +export type StakedLiquidityParams = FunctionArguments +export type StakedLiquidityReturn = FunctionReturn + +/** swap(address,bool,int256,uint160,bytes) */ +export const swap = func('0x128acb08', { + recipient: address, + zeroForOne: bool, + amountSpecified: int256, + sqrtPriceLimitX96: uint160, + data: bytes, +}, struct({ + amount0: int256, + amount1: int256, +})) +export type SwapParams = FunctionArguments +export type SwapReturn = FunctionReturn + +/** syncReward(uint256,uint256,uint256) */ +export const syncReward = func('0x60a73f9b', { + _rewardRate: uint256, + _rewardReserve: uint256, + _periodFinish: uint256, +}) +export type SyncRewardParams = FunctionArguments +export type SyncRewardReturn = FunctionReturn + +/** tickBitmap(int16) */ +export const tickBitmap = func('0x5339c296', { + _0: int16, +}, uint256) +export type TickBitmapParams = FunctionArguments +export type TickBitmapReturn = FunctionReturn + +/** tickSpacing() */ +export const tickSpacing = func('0xd0c93a7c', {}, int24) +export type TickSpacingParams = FunctionArguments +export type TickSpacingReturn = FunctionReturn + +/** ticks(int24) */ +export const ticks = func('0xf30dba93', { + _0: int24, +}, struct({ + liquidityGross: uint128, + liquidityNet: int128, + stakedLiquidityNet: int128, + feeGrowthOutside0X128: uint256, + feeGrowthOutside1X128: uint256, + rewardGrowthOutsideX128: uint256, + tickCumulativeOutside: int56, + secondsPerLiquidityOutsideX128: uint160, + secondsOutside: uint32, + initialized: bool, +})) +export type TicksParams = FunctionArguments +export type TicksReturn = FunctionReturn + +/** token0() */ +export const token0 = func('0x0dfe1681', {}, address) +export type Token0Params = FunctionArguments +export type Token0Return = FunctionReturn + +/** token1() */ +export const token1 = func('0xd21220a7', {}, address) +export type Token1Params = FunctionArguments +export type Token1Return = FunctionReturn + +/** unstakedFee() */ +export const unstakedFee = func('0xb64cc67b', {}, uint24) +export type UnstakedFeeParams = FunctionArguments +export type UnstakedFeeReturn = FunctionReturn + +/** updateRewardsGrowthGlobal() */ +export const updateRewardsGrowthGlobal = func('0x1b410960', {}) +export type UpdateRewardsGrowthGlobalParams = FunctionArguments +export type UpdateRewardsGrowthGlobalReturn = FunctionReturn diff --git a/src/abi/aerodrome-cl-pool/index.ts b/src/abi/aerodrome-cl-pool/index.ts new file mode 100644 index 00000000..11829d6e --- /dev/null +++ b/src/abi/aerodrome-cl-pool/index.ts @@ -0,0 +1,4 @@ +export * as events from './events.js' +export * as functions from './functions.js' + +export { Contract } from './contract.js' diff --git a/src/abi/aerodrome-gauge.ts b/src/abi/aerodrome-gauge.ts deleted file mode 100644 index 692c4c86..00000000 --- a/src/abi/aerodrome-gauge.ts +++ /dev/null @@ -1,226 +0,0 @@ -import * as p from '@subsquid/evm-codec' -import { event, fun, viewFun, indexed, ContractBase } from '@subsquid/evm-abi' -import type { EventParams as EParams, FunctionArguments, FunctionReturn } from '@subsquid/evm-abi' - -export const events = { - ClaimFees: event("0xbc567d6cbad26368064baa0ab5a757be46aae4d70f707f9203d9d9b6c8ccbfa3", "ClaimFees(address,uint256,uint256)", {"from": indexed(p.address), "claimed0": p.uint256, "claimed1": p.uint256}), - ClaimRewards: event("0x1f89f96333d3133000ee447473151fa9606543368f02271c9d95ae14f13bcc67", "ClaimRewards(address,uint256)", {"from": indexed(p.address), "amount": p.uint256}), - Deposit: event("0x5548c837ab068cf56a2c2479df0882a4922fd203edb7517321831d95078c5f62", "Deposit(address,address,uint256)", {"from": indexed(p.address), "to": indexed(p.address), "amount": p.uint256}), - NotifyReward: event("0x095667752957714306e1a6ad83495404412df6fdb932fca6dc849a7ee910d4c1", "NotifyReward(address,uint256)", {"from": indexed(p.address), "amount": p.uint256}), - Withdraw: event("0x884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364", "Withdraw(address,uint256)", {"from": indexed(p.address), "amount": p.uint256}), -} - -export const functions = { - balanceOf: viewFun("0x70a08231", "balanceOf(address)", {"_0": p.address}, p.uint256), - 'deposit(uint256,address)': fun("0x6e553f65", "deposit(uint256,address)", {"_amount": p.uint256, "_recipient": p.address}, ), - 'deposit(uint256)': fun("0xb6b55f25", "deposit(uint256)", {"_amount": p.uint256}, ), - earned: viewFun("0x008cc262", "earned(address)", {"_account": p.address}, p.uint256), - fees0: viewFun("0x93f1c442", "fees0()", {}, p.uint256), - fees1: viewFun("0x4c02a21c", "fees1()", {}, p.uint256), - feesVotingReward: viewFun("0x0fe2f711", "feesVotingReward()", {}, p.address), - getReward: fun("0xc00007b0", "getReward(address)", {"_account": p.address}, ), - isPool: viewFun("0xe2e1c6db", "isPool()", {}, p.bool), - isTrustedForwarder: viewFun("0x572b6c05", "isTrustedForwarder(address)", {"forwarder": p.address}, p.bool), - lastTimeRewardApplicable: viewFun("0x80faa57d", "lastTimeRewardApplicable()", {}, p.uint256), - lastUpdateTime: viewFun("0xc8f33c91", "lastUpdateTime()", {}, p.uint256), - left: viewFun("0x16e64048", "left()", {}, p.uint256), - notifyRewardAmount: fun("0x3c6b16ab", "notifyRewardAmount(uint256)", {"_amount": p.uint256}, ), - notifyRewardWithoutClaim: fun("0xdcdc18dc", "notifyRewardWithoutClaim(uint256)", {"_amount": p.uint256}, ), - periodFinish: viewFun("0xebe2b12b", "periodFinish()", {}, p.uint256), - rewardPerToken: viewFun("0xcd3daf9d", "rewardPerToken()", {}, p.uint256), - rewardPerTokenStored: viewFun("0xdf136d65", "rewardPerTokenStored()", {}, p.uint256), - rewardRate: viewFun("0x7b0a47ee", "rewardRate()", {}, p.uint256), - rewardRateByEpoch: viewFun("0x94af5b63", "rewardRateByEpoch(uint256)", {"_0": p.uint256}, p.uint256), - rewardToken: viewFun("0xf7c618c1", "rewardToken()", {}, p.address), - rewards: viewFun("0x0700037d", "rewards(address)", {"_0": p.address}, p.uint256), - stakingToken: viewFun("0x72f702f3", "stakingToken()", {}, p.address), - totalSupply: viewFun("0x18160ddd", "totalSupply()", {}, p.uint256), - userRewardPerTokenPaid: viewFun("0x8b876347", "userRewardPerTokenPaid(address)", {"_0": p.address}, p.uint256), - ve: viewFun("0x1f850716", "ve()", {}, p.address), - voter: viewFun("0x46c96aac", "voter()", {}, p.address), - withdraw: fun("0x2e1a7d4d", "withdraw(uint256)", {"_amount": p.uint256}, ), -} - -export class Contract extends ContractBase { - - balanceOf(_0: BalanceOfParams["_0"]) { - return this.eth_call(functions.balanceOf, {_0}) - } - - earned(_account: EarnedParams["_account"]) { - return this.eth_call(functions.earned, {_account}) - } - - fees0() { - return this.eth_call(functions.fees0, {}) - } - - fees1() { - return this.eth_call(functions.fees1, {}) - } - - feesVotingReward() { - return this.eth_call(functions.feesVotingReward, {}) - } - - isPool() { - return this.eth_call(functions.isPool, {}) - } - - isTrustedForwarder(forwarder: IsTrustedForwarderParams["forwarder"]) { - return this.eth_call(functions.isTrustedForwarder, {forwarder}) - } - - lastTimeRewardApplicable() { - return this.eth_call(functions.lastTimeRewardApplicable, {}) - } - - lastUpdateTime() { - return this.eth_call(functions.lastUpdateTime, {}) - } - - left() { - return this.eth_call(functions.left, {}) - } - - periodFinish() { - return this.eth_call(functions.periodFinish, {}) - } - - rewardPerToken() { - return this.eth_call(functions.rewardPerToken, {}) - } - - rewardPerTokenStored() { - return this.eth_call(functions.rewardPerTokenStored, {}) - } - - rewardRate() { - return this.eth_call(functions.rewardRate, {}) - } - - rewardRateByEpoch(_0: RewardRateByEpochParams["_0"]) { - return this.eth_call(functions.rewardRateByEpoch, {_0}) - } - - rewardToken() { - return this.eth_call(functions.rewardToken, {}) - } - - rewards(_0: RewardsParams["_0"]) { - return this.eth_call(functions.rewards, {_0}) - } - - stakingToken() { - return this.eth_call(functions.stakingToken, {}) - } - - totalSupply() { - return this.eth_call(functions.totalSupply, {}) - } - - userRewardPerTokenPaid(_0: UserRewardPerTokenPaidParams["_0"]) { - return this.eth_call(functions.userRewardPerTokenPaid, {_0}) - } - - ve() { - return this.eth_call(functions.ve, {}) - } - - voter() { - return this.eth_call(functions.voter, {}) - } -} - -/// Event types -export type ClaimFeesEventArgs = EParams -export type ClaimRewardsEventArgs = EParams -export type DepositEventArgs = EParams -export type NotifyRewardEventArgs = EParams -export type WithdrawEventArgs = EParams - -/// Function types -export type BalanceOfParams = FunctionArguments -export type BalanceOfReturn = FunctionReturn - -export type DepositParams_0 = FunctionArguments -export type DepositReturn_0 = FunctionReturn - -export type DepositParams_1 = FunctionArguments -export type DepositReturn_1 = FunctionReturn - -export type EarnedParams = FunctionArguments -export type EarnedReturn = FunctionReturn - -export type Fees0Params = FunctionArguments -export type Fees0Return = FunctionReturn - -export type Fees1Params = FunctionArguments -export type Fees1Return = FunctionReturn - -export type FeesVotingRewardParams = FunctionArguments -export type FeesVotingRewardReturn = FunctionReturn - -export type GetRewardParams = FunctionArguments -export type GetRewardReturn = FunctionReturn - -export type IsPoolParams = FunctionArguments -export type IsPoolReturn = FunctionReturn - -export type IsTrustedForwarderParams = FunctionArguments -export type IsTrustedForwarderReturn = FunctionReturn - -export type LastTimeRewardApplicableParams = FunctionArguments -export type LastTimeRewardApplicableReturn = FunctionReturn - -export type LastUpdateTimeParams = FunctionArguments -export type LastUpdateTimeReturn = FunctionReturn - -export type LeftParams = FunctionArguments -export type LeftReturn = FunctionReturn - -export type NotifyRewardAmountParams = FunctionArguments -export type NotifyRewardAmountReturn = FunctionReturn - -export type NotifyRewardWithoutClaimParams = FunctionArguments -export type NotifyRewardWithoutClaimReturn = FunctionReturn - -export type PeriodFinishParams = FunctionArguments -export type PeriodFinishReturn = FunctionReturn - -export type RewardPerTokenParams = FunctionArguments -export type RewardPerTokenReturn = FunctionReturn - -export type RewardPerTokenStoredParams = FunctionArguments -export type RewardPerTokenStoredReturn = FunctionReturn - -export type RewardRateParams = FunctionArguments -export type RewardRateReturn = FunctionReturn - -export type RewardRateByEpochParams = FunctionArguments -export type RewardRateByEpochReturn = FunctionReturn - -export type RewardTokenParams = FunctionArguments -export type RewardTokenReturn = FunctionReturn - -export type RewardsParams = FunctionArguments -export type RewardsReturn = FunctionReturn - -export type StakingTokenParams = FunctionArguments -export type StakingTokenReturn = FunctionReturn - -export type TotalSupplyParams = FunctionArguments -export type TotalSupplyReturn = FunctionReturn - -export type UserRewardPerTokenPaidParams = FunctionArguments -export type UserRewardPerTokenPaidReturn = FunctionReturn - -export type VeParams = FunctionArguments -export type VeReturn = FunctionReturn - -export type VoterParams = FunctionArguments -export type VoterReturn = FunctionReturn - -export type WithdrawParams = FunctionArguments -export type WithdrawReturn = FunctionReturn - diff --git a/src/abi/aerodrome-gauge/contract.ts b/src/abi/aerodrome-gauge/contract.ts new file mode 100644 index 00000000..b010f063 --- /dev/null +++ b/src/abi/aerodrome-gauge/contract.ts @@ -0,0 +1,93 @@ +import { ContractBase } from '../abi.support.js' +import { balanceOf, earned, fees0, fees1, feesVotingReward, isPool, isTrustedForwarder, lastTimeRewardApplicable, lastUpdateTime, left, periodFinish, rewardPerToken, rewardPerTokenStored, rewardRate, rewardRateByEpoch, rewardToken, rewards, stakingToken, totalSupply, userRewardPerTokenPaid, ve, voter } from './functions.js' +import type { BalanceOfParams, EarnedParams, IsTrustedForwarderParams, RewardRateByEpochParams, RewardsParams, UserRewardPerTokenPaidParams } from './functions.js' + +export class Contract extends ContractBase { + balanceOf(_0: BalanceOfParams["_0"]) { + return this.eth_call(balanceOf, {_0}) + } + + earned(_account: EarnedParams["_account"]) { + return this.eth_call(earned, {_account}) + } + + fees0() { + return this.eth_call(fees0, {}) + } + + fees1() { + return this.eth_call(fees1, {}) + } + + feesVotingReward() { + return this.eth_call(feesVotingReward, {}) + } + + isPool() { + return this.eth_call(isPool, {}) + } + + isTrustedForwarder(forwarder: IsTrustedForwarderParams["forwarder"]) { + return this.eth_call(isTrustedForwarder, {forwarder}) + } + + lastTimeRewardApplicable() { + return this.eth_call(lastTimeRewardApplicable, {}) + } + + lastUpdateTime() { + return this.eth_call(lastUpdateTime, {}) + } + + left() { + return this.eth_call(left, {}) + } + + periodFinish() { + return this.eth_call(periodFinish, {}) + } + + rewardPerToken() { + return this.eth_call(rewardPerToken, {}) + } + + rewardPerTokenStored() { + return this.eth_call(rewardPerTokenStored, {}) + } + + rewardRate() { + return this.eth_call(rewardRate, {}) + } + + rewardRateByEpoch(_0: RewardRateByEpochParams["_0"]) { + return this.eth_call(rewardRateByEpoch, {_0}) + } + + rewardToken() { + return this.eth_call(rewardToken, {}) + } + + rewards(_0: RewardsParams["_0"]) { + return this.eth_call(rewards, {_0}) + } + + stakingToken() { + return this.eth_call(stakingToken, {}) + } + + totalSupply() { + return this.eth_call(totalSupply, {}) + } + + userRewardPerTokenPaid(_0: UserRewardPerTokenPaidParams["_0"]) { + return this.eth_call(userRewardPerTokenPaid, {_0}) + } + + ve() { + return this.eth_call(ve, {}) + } + + voter() { + return this.eth_call(voter, {}) + } +} diff --git a/src/abi/aerodrome-gauge/events.ts b/src/abi/aerodrome-gauge/events.ts new file mode 100644 index 00000000..67799234 --- /dev/null +++ b/src/abi/aerodrome-gauge/events.ts @@ -0,0 +1,40 @@ +import { address, uint256 } from '@subsquid/evm-codec' +import { event, indexed } from '../abi.support.js' +import type { EventParams as EParams } from '../abi.support.js' + +/** ClaimFees(address,uint256,uint256) */ +export const ClaimFees = event('0xbc567d6cbad26368064baa0ab5a757be46aae4d70f707f9203d9d9b6c8ccbfa3', { + from: indexed(address), + claimed0: uint256, + claimed1: uint256, +}) +export type ClaimFeesEventArgs = EParams + +/** ClaimRewards(address,uint256) */ +export const ClaimRewards = event('0x1f89f96333d3133000ee447473151fa9606543368f02271c9d95ae14f13bcc67', { + from: indexed(address), + amount: uint256, +}) +export type ClaimRewardsEventArgs = EParams + +/** Deposit(address,address,uint256) */ +export const Deposit = event('0x5548c837ab068cf56a2c2479df0882a4922fd203edb7517321831d95078c5f62', { + from: indexed(address), + to: indexed(address), + amount: uint256, +}) +export type DepositEventArgs = EParams + +/** NotifyReward(address,uint256) */ +export const NotifyReward = event('0x095667752957714306e1a6ad83495404412df6fdb932fca6dc849a7ee910d4c1', { + from: indexed(address), + amount: uint256, +}) +export type NotifyRewardEventArgs = EParams + +/** Withdraw(address,uint256) */ +export const Withdraw = event('0x884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364', { + from: indexed(address), + amount: uint256, +}) +export type WithdrawEventArgs = EParams diff --git a/src/abi/aerodrome-gauge/functions.ts b/src/abi/aerodrome-gauge/functions.ts new file mode 100644 index 00000000..50bf8568 --- /dev/null +++ b/src/abi/aerodrome-gauge/functions.ts @@ -0,0 +1,168 @@ +import { address, bool, uint256 } from '@subsquid/evm-codec' +import { func } from '../abi.support.js' +import type { FunctionArguments, FunctionReturn } from '../abi.support.js' + +/** balanceOf(address) */ +export const balanceOf = func('0x70a08231', { + _0: address, +}, uint256) +export type BalanceOfParams = FunctionArguments +export type BalanceOfReturn = FunctionReturn + +/** deposit(uint256,address) */ +export const deposit = func('0x6e553f65', { + _amount: uint256, + _recipient: address, +}) +export type DepositParams = FunctionArguments +export type DepositReturn = FunctionReturn + +/** deposit(uint256) */ +export const deposit_1 = func('0xb6b55f25', { + _amount: uint256, +}) +export type DepositParams_1 = FunctionArguments +export type DepositReturn_1 = FunctionReturn + +/** earned(address) */ +export const earned = func('0x008cc262', { + _account: address, +}, uint256) +export type EarnedParams = FunctionArguments +export type EarnedReturn = FunctionReturn + +/** fees0() */ +export const fees0 = func('0x93f1c442', {}, uint256) +export type Fees0Params = FunctionArguments +export type Fees0Return = FunctionReturn + +/** fees1() */ +export const fees1 = func('0x4c02a21c', {}, uint256) +export type Fees1Params = FunctionArguments +export type Fees1Return = FunctionReturn + +/** feesVotingReward() */ +export const feesVotingReward = func('0x0fe2f711', {}, address) +export type FeesVotingRewardParams = FunctionArguments +export type FeesVotingRewardReturn = FunctionReturn + +/** getReward(address) */ +export const getReward = func('0xc00007b0', { + _account: address, +}) +export type GetRewardParams = FunctionArguments +export type GetRewardReturn = FunctionReturn + +/** isPool() */ +export const isPool = func('0xe2e1c6db', {}, bool) +export type IsPoolParams = FunctionArguments +export type IsPoolReturn = FunctionReturn + +/** isTrustedForwarder(address) */ +export const isTrustedForwarder = func('0x572b6c05', { + forwarder: address, +}, bool) +export type IsTrustedForwarderParams = FunctionArguments +export type IsTrustedForwarderReturn = FunctionReturn + +/** lastTimeRewardApplicable() */ +export const lastTimeRewardApplicable = func('0x80faa57d', {}, uint256) +export type LastTimeRewardApplicableParams = FunctionArguments +export type LastTimeRewardApplicableReturn = FunctionReturn + +/** lastUpdateTime() */ +export const lastUpdateTime = func('0xc8f33c91', {}, uint256) +export type LastUpdateTimeParams = FunctionArguments +export type LastUpdateTimeReturn = FunctionReturn + +/** left() */ +export const left = func('0x16e64048', {}, uint256) +export type LeftParams = FunctionArguments +export type LeftReturn = FunctionReturn + +/** notifyRewardAmount(uint256) */ +export const notifyRewardAmount = func('0x3c6b16ab', { + _amount: uint256, +}) +export type NotifyRewardAmountParams = FunctionArguments +export type NotifyRewardAmountReturn = FunctionReturn + +/** notifyRewardWithoutClaim(uint256) */ +export const notifyRewardWithoutClaim = func('0xdcdc18dc', { + _amount: uint256, +}) +export type NotifyRewardWithoutClaimParams = FunctionArguments +export type NotifyRewardWithoutClaimReturn = FunctionReturn + +/** periodFinish() */ +export const periodFinish = func('0xebe2b12b', {}, uint256) +export type PeriodFinishParams = FunctionArguments +export type PeriodFinishReturn = FunctionReturn + +/** rewardPerToken() */ +export const rewardPerToken = func('0xcd3daf9d', {}, uint256) +export type RewardPerTokenParams = FunctionArguments +export type RewardPerTokenReturn = FunctionReturn + +/** rewardPerTokenStored() */ +export const rewardPerTokenStored = func('0xdf136d65', {}, uint256) +export type RewardPerTokenStoredParams = FunctionArguments +export type RewardPerTokenStoredReturn = FunctionReturn + +/** rewardRate() */ +export const rewardRate = func('0x7b0a47ee', {}, uint256) +export type RewardRateParams = FunctionArguments +export type RewardRateReturn = FunctionReturn + +/** rewardRateByEpoch(uint256) */ +export const rewardRateByEpoch = func('0x94af5b63', { + _0: uint256, +}, uint256) +export type RewardRateByEpochParams = FunctionArguments +export type RewardRateByEpochReturn = FunctionReturn + +/** rewardToken() */ +export const rewardToken = func('0xf7c618c1', {}, address) +export type RewardTokenParams = FunctionArguments +export type RewardTokenReturn = FunctionReturn + +/** rewards(address) */ +export const rewards = func('0x0700037d', { + _0: address, +}, uint256) +export type RewardsParams = FunctionArguments +export type RewardsReturn = FunctionReturn + +/** stakingToken() */ +export const stakingToken = func('0x72f702f3', {}, address) +export type StakingTokenParams = FunctionArguments +export type StakingTokenReturn = FunctionReturn + +/** totalSupply() */ +export const totalSupply = func('0x18160ddd', {}, uint256) +export type TotalSupplyParams = FunctionArguments +export type TotalSupplyReturn = FunctionReturn + +/** userRewardPerTokenPaid(address) */ +export const userRewardPerTokenPaid = func('0x8b876347', { + _0: address, +}, uint256) +export type UserRewardPerTokenPaidParams = FunctionArguments +export type UserRewardPerTokenPaidReturn = FunctionReturn + +/** ve() */ +export const ve = func('0x1f850716', {}, address) +export type VeParams = FunctionArguments +export type VeReturn = FunctionReturn + +/** voter() */ +export const voter = func('0x46c96aac', {}, address) +export type VoterParams = FunctionArguments +export type VoterReturn = FunctionReturn + +/** withdraw(uint256) */ +export const withdraw = func('0x2e1a7d4d', { + _amount: uint256, +}) +export type WithdrawParams = FunctionArguments +export type WithdrawReturn = FunctionReturn diff --git a/src/abi/aerodrome-gauge/index.ts b/src/abi/aerodrome-gauge/index.ts new file mode 100644 index 00000000..11829d6e --- /dev/null +++ b/src/abi/aerodrome-gauge/index.ts @@ -0,0 +1,4 @@ +export * as events from './events.js' +export * as functions from './functions.js' + +export { Contract } from './contract.js' diff --git a/src/abi/aerodrome-lp-sugar-v3.ts b/src/abi/aerodrome-lp-sugar-v3.ts deleted file mode 100644 index dad55dcb..00000000 --- a/src/abi/aerodrome-lp-sugar-v3.ts +++ /dev/null @@ -1,187 +0,0 @@ -import * as p from '@subsquid/evm-codec' -import { event, fun, viewFun, indexed, ContractBase } from '@subsquid/evm-abi' -import type { EventParams as EParams, FunctionArguments, FunctionReturn } from '@subsquid/evm-abi' - -export const functions = { - forSwaps: viewFun("0xb224fcb5", "forSwaps(uint256,uint256)", {"_limit": p.uint256, "_offset": p.uint256}, p.array(p.struct({"lp": p.address, "type": p.int24, "token0": p.address, "token1": p.address, "factory": p.address, "pool_fee": p.uint256}))), - tokens: viewFun("0x295212be", "tokens(uint256,uint256,address,address[])", {"_limit": p.uint256, "_offset": p.uint256, "_account": p.address, "_addresses": p.array(p.address)}, p.array(p.struct({"token_address": p.address, "symbol": p.string, "decimals": p.uint8, "account_balance": p.uint256, "listed": p.bool}))), - all: viewFun("0xb10daf7b", "all(uint256,uint256)", {"_limit": p.uint256, "_offset": p.uint256}, p.array(p.struct({"lp": p.address, "symbol": p.string, "decimals": p.uint8, "liquidity": p.uint256, "type": p.int24, "tick": p.int24, "sqrt_ratio": p.uint160, "token0": p.address, "reserve0": p.uint256, "staked0": p.uint256, "token1": p.address, "reserve1": p.uint256, "staked1": p.uint256, "gauge": p.address, "gauge_liquidity": p.uint256, "gauge_alive": p.bool, "fee": p.address, "bribe": p.address, "factory": p.address, "emissions": p.uint256, "emissions_token": p.address, "pool_fee": p.uint256, "unstaked_fee": p.uint256, "token0_fees": p.uint256, "token1_fees": p.uint256, "nfpm": p.address}))), - byIndex: viewFun("0x1f342dd6", "byIndex(uint256)", {"_index": p.uint256}, p.struct({"lp": p.address, "symbol": p.string, "decimals": p.uint8, "liquidity": p.uint256, "type": p.int24, "tick": p.int24, "sqrt_ratio": p.uint160, "token0": p.address, "reserve0": p.uint256, "staked0": p.uint256, "token1": p.address, "reserve1": p.uint256, "staked1": p.uint256, "gauge": p.address, "gauge_liquidity": p.uint256, "gauge_alive": p.bool, "fee": p.address, "bribe": p.address, "factory": p.address, "emissions": p.uint256, "emissions_token": p.address, "pool_fee": p.uint256, "unstaked_fee": p.uint256, "token0_fees": p.uint256, "token1_fees": p.uint256, "nfpm": p.address})), - positions: viewFun("0xedbd33bf", "positions(uint256,uint256,address)", {"_limit": p.uint256, "_offset": p.uint256, "_account": p.address}, p.array(p.struct({"id": p.uint256, "lp": p.address, "liquidity": p.uint256, "staked": p.uint256, "amount0": p.uint256, "amount1": p.uint256, "staked0": p.uint256, "staked1": p.uint256, "unstaked_earned0": p.uint256, "unstaked_earned1": p.uint256, "emissions_earned": p.uint256, "tick_lower": p.int24, "tick_upper": p.int24, "sqrt_ratio_lower": p.uint160, "sqrt_ratio_upper": p.uint160}))), - positionsByFactory: viewFun("0x0d0154a9", "positionsByFactory(uint256,uint256,address,address)", {"_limit": p.uint256, "_offset": p.uint256, "_account": p.address, "_factory": p.address}, p.array(p.struct({"id": p.uint256, "lp": p.address, "liquidity": p.uint256, "staked": p.uint256, "amount0": p.uint256, "amount1": p.uint256, "staked0": p.uint256, "staked1": p.uint256, "unstaked_earned0": p.uint256, "unstaked_earned1": p.uint256, "emissions_earned": p.uint256, "tick_lower": p.int24, "tick_upper": p.int24, "sqrt_ratio_lower": p.uint160, "sqrt_ratio_upper": p.uint160}))), - epochsLatest: viewFun("0xd94b9bc6", "epochsLatest(uint256,uint256)", {"_limit": p.uint256, "_offset": p.uint256}, p.array(p.struct({"ts": p.uint256, "lp": p.address, "votes": p.uint256, "emissions": p.uint256, "bribes": p.array(p.struct({"token": p.address, "amount": p.uint256})), "fees": p.array(p.struct({"token": p.address, "amount": p.uint256}))}))), - epochsByAddress: viewFun("0x8878d06c", "epochsByAddress(uint256,uint256,address)", {"_limit": p.uint256, "_offset": p.uint256, "_address": p.address}, p.array(p.struct({"ts": p.uint256, "lp": p.address, "votes": p.uint256, "emissions": p.uint256, "bribes": p.array(p.struct({"token": p.address, "amount": p.uint256})), "fees": p.array(p.struct({"token": p.address, "amount": p.uint256}))}))), - rewards: viewFun("0xa9c57fee", "rewards(uint256,uint256,uint256)", {"_limit": p.uint256, "_offset": p.uint256, "_venft_id": p.uint256}, p.array(p.struct({"venft_id": p.uint256, "lp": p.address, "amount": p.uint256, "token": p.address, "fee": p.address, "bribe": p.address}))), - rewardsByAddress: viewFun("0xcd824fb4", "rewardsByAddress(uint256,address)", {"_venft_id": p.uint256, "_pool": p.address}, p.array(p.struct({"venft_id": p.uint256, "lp": p.address, "amount": p.uint256, "token": p.address, "fee": p.address, "bribe": p.address}))), - MAX_FACTORIES: viewFun("0x91c275a7", "MAX_FACTORIES()", {}, p.uint256), - MAX_POOLS: viewFun("0x81358498", "MAX_POOLS()", {}, p.uint256), - MAX_TOKENS: viewFun("0xf47c84c5", "MAX_TOKENS()", {}, p.uint256), - MAX_LPS: viewFun("0x93546ff1", "MAX_LPS()", {}, p.uint256), - MAX_EPOCHS: viewFun("0xc8b72f8f", "MAX_EPOCHS()", {}, p.uint256), - MAX_REWARDS: viewFun("0xfb5478b3", "MAX_REWARDS()", {}, p.uint256), - MAX_POSITIONS: viewFun("0xf7b24e08", "MAX_POSITIONS()", {}, p.uint256), - WEEK: viewFun("0xf4359ce5", "WEEK()", {}, p.uint256), - registry: viewFun("0x7b103999", "registry()", {}, p.address), - voter: viewFun("0x46c96aac", "voter()", {}, p.address), - convertor: viewFun("0xb5030306", "convertor()", {}, p.address), - cl_helper: viewFun("0xc954a389", "cl_helper()", {}, p.address), -} - -export class Contract extends ContractBase { - - forSwaps(_limit: ForSwapsParams["_limit"], _offset: ForSwapsParams["_offset"]) { - return this.eth_call(functions.forSwaps, {_limit, _offset}) - } - - tokens(_limit: TokensParams["_limit"], _offset: TokensParams["_offset"], _account: TokensParams["_account"], _addresses: TokensParams["_addresses"]) { - return this.eth_call(functions.tokens, {_limit, _offset, _account, _addresses}) - } - - all(_limit: AllParams["_limit"], _offset: AllParams["_offset"]) { - return this.eth_call(functions.all, {_limit, _offset}) - } - - byIndex(_index: ByIndexParams["_index"]) { - return this.eth_call(functions.byIndex, {_index}) - } - - positions(_limit: PositionsParams["_limit"], _offset: PositionsParams["_offset"], _account: PositionsParams["_account"]) { - return this.eth_call(functions.positions, {_limit, _offset, _account}) - } - - positionsByFactory(_limit: PositionsByFactoryParams["_limit"], _offset: PositionsByFactoryParams["_offset"], _account: PositionsByFactoryParams["_account"], _factory: PositionsByFactoryParams["_factory"]) { - return this.eth_call(functions.positionsByFactory, {_limit, _offset, _account, _factory}) - } - - epochsLatest(_limit: EpochsLatestParams["_limit"], _offset: EpochsLatestParams["_offset"]) { - return this.eth_call(functions.epochsLatest, {_limit, _offset}) - } - - epochsByAddress(_limit: EpochsByAddressParams["_limit"], _offset: EpochsByAddressParams["_offset"], _address: EpochsByAddressParams["_address"]) { - return this.eth_call(functions.epochsByAddress, {_limit, _offset, _address}) - } - - rewards(_limit: RewardsParams["_limit"], _offset: RewardsParams["_offset"], _venft_id: RewardsParams["_venft_id"]) { - return this.eth_call(functions.rewards, {_limit, _offset, _venft_id}) - } - - rewardsByAddress(_venft_id: RewardsByAddressParams["_venft_id"], _pool: RewardsByAddressParams["_pool"]) { - return this.eth_call(functions.rewardsByAddress, {_venft_id, _pool}) - } - - MAX_FACTORIES() { - return this.eth_call(functions.MAX_FACTORIES, {}) - } - - MAX_POOLS() { - return this.eth_call(functions.MAX_POOLS, {}) - } - - MAX_TOKENS() { - return this.eth_call(functions.MAX_TOKENS, {}) - } - - MAX_LPS() { - return this.eth_call(functions.MAX_LPS, {}) - } - - MAX_EPOCHS() { - return this.eth_call(functions.MAX_EPOCHS, {}) - } - - MAX_REWARDS() { - return this.eth_call(functions.MAX_REWARDS, {}) - } - - MAX_POSITIONS() { - return this.eth_call(functions.MAX_POSITIONS, {}) - } - - WEEK() { - return this.eth_call(functions.WEEK, {}) - } - - registry() { - return this.eth_call(functions.registry, {}) - } - - voter() { - return this.eth_call(functions.voter, {}) - } - - convertor() { - return this.eth_call(functions.convertor, {}) - } - - cl_helper() { - return this.eth_call(functions.cl_helper, {}) - } -} - -/// Function types -export type ForSwapsParams = FunctionArguments -export type ForSwapsReturn = FunctionReturn - -export type TokensParams = FunctionArguments -export type TokensReturn = FunctionReturn - -export type AllParams = FunctionArguments -export type AllReturn = FunctionReturn - -export type ByIndexParams = FunctionArguments -export type ByIndexReturn = FunctionReturn - -export type PositionsParams = FunctionArguments -export type PositionsReturn = FunctionReturn - -export type PositionsByFactoryParams = FunctionArguments -export type PositionsByFactoryReturn = FunctionReturn - -export type EpochsLatestParams = FunctionArguments -export type EpochsLatestReturn = FunctionReturn - -export type EpochsByAddressParams = FunctionArguments -export type EpochsByAddressReturn = FunctionReturn - -export type RewardsParams = FunctionArguments -export type RewardsReturn = FunctionReturn - -export type RewardsByAddressParams = FunctionArguments -export type RewardsByAddressReturn = FunctionReturn - -export type MAX_FACTORIESParams = FunctionArguments -export type MAX_FACTORIESReturn = FunctionReturn - -export type MAX_POOLSParams = FunctionArguments -export type MAX_POOLSReturn = FunctionReturn - -export type MAX_TOKENSParams = FunctionArguments -export type MAX_TOKENSReturn = FunctionReturn - -export type MAX_LPSParams = FunctionArguments -export type MAX_LPSReturn = FunctionReturn - -export type MAX_EPOCHSParams = FunctionArguments -export type MAX_EPOCHSReturn = FunctionReturn - -export type MAX_REWARDSParams = FunctionArguments -export type MAX_REWARDSReturn = FunctionReturn - -export type MAX_POSITIONSParams = FunctionArguments -export type MAX_POSITIONSReturn = FunctionReturn - -export type WEEKParams = FunctionArguments -export type WEEKReturn = FunctionReturn - -export type RegistryParams = FunctionArguments -export type RegistryReturn = FunctionReturn - -export type VoterParams = FunctionArguments -export type VoterReturn = FunctionReturn - -export type ConvertorParams = FunctionArguments -export type ConvertorReturn = FunctionReturn - -export type Cl_helperParams = FunctionArguments -export type Cl_helperReturn = FunctionReturn - diff --git a/src/abi/aerodrome-lp-sugar-v3/contract.ts b/src/abi/aerodrome-lp-sugar-v3/contract.ts new file mode 100644 index 00000000..d4b07316 --- /dev/null +++ b/src/abi/aerodrome-lp-sugar-v3/contract.ts @@ -0,0 +1,93 @@ +import { ContractBase } from '../abi.support.js' +import { MAX_EPOCHS, MAX_FACTORIES, MAX_LPS, MAX_POOLS, MAX_POSITIONS, MAX_REWARDS, MAX_TOKENS, WEEK, all, byIndex, cl_helper, convertor, epochsByAddress, epochsLatest, forSwaps, positions, positionsByFactory, registry, rewards, rewardsByAddress, tokens, voter } from './functions.js' +import type { AllParams, ByIndexParams, EpochsByAddressParams, EpochsLatestParams, ForSwapsParams, PositionsByFactoryParams, PositionsParams, RewardsByAddressParams, RewardsParams, TokensParams } from './functions.js' + +export class Contract extends ContractBase { + forSwaps(_limit: ForSwapsParams["_limit"], _offset: ForSwapsParams["_offset"]) { + return this.eth_call(forSwaps, {_limit, _offset}) + } + + tokens(_limit: TokensParams["_limit"], _offset: TokensParams["_offset"], _account: TokensParams["_account"], _addresses: TokensParams["_addresses"]) { + return this.eth_call(tokens, {_limit, _offset, _account, _addresses}) + } + + all(_limit: AllParams["_limit"], _offset: AllParams["_offset"]) { + return this.eth_call(all, {_limit, _offset}) + } + + byIndex(_index: ByIndexParams["_index"]) { + return this.eth_call(byIndex, {_index}) + } + + positions(_limit: PositionsParams["_limit"], _offset: PositionsParams["_offset"], _account: PositionsParams["_account"]) { + return this.eth_call(positions, {_limit, _offset, _account}) + } + + positionsByFactory(_limit: PositionsByFactoryParams["_limit"], _offset: PositionsByFactoryParams["_offset"], _account: PositionsByFactoryParams["_account"], _factory: PositionsByFactoryParams["_factory"]) { + return this.eth_call(positionsByFactory, {_limit, _offset, _account, _factory}) + } + + epochsLatest(_limit: EpochsLatestParams["_limit"], _offset: EpochsLatestParams["_offset"]) { + return this.eth_call(epochsLatest, {_limit, _offset}) + } + + epochsByAddress(_limit: EpochsByAddressParams["_limit"], _offset: EpochsByAddressParams["_offset"], _address: EpochsByAddressParams["_address"]) { + return this.eth_call(epochsByAddress, {_limit, _offset, _address}) + } + + rewards(_limit: RewardsParams["_limit"], _offset: RewardsParams["_offset"], _venft_id: RewardsParams["_venft_id"]) { + return this.eth_call(rewards, {_limit, _offset, _venft_id}) + } + + rewardsByAddress(_venft_id: RewardsByAddressParams["_venft_id"], _pool: RewardsByAddressParams["_pool"]) { + return this.eth_call(rewardsByAddress, {_venft_id, _pool}) + } + + MAX_FACTORIES() { + return this.eth_call(MAX_FACTORIES, {}) + } + + MAX_POOLS() { + return this.eth_call(MAX_POOLS, {}) + } + + MAX_TOKENS() { + return this.eth_call(MAX_TOKENS, {}) + } + + MAX_LPS() { + return this.eth_call(MAX_LPS, {}) + } + + MAX_EPOCHS() { + return this.eth_call(MAX_EPOCHS, {}) + } + + MAX_REWARDS() { + return this.eth_call(MAX_REWARDS, {}) + } + + MAX_POSITIONS() { + return this.eth_call(MAX_POSITIONS, {}) + } + + WEEK() { + return this.eth_call(WEEK, {}) + } + + registry() { + return this.eth_call(registry, {}) + } + + voter() { + return this.eth_call(voter, {}) + } + + convertor() { + return this.eth_call(convertor, {}) + } + + cl_helper() { + return this.eth_call(cl_helper, {}) + } +} diff --git a/src/abi/aerodrome-lp-sugar-v3/functions.ts b/src/abi/aerodrome-lp-sugar-v3/functions.ts new file mode 100644 index 00000000..725cc2f7 --- /dev/null +++ b/src/abi/aerodrome-lp-sugar-v3/functions.ts @@ -0,0 +1,288 @@ +import { address, array, bool, int24, string, struct, uint160, uint256, uint8 } from '@subsquid/evm-codec' +import { func } from '../abi.support.js' +import type { FunctionArguments, FunctionReturn } from '../abi.support.js' + +/** forSwaps(uint256,uint256) */ +export const forSwaps = func('0xb224fcb5', { + _limit: uint256, + _offset: uint256, +}, array(struct({ + lp: address, + type: int24, + token0: address, + token1: address, + factory: address, + pool_fee: uint256, +}))) +export type ForSwapsParams = FunctionArguments +export type ForSwapsReturn = FunctionReturn + +/** tokens(uint256,uint256,address,address[]) */ +export const tokens = func('0x295212be', { + _limit: uint256, + _offset: uint256, + _account: address, + _addresses: array(address), +}, array(struct({ + token_address: address, + symbol: string, + decimals: uint8, + account_balance: uint256, + listed: bool, +}))) +export type TokensParams = FunctionArguments +export type TokensReturn = FunctionReturn + +/** all(uint256,uint256) */ +export const all = func('0xb10daf7b', { + _limit: uint256, + _offset: uint256, +}, array(struct({ + lp: address, + symbol: string, + decimals: uint8, + liquidity: uint256, + type: int24, + tick: int24, + sqrt_ratio: uint160, + token0: address, + reserve0: uint256, + staked0: uint256, + token1: address, + reserve1: uint256, + staked1: uint256, + gauge: address, + gauge_liquidity: uint256, + gauge_alive: bool, + fee: address, + bribe: address, + factory: address, + emissions: uint256, + emissions_token: address, + pool_fee: uint256, + unstaked_fee: uint256, + token0_fees: uint256, + token1_fees: uint256, + nfpm: address, +}))) +export type AllParams = FunctionArguments +export type AllReturn = FunctionReturn + +/** byIndex(uint256) */ +export const byIndex = func('0x1f342dd6', { + _index: uint256, +}, struct({ + lp: address, + symbol: string, + decimals: uint8, + liquidity: uint256, + type: int24, + tick: int24, + sqrt_ratio: uint160, + token0: address, + reserve0: uint256, + staked0: uint256, + token1: address, + reserve1: uint256, + staked1: uint256, + gauge: address, + gauge_liquidity: uint256, + gauge_alive: bool, + fee: address, + bribe: address, + factory: address, + emissions: uint256, + emissions_token: address, + pool_fee: uint256, + unstaked_fee: uint256, + token0_fees: uint256, + token1_fees: uint256, + nfpm: address, +})) +export type ByIndexParams = FunctionArguments +export type ByIndexReturn = FunctionReturn + +/** positions(uint256,uint256,address) */ +export const positions = func('0xedbd33bf', { + _limit: uint256, + _offset: uint256, + _account: address, +}, array(struct({ + id: uint256, + lp: address, + liquidity: uint256, + staked: uint256, + amount0: uint256, + amount1: uint256, + staked0: uint256, + staked1: uint256, + unstaked_earned0: uint256, + unstaked_earned1: uint256, + emissions_earned: uint256, + tick_lower: int24, + tick_upper: int24, + sqrt_ratio_lower: uint160, + sqrt_ratio_upper: uint160, +}))) +export type PositionsParams = FunctionArguments +export type PositionsReturn = FunctionReturn + +/** positionsByFactory(uint256,uint256,address,address) */ +export const positionsByFactory = func('0x0d0154a9', { + _limit: uint256, + _offset: uint256, + _account: address, + _factory: address, +}, array(struct({ + id: uint256, + lp: address, + liquidity: uint256, + staked: uint256, + amount0: uint256, + amount1: uint256, + staked0: uint256, + staked1: uint256, + unstaked_earned0: uint256, + unstaked_earned1: uint256, + emissions_earned: uint256, + tick_lower: int24, + tick_upper: int24, + sqrt_ratio_lower: uint160, + sqrt_ratio_upper: uint160, +}))) +export type PositionsByFactoryParams = FunctionArguments +export type PositionsByFactoryReturn = FunctionReturn + +/** epochsLatest(uint256,uint256) */ +export const epochsLatest = func('0xd94b9bc6', { + _limit: uint256, + _offset: uint256, +}, array(struct({ + ts: uint256, + lp: address, + votes: uint256, + emissions: uint256, + bribes: array(struct({ + token: address, + amount: uint256, + })), + fees: array(struct({ + token: address, + amount: uint256, + })), +}))) +export type EpochsLatestParams = FunctionArguments +export type EpochsLatestReturn = FunctionReturn + +/** epochsByAddress(uint256,uint256,address) */ +export const epochsByAddress = func('0x8878d06c', { + _limit: uint256, + _offset: uint256, + _address: address, +}, array(struct({ + ts: uint256, + lp: address, + votes: uint256, + emissions: uint256, + bribes: array(struct({ + token: address, + amount: uint256, + })), + fees: array(struct({ + token: address, + amount: uint256, + })), +}))) +export type EpochsByAddressParams = FunctionArguments +export type EpochsByAddressReturn = FunctionReturn + +/** rewards(uint256,uint256,uint256) */ +export const rewards = func('0xa9c57fee', { + _limit: uint256, + _offset: uint256, + _venft_id: uint256, +}, array(struct({ + venft_id: uint256, + lp: address, + amount: uint256, + token: address, + fee: address, + bribe: address, +}))) +export type RewardsParams = FunctionArguments +export type RewardsReturn = FunctionReturn + +/** rewardsByAddress(uint256,address) */ +export const rewardsByAddress = func('0xcd824fb4', { + _venft_id: uint256, + _pool: address, +}, array(struct({ + venft_id: uint256, + lp: address, + amount: uint256, + token: address, + fee: address, + bribe: address, +}))) +export type RewardsByAddressParams = FunctionArguments +export type RewardsByAddressReturn = FunctionReturn + +/** MAX_FACTORIES() */ +export const MAX_FACTORIES = func('0x91c275a7', {}, uint256) +export type MAX_FACTORIESParams = FunctionArguments +export type MAX_FACTORIESReturn = FunctionReturn + +/** MAX_POOLS() */ +export const MAX_POOLS = func('0x81358498', {}, uint256) +export type MAX_POOLSParams = FunctionArguments +export type MAX_POOLSReturn = FunctionReturn + +/** MAX_TOKENS() */ +export const MAX_TOKENS = func('0xf47c84c5', {}, uint256) +export type MAX_TOKENSParams = FunctionArguments +export type MAX_TOKENSReturn = FunctionReturn + +/** MAX_LPS() */ +export const MAX_LPS = func('0x93546ff1', {}, uint256) +export type MAX_LPSParams = FunctionArguments +export type MAX_LPSReturn = FunctionReturn + +/** MAX_EPOCHS() */ +export const MAX_EPOCHS = func('0xc8b72f8f', {}, uint256) +export type MAX_EPOCHSParams = FunctionArguments +export type MAX_EPOCHSReturn = FunctionReturn + +/** MAX_REWARDS() */ +export const MAX_REWARDS = func('0xfb5478b3', {}, uint256) +export type MAX_REWARDSParams = FunctionArguments +export type MAX_REWARDSReturn = FunctionReturn + +/** MAX_POSITIONS() */ +export const MAX_POSITIONS = func('0xf7b24e08', {}, uint256) +export type MAX_POSITIONSParams = FunctionArguments +export type MAX_POSITIONSReturn = FunctionReturn + +/** WEEK() */ +export const WEEK = func('0xf4359ce5', {}, uint256) +export type WEEKParams = FunctionArguments +export type WEEKReturn = FunctionReturn + +/** registry() */ +export const registry = func('0x7b103999', {}, address) +export type RegistryParams = FunctionArguments +export type RegistryReturn = FunctionReturn + +/** voter() */ +export const voter = func('0x46c96aac', {}, address) +export type VoterParams = FunctionArguments +export type VoterReturn = FunctionReturn + +/** convertor() */ +export const convertor = func('0xb5030306', {}, address) +export type ConvertorParams = FunctionArguments +export type ConvertorReturn = FunctionReturn + +/** cl_helper() */ +export const cl_helper = func('0xc954a389', {}, address) +export type Cl_helperParams = FunctionArguments +export type Cl_helperReturn = FunctionReturn diff --git a/src/abi/aerodrome-lp-sugar-v3/index.ts b/src/abi/aerodrome-lp-sugar-v3/index.ts new file mode 100644 index 00000000..ed5306bd --- /dev/null +++ b/src/abi/aerodrome-lp-sugar-v3/index.ts @@ -0,0 +1,3 @@ +export * as functions from './functions.js' + +export { Contract } from './contract.js' diff --git a/src/abi/aerodrome-mixed-quoter.extended.ts b/src/abi/aerodrome-mixed-quoter.extended.ts deleted file mode 100644 index 139f40c1..00000000 --- a/src/abi/aerodrome-mixed-quoter.extended.ts +++ /dev/null @@ -1,59 +0,0 @@ -import type { FunctionArguments, FunctionReturn } from '@subsquid/evm-abi' -import { ContractBase, fun, viewFun } from '@subsquid/evm-abi' -import * as p from '@subsquid/evm-codec' - -export const functions = { - WETH9: viewFun("0x4aa4a4fc", "WETH9()", {}, p.address), - factory: viewFun("0xc45a0155", "factory()", {}, p.address), - factoryV2: viewFun("0x68e0d4e1", "factoryV2()", {}, p.address), - quoteExactInput: fun("0xcdca1753", "quoteExactInput(bytes,uint256)", {"path": p.bytes, "amountIn": p.uint256}, {"amountOut": p.uint256, "v3SqrtPriceX96AfterList": p.array(p.uint160), "v3InitializedTicksCrossedList": p.array(p.uint32), "v3SwapGasEstimate": p.uint256}), - quoteExactInputSingleV2: viewFun("0xc550b186", "quoteExactInputSingleV2((address,address,bool,uint256))", {"params": p.struct({"tokenIn": p.address, "tokenOut": p.address, "stable": p.bool, "amountIn": p.uint256})}, p.uint256), - quoteExactInputSingleV3: fun("0x891e50c6", "quoteExactInputSingleV3((address,address,uint256,int24,uint160))", {"params": p.struct({"tokenIn": p.address, "tokenOut": p.address, "amountIn": p.uint256, "tickSpacing": p.int24, "sqrtPriceLimitX96": p.uint160})}, {"amountOut": p.uint256, "sqrtPriceX96After": p.uint160, "initializedTicksCrossed": p.uint32, "gasEstimate": p.uint256}), - uniswapV3SwapCallback: viewFun("0xfa461e33", "uniswapV3SwapCallback(int256,int256,bytes)", {"amount0Delta": p.int256, "amount1Delta": p.int256, "path": p.bytes}, ), -} - -export class Contract extends ContractBase { - - WETH9() { - return this.eth_call(functions.WETH9, {}) - } - - factory() { - return this.eth_call(functions.factory, {}) - } - - factoryV2() { - return this.eth_call(functions.factoryV2, {}) - } - - quoteExactInputSingleV2(params: QuoteExactInputSingleV2Params["params"]) { - return this.eth_call(functions.quoteExactInputSingleV2, {params}) - } - - quoteExactInputSingleV3(params: QuoteExactInputSingleV3Params["params"]) { - return this.eth_call(functions.quoteExactInputSingleV3, {params}) - } -} - -/// Function types -export type WETH9Params = FunctionArguments -export type WETH9Return = FunctionReturn - -export type FactoryParams = FunctionArguments -export type FactoryReturn = FunctionReturn - -export type FactoryV2Params = FunctionArguments -export type FactoryV2Return = FunctionReturn - -export type QuoteExactInputParams = FunctionArguments -export type QuoteExactInputReturn = FunctionReturn - -export type QuoteExactInputSingleV2Params = FunctionArguments -export type QuoteExactInputSingleV2Return = FunctionReturn - -export type QuoteExactInputSingleV3Params = FunctionArguments -export type QuoteExactInputSingleV3Return = FunctionReturn - -export type UniswapV3SwapCallbackParams = FunctionArguments -export type UniswapV3SwapCallbackReturn = FunctionReturn - diff --git a/src/abi/aerodrome-mixed-quoter.ts b/src/abi/aerodrome-mixed-quoter.ts deleted file mode 100644 index e7e2e1c0..00000000 --- a/src/abi/aerodrome-mixed-quoter.ts +++ /dev/null @@ -1,55 +0,0 @@ -import * as p from '@subsquid/evm-codec' -import { event, fun, viewFun, indexed, ContractBase } from '@subsquid/evm-abi' -import type { EventParams as EParams, FunctionArguments, FunctionReturn } from '@subsquid/evm-abi' - -export const functions = { - WETH9: viewFun("0x4aa4a4fc", "WETH9()", {}, p.address), - factory: viewFun("0xc45a0155", "factory()", {}, p.address), - factoryV2: viewFun("0x68e0d4e1", "factoryV2()", {}, p.address), - quoteExactInput: fun("0xcdca1753", "quoteExactInput(bytes,uint256)", {"path": p.bytes, "amountIn": p.uint256}, {"amountOut": p.uint256, "v3SqrtPriceX96AfterList": p.array(p.uint160), "v3InitializedTicksCrossedList": p.array(p.uint32), "v3SwapGasEstimate": p.uint256}), - quoteExactInputSingleV2: viewFun("0xc550b186", "quoteExactInputSingleV2((address,address,bool,uint256))", {"params": p.struct({"tokenIn": p.address, "tokenOut": p.address, "stable": p.bool, "amountIn": p.uint256})}, p.uint256), - quoteExactInputSingleV3: fun("0x891e50c6", "quoteExactInputSingleV3((address,address,uint256,int24,uint160))", {"params": p.struct({"tokenIn": p.address, "tokenOut": p.address, "amountIn": p.uint256, "tickSpacing": p.int24, "sqrtPriceLimitX96": p.uint160})}, {"amountOut": p.uint256, "sqrtPriceX96After": p.uint160, "initializedTicksCrossed": p.uint32, "gasEstimate": p.uint256}), - uniswapV3SwapCallback: viewFun("0xfa461e33", "uniswapV3SwapCallback(int256,int256,bytes)", {"amount0Delta": p.int256, "amount1Delta": p.int256, "path": p.bytes}, ), -} - -export class Contract extends ContractBase { - - WETH9() { - return this.eth_call(functions.WETH9, {}) - } - - factory() { - return this.eth_call(functions.factory, {}) - } - - factoryV2() { - return this.eth_call(functions.factoryV2, {}) - } - - quoteExactInputSingleV2(params: QuoteExactInputSingleV2Params["params"]) { - return this.eth_call(functions.quoteExactInputSingleV2, {params}) - } -} - -/// Function types -export type WETH9Params = FunctionArguments -export type WETH9Return = FunctionReturn - -export type FactoryParams = FunctionArguments -export type FactoryReturn = FunctionReturn - -export type FactoryV2Params = FunctionArguments -export type FactoryV2Return = FunctionReturn - -export type QuoteExactInputParams = FunctionArguments -export type QuoteExactInputReturn = FunctionReturn - -export type QuoteExactInputSingleV2Params = FunctionArguments -export type QuoteExactInputSingleV2Return = FunctionReturn - -export type QuoteExactInputSingleV3Params = FunctionArguments -export type QuoteExactInputSingleV3Return = FunctionReturn - -export type UniswapV3SwapCallbackParams = FunctionArguments -export type UniswapV3SwapCallbackReturn = FunctionReturn - diff --git a/src/abi/aerodrome-mixed-quoter/contract.ts b/src/abi/aerodrome-mixed-quoter/contract.ts new file mode 100644 index 00000000..f199a763 --- /dev/null +++ b/src/abi/aerodrome-mixed-quoter/contract.ts @@ -0,0 +1,29 @@ +import { ContractBase } from '../abi.support.js' +import { WETH9, factory, factoryV2, quoteExactInput, quoteExactInputSingleV2, quoteExactInputSingleV3 } from './functions.js' +import type { QuoteExactInputParams, QuoteExactInputSingleV2Params, QuoteExactInputSingleV3Params } from './functions.js' + +export class Contract extends ContractBase { + WETH9() { + return this.eth_call(WETH9, {}) + } + + factory() { + return this.eth_call(factory, {}) + } + + factoryV2() { + return this.eth_call(factoryV2, {}) + } + + quoteExactInput(path: QuoteExactInputParams["path"], amountIn: QuoteExactInputParams["amountIn"]) { + return this.eth_call(quoteExactInput, {path, amountIn}) + } + + quoteExactInputSingleV2(params: QuoteExactInputSingleV2Params["params"]) { + return this.eth_call(quoteExactInputSingleV2, {params}) + } + + quoteExactInputSingleV3(params: QuoteExactInputSingleV3Params["params"]) { + return this.eth_call(quoteExactInputSingleV3, {params}) + } +} diff --git a/src/abi/aerodrome-mixed-quoter/functions.ts b/src/abi/aerodrome-mixed-quoter/functions.ts new file mode 100644 index 00000000..d76d937f --- /dev/null +++ b/src/abi/aerodrome-mixed-quoter/functions.ts @@ -0,0 +1,70 @@ +import { address, array, bool, bytes, int24, int256, struct, uint160, uint256, uint32 } from '@subsquid/evm-codec' +import { func } from '../abi.support.js' +import type { FunctionArguments, FunctionReturn } from '../abi.support.js' + +/** WETH9() */ +export const WETH9 = func('0x4aa4a4fc', {}, address) +export type WETH9Params = FunctionArguments +export type WETH9Return = FunctionReturn + +/** factory() */ +export const factory = func('0xc45a0155', {}, address) +export type FactoryParams = FunctionArguments +export type FactoryReturn = FunctionReturn + +/** factoryV2() */ +export const factoryV2 = func('0x68e0d4e1', {}, address) +export type FactoryV2Params = FunctionArguments +export type FactoryV2Return = FunctionReturn + +/** quoteExactInput(bytes,uint256) */ +export const quoteExactInput = func('0xcdca1753', { + path: bytes, + amountIn: uint256, +}, struct({ + amountOut: uint256, + v3SqrtPriceX96AfterList: array(uint160), + v3InitializedTicksCrossedList: array(uint32), + v3SwapGasEstimate: uint256, +})) +export type QuoteExactInputParams = FunctionArguments +export type QuoteExactInputReturn = FunctionReturn + +/** quoteExactInputSingleV2((address,address,bool,uint256)) */ +export const quoteExactInputSingleV2 = func('0xc550b186', { + params: struct({ + tokenIn: address, + tokenOut: address, + stable: bool, + amountIn: uint256, + }), +}, uint256) +export type QuoteExactInputSingleV2Params = FunctionArguments +export type QuoteExactInputSingleV2Return = FunctionReturn + +/** quoteExactInputSingleV3((address,address,uint256,int24,uint160)) */ +export const quoteExactInputSingleV3 = func('0x891e50c6', { + params: struct({ + tokenIn: address, + tokenOut: address, + amountIn: uint256, + tickSpacing: int24, + sqrtPriceLimitX96: uint160, + }), +}, struct({ + amountOut: uint256, + sqrtPriceX96After: uint160, + initializedTicksCrossed: uint32, + gasEstimate: uint256, +})) +export type QuoteExactInputSingleV3Params = FunctionArguments +export type QuoteExactInputSingleV3Return = FunctionReturn + +/** uniswapV3SwapCallback(int256,int256,bytes) */ +export const uniswapV3SwapCallback = func('0xfa461e33', { + amount0Delta: int256, + amount1Delta: int256, + path: bytes, +}) +export type UniswapV3SwapCallbackParams = FunctionArguments +export type UniswapV3SwapCallbackReturn = FunctionReturn diff --git a/src/abi/aerodrome-mixed-quoter/index.ts b/src/abi/aerodrome-mixed-quoter/index.ts new file mode 100644 index 00000000..ed5306bd --- /dev/null +++ b/src/abi/aerodrome-mixed-quoter/index.ts @@ -0,0 +1,3 @@ +export * as functions from './functions.js' + +export { Contract } from './contract.js' diff --git a/src/abi/aerodrome-pool-factory.ts b/src/abi/aerodrome-pool-factory.ts deleted file mode 100644 index 73a10ae2..00000000 --- a/src/abi/aerodrome-pool-factory.ts +++ /dev/null @@ -1,188 +0,0 @@ -import * as p from '@subsquid/evm-codec' -import { event, fun, viewFun, indexed, ContractBase } from '@subsquid/evm-abi' -import type { EventParams as EParams, FunctionArguments, FunctionReturn } from '@subsquid/evm-abi' - -export const events = { - PoolCreated: event("0x2128d88d14c80cb081c1252a5acff7a264671bf199ce226b53788fb26065005e", "PoolCreated(address,address,bool,address,uint256)", {"token0": indexed(p.address), "token1": indexed(p.address), "stable": indexed(p.bool), "pool": p.address, "_4": p.uint256}), - SetCustomFee: event("0xae468ce586f9a87660fdffc1448cee942042c16ae2f02046b134b5224f31936b", "SetCustomFee(address,uint256)", {"pool": indexed(p.address), "fee": p.uint256}), - SetFeeManager: event("0x5d0517e3a4eabea892d9750138cd21d4a6cf3b935b43d0598df7055f463819b2", "SetFeeManager(address)", {"feeManager": p.address}), - SetPauseState: event("0x0d76538efc408318a051137c2720a9e82902acdbd46b802d488b74ca3a09a116", "SetPauseState(bool)", {"state": p.bool}), - SetPauser: event("0xe02efb9e8f0fc21546730ab32d594f62d586e1bbb15bb5045edd0b1878a77b35", "SetPauser(address)", {"pauser": p.address}), - SetVoter: event("0xc6ff127433b785c51da9ae4088ee184c909b1a55b9afd82ae6c64224d3bc15d2", "SetVoter(address)", {"voter": p.address}), -} - -export const functions = { - MAX_FEE: viewFun("0xbc063e1a", "MAX_FEE()", {}, p.uint256), - ZERO_FEE_INDICATOR: viewFun("0x38c55d46", "ZERO_FEE_INDICATOR()", {}, p.uint256), - allPools: viewFun("0x41d1de97", "allPools(uint256)", {"_0": p.uint256}, p.address), - allPoolsLength: viewFun("0xefde4e64", "allPoolsLength()", {}, p.uint256), - 'createPool(address,address,bool)': fun("0x36bf95a0", "createPool(address,address,bool)", {"tokenA": p.address, "tokenB": p.address, "stable": p.bool}, p.address), - 'createPool(address,address,uint24)': fun("0xa1671295", "createPool(address,address,uint24)", {"tokenA": p.address, "tokenB": p.address, "fee": p.uint24}, p.address), - customFee: viewFun("0x4d419abc", "customFee(address)", {"_0": p.address}, p.uint256), - feeManager: viewFun("0xd0fb0203", "feeManager()", {}, p.address), - getFee: viewFun("0xcc56b2c5", "getFee(address,bool)", {"pool": p.address, "_stable": p.bool}, p.uint256), - 'getPool(address,address,uint24)': viewFun("0x1698ee82", "getPool(address,address,uint24)", {"tokenA": p.address, "tokenB": p.address, "fee": p.uint24}, p.address), - 'getPool(address,address,bool)': viewFun("0x79bc57d5", "getPool(address,address,bool)", {"tokenA": p.address, "tokenB": p.address, "stable": p.bool}, p.address), - implementation: viewFun("0x5c60da1b", "implementation()", {}, p.address), - isPaused: viewFun("0xb187bd26", "isPaused()", {}, p.bool), - isPool: viewFun("0x5b16ebb7", "isPool(address)", {"pool": p.address}, p.bool), - pauser: viewFun("0x9fd0506d", "pauser()", {}, p.address), - setCustomFee: fun("0xd49466a8", "setCustomFee(address,uint256)", {"pool": p.address, "fee": p.uint256}, ), - setFee: fun("0xe1f76b44", "setFee(bool,uint256)", {"_stable": p.bool, "_fee": p.uint256}, ), - setFeeManager: fun("0x472d35b9", "setFeeManager(address)", {"_feeManager": p.address}, ), - setPauseState: fun("0xcdb88ad1", "setPauseState(bool)", {"_state": p.bool}, ), - setPauser: fun("0x2d88af4a", "setPauser(address)", {"_pauser": p.address}, ), - setVoter: fun("0x4bc2a657", "setVoter(address)", {"_voter": p.address}, ), - stableFee: viewFun("0x40bbd775", "stableFee()", {}, p.uint256), - volatileFee: viewFun("0x5084ed03", "volatileFee()", {}, p.uint256), - voter: viewFun("0x46c96aac", "voter()", {}, p.address), -} - -export class Contract extends ContractBase { - - MAX_FEE() { - return this.eth_call(functions.MAX_FEE, {}) - } - - ZERO_FEE_INDICATOR() { - return this.eth_call(functions.ZERO_FEE_INDICATOR, {}) - } - - allPools(_0: AllPoolsParams["_0"]) { - return this.eth_call(functions.allPools, {_0}) - } - - allPoolsLength() { - return this.eth_call(functions.allPoolsLength, {}) - } - - customFee(_0: CustomFeeParams["_0"]) { - return this.eth_call(functions.customFee, {_0}) - } - - feeManager() { - return this.eth_call(functions.feeManager, {}) - } - - getFee(pool: GetFeeParams["pool"], _stable: GetFeeParams["_stable"]) { - return this.eth_call(functions.getFee, {pool, _stable}) - } - - 'getPool(address,address,uint24)'(tokenA: GetPoolParams_0["tokenA"], tokenB: GetPoolParams_0["tokenB"], fee: GetPoolParams_0["fee"]) { - return this.eth_call(functions['getPool(address,address,uint24)'], {tokenA, tokenB, fee}) - } - - 'getPool(address,address,bool)'(tokenA: GetPoolParams_1["tokenA"], tokenB: GetPoolParams_1["tokenB"], stable: GetPoolParams_1["stable"]) { - return this.eth_call(functions['getPool(address,address,bool)'], {tokenA, tokenB, stable}) - } - - implementation() { - return this.eth_call(functions.implementation, {}) - } - - isPaused() { - return this.eth_call(functions.isPaused, {}) - } - - isPool(pool: IsPoolParams["pool"]) { - return this.eth_call(functions.isPool, {pool}) - } - - pauser() { - return this.eth_call(functions.pauser, {}) - } - - stableFee() { - return this.eth_call(functions.stableFee, {}) - } - - volatileFee() { - return this.eth_call(functions.volatileFee, {}) - } - - voter() { - return this.eth_call(functions.voter, {}) - } -} - -/// Event types -export type PoolCreatedEventArgs = EParams -export type SetCustomFeeEventArgs = EParams -export type SetFeeManagerEventArgs = EParams -export type SetPauseStateEventArgs = EParams -export type SetPauserEventArgs = EParams -export type SetVoterEventArgs = EParams - -/// Function types -export type MAX_FEEParams = FunctionArguments -export type MAX_FEEReturn = FunctionReturn - -export type ZERO_FEE_INDICATORParams = FunctionArguments -export type ZERO_FEE_INDICATORReturn = FunctionReturn - -export type AllPoolsParams = FunctionArguments -export type AllPoolsReturn = FunctionReturn - -export type AllPoolsLengthParams = FunctionArguments -export type AllPoolsLengthReturn = FunctionReturn - -export type CreatePoolParams_0 = FunctionArguments -export type CreatePoolReturn_0 = FunctionReturn - -export type CreatePoolParams_1 = FunctionArguments -export type CreatePoolReturn_1 = FunctionReturn - -export type CustomFeeParams = FunctionArguments -export type CustomFeeReturn = FunctionReturn - -export type FeeManagerParams = FunctionArguments -export type FeeManagerReturn = FunctionReturn - -export type GetFeeParams = FunctionArguments -export type GetFeeReturn = FunctionReturn - -export type GetPoolParams_0 = FunctionArguments -export type GetPoolReturn_0 = FunctionReturn - -export type GetPoolParams_1 = FunctionArguments -export type GetPoolReturn_1 = FunctionReturn - -export type ImplementationParams = FunctionArguments -export type ImplementationReturn = FunctionReturn - -export type IsPausedParams = FunctionArguments -export type IsPausedReturn = FunctionReturn - -export type IsPoolParams = FunctionArguments -export type IsPoolReturn = FunctionReturn - -export type PauserParams = FunctionArguments -export type PauserReturn = FunctionReturn - -export type SetCustomFeeParams = FunctionArguments -export type SetCustomFeeReturn = FunctionReturn - -export type SetFeeParams = FunctionArguments -export type SetFeeReturn = FunctionReturn - -export type SetFeeManagerParams = FunctionArguments -export type SetFeeManagerReturn = FunctionReturn - -export type SetPauseStateParams = FunctionArguments -export type SetPauseStateReturn = FunctionReturn - -export type SetPauserParams = FunctionArguments -export type SetPauserReturn = FunctionReturn - -export type SetVoterParams = FunctionArguments -export type SetVoterReturn = FunctionReturn - -export type StableFeeParams = FunctionArguments -export type StableFeeReturn = FunctionReturn - -export type VolatileFeeParams = FunctionArguments -export type VolatileFeeReturn = FunctionReturn - -export type VoterParams = FunctionArguments -export type VoterReturn = FunctionReturn - diff --git a/src/abi/aerodrome-pool-factory/contract.ts b/src/abi/aerodrome-pool-factory/contract.ts new file mode 100644 index 00000000..7dbfa717 --- /dev/null +++ b/src/abi/aerodrome-pool-factory/contract.ts @@ -0,0 +1,77 @@ +import { ContractBase } from '../abi.support.js' +import { MAX_FEE, ZERO_FEE_INDICATOR, allPools, allPoolsLength, createPool, createPool_1, customFee, feeManager, getFee, getPool, getPool_1, implementation, isPaused, isPool, pauser, stableFee, volatileFee, voter } from './functions.js' +import type { AllPoolsParams, CreatePoolParams, CreatePoolParams_1, CustomFeeParams, GetFeeParams, GetPoolParams, GetPoolParams_1, IsPoolParams } from './functions.js' + +export class Contract extends ContractBase { + MAX_FEE() { + return this.eth_call(MAX_FEE, {}) + } + + ZERO_FEE_INDICATOR() { + return this.eth_call(ZERO_FEE_INDICATOR, {}) + } + + allPools(_0: AllPoolsParams["_0"]) { + return this.eth_call(allPools, {_0}) + } + + allPoolsLength() { + return this.eth_call(allPoolsLength, {}) + } + + createPool(tokenA: CreatePoolParams["tokenA"], tokenB: CreatePoolParams["tokenB"], stable: CreatePoolParams["stable"]) { + return this.eth_call(createPool, {tokenA, tokenB, stable}) + } + + createPool_1(tokenA: CreatePoolParams_1["tokenA"], tokenB: CreatePoolParams_1["tokenB"], fee: CreatePoolParams_1["fee"]) { + return this.eth_call(createPool_1, {tokenA, tokenB, fee}) + } + + customFee(_0: CustomFeeParams["_0"]) { + return this.eth_call(customFee, {_0}) + } + + feeManager() { + return this.eth_call(feeManager, {}) + } + + getFee(pool: GetFeeParams["pool"], _stable: GetFeeParams["_stable"]) { + return this.eth_call(getFee, {pool, _stable}) + } + + getPool(tokenA: GetPoolParams["tokenA"], tokenB: GetPoolParams["tokenB"], fee: GetPoolParams["fee"]) { + return this.eth_call(getPool, {tokenA, tokenB, fee}) + } + + getPool_1(tokenA: GetPoolParams_1["tokenA"], tokenB: GetPoolParams_1["tokenB"], stable: GetPoolParams_1["stable"]) { + return this.eth_call(getPool_1, {tokenA, tokenB, stable}) + } + + implementation() { + return this.eth_call(implementation, {}) + } + + isPaused() { + return this.eth_call(isPaused, {}) + } + + isPool(pool: IsPoolParams["pool"]) { + return this.eth_call(isPool, {pool}) + } + + pauser() { + return this.eth_call(pauser, {}) + } + + stableFee() { + return this.eth_call(stableFee, {}) + } + + volatileFee() { + return this.eth_call(volatileFee, {}) + } + + voter() { + return this.eth_call(voter, {}) + } +} diff --git a/src/abi/aerodrome-pool-factory/events.ts b/src/abi/aerodrome-pool-factory/events.ts new file mode 100644 index 00000000..3f90a7e6 --- /dev/null +++ b/src/abi/aerodrome-pool-factory/events.ts @@ -0,0 +1,44 @@ +import { address, bool, uint256 } from '@subsquid/evm-codec' +import { event, indexed } from '../abi.support.js' +import type { EventParams as EParams } from '../abi.support.js' + +/** PoolCreated(address,address,bool,address,uint256) */ +export const PoolCreated = event('0x2128d88d14c80cb081c1252a5acff7a264671bf199ce226b53788fb26065005e', { + token0: indexed(address), + token1: indexed(address), + stable: indexed(bool), + pool: address, + _4: uint256, +}) +export type PoolCreatedEventArgs = EParams + +/** SetCustomFee(address,uint256) */ +export const SetCustomFee = event('0xae468ce586f9a87660fdffc1448cee942042c16ae2f02046b134b5224f31936b', { + pool: indexed(address), + fee: uint256, +}) +export type SetCustomFeeEventArgs = EParams + +/** SetFeeManager(address) */ +export const SetFeeManager = event('0x5d0517e3a4eabea892d9750138cd21d4a6cf3b935b43d0598df7055f463819b2', { + feeManager: address, +}) +export type SetFeeManagerEventArgs = EParams + +/** SetPauseState(bool) */ +export const SetPauseState = event('0x0d76538efc408318a051137c2720a9e82902acdbd46b802d488b74ca3a09a116', { + state: bool, +}) +export type SetPauseStateEventArgs = EParams + +/** SetPauser(address) */ +export const SetPauser = event('0xe02efb9e8f0fc21546730ab32d594f62d586e1bbb15bb5045edd0b1878a77b35', { + pauser: address, +}) +export type SetPauserEventArgs = EParams + +/** SetVoter(address) */ +export const SetVoter = event('0xc6ff127433b785c51da9ae4088ee184c909b1a55b9afd82ae6c64224d3bc15d2', { + voter: address, +}) +export type SetVoterEventArgs = EParams diff --git a/src/abi/aerodrome-pool-factory/functions.ts b/src/abi/aerodrome-pool-factory/functions.ts new file mode 100644 index 00000000..a74fe1b0 --- /dev/null +++ b/src/abi/aerodrome-pool-factory/functions.ts @@ -0,0 +1,162 @@ +import { address, bool, uint24, uint256 } from '@subsquid/evm-codec' +import { func } from '../abi.support.js' +import type { FunctionArguments, FunctionReturn } from '../abi.support.js' + +/** MAX_FEE() */ +export const MAX_FEE = func('0xbc063e1a', {}, uint256) +export type MAX_FEEParams = FunctionArguments +export type MAX_FEEReturn = FunctionReturn + +/** ZERO_FEE_INDICATOR() */ +export const ZERO_FEE_INDICATOR = func('0x38c55d46', {}, uint256) +export type ZERO_FEE_INDICATORParams = FunctionArguments +export type ZERO_FEE_INDICATORReturn = FunctionReturn + +/** allPools(uint256) */ +export const allPools = func('0x41d1de97', { + _0: uint256, +}, address) +export type AllPoolsParams = FunctionArguments +export type AllPoolsReturn = FunctionReturn + +/** allPoolsLength() */ +export const allPoolsLength = func('0xefde4e64', {}, uint256) +export type AllPoolsLengthParams = FunctionArguments +export type AllPoolsLengthReturn = FunctionReturn + +/** createPool(address,address,bool) */ +export const createPool = func('0x36bf95a0', { + tokenA: address, + tokenB: address, + stable: bool, +}, address) +export type CreatePoolParams = FunctionArguments +export type CreatePoolReturn = FunctionReturn + +/** createPool(address,address,uint24) */ +export const createPool_1 = func('0xa1671295', { + tokenA: address, + tokenB: address, + fee: uint24, +}, address) +export type CreatePoolParams_1 = FunctionArguments +export type CreatePoolReturn_1 = FunctionReturn + +/** customFee(address) */ +export const customFee = func('0x4d419abc', { + _0: address, +}, uint256) +export type CustomFeeParams = FunctionArguments +export type CustomFeeReturn = FunctionReturn + +/** feeManager() */ +export const feeManager = func('0xd0fb0203', {}, address) +export type FeeManagerParams = FunctionArguments +export type FeeManagerReturn = FunctionReturn + +/** getFee(address,bool) */ +export const getFee = func('0xcc56b2c5', { + pool: address, + _stable: bool, +}, uint256) +export type GetFeeParams = FunctionArguments +export type GetFeeReturn = FunctionReturn + +/** getPool(address,address,uint24) */ +export const getPool = func('0x1698ee82', { + tokenA: address, + tokenB: address, + fee: uint24, +}, address) +export type GetPoolParams = FunctionArguments +export type GetPoolReturn = FunctionReturn + +/** getPool(address,address,bool) */ +export const getPool_1 = func('0x79bc57d5', { + tokenA: address, + tokenB: address, + stable: bool, +}, address) +export type GetPoolParams_1 = FunctionArguments +export type GetPoolReturn_1 = FunctionReturn + +/** implementation() */ +export const implementation = func('0x5c60da1b', {}, address) +export type ImplementationParams = FunctionArguments +export type ImplementationReturn = FunctionReturn + +/** isPaused() */ +export const isPaused = func('0xb187bd26', {}, bool) +export type IsPausedParams = FunctionArguments +export type IsPausedReturn = FunctionReturn + +/** isPool(address) */ +export const isPool = func('0x5b16ebb7', { + pool: address, +}, bool) +export type IsPoolParams = FunctionArguments +export type IsPoolReturn = FunctionReturn + +/** pauser() */ +export const pauser = func('0x9fd0506d', {}, address) +export type PauserParams = FunctionArguments +export type PauserReturn = FunctionReturn + +/** setCustomFee(address,uint256) */ +export const setCustomFee = func('0xd49466a8', { + pool: address, + fee: uint256, +}) +export type SetCustomFeeParams = FunctionArguments +export type SetCustomFeeReturn = FunctionReturn + +/** setFee(bool,uint256) */ +export const setFee = func('0xe1f76b44', { + _stable: bool, + _fee: uint256, +}) +export type SetFeeParams = FunctionArguments +export type SetFeeReturn = FunctionReturn + +/** setFeeManager(address) */ +export const setFeeManager = func('0x472d35b9', { + _feeManager: address, +}) +export type SetFeeManagerParams = FunctionArguments +export type SetFeeManagerReturn = FunctionReturn + +/** setPauseState(bool) */ +export const setPauseState = func('0xcdb88ad1', { + _state: bool, +}) +export type SetPauseStateParams = FunctionArguments +export type SetPauseStateReturn = FunctionReturn + +/** setPauser(address) */ +export const setPauser = func('0x2d88af4a', { + _pauser: address, +}) +export type SetPauserParams = FunctionArguments +export type SetPauserReturn = FunctionReturn + +/** setVoter(address) */ +export const setVoter = func('0x4bc2a657', { + _voter: address, +}) +export type SetVoterParams = FunctionArguments +export type SetVoterReturn = FunctionReturn + +/** stableFee() */ +export const stableFee = func('0x40bbd775', {}, uint256) +export type StableFeeParams = FunctionArguments +export type StableFeeReturn = FunctionReturn + +/** volatileFee() */ +export const volatileFee = func('0x5084ed03', {}, uint256) +export type VolatileFeeParams = FunctionArguments +export type VolatileFeeReturn = FunctionReturn + +/** voter() */ +export const voter = func('0x46c96aac', {}, address) +export type VoterParams = FunctionArguments +export type VoterReturn = FunctionReturn diff --git a/src/abi/aerodrome-pool-factory/index.ts b/src/abi/aerodrome-pool-factory/index.ts new file mode 100644 index 00000000..11829d6e --- /dev/null +++ b/src/abi/aerodrome-pool-factory/index.ts @@ -0,0 +1,4 @@ +export * as events from './events.js' +export * as functions from './functions.js' + +export { Contract } from './contract.js' diff --git a/src/abi/aerodrome-pool.ts b/src/abi/aerodrome-pool.ts deleted file mode 100644 index dc20ef8a..00000000 --- a/src/abi/aerodrome-pool.ts +++ /dev/null @@ -1,394 +0,0 @@ -import * as p from '@subsquid/evm-codec' -import { event, fun, viewFun, indexed, ContractBase } from '@subsquid/evm-abi' -import type { EventParams as EParams, FunctionArguments, FunctionReturn } from '@subsquid/evm-abi' - -export const events = { - Approval: event("0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925", "Approval(address,address,uint256)", {"owner": indexed(p.address), "spender": indexed(p.address), "value": p.uint256}), - Burn: event("0x5d624aa9c148153ab3446c1b154f660ee7701e549fe9b62dab7171b1c80e6fa2", "Burn(address,address,uint256,uint256)", {"sender": indexed(p.address), "to": indexed(p.address), "amount0": p.uint256, "amount1": p.uint256}), - Claim: event("0x865ca08d59f5cb456e85cd2f7ef63664ea4f73327414e9d8152c4158b0e94645", "Claim(address,address,uint256,uint256)", {"sender": indexed(p.address), "recipient": indexed(p.address), "amount0": p.uint256, "amount1": p.uint256}), - EIP712DomainChanged: event("0x0a6387c9ea3628b88a633bb4f3b151770f70085117a15f9bf3787cda53f13d31", "EIP712DomainChanged()", {}), - Fees: event("0x112c256902bf554b6ed882d2936687aaeb4225e8cd5b51303c90ca6cf43a8602", "Fees(address,uint256,uint256)", {"sender": indexed(p.address), "amount0": p.uint256, "amount1": p.uint256}), - Mint: event("0x4c209b5fc8ad50758f13e2e1088ba56a560dff690a1c6fef26394f4c03821c4f", "Mint(address,uint256,uint256)", {"sender": indexed(p.address), "amount0": p.uint256, "amount1": p.uint256}), - Swap: event("0xb3e2773606abfd36b5bd91394b3a54d1398336c65005baf7bf7a05efeffaf75b", "Swap(address,address,uint256,uint256,uint256,uint256)", {"sender": indexed(p.address), "to": indexed(p.address), "amount0In": p.uint256, "amount1In": p.uint256, "amount0Out": p.uint256, "amount1Out": p.uint256}), - Sync: event("0xcf2aa50876cdfbb541206f89af0ee78d44a2abf8d328e37fa4917f982149848a", "Sync(uint256,uint256)", {"reserve0": p.uint256, "reserve1": p.uint256}), - Transfer: event("0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", "Transfer(address,address,uint256)", {"from": indexed(p.address), "to": indexed(p.address), "value": p.uint256}), -} - -export const functions = { - DOMAIN_SEPARATOR: viewFun("0x3644e515", "DOMAIN_SEPARATOR()", {}, p.bytes32), - allowance: viewFun("0xdd62ed3e", "allowance(address,address)", {"owner": p.address, "spender": p.address}, p.uint256), - approve: fun("0x095ea7b3", "approve(address,uint256)", {"spender": p.address, "amount": p.uint256}, p.bool), - balanceOf: viewFun("0x70a08231", "balanceOf(address)", {"account": p.address}, p.uint256), - blockTimestampLast: viewFun("0xc5700a02", "blockTimestampLast()", {}, p.uint256), - burn: fun("0x89afcb44", "burn(address)", {"to": p.address}, {"amount0": p.uint256, "amount1": p.uint256}), - claimFees: fun("0xd294f093", "claimFees()", {}, {"claimed0": p.uint256, "claimed1": p.uint256}), - claimable0: viewFun("0x4d5a9f8a", "claimable0(address)", {"_0": p.address}, p.uint256), - claimable1: viewFun("0xa1ac4d13", "claimable1(address)", {"_0": p.address}, p.uint256), - currentCumulativePrices: viewFun("0x1df8c717", "currentCumulativePrices()", {}, {"reserve0Cumulative": p.uint256, "reserve1Cumulative": p.uint256, "blockTimestamp": p.uint256}), - decimals: viewFun("0x313ce567", "decimals()", {}, p.uint8), - decreaseAllowance: fun("0xa457c2d7", "decreaseAllowance(address,uint256)", {"spender": p.address, "subtractedValue": p.uint256}, p.bool), - eip712Domain: viewFun("0x84b0196e", "eip712Domain()", {}, {"fields": p.bytes1, "name": p.string, "version": p.string, "chainId": p.uint256, "verifyingContract": p.address, "salt": p.bytes32, "extensions": p.array(p.uint256)}), - factory: viewFun("0xc45a0155", "factory()", {}, p.address), - getAmountOut: viewFun("0xf140a35a", "getAmountOut(uint256,address)", {"amountIn": p.uint256, "tokenIn": p.address}, p.uint256), - getK: fun("0xee39e7a0", "getK()", {}, p.uint256), - getReserves: viewFun("0x0902f1ac", "getReserves()", {}, {"_reserve0": p.uint256, "_reserve1": p.uint256, "_blockTimestampLast": p.uint256}), - increaseAllowance: fun("0x39509351", "increaseAllowance(address,uint256)", {"spender": p.address, "addedValue": p.uint256}, p.bool), - index0: viewFun("0x32c0defd", "index0()", {}, p.uint256), - index1: viewFun("0xbda39cad", "index1()", {}, p.uint256), - initialize: fun("0xe4bbb5a8", "initialize(address,address,bool)", {"_token0": p.address, "_token1": p.address, "_stable": p.bool}, ), - lastObservation: viewFun("0x8a7b8cf2", "lastObservation()", {}, p.struct({"timestamp": p.uint256, "reserve0Cumulative": p.uint256, "reserve1Cumulative": p.uint256})), - metadata: viewFun("0x392f37e9", "metadata()", {}, {"dec0": p.uint256, "dec1": p.uint256, "r0": p.uint256, "r1": p.uint256, "st": p.bool, "t0": p.address, "t1": p.address}), - mint: fun("0x6a627842", "mint(address)", {"to": p.address}, p.uint256), - name: viewFun("0x06fdde03", "name()", {}, p.string), - nonces: viewFun("0x7ecebe00", "nonces(address)", {"owner": p.address}, p.uint256), - observationLength: viewFun("0xebeb31db", "observationLength()", {}, p.uint256), - observations: viewFun("0x252c09d7", "observations(uint256)", {"_0": p.uint256}, {"timestamp": p.uint256, "reserve0Cumulative": p.uint256, "reserve1Cumulative": p.uint256}), - periodSize: viewFun("0xe4463eb2", "periodSize()", {}, p.uint256), - permit: fun("0xd505accf", "permit(address,address,uint256,uint256,uint8,bytes32,bytes32)", {"owner": p.address, "spender": p.address, "value": p.uint256, "deadline": p.uint256, "v": p.uint8, "r": p.bytes32, "s": p.bytes32}, ), - poolFees: viewFun("0x33580959", "poolFees()", {}, p.address), - prices: viewFun("0x5881c475", "prices(address,uint256,uint256)", {"tokenIn": p.address, "amountIn": p.uint256, "points": p.uint256}, p.array(p.uint256)), - quote: viewFun("0x9e8cc04b", "quote(address,uint256,uint256)", {"tokenIn": p.address, "amountIn": p.uint256, "granularity": p.uint256}, p.uint256), - reserve0: viewFun("0x443cb4bc", "reserve0()", {}, p.uint256), - reserve0CumulativeLast: viewFun("0xbf944dbc", "reserve0CumulativeLast()", {}, p.uint256), - reserve1: viewFun("0x5a76f25e", "reserve1()", {}, p.uint256), - reserve1CumulativeLast: viewFun("0xc245febc", "reserve1CumulativeLast()", {}, p.uint256), - sample: viewFun("0x13345fe1", "sample(address,uint256,uint256,uint256)", {"tokenIn": p.address, "amountIn": p.uint256, "points": p.uint256, "window": p.uint256}, p.array(p.uint256)), - setName: fun("0xc47f0027", "setName(string)", {"__name": p.string}, ), - setSymbol: fun("0xb84c8246", "setSymbol(string)", {"__symbol": p.string}, ), - skim: fun("0xbc25cf77", "skim(address)", {"to": p.address}, ), - stable: viewFun("0x22be3de1", "stable()", {}, p.bool), - supplyIndex0: viewFun("0x9f767c88", "supplyIndex0(address)", {"_0": p.address}, p.uint256), - supplyIndex1: viewFun("0x205aabf1", "supplyIndex1(address)", {"_0": p.address}, p.uint256), - swap: fun("0x022c0d9f", "swap(uint256,uint256,address,bytes)", {"amount0Out": p.uint256, "amount1Out": p.uint256, "to": p.address, "data": p.bytes}, ), - symbol: viewFun("0x95d89b41", "symbol()", {}, p.string), - sync: fun("0xfff6cae9", "sync()", {}, ), - token0: viewFun("0x0dfe1681", "token0()", {}, p.address), - token1: viewFun("0xd21220a7", "token1()", {}, p.address), - tokens: viewFun("0x9d63848a", "tokens()", {}, {"_0": p.address, "_1": p.address}), - totalSupply: viewFun("0x18160ddd", "totalSupply()", {}, p.uint256), - transfer: fun("0xa9059cbb", "transfer(address,uint256)", {"to": p.address, "amount": p.uint256}, p.bool), - transferFrom: fun("0x23b872dd", "transferFrom(address,address,uint256)", {"from": p.address, "to": p.address, "amount": p.uint256}, p.bool), -} - -export class Contract extends ContractBase { - - DOMAIN_SEPARATOR() { - return this.eth_call(functions.DOMAIN_SEPARATOR, {}) - } - - allowance(owner: AllowanceParams["owner"], spender: AllowanceParams["spender"]) { - return this.eth_call(functions.allowance, {owner, spender}) - } - - balanceOf(account: BalanceOfParams["account"]) { - return this.eth_call(functions.balanceOf, {account}) - } - - blockTimestampLast() { - return this.eth_call(functions.blockTimestampLast, {}) - } - - claimable0(_0: Claimable0Params["_0"]) { - return this.eth_call(functions.claimable0, {_0}) - } - - claimable1(_0: Claimable1Params["_0"]) { - return this.eth_call(functions.claimable1, {_0}) - } - - currentCumulativePrices() { - return this.eth_call(functions.currentCumulativePrices, {}) - } - - decimals() { - return this.eth_call(functions.decimals, {}) - } - - eip712Domain() { - return this.eth_call(functions.eip712Domain, {}) - } - - factory() { - return this.eth_call(functions.factory, {}) - } - - getAmountOut(amountIn: GetAmountOutParams["amountIn"], tokenIn: GetAmountOutParams["tokenIn"]) { - return this.eth_call(functions.getAmountOut, {amountIn, tokenIn}) - } - - getReserves() { - return this.eth_call(functions.getReserves, {}) - } - - index0() { - return this.eth_call(functions.index0, {}) - } - - index1() { - return this.eth_call(functions.index1, {}) - } - - lastObservation() { - return this.eth_call(functions.lastObservation, {}) - } - - metadata() { - return this.eth_call(functions.metadata, {}) - } - - name() { - return this.eth_call(functions.name, {}) - } - - nonces(owner: NoncesParams["owner"]) { - return this.eth_call(functions.nonces, {owner}) - } - - observationLength() { - return this.eth_call(functions.observationLength, {}) - } - - observations(_0: ObservationsParams["_0"]) { - return this.eth_call(functions.observations, {_0}) - } - - periodSize() { - return this.eth_call(functions.periodSize, {}) - } - - poolFees() { - return this.eth_call(functions.poolFees, {}) - } - - prices(tokenIn: PricesParams["tokenIn"], amountIn: PricesParams["amountIn"], points: PricesParams["points"]) { - return this.eth_call(functions.prices, {tokenIn, amountIn, points}) - } - - quote(tokenIn: QuoteParams["tokenIn"], amountIn: QuoteParams["amountIn"], granularity: QuoteParams["granularity"]) { - return this.eth_call(functions.quote, {tokenIn, amountIn, granularity}) - } - - reserve0() { - return this.eth_call(functions.reserve0, {}) - } - - reserve0CumulativeLast() { - return this.eth_call(functions.reserve0CumulativeLast, {}) - } - - reserve1() { - return this.eth_call(functions.reserve1, {}) - } - - reserve1CumulativeLast() { - return this.eth_call(functions.reserve1CumulativeLast, {}) - } - - sample(tokenIn: SampleParams["tokenIn"], amountIn: SampleParams["amountIn"], points: SampleParams["points"], window: SampleParams["window"]) { - return this.eth_call(functions.sample, {tokenIn, amountIn, points, window}) - } - - stable() { - return this.eth_call(functions.stable, {}) - } - - supplyIndex0(_0: SupplyIndex0Params["_0"]) { - return this.eth_call(functions.supplyIndex0, {_0}) - } - - supplyIndex1(_0: SupplyIndex1Params["_0"]) { - return this.eth_call(functions.supplyIndex1, {_0}) - } - - symbol() { - return this.eth_call(functions.symbol, {}) - } - - token0() { - return this.eth_call(functions.token0, {}) - } - - token1() { - return this.eth_call(functions.token1, {}) - } - - tokens() { - return this.eth_call(functions.tokens, {}) - } - - totalSupply() { - return this.eth_call(functions.totalSupply, {}) - } -} - -/// Event types -export type ApprovalEventArgs = EParams -export type BurnEventArgs = EParams -export type ClaimEventArgs = EParams -export type EIP712DomainChangedEventArgs = EParams -export type FeesEventArgs = EParams -export type MintEventArgs = EParams -export type SwapEventArgs = EParams -export type SyncEventArgs = EParams -export type TransferEventArgs = EParams - -/// Function types -export type DOMAIN_SEPARATORParams = FunctionArguments -export type DOMAIN_SEPARATORReturn = FunctionReturn - -export type AllowanceParams = FunctionArguments -export type AllowanceReturn = FunctionReturn - -export type ApproveParams = FunctionArguments -export type ApproveReturn = FunctionReturn - -export type BalanceOfParams = FunctionArguments -export type BalanceOfReturn = FunctionReturn - -export type BlockTimestampLastParams = FunctionArguments -export type BlockTimestampLastReturn = FunctionReturn - -export type BurnParams = FunctionArguments -export type BurnReturn = FunctionReturn - -export type ClaimFeesParams = FunctionArguments -export type ClaimFeesReturn = FunctionReturn - -export type Claimable0Params = FunctionArguments -export type Claimable0Return = FunctionReturn - -export type Claimable1Params = FunctionArguments -export type Claimable1Return = FunctionReturn - -export type CurrentCumulativePricesParams = FunctionArguments -export type CurrentCumulativePricesReturn = FunctionReturn - -export type DecimalsParams = FunctionArguments -export type DecimalsReturn = FunctionReturn - -export type DecreaseAllowanceParams = FunctionArguments -export type DecreaseAllowanceReturn = FunctionReturn - -export type Eip712DomainParams = FunctionArguments -export type Eip712DomainReturn = FunctionReturn - -export type FactoryParams = FunctionArguments -export type FactoryReturn = FunctionReturn - -export type GetAmountOutParams = FunctionArguments -export type GetAmountOutReturn = FunctionReturn - -export type GetKParams = FunctionArguments -export type GetKReturn = FunctionReturn - -export type GetReservesParams = FunctionArguments -export type GetReservesReturn = FunctionReturn - -export type IncreaseAllowanceParams = FunctionArguments -export type IncreaseAllowanceReturn = FunctionReturn - -export type Index0Params = FunctionArguments -export type Index0Return = FunctionReturn - -export type Index1Params = FunctionArguments -export type Index1Return = FunctionReturn - -export type InitializeParams = FunctionArguments -export type InitializeReturn = FunctionReturn - -export type LastObservationParams = FunctionArguments -export type LastObservationReturn = FunctionReturn - -export type MetadataParams = FunctionArguments -export type MetadataReturn = FunctionReturn - -export type MintParams = FunctionArguments -export type MintReturn = FunctionReturn - -export type NameParams = FunctionArguments -export type NameReturn = FunctionReturn - -export type NoncesParams = FunctionArguments -export type NoncesReturn = FunctionReturn - -export type ObservationLengthParams = FunctionArguments -export type ObservationLengthReturn = FunctionReturn - -export type ObservationsParams = FunctionArguments -export type ObservationsReturn = FunctionReturn - -export type PeriodSizeParams = FunctionArguments -export type PeriodSizeReturn = FunctionReturn - -export type PermitParams = FunctionArguments -export type PermitReturn = FunctionReturn - -export type PoolFeesParams = FunctionArguments -export type PoolFeesReturn = FunctionReturn - -export type PricesParams = FunctionArguments -export type PricesReturn = FunctionReturn - -export type QuoteParams = FunctionArguments -export type QuoteReturn = FunctionReturn - -export type Reserve0Params = FunctionArguments -export type Reserve0Return = FunctionReturn - -export type Reserve0CumulativeLastParams = FunctionArguments -export type Reserve0CumulativeLastReturn = FunctionReturn - -export type Reserve1Params = FunctionArguments -export type Reserve1Return = FunctionReturn - -export type Reserve1CumulativeLastParams = FunctionArguments -export type Reserve1CumulativeLastReturn = FunctionReturn - -export type SampleParams = FunctionArguments -export type SampleReturn = FunctionReturn - -export type SetNameParams = FunctionArguments -export type SetNameReturn = FunctionReturn - -export type SetSymbolParams = FunctionArguments -export type SetSymbolReturn = FunctionReturn - -export type SkimParams = FunctionArguments -export type SkimReturn = FunctionReturn - -export type StableParams = FunctionArguments -export type StableReturn = FunctionReturn - -export type SupplyIndex0Params = FunctionArguments -export type SupplyIndex0Return = FunctionReturn - -export type SupplyIndex1Params = FunctionArguments -export type SupplyIndex1Return = FunctionReturn - -export type SwapParams = FunctionArguments -export type SwapReturn = FunctionReturn - -export type SymbolParams = FunctionArguments -export type SymbolReturn = FunctionReturn - -export type SyncParams = FunctionArguments -export type SyncReturn = FunctionReturn - -export type Token0Params = FunctionArguments -export type Token0Return = FunctionReturn - -export type Token1Params = FunctionArguments -export type Token1Return = FunctionReturn - -export type TokensParams = FunctionArguments -export type TokensReturn = FunctionReturn - -export type TotalSupplyParams = FunctionArguments -export type TotalSupplyReturn = FunctionReturn - -export type TransferParams = FunctionArguments -export type TransferReturn = FunctionReturn - -export type TransferFromParams = FunctionArguments -export type TransferFromReturn = FunctionReturn - diff --git a/src/abi/aerodrome-pool/contract.ts b/src/abi/aerodrome-pool/contract.ts new file mode 100644 index 00000000..7c27a744 --- /dev/null +++ b/src/abi/aerodrome-pool/contract.ts @@ -0,0 +1,189 @@ +import { ContractBase } from '../abi.support.js' +import { DOMAIN_SEPARATOR, allowance, approve, balanceOf, blockTimestampLast, burn, claimFees, claimable0, claimable1, currentCumulativePrices, decimals, decreaseAllowance, eip712Domain, factory, getAmountOut, getK, getReserves, increaseAllowance, index0, index1, lastObservation, metadata, mint, name, nonces, observationLength, observations, periodSize, poolFees, prices, quote, reserve0, reserve0CumulativeLast, reserve1, reserve1CumulativeLast, sample, stable, supplyIndex0, supplyIndex1, symbol, token0, token1, tokens, totalSupply, transfer, transferFrom } from './functions.js' +import type { AllowanceParams, ApproveParams, BalanceOfParams, BurnParams, Claimable0Params, Claimable1Params, DecreaseAllowanceParams, GetAmountOutParams, IncreaseAllowanceParams, MintParams, NoncesParams, ObservationsParams, PricesParams, QuoteParams, SampleParams, SupplyIndex0Params, SupplyIndex1Params, TransferFromParams, TransferParams } from './functions.js' + +export class Contract extends ContractBase { + DOMAIN_SEPARATOR() { + return this.eth_call(DOMAIN_SEPARATOR, {}) + } + + allowance(owner: AllowanceParams["owner"], spender: AllowanceParams["spender"]) { + return this.eth_call(allowance, {owner, spender}) + } + + approve(spender: ApproveParams["spender"], amount: ApproveParams["amount"]) { + return this.eth_call(approve, {spender, amount}) + } + + balanceOf(account: BalanceOfParams["account"]) { + return this.eth_call(balanceOf, {account}) + } + + blockTimestampLast() { + return this.eth_call(blockTimestampLast, {}) + } + + burn(to: BurnParams["to"]) { + return this.eth_call(burn, {to}) + } + + claimFees() { + return this.eth_call(claimFees, {}) + } + + claimable0(_0: Claimable0Params["_0"]) { + return this.eth_call(claimable0, {_0}) + } + + claimable1(_0: Claimable1Params["_0"]) { + return this.eth_call(claimable1, {_0}) + } + + currentCumulativePrices() { + return this.eth_call(currentCumulativePrices, {}) + } + + decimals() { + return this.eth_call(decimals, {}) + } + + decreaseAllowance(spender: DecreaseAllowanceParams["spender"], subtractedValue: DecreaseAllowanceParams["subtractedValue"]) { + return this.eth_call(decreaseAllowance, {spender, subtractedValue}) + } + + eip712Domain() { + return this.eth_call(eip712Domain, {}) + } + + factory() { + return this.eth_call(factory, {}) + } + + getAmountOut(amountIn: GetAmountOutParams["amountIn"], tokenIn: GetAmountOutParams["tokenIn"]) { + return this.eth_call(getAmountOut, {amountIn, tokenIn}) + } + + getK() { + return this.eth_call(getK, {}) + } + + getReserves() { + return this.eth_call(getReserves, {}) + } + + increaseAllowance(spender: IncreaseAllowanceParams["spender"], addedValue: IncreaseAllowanceParams["addedValue"]) { + return this.eth_call(increaseAllowance, {spender, addedValue}) + } + + index0() { + return this.eth_call(index0, {}) + } + + index1() { + return this.eth_call(index1, {}) + } + + lastObservation() { + return this.eth_call(lastObservation, {}) + } + + metadata() { + return this.eth_call(metadata, {}) + } + + mint(to: MintParams["to"]) { + return this.eth_call(mint, {to}) + } + + name() { + return this.eth_call(name, {}) + } + + nonces(owner: NoncesParams["owner"]) { + return this.eth_call(nonces, {owner}) + } + + observationLength() { + return this.eth_call(observationLength, {}) + } + + observations(_0: ObservationsParams["_0"]) { + return this.eth_call(observations, {_0}) + } + + periodSize() { + return this.eth_call(periodSize, {}) + } + + poolFees() { + return this.eth_call(poolFees, {}) + } + + prices(tokenIn: PricesParams["tokenIn"], amountIn: PricesParams["amountIn"], points: PricesParams["points"]) { + return this.eth_call(prices, {tokenIn, amountIn, points}) + } + + quote(tokenIn: QuoteParams["tokenIn"], amountIn: QuoteParams["amountIn"], granularity: QuoteParams["granularity"]) { + return this.eth_call(quote, {tokenIn, amountIn, granularity}) + } + + reserve0() { + return this.eth_call(reserve0, {}) + } + + reserve0CumulativeLast() { + return this.eth_call(reserve0CumulativeLast, {}) + } + + reserve1() { + return this.eth_call(reserve1, {}) + } + + reserve1CumulativeLast() { + return this.eth_call(reserve1CumulativeLast, {}) + } + + sample(tokenIn: SampleParams["tokenIn"], amountIn: SampleParams["amountIn"], points: SampleParams["points"], window: SampleParams["window"]) { + return this.eth_call(sample, {tokenIn, amountIn, points, window}) + } + + stable() { + return this.eth_call(stable, {}) + } + + supplyIndex0(_0: SupplyIndex0Params["_0"]) { + return this.eth_call(supplyIndex0, {_0}) + } + + supplyIndex1(_0: SupplyIndex1Params["_0"]) { + return this.eth_call(supplyIndex1, {_0}) + } + + symbol() { + return this.eth_call(symbol, {}) + } + + token0() { + return this.eth_call(token0, {}) + } + + token1() { + return this.eth_call(token1, {}) + } + + tokens() { + return this.eth_call(tokens, {}) + } + + totalSupply() { + return this.eth_call(totalSupply, {}) + } + + transfer(to: TransferParams["to"], amount: TransferParams["amount"]) { + return this.eth_call(transfer, {to, amount}) + } + + transferFrom(from: TransferFromParams["from"], to: TransferFromParams["to"], amount: TransferFromParams["amount"]) { + return this.eth_call(transferFrom, {from, to, amount}) + } +} diff --git a/src/abi/aerodrome-pool/events.ts b/src/abi/aerodrome-pool/events.ts new file mode 100644 index 00000000..80208406 --- /dev/null +++ b/src/abi/aerodrome-pool/events.ts @@ -0,0 +1,75 @@ +import { address, uint256 } from '@subsquid/evm-codec' +import { event, indexed } from '../abi.support.js' +import type { EventParams as EParams } from '../abi.support.js' + +/** Approval(address,address,uint256) */ +export const Approval = event('0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925', { + owner: indexed(address), + spender: indexed(address), + value: uint256, +}) +export type ApprovalEventArgs = EParams + +/** Burn(address,address,uint256,uint256) */ +export const Burn = event('0x5d624aa9c148153ab3446c1b154f660ee7701e549fe9b62dab7171b1c80e6fa2', { + sender: indexed(address), + to: indexed(address), + amount0: uint256, + amount1: uint256, +}) +export type BurnEventArgs = EParams + +/** Claim(address,address,uint256,uint256) */ +export const Claim = event('0x865ca08d59f5cb456e85cd2f7ef63664ea4f73327414e9d8152c4158b0e94645', { + sender: indexed(address), + recipient: indexed(address), + amount0: uint256, + amount1: uint256, +}) +export type ClaimEventArgs = EParams + +/** EIP712DomainChanged() */ +export const EIP712DomainChanged = event('0x0a6387c9ea3628b88a633bb4f3b151770f70085117a15f9bf3787cda53f13d31', {}) +export type EIP712DomainChangedEventArgs = EParams + +/** Fees(address,uint256,uint256) */ +export const Fees = event('0x112c256902bf554b6ed882d2936687aaeb4225e8cd5b51303c90ca6cf43a8602', { + sender: indexed(address), + amount0: uint256, + amount1: uint256, +}) +export type FeesEventArgs = EParams + +/** Mint(address,uint256,uint256) */ +export const Mint = event('0x4c209b5fc8ad50758f13e2e1088ba56a560dff690a1c6fef26394f4c03821c4f', { + sender: indexed(address), + amount0: uint256, + amount1: uint256, +}) +export type MintEventArgs = EParams + +/** Swap(address,address,uint256,uint256,uint256,uint256) */ +export const Swap = event('0xb3e2773606abfd36b5bd91394b3a54d1398336c65005baf7bf7a05efeffaf75b', { + sender: indexed(address), + to: indexed(address), + amount0In: uint256, + amount1In: uint256, + amount0Out: uint256, + amount1Out: uint256, +}) +export type SwapEventArgs = EParams + +/** Sync(uint256,uint256) */ +export const Sync = event('0xcf2aa50876cdfbb541206f89af0ee78d44a2abf8d328e37fa4917f982149848a', { + reserve0: uint256, + reserve1: uint256, +}) +export type SyncEventArgs = EParams + +/** Transfer(address,address,uint256) */ +export const Transfer = event('0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', { + from: indexed(address), + to: indexed(address), + value: uint256, +}) +export type TransferEventArgs = EParams diff --git a/src/abi/aerodrome-pool/functions.ts b/src/abi/aerodrome-pool/functions.ts new file mode 100644 index 00000000..9d831fb0 --- /dev/null +++ b/src/abi/aerodrome-pool/functions.ts @@ -0,0 +1,385 @@ +import { address, array, bool, bytes, bytes1, bytes32, string, struct, uint256, uint8 } from '@subsquid/evm-codec' +import { func } from '../abi.support.js' +import type { FunctionArguments, FunctionReturn } from '../abi.support.js' + +/** DOMAIN_SEPARATOR() */ +export const DOMAIN_SEPARATOR = func('0x3644e515', {}, bytes32) +export type DOMAIN_SEPARATORParams = FunctionArguments +export type DOMAIN_SEPARATORReturn = FunctionReturn + +/** allowance(address,address) */ +export const allowance = func('0xdd62ed3e', { + owner: address, + spender: address, +}, uint256) +export type AllowanceParams = FunctionArguments +export type AllowanceReturn = FunctionReturn + +/** approve(address,uint256) */ +export const approve = func('0x095ea7b3', { + spender: address, + amount: uint256, +}, bool) +export type ApproveParams = FunctionArguments +export type ApproveReturn = FunctionReturn + +/** balanceOf(address) */ +export const balanceOf = func('0x70a08231', { + account: address, +}, uint256) +export type BalanceOfParams = FunctionArguments +export type BalanceOfReturn = FunctionReturn + +/** blockTimestampLast() */ +export const blockTimestampLast = func('0xc5700a02', {}, uint256) +export type BlockTimestampLastParams = FunctionArguments +export type BlockTimestampLastReturn = FunctionReturn + +/** burn(address) */ +export const burn = func('0x89afcb44', { + to: address, +}, struct({ + amount0: uint256, + amount1: uint256, +})) +export type BurnParams = FunctionArguments +export type BurnReturn = FunctionReturn + +/** claimFees() */ +export const claimFees = func('0xd294f093', {}, struct({ + claimed0: uint256, + claimed1: uint256, +})) +export type ClaimFeesParams = FunctionArguments +export type ClaimFeesReturn = FunctionReturn + +/** claimable0(address) */ +export const claimable0 = func('0x4d5a9f8a', { + _0: address, +}, uint256) +export type Claimable0Params = FunctionArguments +export type Claimable0Return = FunctionReturn + +/** claimable1(address) */ +export const claimable1 = func('0xa1ac4d13', { + _0: address, +}, uint256) +export type Claimable1Params = FunctionArguments +export type Claimable1Return = FunctionReturn + +/** currentCumulativePrices() */ +export const currentCumulativePrices = func('0x1df8c717', {}, struct({ + reserve0Cumulative: uint256, + reserve1Cumulative: uint256, + blockTimestamp: uint256, +})) +export type CurrentCumulativePricesParams = FunctionArguments +export type CurrentCumulativePricesReturn = FunctionReturn + +/** decimals() */ +export const decimals = func('0x313ce567', {}, uint8) +export type DecimalsParams = FunctionArguments +export type DecimalsReturn = FunctionReturn + +/** decreaseAllowance(address,uint256) */ +export const decreaseAllowance = func('0xa457c2d7', { + spender: address, + subtractedValue: uint256, +}, bool) +export type DecreaseAllowanceParams = FunctionArguments +export type DecreaseAllowanceReturn = FunctionReturn + +/** eip712Domain() */ +export const eip712Domain = func('0x84b0196e', {}, struct({ + fields: bytes1, + name: string, + version: string, + chainId: uint256, + verifyingContract: address, + salt: bytes32, + extensions: array(uint256), +})) +export type Eip712DomainParams = FunctionArguments +export type Eip712DomainReturn = FunctionReturn + +/** factory() */ +export const factory = func('0xc45a0155', {}, address) +export type FactoryParams = FunctionArguments +export type FactoryReturn = FunctionReturn + +/** getAmountOut(uint256,address) */ +export const getAmountOut = func('0xf140a35a', { + amountIn: uint256, + tokenIn: address, +}, uint256) +export type GetAmountOutParams = FunctionArguments +export type GetAmountOutReturn = FunctionReturn + +/** getK() */ +export const getK = func('0xee39e7a0', {}, uint256) +export type GetKParams = FunctionArguments +export type GetKReturn = FunctionReturn + +/** getReserves() */ +export const getReserves = func('0x0902f1ac', {}, struct({ + _reserve0: uint256, + _reserve1: uint256, + _blockTimestampLast: uint256, +})) +export type GetReservesParams = FunctionArguments +export type GetReservesReturn = FunctionReturn + +/** increaseAllowance(address,uint256) */ +export const increaseAllowance = func('0x39509351', { + spender: address, + addedValue: uint256, +}, bool) +export type IncreaseAllowanceParams = FunctionArguments +export type IncreaseAllowanceReturn = FunctionReturn + +/** index0() */ +export const index0 = func('0x32c0defd', {}, uint256) +export type Index0Params = FunctionArguments +export type Index0Return = FunctionReturn + +/** index1() */ +export const index1 = func('0xbda39cad', {}, uint256) +export type Index1Params = FunctionArguments +export type Index1Return = FunctionReturn + +/** initialize(address,address,bool) */ +export const initialize = func('0xe4bbb5a8', { + _token0: address, + _token1: address, + _stable: bool, +}) +export type InitializeParams = FunctionArguments +export type InitializeReturn = FunctionReturn + +/** lastObservation() */ +export const lastObservation = func('0x8a7b8cf2', {}, struct({ + timestamp: uint256, + reserve0Cumulative: uint256, + reserve1Cumulative: uint256, +})) +export type LastObservationParams = FunctionArguments +export type LastObservationReturn = FunctionReturn + +/** metadata() */ +export const metadata = func('0x392f37e9', {}, struct({ + dec0: uint256, + dec1: uint256, + r0: uint256, + r1: uint256, + st: bool, + t0: address, + t1: address, +})) +export type MetadataParams = FunctionArguments +export type MetadataReturn = FunctionReturn + +/** mint(address) */ +export const mint = func('0x6a627842', { + to: address, +}, uint256) +export type MintParams = FunctionArguments +export type MintReturn = FunctionReturn + +/** name() */ +export const name = func('0x06fdde03', {}, string) +export type NameParams = FunctionArguments +export type NameReturn = FunctionReturn + +/** nonces(address) */ +export const nonces = func('0x7ecebe00', { + owner: address, +}, uint256) +export type NoncesParams = FunctionArguments +export type NoncesReturn = FunctionReturn + +/** observationLength() */ +export const observationLength = func('0xebeb31db', {}, uint256) +export type ObservationLengthParams = FunctionArguments +export type ObservationLengthReturn = FunctionReturn + +/** observations(uint256) */ +export const observations = func('0x252c09d7', { + _0: uint256, +}, struct({ + timestamp: uint256, + reserve0Cumulative: uint256, + reserve1Cumulative: uint256, +})) +export type ObservationsParams = FunctionArguments +export type ObservationsReturn = FunctionReturn + +/** periodSize() */ +export const periodSize = func('0xe4463eb2', {}, uint256) +export type PeriodSizeParams = FunctionArguments +export type PeriodSizeReturn = FunctionReturn + +/** permit(address,address,uint256,uint256,uint8,bytes32,bytes32) */ +export const permit = func('0xd505accf', { + owner: address, + spender: address, + value: uint256, + deadline: uint256, + v: uint8, + r: bytes32, + s: bytes32, +}) +export type PermitParams = FunctionArguments +export type PermitReturn = FunctionReturn + +/** poolFees() */ +export const poolFees = func('0x33580959', {}, address) +export type PoolFeesParams = FunctionArguments +export type PoolFeesReturn = FunctionReturn + +/** prices(address,uint256,uint256) */ +export const prices = func('0x5881c475', { + tokenIn: address, + amountIn: uint256, + points: uint256, +}, array(uint256)) +export type PricesParams = FunctionArguments +export type PricesReturn = FunctionReturn + +/** quote(address,uint256,uint256) */ +export const quote = func('0x9e8cc04b', { + tokenIn: address, + amountIn: uint256, + granularity: uint256, +}, uint256) +export type QuoteParams = FunctionArguments +export type QuoteReturn = FunctionReturn + +/** reserve0() */ +export const reserve0 = func('0x443cb4bc', {}, uint256) +export type Reserve0Params = FunctionArguments +export type Reserve0Return = FunctionReturn + +/** reserve0CumulativeLast() */ +export const reserve0CumulativeLast = func('0xbf944dbc', {}, uint256) +export type Reserve0CumulativeLastParams = FunctionArguments +export type Reserve0CumulativeLastReturn = FunctionReturn + +/** reserve1() */ +export const reserve1 = func('0x5a76f25e', {}, uint256) +export type Reserve1Params = FunctionArguments +export type Reserve1Return = FunctionReturn + +/** reserve1CumulativeLast() */ +export const reserve1CumulativeLast = func('0xc245febc', {}, uint256) +export type Reserve1CumulativeLastParams = FunctionArguments +export type Reserve1CumulativeLastReturn = FunctionReturn + +/** sample(address,uint256,uint256,uint256) */ +export const sample = func('0x13345fe1', { + tokenIn: address, + amountIn: uint256, + points: uint256, + window: uint256, +}, array(uint256)) +export type SampleParams = FunctionArguments +export type SampleReturn = FunctionReturn + +/** setName(string) */ +export const setName = func('0xc47f0027', { + __name: string, +}) +export type SetNameParams = FunctionArguments +export type SetNameReturn = FunctionReturn + +/** setSymbol(string) */ +export const setSymbol = func('0xb84c8246', { + __symbol: string, +}) +export type SetSymbolParams = FunctionArguments +export type SetSymbolReturn = FunctionReturn + +/** skim(address) */ +export const skim = func('0xbc25cf77', { + to: address, +}) +export type SkimParams = FunctionArguments +export type SkimReturn = FunctionReturn + +/** stable() */ +export const stable = func('0x22be3de1', {}, bool) +export type StableParams = FunctionArguments +export type StableReturn = FunctionReturn + +/** supplyIndex0(address) */ +export const supplyIndex0 = func('0x9f767c88', { + _0: address, +}, uint256) +export type SupplyIndex0Params = FunctionArguments +export type SupplyIndex0Return = FunctionReturn + +/** supplyIndex1(address) */ +export const supplyIndex1 = func('0x205aabf1', { + _0: address, +}, uint256) +export type SupplyIndex1Params = FunctionArguments +export type SupplyIndex1Return = FunctionReturn + +/** swap(uint256,uint256,address,bytes) */ +export const swap = func('0x022c0d9f', { + amount0Out: uint256, + amount1Out: uint256, + to: address, + data: bytes, +}) +export type SwapParams = FunctionArguments +export type SwapReturn = FunctionReturn + +/** symbol() */ +export const symbol = func('0x95d89b41', {}, string) +export type SymbolParams = FunctionArguments +export type SymbolReturn = FunctionReturn + +/** sync() */ +export const sync = func('0xfff6cae9', {}) +export type SyncParams = FunctionArguments +export type SyncReturn = FunctionReturn + +/** token0() */ +export const token0 = func('0x0dfe1681', {}, address) +export type Token0Params = FunctionArguments +export type Token0Return = FunctionReturn + +/** token1() */ +export const token1 = func('0xd21220a7', {}, address) +export type Token1Params = FunctionArguments +export type Token1Return = FunctionReturn + +/** tokens() */ +export const tokens = func('0x9d63848a', {}, struct({ + _0: address, + _1: address, +})) +export type TokensParams = FunctionArguments +export type TokensReturn = FunctionReturn + +/** totalSupply() */ +export const totalSupply = func('0x18160ddd', {}, uint256) +export type TotalSupplyParams = FunctionArguments +export type TotalSupplyReturn = FunctionReturn + +/** transfer(address,uint256) */ +export const transfer = func('0xa9059cbb', { + to: address, + amount: uint256, +}, bool) +export type TransferParams = FunctionArguments +export type TransferReturn = FunctionReturn + +/** transferFrom(address,address,uint256) */ +export const transferFrom = func('0x23b872dd', { + from: address, + to: address, + amount: uint256, +}, bool) +export type TransferFromParams = FunctionArguments +export type TransferFromReturn = FunctionReturn diff --git a/src/abi/aerodrome-pool/index.ts b/src/abi/aerodrome-pool/index.ts new file mode 100644 index 00000000..11829d6e --- /dev/null +++ b/src/abi/aerodrome-pool/index.ts @@ -0,0 +1,4 @@ +export * as events from './events.js' +export * as functions from './functions.js' + +export { Contract } from './contract.js' diff --git a/src/abi/aerodrome-voter.ts b/src/abi/aerodrome-voter.ts deleted file mode 100644 index dc50678c..00000000 --- a/src/abi/aerodrome-voter.ts +++ /dev/null @@ -1,370 +0,0 @@ -import * as p from '@subsquid/evm-codec' -import { event, fun, viewFun, indexed, ContractBase } from '@subsquid/evm-abi' -import type { EventParams as EParams, FunctionArguments, FunctionReturn } from '@subsquid/evm-abi' - -export const events = { - Abstained: event("0xadab630928b1d46214641293704a312ee7ad87e03ae14a7fd95e7308b93998df", "Abstained(address,address,uint256,uint256,uint256,uint256)", {"voter": indexed(p.address), "pool": indexed(p.address), "tokenId": indexed(p.uint256), "weight": p.uint256, "totalWeight": p.uint256, "timestamp": p.uint256}), - DistributeReward: event("0x4fa9693cae526341d334e2862ca2413b2e503f1266255f9e0869fb36e6d89b17", "DistributeReward(address,address,uint256)", {"sender": indexed(p.address), "gauge": indexed(p.address), "amount": p.uint256}), - GaugeCreated: event("0xef9f7d1ffff3b249c6b9bf2528499e935f7d96bb6d6ec4e7da504d1d3c6279e1", "GaugeCreated(address,address,address,address,address,address,address,address)", {"poolFactory": indexed(p.address), "votingRewardsFactory": indexed(p.address), "gaugeFactory": indexed(p.address), "pool": p.address, "bribeVotingReward": p.address, "feeVotingReward": p.address, "gauge": p.address, "creator": p.address}), - GaugeKilled: event("0x04a5d3f5d80d22d9345acc80618f4a4e7e663cf9e1aed23b57d975acec002ba7", "GaugeKilled(address)", {"gauge": indexed(p.address)}), - GaugeRevived: event("0xed18e9faa3dccfd8aa45f69c4de40546b2ca9cccc4538a2323531656516db1aa", "GaugeRevived(address)", {"gauge": indexed(p.address)}), - NotifyReward: event("0xf70d5c697de7ea828df48e5c4573cb2194c659f1901f70110c52b066dcf50826", "NotifyReward(address,address,uint256)", {"sender": indexed(p.address), "reward": indexed(p.address), "amount": p.uint256}), - Voted: event("0x452d440efc30dfa14a0ef803ccb55936af860ec6a6960ed27f129bef913f296a", "Voted(address,address,uint256,uint256,uint256,uint256)", {"voter": indexed(p.address), "pool": indexed(p.address), "tokenId": indexed(p.uint256), "weight": p.uint256, "totalWeight": p.uint256, "timestamp": p.uint256}), - WhitelistNFT: event("0x8a6ff732c8641e1e34d771e1f8b1673e988c1abdfb694ebdf6c910a5e3d0d853", "WhitelistNFT(address,uint256,bool)", {"whitelister": indexed(p.address), "tokenId": indexed(p.uint256), "_bool": indexed(p.bool)}), - WhitelistToken: event("0x44948130cf88523dbc150908a47dd6332c33a01a3869d7f2fa78e51d5a5f9c57", "WhitelistToken(address,address,bool)", {"whitelister": indexed(p.address), "token": indexed(p.address), "_bool": indexed(p.bool)}), -} - -export const functions = { - claimBribes: fun("0x7715ee75", "claimBribes(address[],address[][],uint256)", {"_bribes": p.array(p.address), "_tokens": p.array(p.array(p.address)), "_tokenId": p.uint256}, ), - claimFees: fun("0x666256aa", "claimFees(address[],address[][],uint256)", {"_fees": p.array(p.address), "_tokens": p.array(p.array(p.address)), "_tokenId": p.uint256}, ), - claimRewards: fun("0xf9f031df", "claimRewards(address[])", {"_gauges": p.array(p.address)}, ), - claimable: viewFun("0x402914f5", "claimable(address)", {"_0": p.address}, p.uint256), - createGauge: fun("0x794cea3c", "createGauge(address,address)", {"_poolFactory": p.address, "_pool": p.address}, p.address), - depositManaged: fun("0xe0c11f9a", "depositManaged(uint256,uint256)", {"_tokenId": p.uint256, "_mTokenId": p.uint256}, ), - 'distribute(address[])': fun("0x6138889b", "distribute(address[])", {"_gauges": p.array(p.address)}, ), - 'distribute(uint256,uint256)': fun("0x7625391a", "distribute(uint256,uint256)", {"_start": p.uint256, "_finish": p.uint256}, ), - emergencyCouncil: viewFun("0x7778960e", "emergencyCouncil()", {}, p.address), - epochGovernor: viewFun("0x3aae971f", "epochGovernor()", {}, p.address), - epochNext: viewFun("0x880e36fc", "epochNext(uint256)", {"_timestamp": p.uint256}, p.uint256), - epochStart: viewFun("0xaa9354a3", "epochStart(uint256)", {"_timestamp": p.uint256}, p.uint256), - epochVoteEnd: viewFun("0xd58b15d4", "epochVoteEnd(uint256)", {"_timestamp": p.uint256}, p.uint256), - epochVoteStart: viewFun("0x39e9f3b6", "epochVoteStart(uint256)", {"_timestamp": p.uint256}, p.uint256), - factoryRegistry: viewFun("0x3bf0c9fb", "factoryRegistry()", {}, p.address), - forwarder: viewFun("0xf645d4f9", "forwarder()", {}, p.address), - gaugeToBribe: viewFun("0x929c8dcd", "gaugeToBribe(address)", {"_0": p.address}, p.address), - gaugeToFees: viewFun("0xc4f08165", "gaugeToFees(address)", {"_0": p.address}, p.address), - gauges: viewFun("0xb9a09fd5", "gauges(address)", {"_0": p.address}, p.address), - governor: viewFun("0x0c340a24", "governor()", {}, p.address), - initialize: fun("0x462d0b2e", "initialize(address[],address)", {"_tokens": p.array(p.address), "_minter": p.address}, ), - isAlive: viewFun("0x1703e5f9", "isAlive(address)", {"_0": p.address}, p.bool), - isGauge: viewFun("0xaa79979b", "isGauge(address)", {"_0": p.address}, p.bool), - isTrustedForwarder: viewFun("0x572b6c05", "isTrustedForwarder(address)", {"forwarder": p.address}, p.bool), - isWhitelistedNFT: viewFun("0xd4e2616f", "isWhitelistedNFT(uint256)", {"_0": p.uint256}, p.bool), - isWhitelistedToken: viewFun("0xab37f486", "isWhitelistedToken(address)", {"_0": p.address}, p.bool), - killGauge: fun("0x992a7933", "killGauge(address)", {"_gauge": p.address}, ), - lastVoted: viewFun("0xf3594be0", "lastVoted(uint256)", {"_0": p.uint256}, p.uint256), - length: viewFun("0x1f7b6d32", "length()", {}, p.uint256), - maxVotingNum: viewFun("0xe8b3fd57", "maxVotingNum()", {}, p.uint256), - minter: viewFun("0x07546172", "minter()", {}, p.address), - notifyRewardAmount: fun("0x3c6b16ab", "notifyRewardAmount(uint256)", {"_amount": p.uint256}, ), - poke: fun("0x32145f90", "poke(uint256)", {"_tokenId": p.uint256}, ), - poolForGauge: viewFun("0x06d6a1b2", "poolForGauge(address)", {"_0": p.address}, p.address), - poolVote: viewFun("0xa86a366d", "poolVote(uint256,uint256)", {"_0": p.uint256, "_1": p.uint256}, p.address), - pools: viewFun("0xac4afa38", "pools(uint256)", {"_0": p.uint256}, p.address), - reset: fun("0x310bd74b", "reset(uint256)", {"_tokenId": p.uint256}, ), - reviveGauge: fun("0x9f06247b", "reviveGauge(address)", {"_gauge": p.address}, ), - setEmergencyCouncil: fun("0xe586875f", "setEmergencyCouncil(address)", {"_council": p.address}, ), - setEpochGovernor: fun("0x598d521b", "setEpochGovernor(address)", {"_epochGovernor": p.address}, ), - setGovernor: fun("0xc42cf535", "setGovernor(address)", {"_governor": p.address}, ), - setMaxVotingNum: fun("0x30331b2f", "setMaxVotingNum(uint256)", {"_maxVotingNum": p.uint256}, ), - totalWeight: viewFun("0x96c82e57", "totalWeight()", {}, p.uint256), - 'updateFor(address)': fun("0x0e0a5968", "updateFor(address)", {"_gauge": p.address}, ), - 'updateFor(uint256,uint256)': fun("0xc9ff6f4d", "updateFor(uint256,uint256)", {"start": p.uint256, "end": p.uint256}, ), - 'updateFor(address[])': fun("0xd560b0d7", "updateFor(address[])", {"_gauges": p.array(p.address)}, ), - usedWeights: viewFun("0x79e93824", "usedWeights(uint256)", {"_0": p.uint256}, p.uint256), - ve: viewFun("0x1f850716", "ve()", {}, p.address), - vote: fun("0x7ac09bf7", "vote(uint256,address[],uint256[])", {"_tokenId": p.uint256, "_poolVote": p.array(p.address), "_weights": p.array(p.uint256)}, ), - votes: viewFun("0xd23254b4", "votes(uint256,address)", {"_0": p.uint256, "_1": p.address}, p.uint256), - weights: viewFun("0xa7cac846", "weights(address)", {"_0": p.address}, p.uint256), - whitelistNFT: fun("0xe2819d5c", "whitelistNFT(uint256,bool)", {"_tokenId": p.uint256, "_bool": p.bool}, ), - whitelistToken: fun("0x0ffb1d8b", "whitelistToken(address,bool)", {"_token": p.address, "_bool": p.bool}, ), - withdrawManaged: fun("0x370fb5fa", "withdrawManaged(uint256)", {"_tokenId": p.uint256}, ), -} - -export class Contract extends ContractBase { - - claimable(_0: ClaimableParams["_0"]) { - return this.eth_call(functions.claimable, {_0}) - } - - emergencyCouncil() { - return this.eth_call(functions.emergencyCouncil, {}) - } - - epochGovernor() { - return this.eth_call(functions.epochGovernor, {}) - } - - epochNext(_timestamp: EpochNextParams["_timestamp"]) { - return this.eth_call(functions.epochNext, {_timestamp}) - } - - epochStart(_timestamp: EpochStartParams["_timestamp"]) { - return this.eth_call(functions.epochStart, {_timestamp}) - } - - epochVoteEnd(_timestamp: EpochVoteEndParams["_timestamp"]) { - return this.eth_call(functions.epochVoteEnd, {_timestamp}) - } - - epochVoteStart(_timestamp: EpochVoteStartParams["_timestamp"]) { - return this.eth_call(functions.epochVoteStart, {_timestamp}) - } - - factoryRegistry() { - return this.eth_call(functions.factoryRegistry, {}) - } - - forwarder() { - return this.eth_call(functions.forwarder, {}) - } - - gaugeToBribe(_0: GaugeToBribeParams["_0"]) { - return this.eth_call(functions.gaugeToBribe, {_0}) - } - - gaugeToFees(_0: GaugeToFeesParams["_0"]) { - return this.eth_call(functions.gaugeToFees, {_0}) - } - - gauges(_0: GaugesParams["_0"]) { - return this.eth_call(functions.gauges, {_0}) - } - - governor() { - return this.eth_call(functions.governor, {}) - } - - isAlive(_0: IsAliveParams["_0"]) { - return this.eth_call(functions.isAlive, {_0}) - } - - isGauge(_0: IsGaugeParams["_0"]) { - return this.eth_call(functions.isGauge, {_0}) - } - - isTrustedForwarder(forwarder: IsTrustedForwarderParams["forwarder"]) { - return this.eth_call(functions.isTrustedForwarder, {forwarder}) - } - - isWhitelistedNFT(_0: IsWhitelistedNFTParams["_0"]) { - return this.eth_call(functions.isWhitelistedNFT, {_0}) - } - - isWhitelistedToken(_0: IsWhitelistedTokenParams["_0"]) { - return this.eth_call(functions.isWhitelistedToken, {_0}) - } - - lastVoted(_0: LastVotedParams["_0"]) { - return this.eth_call(functions.lastVoted, {_0}) - } - - length() { - return this.eth_call(functions.length, {}) - } - - maxVotingNum() { - return this.eth_call(functions.maxVotingNum, {}) - } - - minter() { - return this.eth_call(functions.minter, {}) - } - - poolForGauge(_0: PoolForGaugeParams["_0"]) { - return this.eth_call(functions.poolForGauge, {_0}) - } - - poolVote(_0: PoolVoteParams["_0"], _1: PoolVoteParams["_1"]) { - return this.eth_call(functions.poolVote, {_0, _1}) - } - - pools(_0: PoolsParams["_0"]) { - return this.eth_call(functions.pools, {_0}) - } - - totalWeight() { - return this.eth_call(functions.totalWeight, {}) - } - - usedWeights(_0: UsedWeightsParams["_0"]) { - return this.eth_call(functions.usedWeights, {_0}) - } - - ve() { - return this.eth_call(functions.ve, {}) - } - - votes(_0: VotesParams["_0"], _1: VotesParams["_1"]) { - return this.eth_call(functions.votes, {_0, _1}) - } - - weights(_0: WeightsParams["_0"]) { - return this.eth_call(functions.weights, {_0}) - } -} - -/// Event types -export type AbstainedEventArgs = EParams -export type DistributeRewardEventArgs = EParams -export type GaugeCreatedEventArgs = EParams -export type GaugeKilledEventArgs = EParams -export type GaugeRevivedEventArgs = EParams -export type NotifyRewardEventArgs = EParams -export type VotedEventArgs = EParams -export type WhitelistNFTEventArgs = EParams -export type WhitelistTokenEventArgs = EParams - -/// Function types -export type ClaimBribesParams = FunctionArguments -export type ClaimBribesReturn = FunctionReturn - -export type ClaimFeesParams = FunctionArguments -export type ClaimFeesReturn = FunctionReturn - -export type ClaimRewardsParams = FunctionArguments -export type ClaimRewardsReturn = FunctionReturn - -export type ClaimableParams = FunctionArguments -export type ClaimableReturn = FunctionReturn - -export type CreateGaugeParams = FunctionArguments -export type CreateGaugeReturn = FunctionReturn - -export type DepositManagedParams = FunctionArguments -export type DepositManagedReturn = FunctionReturn - -export type DistributeParams_0 = FunctionArguments -export type DistributeReturn_0 = FunctionReturn - -export type DistributeParams_1 = FunctionArguments -export type DistributeReturn_1 = FunctionReturn - -export type EmergencyCouncilParams = FunctionArguments -export type EmergencyCouncilReturn = FunctionReturn - -export type EpochGovernorParams = FunctionArguments -export type EpochGovernorReturn = FunctionReturn - -export type EpochNextParams = FunctionArguments -export type EpochNextReturn = FunctionReturn - -export type EpochStartParams = FunctionArguments -export type EpochStartReturn = FunctionReturn - -export type EpochVoteEndParams = FunctionArguments -export type EpochVoteEndReturn = FunctionReturn - -export type EpochVoteStartParams = FunctionArguments -export type EpochVoteStartReturn = FunctionReturn - -export type FactoryRegistryParams = FunctionArguments -export type FactoryRegistryReturn = FunctionReturn - -export type ForwarderParams = FunctionArguments -export type ForwarderReturn = FunctionReturn - -export type GaugeToBribeParams = FunctionArguments -export type GaugeToBribeReturn = FunctionReturn - -export type GaugeToFeesParams = FunctionArguments -export type GaugeToFeesReturn = FunctionReturn - -export type GaugesParams = FunctionArguments -export type GaugesReturn = FunctionReturn - -export type GovernorParams = FunctionArguments -export type GovernorReturn = FunctionReturn - -export type InitializeParams = FunctionArguments -export type InitializeReturn = FunctionReturn - -export type IsAliveParams = FunctionArguments -export type IsAliveReturn = FunctionReturn - -export type IsGaugeParams = FunctionArguments -export type IsGaugeReturn = FunctionReturn - -export type IsTrustedForwarderParams = FunctionArguments -export type IsTrustedForwarderReturn = FunctionReturn - -export type IsWhitelistedNFTParams = FunctionArguments -export type IsWhitelistedNFTReturn = FunctionReturn - -export type IsWhitelistedTokenParams = FunctionArguments -export type IsWhitelistedTokenReturn = FunctionReturn - -export type KillGaugeParams = FunctionArguments -export type KillGaugeReturn = FunctionReturn - -export type LastVotedParams = FunctionArguments -export type LastVotedReturn = FunctionReturn - -export type LengthParams = FunctionArguments -export type LengthReturn = FunctionReturn - -export type MaxVotingNumParams = FunctionArguments -export type MaxVotingNumReturn = FunctionReturn - -export type MinterParams = FunctionArguments -export type MinterReturn = FunctionReturn - -export type NotifyRewardAmountParams = FunctionArguments -export type NotifyRewardAmountReturn = FunctionReturn - -export type PokeParams = FunctionArguments -export type PokeReturn = FunctionReturn - -export type PoolForGaugeParams = FunctionArguments -export type PoolForGaugeReturn = FunctionReturn - -export type PoolVoteParams = FunctionArguments -export type PoolVoteReturn = FunctionReturn - -export type PoolsParams = FunctionArguments -export type PoolsReturn = FunctionReturn - -export type ResetParams = FunctionArguments -export type ResetReturn = FunctionReturn - -export type ReviveGaugeParams = FunctionArguments -export type ReviveGaugeReturn = FunctionReturn - -export type SetEmergencyCouncilParams = FunctionArguments -export type SetEmergencyCouncilReturn = FunctionReturn - -export type SetEpochGovernorParams = FunctionArguments -export type SetEpochGovernorReturn = FunctionReturn - -export type SetGovernorParams = FunctionArguments -export type SetGovernorReturn = FunctionReturn - -export type SetMaxVotingNumParams = FunctionArguments -export type SetMaxVotingNumReturn = FunctionReturn - -export type TotalWeightParams = FunctionArguments -export type TotalWeightReturn = FunctionReturn - -export type UpdateForParams_0 = FunctionArguments -export type UpdateForReturn_0 = FunctionReturn - -export type UpdateForParams_1 = FunctionArguments -export type UpdateForReturn_1 = FunctionReturn - -export type UpdateForParams_2 = FunctionArguments -export type UpdateForReturn_2 = FunctionReturn - -export type UsedWeightsParams = FunctionArguments -export type UsedWeightsReturn = FunctionReturn - -export type VeParams = FunctionArguments -export type VeReturn = FunctionReturn - -export type VoteParams = FunctionArguments -export type VoteReturn = FunctionReturn - -export type VotesParams = FunctionArguments -export type VotesReturn = FunctionReturn - -export type WeightsParams = FunctionArguments -export type WeightsReturn = FunctionReturn - -export type WhitelistNFTParams = FunctionArguments -export type WhitelistNFTReturn = FunctionReturn - -export type WhitelistTokenParams = FunctionArguments -export type WhitelistTokenReturn = FunctionReturn - -export type WithdrawManagedParams = FunctionArguments -export type WithdrawManagedReturn = FunctionReturn - diff --git a/src/abi/aerodrome-voter/contract.ts b/src/abi/aerodrome-voter/contract.ts new file mode 100644 index 00000000..076d15eb --- /dev/null +++ b/src/abi/aerodrome-voter/contract.ts @@ -0,0 +1,129 @@ +import { ContractBase } from '../abi.support.js' +import { claimable, createGauge, emergencyCouncil, epochGovernor, epochNext, epochStart, epochVoteEnd, epochVoteStart, factoryRegistry, forwarder, gaugeToBribe, gaugeToFees, gauges, governor, isAlive, isGauge, isTrustedForwarder, isWhitelistedNFT, isWhitelistedToken, lastVoted, length, maxVotingNum, minter, poolForGauge, poolVote, pools, totalWeight, usedWeights, ve, votes, weights } from './functions.js' +import type { ClaimableParams, CreateGaugeParams, EpochNextParams, EpochStartParams, EpochVoteEndParams, EpochVoteStartParams, GaugeToBribeParams, GaugeToFeesParams, GaugesParams, IsAliveParams, IsGaugeParams, IsTrustedForwarderParams, IsWhitelistedNFTParams, IsWhitelistedTokenParams, LastVotedParams, PoolForGaugeParams, PoolVoteParams, PoolsParams, UsedWeightsParams, VotesParams, WeightsParams } from './functions.js' + +export class Contract extends ContractBase { + claimable(_0: ClaimableParams["_0"]) { + return this.eth_call(claimable, {_0}) + } + + createGauge(_poolFactory: CreateGaugeParams["_poolFactory"], _pool: CreateGaugeParams["_pool"]) { + return this.eth_call(createGauge, {_poolFactory, _pool}) + } + + emergencyCouncil() { + return this.eth_call(emergencyCouncil, {}) + } + + epochGovernor() { + return this.eth_call(epochGovernor, {}) + } + + epochNext(_timestamp: EpochNextParams["_timestamp"]) { + return this.eth_call(epochNext, {_timestamp}) + } + + epochStart(_timestamp: EpochStartParams["_timestamp"]) { + return this.eth_call(epochStart, {_timestamp}) + } + + epochVoteEnd(_timestamp: EpochVoteEndParams["_timestamp"]) { + return this.eth_call(epochVoteEnd, {_timestamp}) + } + + epochVoteStart(_timestamp: EpochVoteStartParams["_timestamp"]) { + return this.eth_call(epochVoteStart, {_timestamp}) + } + + factoryRegistry() { + return this.eth_call(factoryRegistry, {}) + } + + forwarder() { + return this.eth_call(forwarder, {}) + } + + gaugeToBribe(_0: GaugeToBribeParams["_0"]) { + return this.eth_call(gaugeToBribe, {_0}) + } + + gaugeToFees(_0: GaugeToFeesParams["_0"]) { + return this.eth_call(gaugeToFees, {_0}) + } + + gauges(_0: GaugesParams["_0"]) { + return this.eth_call(gauges, {_0}) + } + + governor() { + return this.eth_call(governor, {}) + } + + isAlive(_0: IsAliveParams["_0"]) { + return this.eth_call(isAlive, {_0}) + } + + isGauge(_0: IsGaugeParams["_0"]) { + return this.eth_call(isGauge, {_0}) + } + + isTrustedForwarder(forwarder: IsTrustedForwarderParams["forwarder"]) { + return this.eth_call(isTrustedForwarder, {forwarder}) + } + + isWhitelistedNFT(_0: IsWhitelistedNFTParams["_0"]) { + return this.eth_call(isWhitelistedNFT, {_0}) + } + + isWhitelistedToken(_0: IsWhitelistedTokenParams["_0"]) { + return this.eth_call(isWhitelistedToken, {_0}) + } + + lastVoted(_0: LastVotedParams["_0"]) { + return this.eth_call(lastVoted, {_0}) + } + + length() { + return this.eth_call(length, {}) + } + + maxVotingNum() { + return this.eth_call(maxVotingNum, {}) + } + + minter() { + return this.eth_call(minter, {}) + } + + poolForGauge(_0: PoolForGaugeParams["_0"]) { + return this.eth_call(poolForGauge, {_0}) + } + + poolVote(_0: PoolVoteParams["_0"], _1: PoolVoteParams["_1"]) { + return this.eth_call(poolVote, {_0, _1}) + } + + pools(_0: PoolsParams["_0"]) { + return this.eth_call(pools, {_0}) + } + + totalWeight() { + return this.eth_call(totalWeight, {}) + } + + usedWeights(_0: UsedWeightsParams["_0"]) { + return this.eth_call(usedWeights, {_0}) + } + + ve() { + return this.eth_call(ve, {}) + } + + votes(_0: VotesParams["_0"], _1: VotesParams["_1"]) { + return this.eth_call(votes, {_0, _1}) + } + + weights(_0: WeightsParams["_0"]) { + return this.eth_call(weights, {_0}) + } +} diff --git a/src/abi/aerodrome-voter/events.ts b/src/abi/aerodrome-voter/events.ts new file mode 100644 index 00000000..fec89241 --- /dev/null +++ b/src/abi/aerodrome-voter/events.ts @@ -0,0 +1,82 @@ +import { address, bool, uint256 } from '@subsquid/evm-codec' +import { event, indexed } from '../abi.support.js' +import type { EventParams as EParams } from '../abi.support.js' + +/** Abstained(address,address,uint256,uint256,uint256,uint256) */ +export const Abstained = event('0xadab630928b1d46214641293704a312ee7ad87e03ae14a7fd95e7308b93998df', { + voter: indexed(address), + pool: indexed(address), + tokenId: indexed(uint256), + weight: uint256, + totalWeight: uint256, + timestamp: uint256, +}) +export type AbstainedEventArgs = EParams + +/** DistributeReward(address,address,uint256) */ +export const DistributeReward = event('0x4fa9693cae526341d334e2862ca2413b2e503f1266255f9e0869fb36e6d89b17', { + sender: indexed(address), + gauge: indexed(address), + amount: uint256, +}) +export type DistributeRewardEventArgs = EParams + +/** GaugeCreated(address,address,address,address,address,address,address,address) */ +export const GaugeCreated = event('0xef9f7d1ffff3b249c6b9bf2528499e935f7d96bb6d6ec4e7da504d1d3c6279e1', { + poolFactory: indexed(address), + votingRewardsFactory: indexed(address), + gaugeFactory: indexed(address), + pool: address, + bribeVotingReward: address, + feeVotingReward: address, + gauge: address, + creator: address, +}) +export type GaugeCreatedEventArgs = EParams + +/** GaugeKilled(address) */ +export const GaugeKilled = event('0x04a5d3f5d80d22d9345acc80618f4a4e7e663cf9e1aed23b57d975acec002ba7', { + gauge: indexed(address), +}) +export type GaugeKilledEventArgs = EParams + +/** GaugeRevived(address) */ +export const GaugeRevived = event('0xed18e9faa3dccfd8aa45f69c4de40546b2ca9cccc4538a2323531656516db1aa', { + gauge: indexed(address), +}) +export type GaugeRevivedEventArgs = EParams + +/** NotifyReward(address,address,uint256) */ +export const NotifyReward = event('0xf70d5c697de7ea828df48e5c4573cb2194c659f1901f70110c52b066dcf50826', { + sender: indexed(address), + reward: indexed(address), + amount: uint256, +}) +export type NotifyRewardEventArgs = EParams + +/** Voted(address,address,uint256,uint256,uint256,uint256) */ +export const Voted = event('0x452d440efc30dfa14a0ef803ccb55936af860ec6a6960ed27f129bef913f296a', { + voter: indexed(address), + pool: indexed(address), + tokenId: indexed(uint256), + weight: uint256, + totalWeight: uint256, + timestamp: uint256, +}) +export type VotedEventArgs = EParams + +/** WhitelistNFT(address,uint256,bool) */ +export const WhitelistNFT = event('0x8a6ff732c8641e1e34d771e1f8b1673e988c1abdfb694ebdf6c910a5e3d0d853', { + whitelister: indexed(address), + tokenId: indexed(uint256), + _bool: indexed(bool), +}) +export type WhitelistNFTEventArgs = EParams + +/** WhitelistToken(address,address,bool) */ +export const WhitelistToken = event('0x44948130cf88523dbc150908a47dd6332c33a01a3869d7f2fa78e51d5a5f9c57', { + whitelister: indexed(address), + token: indexed(address), + _bool: indexed(bool), +}) +export type WhitelistTokenEventArgs = EParams diff --git a/src/abi/aerodrome-voter/functions.ts b/src/abi/aerodrome-voter/functions.ts new file mode 100644 index 00000000..4a5a0a0f --- /dev/null +++ b/src/abi/aerodrome-voter/functions.ts @@ -0,0 +1,376 @@ +import { address, array, bool, uint256 } from '@subsquid/evm-codec' +import { func } from '../abi.support.js' +import type { FunctionArguments, FunctionReturn } from '../abi.support.js' + +/** claimBribes(address[],address[][],uint256) */ +export const claimBribes = func('0x7715ee75', { + _bribes: array(address), + _tokens: array(array(address)), + _tokenId: uint256, +}) +export type ClaimBribesParams = FunctionArguments +export type ClaimBribesReturn = FunctionReturn + +/** claimFees(address[],address[][],uint256) */ +export const claimFees = func('0x666256aa', { + _fees: array(address), + _tokens: array(array(address)), + _tokenId: uint256, +}) +export type ClaimFeesParams = FunctionArguments +export type ClaimFeesReturn = FunctionReturn + +/** claimRewards(address[]) */ +export const claimRewards = func('0xf9f031df', { + _gauges: array(address), +}) +export type ClaimRewardsParams = FunctionArguments +export type ClaimRewardsReturn = FunctionReturn + +/** claimable(address) */ +export const claimable = func('0x402914f5', { + _0: address, +}, uint256) +export type ClaimableParams = FunctionArguments +export type ClaimableReturn = FunctionReturn + +/** createGauge(address,address) */ +export const createGauge = func('0x794cea3c', { + _poolFactory: address, + _pool: address, +}, address) +export type CreateGaugeParams = FunctionArguments +export type CreateGaugeReturn = FunctionReturn + +/** depositManaged(uint256,uint256) */ +export const depositManaged = func('0xe0c11f9a', { + _tokenId: uint256, + _mTokenId: uint256, +}) +export type DepositManagedParams = FunctionArguments +export type DepositManagedReturn = FunctionReturn + +/** distribute(address[]) */ +export const distribute = func('0x6138889b', { + _gauges: array(address), +}) +export type DistributeParams = FunctionArguments +export type DistributeReturn = FunctionReturn + +/** distribute(uint256,uint256) */ +export const distribute_1 = func('0x7625391a', { + _start: uint256, + _finish: uint256, +}) +export type DistributeParams_1 = FunctionArguments +export type DistributeReturn_1 = FunctionReturn + +/** emergencyCouncil() */ +export const emergencyCouncil = func('0x7778960e', {}, address) +export type EmergencyCouncilParams = FunctionArguments +export type EmergencyCouncilReturn = FunctionReturn + +/** epochGovernor() */ +export const epochGovernor = func('0x3aae971f', {}, address) +export type EpochGovernorParams = FunctionArguments +export type EpochGovernorReturn = FunctionReturn + +/** epochNext(uint256) */ +export const epochNext = func('0x880e36fc', { + _timestamp: uint256, +}, uint256) +export type EpochNextParams = FunctionArguments +export type EpochNextReturn = FunctionReturn + +/** epochStart(uint256) */ +export const epochStart = func('0xaa9354a3', { + _timestamp: uint256, +}, uint256) +export type EpochStartParams = FunctionArguments +export type EpochStartReturn = FunctionReturn + +/** epochVoteEnd(uint256) */ +export const epochVoteEnd = func('0xd58b15d4', { + _timestamp: uint256, +}, uint256) +export type EpochVoteEndParams = FunctionArguments +export type EpochVoteEndReturn = FunctionReturn + +/** epochVoteStart(uint256) */ +export const epochVoteStart = func('0x39e9f3b6', { + _timestamp: uint256, +}, uint256) +export type EpochVoteStartParams = FunctionArguments +export type EpochVoteStartReturn = FunctionReturn + +/** factoryRegistry() */ +export const factoryRegistry = func('0x3bf0c9fb', {}, address) +export type FactoryRegistryParams = FunctionArguments +export type FactoryRegistryReturn = FunctionReturn + +/** forwarder() */ +export const forwarder = func('0xf645d4f9', {}, address) +export type ForwarderParams = FunctionArguments +export type ForwarderReturn = FunctionReturn + +/** gaugeToBribe(address) */ +export const gaugeToBribe = func('0x929c8dcd', { + _0: address, +}, address) +export type GaugeToBribeParams = FunctionArguments +export type GaugeToBribeReturn = FunctionReturn + +/** gaugeToFees(address) */ +export const gaugeToFees = func('0xc4f08165', { + _0: address, +}, address) +export type GaugeToFeesParams = FunctionArguments +export type GaugeToFeesReturn = FunctionReturn + +/** gauges(address) */ +export const gauges = func('0xb9a09fd5', { + _0: address, +}, address) +export type GaugesParams = FunctionArguments +export type GaugesReturn = FunctionReturn + +/** governor() */ +export const governor = func('0x0c340a24', {}, address) +export type GovernorParams = FunctionArguments +export type GovernorReturn = FunctionReturn + +/** initialize(address[],address) */ +export const initialize = func('0x462d0b2e', { + _tokens: array(address), + _minter: address, +}) +export type InitializeParams = FunctionArguments +export type InitializeReturn = FunctionReturn + +/** isAlive(address) */ +export const isAlive = func('0x1703e5f9', { + _0: address, +}, bool) +export type IsAliveParams = FunctionArguments +export type IsAliveReturn = FunctionReturn + +/** isGauge(address) */ +export const isGauge = func('0xaa79979b', { + _0: address, +}, bool) +export type IsGaugeParams = FunctionArguments +export type IsGaugeReturn = FunctionReturn + +/** isTrustedForwarder(address) */ +export const isTrustedForwarder = func('0x572b6c05', { + forwarder: address, +}, bool) +export type IsTrustedForwarderParams = FunctionArguments +export type IsTrustedForwarderReturn = FunctionReturn + +/** isWhitelistedNFT(uint256) */ +export const isWhitelistedNFT = func('0xd4e2616f', { + _0: uint256, +}, bool) +export type IsWhitelistedNFTParams = FunctionArguments +export type IsWhitelistedNFTReturn = FunctionReturn + +/** isWhitelistedToken(address) */ +export const isWhitelistedToken = func('0xab37f486', { + _0: address, +}, bool) +export type IsWhitelistedTokenParams = FunctionArguments +export type IsWhitelistedTokenReturn = FunctionReturn + +/** killGauge(address) */ +export const killGauge = func('0x992a7933', { + _gauge: address, +}) +export type KillGaugeParams = FunctionArguments +export type KillGaugeReturn = FunctionReturn + +/** lastVoted(uint256) */ +export const lastVoted = func('0xf3594be0', { + _0: uint256, +}, uint256) +export type LastVotedParams = FunctionArguments +export type LastVotedReturn = FunctionReturn + +/** length() */ +export const length = func('0x1f7b6d32', {}, uint256) +export type LengthParams = FunctionArguments +export type LengthReturn = FunctionReturn + +/** maxVotingNum() */ +export const maxVotingNum = func('0xe8b3fd57', {}, uint256) +export type MaxVotingNumParams = FunctionArguments +export type MaxVotingNumReturn = FunctionReturn + +/** minter() */ +export const minter = func('0x07546172', {}, address) +export type MinterParams = FunctionArguments +export type MinterReturn = FunctionReturn + +/** notifyRewardAmount(uint256) */ +export const notifyRewardAmount = func('0x3c6b16ab', { + _amount: uint256, +}) +export type NotifyRewardAmountParams = FunctionArguments +export type NotifyRewardAmountReturn = FunctionReturn + +/** poke(uint256) */ +export const poke = func('0x32145f90', { + _tokenId: uint256, +}) +export type PokeParams = FunctionArguments +export type PokeReturn = FunctionReturn + +/** poolForGauge(address) */ +export const poolForGauge = func('0x06d6a1b2', { + _0: address, +}, address) +export type PoolForGaugeParams = FunctionArguments +export type PoolForGaugeReturn = FunctionReturn + +/** poolVote(uint256,uint256) */ +export const poolVote = func('0xa86a366d', { + _0: uint256, + _1: uint256, +}, address) +export type PoolVoteParams = FunctionArguments +export type PoolVoteReturn = FunctionReturn + +/** pools(uint256) */ +export const pools = func('0xac4afa38', { + _0: uint256, +}, address) +export type PoolsParams = FunctionArguments +export type PoolsReturn = FunctionReturn + +/** reset(uint256) */ +export const reset = func('0x310bd74b', { + _tokenId: uint256, +}) +export type ResetParams = FunctionArguments +export type ResetReturn = FunctionReturn + +/** reviveGauge(address) */ +export const reviveGauge = func('0x9f06247b', { + _gauge: address, +}) +export type ReviveGaugeParams = FunctionArguments +export type ReviveGaugeReturn = FunctionReturn + +/** setEmergencyCouncil(address) */ +export const setEmergencyCouncil = func('0xe586875f', { + _council: address, +}) +export type SetEmergencyCouncilParams = FunctionArguments +export type SetEmergencyCouncilReturn = FunctionReturn + +/** setEpochGovernor(address) */ +export const setEpochGovernor = func('0x598d521b', { + _epochGovernor: address, +}) +export type SetEpochGovernorParams = FunctionArguments +export type SetEpochGovernorReturn = FunctionReturn + +/** setGovernor(address) */ +export const setGovernor = func('0xc42cf535', { + _governor: address, +}) +export type SetGovernorParams = FunctionArguments +export type SetGovernorReturn = FunctionReturn + +/** setMaxVotingNum(uint256) */ +export const setMaxVotingNum = func('0x30331b2f', { + _maxVotingNum: uint256, +}) +export type SetMaxVotingNumParams = FunctionArguments +export type SetMaxVotingNumReturn = FunctionReturn + +/** totalWeight() */ +export const totalWeight = func('0x96c82e57', {}, uint256) +export type TotalWeightParams = FunctionArguments +export type TotalWeightReturn = FunctionReturn + +/** updateFor(address) */ +export const updateFor = func('0x0e0a5968', { + _gauge: address, +}) +export type UpdateForParams = FunctionArguments +export type UpdateForReturn = FunctionReturn + +/** updateFor(uint256,uint256) */ +export const updateFor_1 = func('0xc9ff6f4d', { + start: uint256, + end: uint256, +}) +export type UpdateForParams_1 = FunctionArguments +export type UpdateForReturn_1 = FunctionReturn + +/** updateFor(address[]) */ +export const updateFor_2 = func('0xd560b0d7', { + _gauges: array(address), +}) +export type UpdateForParams_2 = FunctionArguments +export type UpdateForReturn_2 = FunctionReturn + +/** usedWeights(uint256) */ +export const usedWeights = func('0x79e93824', { + _0: uint256, +}, uint256) +export type UsedWeightsParams = FunctionArguments +export type UsedWeightsReturn = FunctionReturn + +/** ve() */ +export const ve = func('0x1f850716', {}, address) +export type VeParams = FunctionArguments +export type VeReturn = FunctionReturn + +/** vote(uint256,address[],uint256[]) */ +export const vote = func('0x7ac09bf7', { + _tokenId: uint256, + _poolVote: array(address), + _weights: array(uint256), +}) +export type VoteParams = FunctionArguments +export type VoteReturn = FunctionReturn + +/** votes(uint256,address) */ +export const votes = func('0xd23254b4', { + _0: uint256, + _1: address, +}, uint256) +export type VotesParams = FunctionArguments +export type VotesReturn = FunctionReturn + +/** weights(address) */ +export const weights = func('0xa7cac846', { + _0: address, +}, uint256) +export type WeightsParams = FunctionArguments +export type WeightsReturn = FunctionReturn + +/** whitelistNFT(uint256,bool) */ +export const whitelistNFT = func('0xe2819d5c', { + _tokenId: uint256, + _bool: bool, +}) +export type WhitelistNFTParams = FunctionArguments +export type WhitelistNFTReturn = FunctionReturn + +/** whitelistToken(address,bool) */ +export const whitelistToken = func('0x0ffb1d8b', { + _token: address, + _bool: bool, +}) +export type WhitelistTokenParams = FunctionArguments +export type WhitelistTokenReturn = FunctionReturn + +/** withdrawManaged(uint256) */ +export const withdrawManaged = func('0x370fb5fa', { + _tokenId: uint256, +}) +export type WithdrawManagedParams = FunctionArguments +export type WithdrawManagedReturn = FunctionReturn diff --git a/src/abi/aerodrome-voter/index.ts b/src/abi/aerodrome-voter/index.ts new file mode 100644 index 00000000..11829d6e --- /dev/null +++ b/src/abi/aerodrome-voter/index.ts @@ -0,0 +1,4 @@ +export * as events from './events.js' +export * as functions from './functions.js' + +export { Contract } from './contract.js' diff --git a/src/abi/algebra-v4-factory.ts b/src/abi/algebra-v4-factory.ts deleted file mode 100644 index 1d110f42..00000000 --- a/src/abi/algebra-v4-factory.ts +++ /dev/null @@ -1,268 +0,0 @@ -import * as p from '@subsquid/evm-codec' -import { event, fun, viewFun, indexed, ContractBase } from '@subsquid/evm-abi' -import type { EventParams as EParams, FunctionArguments, FunctionReturn } from '@subsquid/evm-abi' - -export const events = { - DefaultCommunityFee: event("0x6b5c342391f543846fce47a925e7eba910f7bec232b08633308ca93fdd0fdf0d", "DefaultCommunityFee(uint16)", {"newDefaultCommunityFee": p.uint16}), - DefaultFee: event("0xddc0c6f0b581e0d51bfe90ff138e4a548f94515c4dbcb12f5e98fdf0f7503983", "DefaultFee(uint16)", {"newDefaultFee": p.uint16}), - DefaultPluginFactory: event("0x5e38e259ec1f8a38b98fc65a27e266bb9cc87c76eb8c96c957450d1cff4591ef", "DefaultPluginFactory(address)", {"defaultPluginFactoryAddress": p.address}), - DefaultTickspacing: event("0x7d7979096f943139ebee59f01c077a0f0766d06c40c86d596f23ed2561547cce", "DefaultTickspacing(int24)", {"newDefaultTickspacing": p.int24}), - OwnershipTransferStarted: event("0x38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e22700", "OwnershipTransferStarted(address,address)", {"previousOwner": indexed(p.address), "newOwner": indexed(p.address)}), - OwnershipTransferred: event("0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", "OwnershipTransferred(address,address)", {"previousOwner": indexed(p.address), "newOwner": indexed(p.address)}), - Pool: event("0x91ccaa7a278130b65168c3a0c8d3bcae84cf5e43704342bd3ec0b59e59c036db", "Pool(address,address,address)", {"token0": indexed(p.address), "token1": indexed(p.address), "pool": p.address}), - RenounceOwnershipFinish: event("0xa24203c457ce43a097fa0c491fc9cf5e0a893af87a5e0a9785f29491deb11e23", "RenounceOwnershipFinish(uint256)", {"timestamp": p.uint256}), - RenounceOwnershipStart: event("0xcd60f5d54996130c21c3f063279b39230bcbafc12f763a1ac1dfaec2e9b61d29", "RenounceOwnershipStart(uint256,uint256)", {"timestamp": p.uint256, "finishTimestamp": p.uint256}), - RenounceOwnershipStop: event("0xa2492902a0a1d28dc73e6ab22e473239ef077bb7bc8174dc7dab9fc0818e7135", "RenounceOwnershipStop(uint256)", {"timestamp": p.uint256}), - RoleAdminChanged: event("0xbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff", "RoleAdminChanged(bytes32,bytes32,bytes32)", {"role": indexed(p.bytes32), "previousAdminRole": indexed(p.bytes32), "newAdminRole": indexed(p.bytes32)}), - RoleGranted: event("0x2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d", "RoleGranted(bytes32,address,address)", {"role": indexed(p.bytes32), "account": indexed(p.address), "sender": indexed(p.address)}), - RoleRevoked: event("0xf6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b", "RoleRevoked(bytes32,address,address)", {"role": indexed(p.bytes32), "account": indexed(p.address), "sender": indexed(p.address)}), - VaultFactory: event("0xa006ea05a14783821b0248e75d2342cd1681b07509e10a0f08487b080c29dea8", "VaultFactory(address)", {"newVaultFactory": p.address}), -} - -export const functions = { - DEFAULT_ADMIN_ROLE: viewFun("0xa217fddf", "DEFAULT_ADMIN_ROLE()", {}, p.bytes32), - POOLS_ADMINISTRATOR_ROLE: viewFun("0xb500a48b", "POOLS_ADMINISTRATOR_ROLE()", {}, p.bytes32), - POOL_INIT_CODE_HASH: viewFun("0xdc6fd8ab", "POOL_INIT_CODE_HASH()", {}, p.bytes32), - acceptOwnership: fun("0x79ba5097", "acceptOwnership()", {}, ), - computePoolAddress: viewFun("0xd8ed2241", "computePoolAddress(address,address)", {"token0": p.address, "token1": p.address}, p.address), - createPool: fun("0xe3433615", "createPool(address,address)", {"tokenA": p.address, "tokenB": p.address}, p.address), - defaultCommunityFee: viewFun("0x2f8a39dd", "defaultCommunityFee()", {}, p.uint16), - defaultConfigurationForPool: viewFun("0x82b13d8d", "defaultConfigurationForPool(address)", {"pool": p.address}, {"communityFee": p.uint16, "tickSpacing": p.int24, "fee": p.uint16, "communityVault": p.address}), - defaultFee: viewFun("0x5a6c72d0", "defaultFee()", {}, p.uint16), - defaultPluginFactory: viewFun("0xd0ad2792", "defaultPluginFactory()", {}, p.address), - defaultTickspacing: viewFun("0x29bc3446", "defaultTickspacing()", {}, p.int24), - getRoleAdmin: viewFun("0x248a9ca3", "getRoleAdmin(bytes32)", {"role": p.bytes32}, p.bytes32), - getRoleMember: viewFun("0x9010d07c", "getRoleMember(bytes32,uint256)", {"role": p.bytes32, "index": p.uint256}, p.address), - getRoleMemberCount: viewFun("0xca15c873", "getRoleMemberCount(bytes32)", {"role": p.bytes32}, p.uint256), - grantRole: fun("0x2f2ff15d", "grantRole(bytes32,address)", {"role": p.bytes32, "account": p.address}, ), - hasRole: viewFun("0x91d14854", "hasRole(bytes32,address)", {"role": p.bytes32, "account": p.address}, p.bool), - hasRoleOrOwner: viewFun("0xe8ae2b69", "hasRoleOrOwner(bytes32,address)", {"role": p.bytes32, "account": p.address}, p.bool), - owner: viewFun("0x8da5cb5b", "owner()", {}, p.address), - pendingOwner: viewFun("0xe30c3978", "pendingOwner()", {}, p.address), - poolByPair: viewFun("0xd9a641e1", "poolByPair(address,address)", {"_0": p.address, "_1": p.address}, p.address), - poolDeployer: viewFun("0x3119049a", "poolDeployer()", {}, p.address), - renounceOwnership: fun("0x715018a6", "renounceOwnership()", {}, ), - renounceOwnershipStartTimestamp: viewFun("0x084bfff9", "renounceOwnershipStartTimestamp()", {}, p.uint256), - renounceRole: fun("0x36568abe", "renounceRole(bytes32,address)", {"role": p.bytes32, "account": p.address}, ), - revokeRole: fun("0xd547741f", "revokeRole(bytes32,address)", {"role": p.bytes32, "account": p.address}, ), - setDefaultCommunityFee: fun("0x8d5a8711", "setDefaultCommunityFee(uint16)", {"newDefaultCommunityFee": p.uint16}, ), - setDefaultFee: fun("0x77326584", "setDefaultFee(uint16)", {"newDefaultFee": p.uint16}, ), - setDefaultPluginFactory: fun("0x2939dd97", "setDefaultPluginFactory(address)", {"newDefaultPluginFactory": p.address}, ), - setDefaultTickspacing: fun("0xf09489ac", "setDefaultTickspacing(int24)", {"newDefaultTickspacing": p.int24}, ), - setVaultFactory: fun("0x3ea7fbdb", "setVaultFactory(address)", {"newVaultFactory": p.address}, ), - startRenounceOwnership: fun("0x469388c4", "startRenounceOwnership()", {}, ), - stopRenounceOwnership: fun("0x238a1d74", "stopRenounceOwnership()", {}, ), - supportsInterface: viewFun("0x01ffc9a7", "supportsInterface(bytes4)", {"interfaceId": p.bytes4}, p.bool), - transferOwnership: fun("0xf2fde38b", "transferOwnership(address)", {"newOwner": p.address}, ), - vaultFactory: viewFun("0xd8a06f73", "vaultFactory()", {}, p.address), -} - -export class Contract extends ContractBase { - - DEFAULT_ADMIN_ROLE() { - return this.eth_call(functions.DEFAULT_ADMIN_ROLE, {}) - } - - POOLS_ADMINISTRATOR_ROLE() { - return this.eth_call(functions.POOLS_ADMINISTRATOR_ROLE, {}) - } - - POOL_INIT_CODE_HASH() { - return this.eth_call(functions.POOL_INIT_CODE_HASH, {}) - } - - computePoolAddress(token0: ComputePoolAddressParams["token0"], token1: ComputePoolAddressParams["token1"]) { - return this.eth_call(functions.computePoolAddress, {token0, token1}) - } - - defaultCommunityFee() { - return this.eth_call(functions.defaultCommunityFee, {}) - } - - defaultConfigurationForPool(pool: DefaultConfigurationForPoolParams["pool"]) { - return this.eth_call(functions.defaultConfigurationForPool, {pool}) - } - - defaultFee() { - return this.eth_call(functions.defaultFee, {}) - } - - defaultPluginFactory() { - return this.eth_call(functions.defaultPluginFactory, {}) - } - - defaultTickspacing() { - return this.eth_call(functions.defaultTickspacing, {}) - } - - getRoleAdmin(role: GetRoleAdminParams["role"]) { - return this.eth_call(functions.getRoleAdmin, {role}) - } - - getRoleMember(role: GetRoleMemberParams["role"], index: GetRoleMemberParams["index"]) { - return this.eth_call(functions.getRoleMember, {role, index}) - } - - getRoleMemberCount(role: GetRoleMemberCountParams["role"]) { - return this.eth_call(functions.getRoleMemberCount, {role}) - } - - hasRole(role: HasRoleParams["role"], account: HasRoleParams["account"]) { - return this.eth_call(functions.hasRole, {role, account}) - } - - hasRoleOrOwner(role: HasRoleOrOwnerParams["role"], account: HasRoleOrOwnerParams["account"]) { - return this.eth_call(functions.hasRoleOrOwner, {role, account}) - } - - owner() { - return this.eth_call(functions.owner, {}) - } - - pendingOwner() { - return this.eth_call(functions.pendingOwner, {}) - } - - poolByPair(_0: PoolByPairParams["_0"], _1: PoolByPairParams["_1"]) { - return this.eth_call(functions.poolByPair, {_0, _1}) - } - - poolDeployer() { - return this.eth_call(functions.poolDeployer, {}) - } - - renounceOwnershipStartTimestamp() { - return this.eth_call(functions.renounceOwnershipStartTimestamp, {}) - } - - supportsInterface(interfaceId: SupportsInterfaceParams["interfaceId"]) { - return this.eth_call(functions.supportsInterface, {interfaceId}) - } - - vaultFactory() { - return this.eth_call(functions.vaultFactory, {}) - } -} - -/// Event types -export type DefaultCommunityFeeEventArgs = EParams -export type DefaultFeeEventArgs = EParams -export type DefaultPluginFactoryEventArgs = EParams -export type DefaultTickspacingEventArgs = EParams -export type OwnershipTransferStartedEventArgs = EParams -export type OwnershipTransferredEventArgs = EParams -export type PoolEventArgs = EParams -export type RenounceOwnershipFinishEventArgs = EParams -export type RenounceOwnershipStartEventArgs = EParams -export type RenounceOwnershipStopEventArgs = EParams -export type RoleAdminChangedEventArgs = EParams -export type RoleGrantedEventArgs = EParams -export type RoleRevokedEventArgs = EParams -export type VaultFactoryEventArgs = EParams - -/// Function types -export type DEFAULT_ADMIN_ROLEParams = FunctionArguments -export type DEFAULT_ADMIN_ROLEReturn = FunctionReturn - -export type POOLS_ADMINISTRATOR_ROLEParams = FunctionArguments -export type POOLS_ADMINISTRATOR_ROLEReturn = FunctionReturn - -export type POOL_INIT_CODE_HASHParams = FunctionArguments -export type POOL_INIT_CODE_HASHReturn = FunctionReturn - -export type AcceptOwnershipParams = FunctionArguments -export type AcceptOwnershipReturn = FunctionReturn - -export type ComputePoolAddressParams = FunctionArguments -export type ComputePoolAddressReturn = FunctionReturn - -export type CreatePoolParams = FunctionArguments -export type CreatePoolReturn = FunctionReturn - -export type DefaultCommunityFeeParams = FunctionArguments -export type DefaultCommunityFeeReturn = FunctionReturn - -export type DefaultConfigurationForPoolParams = FunctionArguments -export type DefaultConfigurationForPoolReturn = FunctionReturn - -export type DefaultFeeParams = FunctionArguments -export type DefaultFeeReturn = FunctionReturn - -export type DefaultPluginFactoryParams = FunctionArguments -export type DefaultPluginFactoryReturn = FunctionReturn - -export type DefaultTickspacingParams = FunctionArguments -export type DefaultTickspacingReturn = FunctionReturn - -export type GetRoleAdminParams = FunctionArguments -export type GetRoleAdminReturn = FunctionReturn - -export type GetRoleMemberParams = FunctionArguments -export type GetRoleMemberReturn = FunctionReturn - -export type GetRoleMemberCountParams = FunctionArguments -export type GetRoleMemberCountReturn = FunctionReturn - -export type GrantRoleParams = FunctionArguments -export type GrantRoleReturn = FunctionReturn - -export type HasRoleParams = FunctionArguments -export type HasRoleReturn = FunctionReturn - -export type HasRoleOrOwnerParams = FunctionArguments -export type HasRoleOrOwnerReturn = FunctionReturn - -export type OwnerParams = FunctionArguments -export type OwnerReturn = FunctionReturn - -export type PendingOwnerParams = FunctionArguments -export type PendingOwnerReturn = FunctionReturn - -export type PoolByPairParams = FunctionArguments -export type PoolByPairReturn = FunctionReturn - -export type PoolDeployerParams = FunctionArguments -export type PoolDeployerReturn = FunctionReturn - -export type RenounceOwnershipParams = FunctionArguments -export type RenounceOwnershipReturn = FunctionReturn - -export type RenounceOwnershipStartTimestampParams = FunctionArguments -export type RenounceOwnershipStartTimestampReturn = FunctionReturn - -export type RenounceRoleParams = FunctionArguments -export type RenounceRoleReturn = FunctionReturn - -export type RevokeRoleParams = FunctionArguments -export type RevokeRoleReturn = FunctionReturn - -export type SetDefaultCommunityFeeParams = FunctionArguments -export type SetDefaultCommunityFeeReturn = FunctionReturn - -export type SetDefaultFeeParams = FunctionArguments -export type SetDefaultFeeReturn = FunctionReturn - -export type SetDefaultPluginFactoryParams = FunctionArguments -export type SetDefaultPluginFactoryReturn = FunctionReturn - -export type SetDefaultTickspacingParams = FunctionArguments -export type SetDefaultTickspacingReturn = FunctionReturn - -export type SetVaultFactoryParams = FunctionArguments -export type SetVaultFactoryReturn = FunctionReturn - -export type StartRenounceOwnershipParams = FunctionArguments -export type StartRenounceOwnershipReturn = FunctionReturn - -export type StopRenounceOwnershipParams = FunctionArguments -export type StopRenounceOwnershipReturn = FunctionReturn - -export type SupportsInterfaceParams = FunctionArguments -export type SupportsInterfaceReturn = FunctionReturn - -export type TransferOwnershipParams = FunctionArguments -export type TransferOwnershipReturn = FunctionReturn - -export type VaultFactoryParams = FunctionArguments -export type VaultFactoryReturn = FunctionReturn - diff --git a/src/abi/algebra-v4-factory/contract.ts b/src/abi/algebra-v4-factory/contract.ts new file mode 100644 index 00000000..eea8d981 --- /dev/null +++ b/src/abi/algebra-v4-factory/contract.ts @@ -0,0 +1,93 @@ +import { ContractBase } from '../abi.support.js' +import { DEFAULT_ADMIN_ROLE, POOLS_ADMINISTRATOR_ROLE, POOL_INIT_CODE_HASH, computePoolAddress, createPool, defaultCommunityFee, defaultConfigurationForPool, defaultFee, defaultPluginFactory, defaultTickspacing, getRoleAdmin, getRoleMember, getRoleMemberCount, hasRole, hasRoleOrOwner, owner, pendingOwner, poolByPair, poolDeployer, renounceOwnershipStartTimestamp, supportsInterface, vaultFactory } from './functions.js' +import type { ComputePoolAddressParams, CreatePoolParams, DefaultConfigurationForPoolParams, GetRoleAdminParams, GetRoleMemberCountParams, GetRoleMemberParams, HasRoleOrOwnerParams, HasRoleParams, PoolByPairParams, SupportsInterfaceParams } from './functions.js' + +export class Contract extends ContractBase { + DEFAULT_ADMIN_ROLE() { + return this.eth_call(DEFAULT_ADMIN_ROLE, {}) + } + + POOLS_ADMINISTRATOR_ROLE() { + return this.eth_call(POOLS_ADMINISTRATOR_ROLE, {}) + } + + POOL_INIT_CODE_HASH() { + return this.eth_call(POOL_INIT_CODE_HASH, {}) + } + + computePoolAddress(token0: ComputePoolAddressParams["token0"], token1: ComputePoolAddressParams["token1"]) { + return this.eth_call(computePoolAddress, {token0, token1}) + } + + createPool(tokenA: CreatePoolParams["tokenA"], tokenB: CreatePoolParams["tokenB"]) { + return this.eth_call(createPool, {tokenA, tokenB}) + } + + defaultCommunityFee() { + return this.eth_call(defaultCommunityFee, {}) + } + + defaultConfigurationForPool(pool: DefaultConfigurationForPoolParams["pool"]) { + return this.eth_call(defaultConfigurationForPool, {pool}) + } + + defaultFee() { + return this.eth_call(defaultFee, {}) + } + + defaultPluginFactory() { + return this.eth_call(defaultPluginFactory, {}) + } + + defaultTickspacing() { + return this.eth_call(defaultTickspacing, {}) + } + + getRoleAdmin(role: GetRoleAdminParams["role"]) { + return this.eth_call(getRoleAdmin, {role}) + } + + getRoleMember(role: GetRoleMemberParams["role"], index: GetRoleMemberParams["index"]) { + return this.eth_call(getRoleMember, {role, index}) + } + + getRoleMemberCount(role: GetRoleMemberCountParams["role"]) { + return this.eth_call(getRoleMemberCount, {role}) + } + + hasRole(role: HasRoleParams["role"], account: HasRoleParams["account"]) { + return this.eth_call(hasRole, {role, account}) + } + + hasRoleOrOwner(role: HasRoleOrOwnerParams["role"], account: HasRoleOrOwnerParams["account"]) { + return this.eth_call(hasRoleOrOwner, {role, account}) + } + + owner() { + return this.eth_call(owner, {}) + } + + pendingOwner() { + return this.eth_call(pendingOwner, {}) + } + + poolByPair(_0: PoolByPairParams["_0"], _1: PoolByPairParams["_1"]) { + return this.eth_call(poolByPair, {_0, _1}) + } + + poolDeployer() { + return this.eth_call(poolDeployer, {}) + } + + renounceOwnershipStartTimestamp() { + return this.eth_call(renounceOwnershipStartTimestamp, {}) + } + + supportsInterface(interfaceId: SupportsInterfaceParams["interfaceId"]) { + return this.eth_call(supportsInterface, {interfaceId}) + } + + vaultFactory() { + return this.eth_call(vaultFactory, {}) + } +} diff --git a/src/abi/algebra-v4-factory/events.ts b/src/abi/algebra-v4-factory/events.ts new file mode 100644 index 00000000..fe27c153 --- /dev/null +++ b/src/abi/algebra-v4-factory/events.ts @@ -0,0 +1,98 @@ +import { address, bytes32, int24, uint16, uint256 } from '@subsquid/evm-codec' +import { event, indexed } from '../abi.support.js' +import type { EventParams as EParams } from '../abi.support.js' + +/** DefaultCommunityFee(uint16) */ +export const DefaultCommunityFee = event('0x6b5c342391f543846fce47a925e7eba910f7bec232b08633308ca93fdd0fdf0d', { + newDefaultCommunityFee: uint16, +}) +export type DefaultCommunityFeeEventArgs = EParams + +/** DefaultFee(uint16) */ +export const DefaultFee = event('0xddc0c6f0b581e0d51bfe90ff138e4a548f94515c4dbcb12f5e98fdf0f7503983', { + newDefaultFee: uint16, +}) +export type DefaultFeeEventArgs = EParams + +/** DefaultPluginFactory(address) */ +export const DefaultPluginFactory = event('0x5e38e259ec1f8a38b98fc65a27e266bb9cc87c76eb8c96c957450d1cff4591ef', { + defaultPluginFactoryAddress: address, +}) +export type DefaultPluginFactoryEventArgs = EParams + +/** DefaultTickspacing(int24) */ +export const DefaultTickspacing = event('0x7d7979096f943139ebee59f01c077a0f0766d06c40c86d596f23ed2561547cce', { + newDefaultTickspacing: int24, +}) +export type DefaultTickspacingEventArgs = EParams + +/** OwnershipTransferStarted(address,address) */ +export const OwnershipTransferStarted = event('0x38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e22700', { + previousOwner: indexed(address), + newOwner: indexed(address), +}) +export type OwnershipTransferStartedEventArgs = EParams + +/** OwnershipTransferred(address,address) */ +export const OwnershipTransferred = event('0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0', { + previousOwner: indexed(address), + newOwner: indexed(address), +}) +export type OwnershipTransferredEventArgs = EParams + +/** Pool(address,address,address) */ +export const Pool = event('0x91ccaa7a278130b65168c3a0c8d3bcae84cf5e43704342bd3ec0b59e59c036db', { + token0: indexed(address), + token1: indexed(address), + pool: address, +}) +export type PoolEventArgs = EParams + +/** RenounceOwnershipFinish(uint256) */ +export const RenounceOwnershipFinish = event('0xa24203c457ce43a097fa0c491fc9cf5e0a893af87a5e0a9785f29491deb11e23', { + timestamp: uint256, +}) +export type RenounceOwnershipFinishEventArgs = EParams + +/** RenounceOwnershipStart(uint256,uint256) */ +export const RenounceOwnershipStart = event('0xcd60f5d54996130c21c3f063279b39230bcbafc12f763a1ac1dfaec2e9b61d29', { + timestamp: uint256, + finishTimestamp: uint256, +}) +export type RenounceOwnershipStartEventArgs = EParams + +/** RenounceOwnershipStop(uint256) */ +export const RenounceOwnershipStop = event('0xa2492902a0a1d28dc73e6ab22e473239ef077bb7bc8174dc7dab9fc0818e7135', { + timestamp: uint256, +}) +export type RenounceOwnershipStopEventArgs = EParams + +/** RoleAdminChanged(bytes32,bytes32,bytes32) */ +export const RoleAdminChanged = event('0xbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff', { + role: indexed(bytes32), + previousAdminRole: indexed(bytes32), + newAdminRole: indexed(bytes32), +}) +export type RoleAdminChangedEventArgs = EParams + +/** RoleGranted(bytes32,address,address) */ +export const RoleGranted = event('0x2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d', { + role: indexed(bytes32), + account: indexed(address), + sender: indexed(address), +}) +export type RoleGrantedEventArgs = EParams + +/** RoleRevoked(bytes32,address,address) */ +export const RoleRevoked = event('0xf6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b', { + role: indexed(bytes32), + account: indexed(address), + sender: indexed(address), +}) +export type RoleRevokedEventArgs = EParams + +/** VaultFactory(address) */ +export const VaultFactory = event('0xa006ea05a14783821b0248e75d2342cd1681b07509e10a0f08487b080c29dea8', { + newVaultFactory: address, +}) +export type VaultFactoryEventArgs = EParams diff --git a/src/abi/algebra-v4-factory/functions.ts b/src/abi/algebra-v4-factory/functions.ts new file mode 100644 index 00000000..a1f8fb07 --- /dev/null +++ b/src/abi/algebra-v4-factory/functions.ts @@ -0,0 +1,230 @@ +import { address, bool, bytes32, bytes4, int24, struct, uint16, uint256 } from '@subsquid/evm-codec' +import { func } from '../abi.support.js' +import type { FunctionArguments, FunctionReturn } from '../abi.support.js' + +/** DEFAULT_ADMIN_ROLE() */ +export const DEFAULT_ADMIN_ROLE = func('0xa217fddf', {}, bytes32) +export type DEFAULT_ADMIN_ROLEParams = FunctionArguments +export type DEFAULT_ADMIN_ROLEReturn = FunctionReturn + +/** POOLS_ADMINISTRATOR_ROLE() */ +export const POOLS_ADMINISTRATOR_ROLE = func('0xb500a48b', {}, bytes32) +export type POOLS_ADMINISTRATOR_ROLEParams = FunctionArguments +export type POOLS_ADMINISTRATOR_ROLEReturn = FunctionReturn + +/** POOL_INIT_CODE_HASH() */ +export const POOL_INIT_CODE_HASH = func('0xdc6fd8ab', {}, bytes32) +export type POOL_INIT_CODE_HASHParams = FunctionArguments +export type POOL_INIT_CODE_HASHReturn = FunctionReturn + +/** acceptOwnership() */ +export const acceptOwnership = func('0x79ba5097', {}) +export type AcceptOwnershipParams = FunctionArguments +export type AcceptOwnershipReturn = FunctionReturn + +/** computePoolAddress(address,address) */ +export const computePoolAddress = func('0xd8ed2241', { + token0: address, + token1: address, +}, address) +export type ComputePoolAddressParams = FunctionArguments +export type ComputePoolAddressReturn = FunctionReturn + +/** createPool(address,address) */ +export const createPool = func('0xe3433615', { + tokenA: address, + tokenB: address, +}, address) +export type CreatePoolParams = FunctionArguments +export type CreatePoolReturn = FunctionReturn + +/** defaultCommunityFee() */ +export const defaultCommunityFee = func('0x2f8a39dd', {}, uint16) +export type DefaultCommunityFeeParams = FunctionArguments +export type DefaultCommunityFeeReturn = FunctionReturn + +/** defaultConfigurationForPool(address) */ +export const defaultConfigurationForPool = func('0x82b13d8d', { + pool: address, +}, struct({ + communityFee: uint16, + tickSpacing: int24, + fee: uint16, + communityVault: address, +})) +export type DefaultConfigurationForPoolParams = FunctionArguments +export type DefaultConfigurationForPoolReturn = FunctionReturn + +/** defaultFee() */ +export const defaultFee = func('0x5a6c72d0', {}, uint16) +export type DefaultFeeParams = FunctionArguments +export type DefaultFeeReturn = FunctionReturn + +/** defaultPluginFactory() */ +export const defaultPluginFactory = func('0xd0ad2792', {}, address) +export type DefaultPluginFactoryParams = FunctionArguments +export type DefaultPluginFactoryReturn = FunctionReturn + +/** defaultTickspacing() */ +export const defaultTickspacing = func('0x29bc3446', {}, int24) +export type DefaultTickspacingParams = FunctionArguments +export type DefaultTickspacingReturn = FunctionReturn + +/** getRoleAdmin(bytes32) */ +export const getRoleAdmin = func('0x248a9ca3', { + role: bytes32, +}, bytes32) +export type GetRoleAdminParams = FunctionArguments +export type GetRoleAdminReturn = FunctionReturn + +/** getRoleMember(bytes32,uint256) */ +export const getRoleMember = func('0x9010d07c', { + role: bytes32, + index: uint256, +}, address) +export type GetRoleMemberParams = FunctionArguments +export type GetRoleMemberReturn = FunctionReturn + +/** getRoleMemberCount(bytes32) */ +export const getRoleMemberCount = func('0xca15c873', { + role: bytes32, +}, uint256) +export type GetRoleMemberCountParams = FunctionArguments +export type GetRoleMemberCountReturn = FunctionReturn + +/** grantRole(bytes32,address) */ +export const grantRole = func('0x2f2ff15d', { + role: bytes32, + account: address, +}) +export type GrantRoleParams = FunctionArguments +export type GrantRoleReturn = FunctionReturn + +/** hasRole(bytes32,address) */ +export const hasRole = func('0x91d14854', { + role: bytes32, + account: address, +}, bool) +export type HasRoleParams = FunctionArguments +export type HasRoleReturn = FunctionReturn + +/** hasRoleOrOwner(bytes32,address) */ +export const hasRoleOrOwner = func('0xe8ae2b69', { + role: bytes32, + account: address, +}, bool) +export type HasRoleOrOwnerParams = FunctionArguments +export type HasRoleOrOwnerReturn = FunctionReturn + +/** owner() */ +export const owner = func('0x8da5cb5b', {}, address) +export type OwnerParams = FunctionArguments +export type OwnerReturn = FunctionReturn + +/** pendingOwner() */ +export const pendingOwner = func('0xe30c3978', {}, address) +export type PendingOwnerParams = FunctionArguments +export type PendingOwnerReturn = FunctionReturn + +/** poolByPair(address,address) */ +export const poolByPair = func('0xd9a641e1', { + _0: address, + _1: address, +}, address) +export type PoolByPairParams = FunctionArguments +export type PoolByPairReturn = FunctionReturn + +/** poolDeployer() */ +export const poolDeployer = func('0x3119049a', {}, address) +export type PoolDeployerParams = FunctionArguments +export type PoolDeployerReturn = FunctionReturn + +/** renounceOwnership() */ +export const renounceOwnership = func('0x715018a6', {}) +export type RenounceOwnershipParams = FunctionArguments +export type RenounceOwnershipReturn = FunctionReturn + +/** renounceOwnershipStartTimestamp() */ +export const renounceOwnershipStartTimestamp = func('0x084bfff9', {}, uint256) +export type RenounceOwnershipStartTimestampParams = FunctionArguments +export type RenounceOwnershipStartTimestampReturn = FunctionReturn + +/** renounceRole(bytes32,address) */ +export const renounceRole = func('0x36568abe', { + role: bytes32, + account: address, +}) +export type RenounceRoleParams = FunctionArguments +export type RenounceRoleReturn = FunctionReturn + +/** revokeRole(bytes32,address) */ +export const revokeRole = func('0xd547741f', { + role: bytes32, + account: address, +}) +export type RevokeRoleParams = FunctionArguments +export type RevokeRoleReturn = FunctionReturn + +/** setDefaultCommunityFee(uint16) */ +export const setDefaultCommunityFee = func('0x8d5a8711', { + newDefaultCommunityFee: uint16, +}) +export type SetDefaultCommunityFeeParams = FunctionArguments +export type SetDefaultCommunityFeeReturn = FunctionReturn + +/** setDefaultFee(uint16) */ +export const setDefaultFee = func('0x77326584', { + newDefaultFee: uint16, +}) +export type SetDefaultFeeParams = FunctionArguments +export type SetDefaultFeeReturn = FunctionReturn + +/** setDefaultPluginFactory(address) */ +export const setDefaultPluginFactory = func('0x2939dd97', { + newDefaultPluginFactory: address, +}) +export type SetDefaultPluginFactoryParams = FunctionArguments +export type SetDefaultPluginFactoryReturn = FunctionReturn + +/** setDefaultTickspacing(int24) */ +export const setDefaultTickspacing = func('0xf09489ac', { + newDefaultTickspacing: int24, +}) +export type SetDefaultTickspacingParams = FunctionArguments +export type SetDefaultTickspacingReturn = FunctionReturn + +/** setVaultFactory(address) */ +export const setVaultFactory = func('0x3ea7fbdb', { + newVaultFactory: address, +}) +export type SetVaultFactoryParams = FunctionArguments +export type SetVaultFactoryReturn = FunctionReturn + +/** startRenounceOwnership() */ +export const startRenounceOwnership = func('0x469388c4', {}) +export type StartRenounceOwnershipParams = FunctionArguments +export type StartRenounceOwnershipReturn = FunctionReturn + +/** stopRenounceOwnership() */ +export const stopRenounceOwnership = func('0x238a1d74', {}) +export type StopRenounceOwnershipParams = FunctionArguments +export type StopRenounceOwnershipReturn = FunctionReturn + +/** supportsInterface(bytes4) */ +export const supportsInterface = func('0x01ffc9a7', { + interfaceId: bytes4, +}, bool) +export type SupportsInterfaceParams = FunctionArguments +export type SupportsInterfaceReturn = FunctionReturn + +/** transferOwnership(address) */ +export const transferOwnership = func('0xf2fde38b', { + newOwner: address, +}) +export type TransferOwnershipParams = FunctionArguments +export type TransferOwnershipReturn = FunctionReturn + +/** vaultFactory() */ +export const vaultFactory = func('0xd8a06f73', {}, address) +export type VaultFactoryParams = FunctionArguments +export type VaultFactoryReturn = FunctionReturn diff --git a/src/abi/algebra-v4-factory/index.ts b/src/abi/algebra-v4-factory/index.ts new file mode 100644 index 00000000..11829d6e --- /dev/null +++ b/src/abi/algebra-v4-factory/index.ts @@ -0,0 +1,4 @@ +export * as events from './events.js' +export * as functions from './functions.js' + +export { Contract } from './contract.js' diff --git a/src/abi/algebra-v4-pool.ts b/src/abi/algebra-v4-pool.ts deleted file mode 100644 index 842c515c..00000000 --- a/src/abi/algebra-v4-pool.ts +++ /dev/null @@ -1,284 +0,0 @@ -import * as p from '@subsquid/evm-codec' -import { event, fun, viewFun, indexed, ContractBase } from '@subsquid/evm-abi' -import type { EventParams as EParams, FunctionArguments, FunctionReturn } from '@subsquid/evm-abi' - -export const events = { - Burn: event("0x0c396cd989a39f4459b5fa1aed6a9a8dcdbc45908acfd67e028cd568da98982c", "Burn(address,int24,int24,uint128,uint256,uint256)", {"owner": indexed(p.address), "bottomTick": indexed(p.int24), "topTick": indexed(p.int24), "liquidityAmount": p.uint128, "amount0": p.uint256, "amount1": p.uint256}), - Collect: event("0x70935338e69775456a85ddef226c395fb668b63fa0115f5f20610b388e6ca9c0", "Collect(address,address,int24,int24,uint128,uint128)", {"owner": indexed(p.address), "recipient": p.address, "bottomTick": indexed(p.int24), "topTick": indexed(p.int24), "amount0": p.uint128, "amount1": p.uint128}), - CommunityFee: event("0x3647dccc990d4941b0b05b32527ef493a98d6187b20639ca2f9743f3b55ca5e1", "CommunityFee(uint16)", {"communityFeeNew": p.uint16}), - CommunityVault: event("0xb0b573c1f636e1f8bd9b415ba6c04d6dd49100bc25493fc6305b65ec0e581df3", "CommunityVault(address)", {"newCommunityVault": p.address}), - Fee: event("0x598b9f043c813aa6be3426ca60d1c65d17256312890be5118dab55b0775ebe2a", "Fee(uint16)", {"fee": p.uint16}), - Flash: event("0xbdbdb71d7860376ba52b25a5028beea23581364a40522f6bcfb86bb1f2dca633", "Flash(address,address,uint256,uint256,uint256,uint256)", {"sender": indexed(p.address), "recipient": indexed(p.address), "amount0": p.uint256, "amount1": p.uint256, "paid0": p.uint256, "paid1": p.uint256}), - Initialize: event("0x98636036cb66a9c19a37435efc1e90142190214e8abeb821bdba3f2990dd4c95", "Initialize(uint160,int24)", {"price": p.uint160, "tick": p.int24}), - Mint: event("0x7a53080ba414158be7ec69b987b5fb7d07dee101fe85488f0853ae16239d0bde", "Mint(address,address,int24,int24,uint128,uint256,uint256)", {"sender": p.address, "owner": indexed(p.address), "bottomTick": indexed(p.int24), "topTick": indexed(p.int24), "liquidityAmount": p.uint128, "amount0": p.uint256, "amount1": p.uint256}), - Plugin: event("0x27a3944eff2135a57675f17e72501038982b73620d01f794c72e93d61a3932a2", "Plugin(address)", {"newPluginAddress": p.address}), - PluginConfig: event("0x3a6271b36c1b44bd6a0a0d56230602dc6919b7c17af57254306fadf5fee69dc3", "PluginConfig(uint8)", {"newPluginConfig": p.uint8}), - Swap: event("0xc42079f94a6350d7e6235f29174924f928cc2ac818eb64fed8004e115fbcca67", "Swap(address,address,int256,int256,uint160,uint128,int24)", {"sender": indexed(p.address), "recipient": indexed(p.address), "amount0": p.int256, "amount1": p.int256, "price": p.uint160, "liquidity": p.uint128, "tick": p.int24}), - TickSpacing: event("0x01413b1d5d4c359e9a0daa7909ecda165f6e8c51fe2ff529d74b22a5a7c02645", "TickSpacing(int24)", {"newTickSpacing": p.int24}), -} - -export const functions = { - burn: fun("0x3b3bc70e", "burn(int24,int24,uint128,bytes)", {"bottomTick": p.int24, "topTick": p.int24, "amount": p.uint128, "data": p.bytes}, {"amount0": p.uint256, "amount1": p.uint256}), - collect: fun("0x4f1eb3d8", "collect(address,int24,int24,uint128,uint128)", {"recipient": p.address, "bottomTick": p.int24, "topTick": p.int24, "amount0Requested": p.uint128, "amount1Requested": p.uint128}, {"amount0": p.uint128, "amount1": p.uint128}), - communityFeeLastTimestamp: viewFun("0x1131b110", "communityFeeLastTimestamp()", {}, p.uint32), - communityVault: viewFun("0x53e97868", "communityVault()", {}, p.address), - factory: viewFun("0xc45a0155", "factory()", {}, p.address), - fee: viewFun("0xddca3f43", "fee()", {}, p.uint16), - flash: fun("0x490e6cbc", "flash(address,uint256,uint256,bytes)", {"recipient": p.address, "amount0": p.uint256, "amount1": p.uint256, "data": p.bytes}, ), - getCommunityFeePending: viewFun("0x7bd78025", "getCommunityFeePending()", {}, {"_0": p.uint128, "_1": p.uint128}), - getReserves: viewFun("0x0902f1ac", "getReserves()", {}, {"_0": p.uint128, "_1": p.uint128}), - globalState: viewFun("0xe76c01e4", "globalState()", {}, {"price": p.uint160, "tick": p.int24, "lastFee": p.uint16, "pluginConfig": p.uint8, "communityFee": p.uint16, "unlocked": p.bool}), - initialize: fun("0xf637731d", "initialize(uint160)", {"initialPrice": p.uint160}, ), - isUnlocked: viewFun("0x8380edb7", "isUnlocked()", {}, p.bool), - liquidity: viewFun("0x1a686502", "liquidity()", {}, p.uint128), - maxLiquidityPerTick: viewFun("0x70cf754a", "maxLiquidityPerTick()", {}, p.uint128), - mint: fun("0xaafe29c0", "mint(address,address,int24,int24,uint128,bytes)", {"leftoversRecipient": p.address, "recipient": p.address, "bottomTick": p.int24, "topTick": p.int24, "liquidityDesired": p.uint128, "data": p.bytes}, {"amount0": p.uint256, "amount1": p.uint256, "liquidityActual": p.uint128}), - nextTickGlobal: viewFun("0xd5c35a7e", "nextTickGlobal()", {}, p.int24), - plugin: viewFun("0xef01df4f", "plugin()", {}, p.address), - positions: viewFun("0x514ea4bf", "positions(bytes32)", {"_0": p.bytes32}, {"liquidity": p.uint256, "innerFeeGrowth0Token": p.uint256, "innerFeeGrowth1Token": p.uint256, "fees0": p.uint128, "fees1": p.uint128}), - prevTickGlobal: viewFun("0x050a4d21", "prevTickGlobal()", {}, p.int24), - safelyGetStateOfAMM: viewFun("0x97ce1c51", "safelyGetStateOfAMM()", {}, {"sqrtPrice": p.uint160, "tick": p.int24, "lastFee": p.uint16, "pluginConfig": p.uint8, "activeLiquidity": p.uint128, "nextTick": p.int24, "previousTick": p.int24}), - setCommunityFee: fun("0x240a875a", "setCommunityFee(uint16)", {"newCommunityFee": p.uint16}, ), - setCommunityVault: fun("0xd8544cf3", "setCommunityVault(address)", {"newCommunityVault": p.address}, ), - setFee: fun("0x8e005553", "setFee(uint16)", {"newFee": p.uint16}, ), - setPlugin: fun("0xcc1f97cf", "setPlugin(address)", {"newPluginAddress": p.address}, ), - setPluginConfig: fun("0xbca57f81", "setPluginConfig(uint8)", {"newConfig": p.uint8}, ), - setTickSpacing: fun("0xf085a610", "setTickSpacing(int24)", {"newTickSpacing": p.int24}, ), - swap: fun("0x128acb08", "swap(address,bool,int256,uint160,bytes)", {"recipient": p.address, "zeroToOne": p.bool, "amountRequired": p.int256, "limitSqrtPrice": p.uint160, "data": p.bytes}, {"amount0": p.int256, "amount1": p.int256}), - swapWithPaymentInAdvance: fun("0x9e4e0227", "swapWithPaymentInAdvance(address,address,bool,int256,uint160,bytes)", {"leftoversRecipient": p.address, "recipient": p.address, "zeroToOne": p.bool, "amountToSell": p.int256, "limitSqrtPrice": p.uint160, "data": p.bytes}, {"amount0": p.int256, "amount1": p.int256}), - tickSpacing: viewFun("0xd0c93a7c", "tickSpacing()", {}, p.int24), - tickTable: viewFun("0xc677e3e0", "tickTable(int16)", {"_0": p.int16}, p.uint256), - tickTreeRoot: viewFun("0x578b9a36", "tickTreeRoot()", {}, p.uint32), - tickTreeSecondLayer: viewFun("0xd8619037", "tickTreeSecondLayer(int16)", {"_0": p.int16}, p.uint256), - ticks: viewFun("0xf30dba93", "ticks(int24)", {"_0": p.int24}, {"liquidityTotal": p.uint256, "liquidityDelta": p.int128, "prevTick": p.int24, "nextTick": p.int24, "outerFeeGrowth0Token": p.uint256, "outerFeeGrowth1Token": p.uint256}), - token0: viewFun("0x0dfe1681", "token0()", {}, p.address), - token1: viewFun("0xd21220a7", "token1()", {}, p.address), - totalFeeGrowth0Token: viewFun("0x6378ae44", "totalFeeGrowth0Token()", {}, p.uint256), - totalFeeGrowth1Token: viewFun("0xecdecf42", "totalFeeGrowth1Token()", {}, p.uint256), -} - -export class Contract extends ContractBase { - - communityFeeLastTimestamp() { - return this.eth_call(functions.communityFeeLastTimestamp, {}) - } - - communityVault() { - return this.eth_call(functions.communityVault, {}) - } - - factory() { - return this.eth_call(functions.factory, {}) - } - - fee() { - return this.eth_call(functions.fee, {}) - } - - getCommunityFeePending() { - return this.eth_call(functions.getCommunityFeePending, {}) - } - - getReserves() { - return this.eth_call(functions.getReserves, {}) - } - - globalState() { - return this.eth_call(functions.globalState, {}) - } - - isUnlocked() { - return this.eth_call(functions.isUnlocked, {}) - } - - liquidity() { - return this.eth_call(functions.liquidity, {}) - } - - maxLiquidityPerTick() { - return this.eth_call(functions.maxLiquidityPerTick, {}) - } - - nextTickGlobal() { - return this.eth_call(functions.nextTickGlobal, {}) - } - - plugin() { - return this.eth_call(functions.plugin, {}) - } - - positions(_0: PositionsParams["_0"]) { - return this.eth_call(functions.positions, {_0}) - } - - prevTickGlobal() { - return this.eth_call(functions.prevTickGlobal, {}) - } - - safelyGetStateOfAMM() { - return this.eth_call(functions.safelyGetStateOfAMM, {}) - } - - tickSpacing() { - return this.eth_call(functions.tickSpacing, {}) - } - - tickTable(_0: TickTableParams["_0"]) { - return this.eth_call(functions.tickTable, {_0}) - } - - tickTreeRoot() { - return this.eth_call(functions.tickTreeRoot, {}) - } - - tickTreeSecondLayer(_0: TickTreeSecondLayerParams["_0"]) { - return this.eth_call(functions.tickTreeSecondLayer, {_0}) - } - - ticks(_0: TicksParams["_0"]) { - return this.eth_call(functions.ticks, {_0}) - } - - token0() { - return this.eth_call(functions.token0, {}) - } - - token1() { - return this.eth_call(functions.token1, {}) - } - - totalFeeGrowth0Token() { - return this.eth_call(functions.totalFeeGrowth0Token, {}) - } - - totalFeeGrowth1Token() { - return this.eth_call(functions.totalFeeGrowth1Token, {}) - } -} - -/// Event types -export type BurnEventArgs = EParams -export type CollectEventArgs = EParams -export type CommunityFeeEventArgs = EParams -export type CommunityVaultEventArgs = EParams -export type FeeEventArgs = EParams -export type FlashEventArgs = EParams -export type InitializeEventArgs = EParams -export type MintEventArgs = EParams -export type PluginEventArgs = EParams -export type PluginConfigEventArgs = EParams -export type SwapEventArgs = EParams -export type TickSpacingEventArgs = EParams - -/// Function types -export type BurnParams = FunctionArguments -export type BurnReturn = FunctionReturn - -export type CollectParams = FunctionArguments -export type CollectReturn = FunctionReturn - -export type CommunityFeeLastTimestampParams = FunctionArguments -export type CommunityFeeLastTimestampReturn = FunctionReturn - -export type CommunityVaultParams = FunctionArguments -export type CommunityVaultReturn = FunctionReturn - -export type FactoryParams = FunctionArguments -export type FactoryReturn = FunctionReturn - -export type FeeParams = FunctionArguments -export type FeeReturn = FunctionReturn - -export type FlashParams = FunctionArguments -export type FlashReturn = FunctionReturn - -export type GetCommunityFeePendingParams = FunctionArguments -export type GetCommunityFeePendingReturn = FunctionReturn - -export type GetReservesParams = FunctionArguments -export type GetReservesReturn = FunctionReturn - -export type GlobalStateParams = FunctionArguments -export type GlobalStateReturn = FunctionReturn - -export type InitializeParams = FunctionArguments -export type InitializeReturn = FunctionReturn - -export type IsUnlockedParams = FunctionArguments -export type IsUnlockedReturn = FunctionReturn - -export type LiquidityParams = FunctionArguments -export type LiquidityReturn = FunctionReturn - -export type MaxLiquidityPerTickParams = FunctionArguments -export type MaxLiquidityPerTickReturn = FunctionReturn - -export type MintParams = FunctionArguments -export type MintReturn = FunctionReturn - -export type NextTickGlobalParams = FunctionArguments -export type NextTickGlobalReturn = FunctionReturn - -export type PluginParams = FunctionArguments -export type PluginReturn = FunctionReturn - -export type PositionsParams = FunctionArguments -export type PositionsReturn = FunctionReturn - -export type PrevTickGlobalParams = FunctionArguments -export type PrevTickGlobalReturn = FunctionReturn - -export type SafelyGetStateOfAMMParams = FunctionArguments -export type SafelyGetStateOfAMMReturn = FunctionReturn - -export type SetCommunityFeeParams = FunctionArguments -export type SetCommunityFeeReturn = FunctionReturn - -export type SetCommunityVaultParams = FunctionArguments -export type SetCommunityVaultReturn = FunctionReturn - -export type SetFeeParams = FunctionArguments -export type SetFeeReturn = FunctionReturn - -export type SetPluginParams = FunctionArguments -export type SetPluginReturn = FunctionReturn - -export type SetPluginConfigParams = FunctionArguments -export type SetPluginConfigReturn = FunctionReturn - -export type SetTickSpacingParams = FunctionArguments -export type SetTickSpacingReturn = FunctionReturn - -export type SwapParams = FunctionArguments -export type SwapReturn = FunctionReturn - -export type SwapWithPaymentInAdvanceParams = FunctionArguments -export type SwapWithPaymentInAdvanceReturn = FunctionReturn - -export type TickSpacingParams = FunctionArguments -export type TickSpacingReturn = FunctionReturn - -export type TickTableParams = FunctionArguments -export type TickTableReturn = FunctionReturn - -export type TickTreeRootParams = FunctionArguments -export type TickTreeRootReturn = FunctionReturn - -export type TickTreeSecondLayerParams = FunctionArguments -export type TickTreeSecondLayerReturn = FunctionReturn - -export type TicksParams = FunctionArguments -export type TicksReturn = FunctionReturn - -export type Token0Params = FunctionArguments -export type Token0Return = FunctionReturn - -export type Token1Params = FunctionArguments -export type Token1Return = FunctionReturn - -export type TotalFeeGrowth0TokenParams = FunctionArguments -export type TotalFeeGrowth0TokenReturn = FunctionReturn - -export type TotalFeeGrowth1TokenParams = FunctionArguments -export type TotalFeeGrowth1TokenReturn = FunctionReturn - diff --git a/src/abi/algebra-v4-pool/contract.ts b/src/abi/algebra-v4-pool/contract.ts new file mode 100644 index 00000000..d66e5814 --- /dev/null +++ b/src/abi/algebra-v4-pool/contract.ts @@ -0,0 +1,121 @@ +import { ContractBase } from '../abi.support.js' +import { burn, collect, communityFeeLastTimestamp, communityVault, factory, fee, getCommunityFeePending, getReserves, globalState, isUnlocked, liquidity, maxLiquidityPerTick, mint, nextTickGlobal, plugin, positions, prevTickGlobal, safelyGetStateOfAMM, swap, swapWithPaymentInAdvance, tickSpacing, tickTable, tickTreeRoot, tickTreeSecondLayer, ticks, token0, token1, totalFeeGrowth0Token, totalFeeGrowth1Token } from './functions.js' +import type { BurnParams, CollectParams, MintParams, PositionsParams, SwapParams, SwapWithPaymentInAdvanceParams, TickTableParams, TickTreeSecondLayerParams, TicksParams } from './functions.js' + +export class Contract extends ContractBase { + burn(bottomTick: BurnParams["bottomTick"], topTick: BurnParams["topTick"], amount: BurnParams["amount"], data: BurnParams["data"]) { + return this.eth_call(burn, {bottomTick, topTick, amount, data}) + } + + collect(recipient: CollectParams["recipient"], bottomTick: CollectParams["bottomTick"], topTick: CollectParams["topTick"], amount0Requested: CollectParams["amount0Requested"], amount1Requested: CollectParams["amount1Requested"]) { + return this.eth_call(collect, {recipient, bottomTick, topTick, amount0Requested, amount1Requested}) + } + + communityFeeLastTimestamp() { + return this.eth_call(communityFeeLastTimestamp, {}) + } + + communityVault() { + return this.eth_call(communityVault, {}) + } + + factory() { + return this.eth_call(factory, {}) + } + + fee() { + return this.eth_call(fee, {}) + } + + getCommunityFeePending() { + return this.eth_call(getCommunityFeePending, {}) + } + + getReserves() { + return this.eth_call(getReserves, {}) + } + + globalState() { + return this.eth_call(globalState, {}) + } + + isUnlocked() { + return this.eth_call(isUnlocked, {}) + } + + liquidity() { + return this.eth_call(liquidity, {}) + } + + maxLiquidityPerTick() { + return this.eth_call(maxLiquidityPerTick, {}) + } + + mint(leftoversRecipient: MintParams["leftoversRecipient"], recipient: MintParams["recipient"], bottomTick: MintParams["bottomTick"], topTick: MintParams["topTick"], liquidityDesired: MintParams["liquidityDesired"], data: MintParams["data"]) { + return this.eth_call(mint, {leftoversRecipient, recipient, bottomTick, topTick, liquidityDesired, data}) + } + + nextTickGlobal() { + return this.eth_call(nextTickGlobal, {}) + } + + plugin() { + return this.eth_call(plugin, {}) + } + + positions(_0: PositionsParams["_0"]) { + return this.eth_call(positions, {_0}) + } + + prevTickGlobal() { + return this.eth_call(prevTickGlobal, {}) + } + + safelyGetStateOfAMM() { + return this.eth_call(safelyGetStateOfAMM, {}) + } + + swap(recipient: SwapParams["recipient"], zeroToOne: SwapParams["zeroToOne"], amountRequired: SwapParams["amountRequired"], limitSqrtPrice: SwapParams["limitSqrtPrice"], data: SwapParams["data"]) { + return this.eth_call(swap, {recipient, zeroToOne, amountRequired, limitSqrtPrice, data}) + } + + swapWithPaymentInAdvance(leftoversRecipient: SwapWithPaymentInAdvanceParams["leftoversRecipient"], recipient: SwapWithPaymentInAdvanceParams["recipient"], zeroToOne: SwapWithPaymentInAdvanceParams["zeroToOne"], amountToSell: SwapWithPaymentInAdvanceParams["amountToSell"], limitSqrtPrice: SwapWithPaymentInAdvanceParams["limitSqrtPrice"], data: SwapWithPaymentInAdvanceParams["data"]) { + return this.eth_call(swapWithPaymentInAdvance, {leftoversRecipient, recipient, zeroToOne, amountToSell, limitSqrtPrice, data}) + } + + tickSpacing() { + return this.eth_call(tickSpacing, {}) + } + + tickTable(_0: TickTableParams["_0"]) { + return this.eth_call(tickTable, {_0}) + } + + tickTreeRoot() { + return this.eth_call(tickTreeRoot, {}) + } + + tickTreeSecondLayer(_0: TickTreeSecondLayerParams["_0"]) { + return this.eth_call(tickTreeSecondLayer, {_0}) + } + + ticks(_0: TicksParams["_0"]) { + return this.eth_call(ticks, {_0}) + } + + token0() { + return this.eth_call(token0, {}) + } + + token1() { + return this.eth_call(token1, {}) + } + + totalFeeGrowth0Token() { + return this.eth_call(totalFeeGrowth0Token, {}) + } + + totalFeeGrowth1Token() { + return this.eth_call(totalFeeGrowth1Token, {}) + } +} diff --git a/src/abi/algebra-v4-pool/events.ts b/src/abi/algebra-v4-pool/events.ts new file mode 100644 index 00000000..b85b28a2 --- /dev/null +++ b/src/abi/algebra-v4-pool/events.ts @@ -0,0 +1,103 @@ +import { address, int24, int256, uint128, uint16, uint160, uint256, uint8 } from '@subsquid/evm-codec' +import { event, indexed } from '../abi.support.js' +import type { EventParams as EParams } from '../abi.support.js' + +/** Burn(address,int24,int24,uint128,uint256,uint256) */ +export const Burn = event('0x0c396cd989a39f4459b5fa1aed6a9a8dcdbc45908acfd67e028cd568da98982c', { + owner: indexed(address), + bottomTick: indexed(int24), + topTick: indexed(int24), + liquidityAmount: uint128, + amount0: uint256, + amount1: uint256, +}) +export type BurnEventArgs = EParams + +/** Collect(address,address,int24,int24,uint128,uint128) */ +export const Collect = event('0x70935338e69775456a85ddef226c395fb668b63fa0115f5f20610b388e6ca9c0', { + owner: indexed(address), + recipient: address, + bottomTick: indexed(int24), + topTick: indexed(int24), + amount0: uint128, + amount1: uint128, +}) +export type CollectEventArgs = EParams + +/** CommunityFee(uint16) */ +export const CommunityFee = event('0x3647dccc990d4941b0b05b32527ef493a98d6187b20639ca2f9743f3b55ca5e1', { + communityFeeNew: uint16, +}) +export type CommunityFeeEventArgs = EParams + +/** CommunityVault(address) */ +export const CommunityVault = event('0xb0b573c1f636e1f8bd9b415ba6c04d6dd49100bc25493fc6305b65ec0e581df3', { + newCommunityVault: address, +}) +export type CommunityVaultEventArgs = EParams + +/** Fee(uint16) */ +export const Fee = event('0x598b9f043c813aa6be3426ca60d1c65d17256312890be5118dab55b0775ebe2a', { + fee: uint16, +}) +export type FeeEventArgs = EParams + +/** Flash(address,address,uint256,uint256,uint256,uint256) */ +export const Flash = event('0xbdbdb71d7860376ba52b25a5028beea23581364a40522f6bcfb86bb1f2dca633', { + sender: indexed(address), + recipient: indexed(address), + amount0: uint256, + amount1: uint256, + paid0: uint256, + paid1: uint256, +}) +export type FlashEventArgs = EParams + +/** Initialize(uint160,int24) */ +export const Initialize = event('0x98636036cb66a9c19a37435efc1e90142190214e8abeb821bdba3f2990dd4c95', { + price: uint160, + tick: int24, +}) +export type InitializeEventArgs = EParams + +/** Mint(address,address,int24,int24,uint128,uint256,uint256) */ +export const Mint = event('0x7a53080ba414158be7ec69b987b5fb7d07dee101fe85488f0853ae16239d0bde', { + sender: address, + owner: indexed(address), + bottomTick: indexed(int24), + topTick: indexed(int24), + liquidityAmount: uint128, + amount0: uint256, + amount1: uint256, +}) +export type MintEventArgs = EParams + +/** Plugin(address) */ +export const Plugin = event('0x27a3944eff2135a57675f17e72501038982b73620d01f794c72e93d61a3932a2', { + newPluginAddress: address, +}) +export type PluginEventArgs = EParams + +/** PluginConfig(uint8) */ +export const PluginConfig = event('0x3a6271b36c1b44bd6a0a0d56230602dc6919b7c17af57254306fadf5fee69dc3', { + newPluginConfig: uint8, +}) +export type PluginConfigEventArgs = EParams + +/** Swap(address,address,int256,int256,uint160,uint128,int24) */ +export const Swap = event('0xc42079f94a6350d7e6235f29174924f928cc2ac818eb64fed8004e115fbcca67', { + sender: indexed(address), + recipient: indexed(address), + amount0: int256, + amount1: int256, + price: uint160, + liquidity: uint128, + tick: int24, +}) +export type SwapEventArgs = EParams + +/** TickSpacing(int24) */ +export const TickSpacing = event('0x01413b1d5d4c359e9a0daa7909ecda165f6e8c51fe2ff529d74b22a5a7c02645', { + newTickSpacing: int24, +}) +export type TickSpacingEventArgs = EParams diff --git a/src/abi/algebra-v4-pool/functions.ts b/src/abi/algebra-v4-pool/functions.ts new file mode 100644 index 00000000..af59c3ec --- /dev/null +++ b/src/abi/algebra-v4-pool/functions.ts @@ -0,0 +1,296 @@ +import { address, bool, bytes, bytes32, int128, int16, int24, int256, struct, uint128, uint16, uint160, uint256, uint32, uint8 } from '@subsquid/evm-codec' +import { func } from '../abi.support.js' +import type { FunctionArguments, FunctionReturn } from '../abi.support.js' + +/** burn(int24,int24,uint128,bytes) */ +export const burn = func('0x3b3bc70e', { + bottomTick: int24, + topTick: int24, + amount: uint128, + data: bytes, +}, struct({ + amount0: uint256, + amount1: uint256, +})) +export type BurnParams = FunctionArguments +export type BurnReturn = FunctionReturn + +/** collect(address,int24,int24,uint128,uint128) */ +export const collect = func('0x4f1eb3d8', { + recipient: address, + bottomTick: int24, + topTick: int24, + amount0Requested: uint128, + amount1Requested: uint128, +}, struct({ + amount0: uint128, + amount1: uint128, +})) +export type CollectParams = FunctionArguments +export type CollectReturn = FunctionReturn + +/** communityFeeLastTimestamp() */ +export const communityFeeLastTimestamp = func('0x1131b110', {}, uint32) +export type CommunityFeeLastTimestampParams = FunctionArguments +export type CommunityFeeLastTimestampReturn = FunctionReturn + +/** communityVault() */ +export const communityVault = func('0x53e97868', {}, address) +export type CommunityVaultParams = FunctionArguments +export type CommunityVaultReturn = FunctionReturn + +/** factory() */ +export const factory = func('0xc45a0155', {}, address) +export type FactoryParams = FunctionArguments +export type FactoryReturn = FunctionReturn + +/** fee() */ +export const fee = func('0xddca3f43', {}, uint16) +export type FeeParams = FunctionArguments +export type FeeReturn = FunctionReturn + +/** flash(address,uint256,uint256,bytes) */ +export const flash = func('0x490e6cbc', { + recipient: address, + amount0: uint256, + amount1: uint256, + data: bytes, +}) +export type FlashParams = FunctionArguments +export type FlashReturn = FunctionReturn + +/** getCommunityFeePending() */ +export const getCommunityFeePending = func('0x7bd78025', {}, struct({ + _0: uint128, + _1: uint128, +})) +export type GetCommunityFeePendingParams = FunctionArguments +export type GetCommunityFeePendingReturn = FunctionReturn + +/** getReserves() */ +export const getReserves = func('0x0902f1ac', {}, struct({ + _0: uint128, + _1: uint128, +})) +export type GetReservesParams = FunctionArguments +export type GetReservesReturn = FunctionReturn + +/** globalState() */ +export const globalState = func('0xe76c01e4', {}, struct({ + price: uint160, + tick: int24, + lastFee: uint16, + pluginConfig: uint8, + communityFee: uint16, + unlocked: bool, +})) +export type GlobalStateParams = FunctionArguments +export type GlobalStateReturn = FunctionReturn + +/** initialize(uint160) */ +export const initialize = func('0xf637731d', { + initialPrice: uint160, +}) +export type InitializeParams = FunctionArguments +export type InitializeReturn = FunctionReturn + +/** isUnlocked() */ +export const isUnlocked = func('0x8380edb7', {}, bool) +export type IsUnlockedParams = FunctionArguments +export type IsUnlockedReturn = FunctionReturn + +/** liquidity() */ +export const liquidity = func('0x1a686502', {}, uint128) +export type LiquidityParams = FunctionArguments +export type LiquidityReturn = FunctionReturn + +/** maxLiquidityPerTick() */ +export const maxLiquidityPerTick = func('0x70cf754a', {}, uint128) +export type MaxLiquidityPerTickParams = FunctionArguments +export type MaxLiquidityPerTickReturn = FunctionReturn + +/** mint(address,address,int24,int24,uint128,bytes) */ +export const mint = func('0xaafe29c0', { + leftoversRecipient: address, + recipient: address, + bottomTick: int24, + topTick: int24, + liquidityDesired: uint128, + data: bytes, +}, struct({ + amount0: uint256, + amount1: uint256, + liquidityActual: uint128, +})) +export type MintParams = FunctionArguments +export type MintReturn = FunctionReturn + +/** nextTickGlobal() */ +export const nextTickGlobal = func('0xd5c35a7e', {}, int24) +export type NextTickGlobalParams = FunctionArguments +export type NextTickGlobalReturn = FunctionReturn + +/** plugin() */ +export const plugin = func('0xef01df4f', {}, address) +export type PluginParams = FunctionArguments +export type PluginReturn = FunctionReturn + +/** positions(bytes32) */ +export const positions = func('0x514ea4bf', { + _0: bytes32, +}, struct({ + liquidity: uint256, + innerFeeGrowth0Token: uint256, + innerFeeGrowth1Token: uint256, + fees0: uint128, + fees1: uint128, +})) +export type PositionsParams = FunctionArguments +export type PositionsReturn = FunctionReturn + +/** prevTickGlobal() */ +export const prevTickGlobal = func('0x050a4d21', {}, int24) +export type PrevTickGlobalParams = FunctionArguments +export type PrevTickGlobalReturn = FunctionReturn + +/** safelyGetStateOfAMM() */ +export const safelyGetStateOfAMM = func('0x97ce1c51', {}, struct({ + sqrtPrice: uint160, + tick: int24, + lastFee: uint16, + pluginConfig: uint8, + activeLiquidity: uint128, + nextTick: int24, + previousTick: int24, +})) +export type SafelyGetStateOfAMMParams = FunctionArguments +export type SafelyGetStateOfAMMReturn = FunctionReturn + +/** setCommunityFee(uint16) */ +export const setCommunityFee = func('0x240a875a', { + newCommunityFee: uint16, +}) +export type SetCommunityFeeParams = FunctionArguments +export type SetCommunityFeeReturn = FunctionReturn + +/** setCommunityVault(address) */ +export const setCommunityVault = func('0xd8544cf3', { + newCommunityVault: address, +}) +export type SetCommunityVaultParams = FunctionArguments +export type SetCommunityVaultReturn = FunctionReturn + +/** setFee(uint16) */ +export const setFee = func('0x8e005553', { + newFee: uint16, +}) +export type SetFeeParams = FunctionArguments +export type SetFeeReturn = FunctionReturn + +/** setPlugin(address) */ +export const setPlugin = func('0xcc1f97cf', { + newPluginAddress: address, +}) +export type SetPluginParams = FunctionArguments +export type SetPluginReturn = FunctionReturn + +/** setPluginConfig(uint8) */ +export const setPluginConfig = func('0xbca57f81', { + newConfig: uint8, +}) +export type SetPluginConfigParams = FunctionArguments +export type SetPluginConfigReturn = FunctionReturn + +/** setTickSpacing(int24) */ +export const setTickSpacing = func('0xf085a610', { + newTickSpacing: int24, +}) +export type SetTickSpacingParams = FunctionArguments +export type SetTickSpacingReturn = FunctionReturn + +/** swap(address,bool,int256,uint160,bytes) */ +export const swap = func('0x128acb08', { + recipient: address, + zeroToOne: bool, + amountRequired: int256, + limitSqrtPrice: uint160, + data: bytes, +}, struct({ + amount0: int256, + amount1: int256, +})) +export type SwapParams = FunctionArguments +export type SwapReturn = FunctionReturn + +/** swapWithPaymentInAdvance(address,address,bool,int256,uint160,bytes) */ +export const swapWithPaymentInAdvance = func('0x9e4e0227', { + leftoversRecipient: address, + recipient: address, + zeroToOne: bool, + amountToSell: int256, + limitSqrtPrice: uint160, + data: bytes, +}, struct({ + amount0: int256, + amount1: int256, +})) +export type SwapWithPaymentInAdvanceParams = FunctionArguments +export type SwapWithPaymentInAdvanceReturn = FunctionReturn + +/** tickSpacing() */ +export const tickSpacing = func('0xd0c93a7c', {}, int24) +export type TickSpacingParams = FunctionArguments +export type TickSpacingReturn = FunctionReturn + +/** tickTable(int16) */ +export const tickTable = func('0xc677e3e0', { + _0: int16, +}, uint256) +export type TickTableParams = FunctionArguments +export type TickTableReturn = FunctionReturn + +/** tickTreeRoot() */ +export const tickTreeRoot = func('0x578b9a36', {}, uint32) +export type TickTreeRootParams = FunctionArguments +export type TickTreeRootReturn = FunctionReturn + +/** tickTreeSecondLayer(int16) */ +export const tickTreeSecondLayer = func('0xd8619037', { + _0: int16, +}, uint256) +export type TickTreeSecondLayerParams = FunctionArguments +export type TickTreeSecondLayerReturn = FunctionReturn + +/** ticks(int24) */ +export const ticks = func('0xf30dba93', { + _0: int24, +}, struct({ + liquidityTotal: uint256, + liquidityDelta: int128, + prevTick: int24, + nextTick: int24, + outerFeeGrowth0Token: uint256, + outerFeeGrowth1Token: uint256, +})) +export type TicksParams = FunctionArguments +export type TicksReturn = FunctionReturn + +/** token0() */ +export const token0 = func('0x0dfe1681', {}, address) +export type Token0Params = FunctionArguments +export type Token0Return = FunctionReturn + +/** token1() */ +export const token1 = func('0xd21220a7', {}, address) +export type Token1Params = FunctionArguments +export type Token1Return = FunctionReturn + +/** totalFeeGrowth0Token() */ +export const totalFeeGrowth0Token = func('0x6378ae44', {}, uint256) +export type TotalFeeGrowth0TokenParams = FunctionArguments +export type TotalFeeGrowth0TokenReturn = FunctionReturn + +/** totalFeeGrowth1Token() */ +export const totalFeeGrowth1Token = func('0xecdecf42', {}, uint256) +export type TotalFeeGrowth1TokenParams = FunctionArguments +export type TotalFeeGrowth1TokenReturn = FunctionReturn diff --git a/src/abi/algebra-v4-pool/index.ts b/src/abi/algebra-v4-pool/index.ts new file mode 100644 index 00000000..11829d6e --- /dev/null +++ b/src/abi/algebra-v4-pool/index.ts @@ -0,0 +1,4 @@ +export * as events from './events.js' +export * as functions from './functions.js' + +export { Contract } from './contract.js' diff --git a/src/abi/balancer-meta-pool-strategy.ts b/src/abi/balancer-meta-pool-strategy.ts deleted file mode 100644 index 42dd9c58..00000000 --- a/src/abi/balancer-meta-pool-strategy.ts +++ /dev/null @@ -1,278 +0,0 @@ -import * as p from '@subsquid/evm-codec' -import { event, fun, viewFun, indexed, ContractBase } from '@subsquid/evm-abi' -import type { EventParams as EParams, FunctionArguments, FunctionReturn } from '@subsquid/evm-abi' - -export const events = { - Deposit: event("0x5548c837ab068cf56a2c2479df0882a4922fd203edb7517321831d95078c5f62", "Deposit(address,address,uint256)", {"_asset": indexed(p.address), "_pToken": p.address, "_amount": p.uint256}), - GovernorshipTransferred: event("0xc7c0c772add429241571afb3805861fb3cfa2af374534088b76cdb4325a87e9a", "GovernorshipTransferred(address,address)", {"previousGovernor": indexed(p.address), "newGovernor": indexed(p.address)}), - HarvesterAddressesUpdated: event("0xe48386b84419f4d36e0f96c10cc3510b6fb1a33795620c5098b22472bbe90796", "HarvesterAddressesUpdated(address,address)", {"_oldHarvesterAddress": p.address, "_newHarvesterAddress": p.address}), - MaxDepositDeviationUpdated: event("0x42ef8699937e03e56ce59a64b430e1a18719693244c594c7884f9cb7c1c98e5c", "MaxDepositDeviationUpdated(uint256,uint256)", {"_prevMaxDeviationPercentage": p.uint256, "_newMaxDeviationPercentage": p.uint256}), - MaxWithdrawalDeviationUpdated: event("0xdea5bd7251b6797372e2785ac437c2b046149b71216727e0d33ab3140b11d6f7", "MaxWithdrawalDeviationUpdated(uint256,uint256)", {"_prevMaxDeviationPercentage": p.uint256, "_newMaxDeviationPercentage": p.uint256}), - PTokenAdded: event("0xef6485b84315f9b1483beffa32aae9a0596890395e3d7521f1c5fbb51790e765", "PTokenAdded(address,address)", {"_asset": indexed(p.address), "_pToken": p.address}), - PTokenRemoved: event("0x16b7600acff27e39a8a96056b3d533045298de927507f5c1d97e4accde60488c", "PTokenRemoved(address,address)", {"_asset": indexed(p.address), "_pToken": p.address}), - PendingGovernorshipTransfer: event("0xa39cc5eb22d0f34d8beaefee8a3f17cc229c1a1d1ef87a5ad47313487b1c4f0d", "PendingGovernorshipTransfer(address,address)", {"previousGovernor": indexed(p.address), "newGovernor": indexed(p.address)}), - RewardTokenAddressesUpdated: event("0x04c0b9649497d316554306e53678d5f5f5dbc3a06f97dec13ff4cfe98b986bbc", "RewardTokenAddressesUpdated(address[],address[])", {"_oldAddresses": p.array(p.address), "_newAddresses": p.array(p.address)}), - RewardTokenCollected: event("0xf6c07a063ed4e63808eb8da7112d46dbcd38de2b40a73dbcc9353c5a94c72353", "RewardTokenCollected(address,address,uint256)", {"recipient": p.address, "rewardToken": p.address, "amount": p.uint256}), - Withdrawal: event("0x2717ead6b9200dd235aad468c9809ea400fe33ac69b5bfaa6d3e90fc922b6398", "Withdrawal(address,address,uint256)", {"_asset": indexed(p.address), "_pToken": p.address, "_amount": p.uint256}), -} - -export const functions = { - assetToPToken: viewFun("0x0fc3b4c4", "assetToPToken(address)", {"_0": p.address}, p.address), - auraRewardPoolAddress: viewFun("0x3132a21d", "auraRewardPoolAddress()", {}, p.address), - balancerPoolId: viewFun("0xdbbb64b9", "balancerPoolId()", {}, p.bytes32), - balancerVault: viewFun("0x158274a5", "balancerVault()", {}, p.address), - 'checkBalance(address)': viewFun("0x5f515226", "checkBalance(address)", {"_asset": p.address}, p.uint256), - 'checkBalance()': viewFun("0xc71daccb", "checkBalance()", {}, p.uint256), - claimGovernance: fun("0x5d36b190", "claimGovernance()", {}, ), - collectRewardTokens: fun("0x5a063f63", "collectRewardTokens()", {}, ), - 'deposit(address,uint256)': fun("0x47e7ef24", "deposit(address,uint256)", {"_0": p.address, "_1": p.uint256}, ), - 'deposit(address[],uint256[])': fun("0xefc908a1", "deposit(address[],uint256[])", {"_0": p.array(p.address), "_1": p.array(p.uint256)}, ), - depositAll: fun("0xde5f6268", "depositAll()", {}, ), - frxETH: viewFun("0x565d3e6e", "frxETH()", {}, p.address), - getRewardTokenAddresses: viewFun("0xf6ca71b0", "getRewardTokenAddresses()", {}, p.array(p.address)), - governor: viewFun("0x0c340a24", "governor()", {}, p.address), - harvesterAddress: viewFun("0x67c7066c", "harvesterAddress()", {}, p.address), - initialize: fun("0x435356d1", "initialize(address[],address[],address[])", {"_rewardTokenAddresses": p.array(p.address), "_assets": p.array(p.address), "_pTokens": p.array(p.address)}, ), - isGovernor: viewFun("0xc7af3352", "isGovernor()", {}, p.bool), - maxDepositDeviation: viewFun("0x3f6f7a14", "maxDepositDeviation()", {}, p.uint256), - maxWithdrawalDeviation: viewFun("0x14f0747e", "maxWithdrawalDeviation()", {}, p.uint256), - platformAddress: viewFun("0xdbe55e56", "platformAddress()", {}, p.address), - rETH: viewFun("0xca8aa0e4", "rETH()", {}, p.address), - removePToken: fun("0x9136616a", "removePToken(uint256)", {"_assetIndex": p.uint256}, ), - rewardTokenAddresses: viewFun("0x7b2d9b2c", "rewardTokenAddresses(uint256)", {"_0": p.uint256}, p.address), - safeApproveAllTokens: fun("0xad1728cb", "safeApproveAllTokens()", {}, ), - setHarvesterAddress: fun("0xc2e1e3f4", "setHarvesterAddress(address)", {"_harvesterAddress": p.address}, ), - setMaxDepositDeviation: fun("0x683c1ef9", "setMaxDepositDeviation(uint256)", {"_maxDepositDeviation": p.uint256}, ), - setMaxWithdrawalDeviation: fun("0x79e66fcc", "setMaxWithdrawalDeviation(uint256)", {"_maxWithdrawalDeviation": p.uint256}, ), - setPTokenAddress: fun("0x0ed57b3a", "setPTokenAddress(address,address)", {"_asset": p.address, "_pToken": p.address}, ), - setRewardTokenAddresses: fun("0x96d538bb", "setRewardTokenAddresses(address[])", {"_rewardTokenAddresses": p.array(p.address)}, ), - sfrxETH: viewFun("0xc9ac8c8e", "sfrxETH()", {}, p.address), - stETH: viewFun("0xc1fe3e48", "stETH()", {}, p.address), - supportsAsset: viewFun("0xaa388af6", "supportsAsset(address)", {"_asset": p.address}, p.bool), - transferGovernance: fun("0xd38bfff4", "transferGovernance(address)", {"_newGovernor": p.address}, ), - transferToken: fun("0x1072cbea", "transferToken(address,uint256)", {"_asset": p.address, "_amount": p.uint256}, ), - vaultAddress: viewFun("0x430bf08a", "vaultAddress()", {}, p.address), - 'withdraw(address,address,uint256)': fun("0xd9caed12", "withdraw(address,address,uint256)", {"_recipient": p.address, "_strategyAsset": p.address, "_strategyAmount": p.uint256}, ), - 'withdraw(address,address[],uint256[])': fun("0xedbd7668", "withdraw(address,address[],uint256[])", {"_recipient": p.address, "_strategyAssets": p.array(p.address), "_strategyAmounts": p.array(p.uint256)}, ), - withdrawAll: fun("0x853828b6", "withdrawAll()", {}, ), - wstETH: viewFun("0x4aa07e64", "wstETH()", {}, p.address), -} - -export class Contract extends ContractBase { - - assetToPToken(_0: AssetToPTokenParams["_0"]) { - return this.eth_call(functions.assetToPToken, {_0}) - } - - auraRewardPoolAddress() { - return this.eth_call(functions.auraRewardPoolAddress, {}) - } - - balancerPoolId() { - return this.eth_call(functions.balancerPoolId, {}) - } - - balancerVault() { - return this.eth_call(functions.balancerVault, {}) - } - - 'checkBalance(address)'(_asset: CheckBalanceParams_0["_asset"]) { - return this.eth_call(functions['checkBalance(address)'], {_asset}) - } - - 'checkBalance()'() { - return this.eth_call(functions['checkBalance()'], {}) - } - - frxETH() { - return this.eth_call(functions.frxETH, {}) - } - - getRewardTokenAddresses() { - return this.eth_call(functions.getRewardTokenAddresses, {}) - } - - governor() { - return this.eth_call(functions.governor, {}) - } - - harvesterAddress() { - return this.eth_call(functions.harvesterAddress, {}) - } - - isGovernor() { - return this.eth_call(functions.isGovernor, {}) - } - - maxDepositDeviation() { - return this.eth_call(functions.maxDepositDeviation, {}) - } - - maxWithdrawalDeviation() { - return this.eth_call(functions.maxWithdrawalDeviation, {}) - } - - platformAddress() { - return this.eth_call(functions.platformAddress, {}) - } - - rETH() { - return this.eth_call(functions.rETH, {}) - } - - rewardTokenAddresses(_0: RewardTokenAddressesParams["_0"]) { - return this.eth_call(functions.rewardTokenAddresses, {_0}) - } - - sfrxETH() { - return this.eth_call(functions.sfrxETH, {}) - } - - stETH() { - return this.eth_call(functions.stETH, {}) - } - - supportsAsset(_asset: SupportsAssetParams["_asset"]) { - return this.eth_call(functions.supportsAsset, {_asset}) - } - - vaultAddress() { - return this.eth_call(functions.vaultAddress, {}) - } - - wstETH() { - return this.eth_call(functions.wstETH, {}) - } -} - -/// Event types -export type DepositEventArgs = EParams -export type GovernorshipTransferredEventArgs = EParams -export type HarvesterAddressesUpdatedEventArgs = EParams -export type MaxDepositDeviationUpdatedEventArgs = EParams -export type MaxWithdrawalDeviationUpdatedEventArgs = EParams -export type PTokenAddedEventArgs = EParams -export type PTokenRemovedEventArgs = EParams -export type PendingGovernorshipTransferEventArgs = EParams -export type RewardTokenAddressesUpdatedEventArgs = EParams -export type RewardTokenCollectedEventArgs = EParams -export type WithdrawalEventArgs = EParams - -/// Function types -export type AssetToPTokenParams = FunctionArguments -export type AssetToPTokenReturn = FunctionReturn - -export type AuraRewardPoolAddressParams = FunctionArguments -export type AuraRewardPoolAddressReturn = FunctionReturn - -export type BalancerPoolIdParams = FunctionArguments -export type BalancerPoolIdReturn = FunctionReturn - -export type BalancerVaultParams = FunctionArguments -export type BalancerVaultReturn = FunctionReturn - -export type CheckBalanceParams_0 = FunctionArguments -export type CheckBalanceReturn_0 = FunctionReturn - -export type CheckBalanceParams_1 = FunctionArguments -export type CheckBalanceReturn_1 = FunctionReturn - -export type ClaimGovernanceParams = FunctionArguments -export type ClaimGovernanceReturn = FunctionReturn - -export type CollectRewardTokensParams = FunctionArguments -export type CollectRewardTokensReturn = FunctionReturn - -export type DepositParams_0 = FunctionArguments -export type DepositReturn_0 = FunctionReturn - -export type DepositParams_1 = FunctionArguments -export type DepositReturn_1 = FunctionReturn - -export type DepositAllParams = FunctionArguments -export type DepositAllReturn = FunctionReturn - -export type FrxETHParams = FunctionArguments -export type FrxETHReturn = FunctionReturn - -export type GetRewardTokenAddressesParams = FunctionArguments -export type GetRewardTokenAddressesReturn = FunctionReturn - -export type GovernorParams = FunctionArguments -export type GovernorReturn = FunctionReturn - -export type HarvesterAddressParams = FunctionArguments -export type HarvesterAddressReturn = FunctionReturn - -export type InitializeParams = FunctionArguments -export type InitializeReturn = FunctionReturn - -export type IsGovernorParams = FunctionArguments -export type IsGovernorReturn = FunctionReturn - -export type MaxDepositDeviationParams = FunctionArguments -export type MaxDepositDeviationReturn = FunctionReturn - -export type MaxWithdrawalDeviationParams = FunctionArguments -export type MaxWithdrawalDeviationReturn = FunctionReturn - -export type PlatformAddressParams = FunctionArguments -export type PlatformAddressReturn = FunctionReturn - -export type RETHParams = FunctionArguments -export type RETHReturn = FunctionReturn - -export type RemovePTokenParams = FunctionArguments -export type RemovePTokenReturn = FunctionReturn - -export type RewardTokenAddressesParams = FunctionArguments -export type RewardTokenAddressesReturn = FunctionReturn - -export type SafeApproveAllTokensParams = FunctionArguments -export type SafeApproveAllTokensReturn = FunctionReturn - -export type SetHarvesterAddressParams = FunctionArguments -export type SetHarvesterAddressReturn = FunctionReturn - -export type SetMaxDepositDeviationParams = FunctionArguments -export type SetMaxDepositDeviationReturn = FunctionReturn - -export type SetMaxWithdrawalDeviationParams = FunctionArguments -export type SetMaxWithdrawalDeviationReturn = FunctionReturn - -export type SetPTokenAddressParams = FunctionArguments -export type SetPTokenAddressReturn = FunctionReturn - -export type SetRewardTokenAddressesParams = FunctionArguments -export type SetRewardTokenAddressesReturn = FunctionReturn - -export type SfrxETHParams = FunctionArguments -export type SfrxETHReturn = FunctionReturn - -export type StETHParams = FunctionArguments -export type StETHReturn = FunctionReturn - -export type SupportsAssetParams = FunctionArguments -export type SupportsAssetReturn = FunctionReturn - -export type TransferGovernanceParams = FunctionArguments -export type TransferGovernanceReturn = FunctionReturn - -export type TransferTokenParams = FunctionArguments -export type TransferTokenReturn = FunctionReturn - -export type VaultAddressParams = FunctionArguments -export type VaultAddressReturn = FunctionReturn - -export type WithdrawParams_0 = FunctionArguments -export type WithdrawReturn_0 = FunctionReturn - -export type WithdrawParams_1 = FunctionArguments -export type WithdrawReturn_1 = FunctionReturn - -export type WithdrawAllParams = FunctionArguments -export type WithdrawAllReturn = FunctionReturn - -export type WstETHParams = FunctionArguments -export type WstETHReturn = FunctionReturn - diff --git a/src/abi/balancer-meta-pool-strategy/contract.ts b/src/abi/balancer-meta-pool-strategy/contract.ts new file mode 100644 index 00000000..791c8657 --- /dev/null +++ b/src/abi/balancer-meta-pool-strategy/contract.ts @@ -0,0 +1,89 @@ +import { ContractBase } from '../abi.support.js' +import { assetToPToken, auraRewardPoolAddress, balancerPoolId, balancerVault, checkBalance, checkBalance_1, frxETH, getRewardTokenAddresses, governor, harvesterAddress, isGovernor, maxDepositDeviation, maxWithdrawalDeviation, platformAddress, rETH, rewardTokenAddresses, sfrxETH, stETH, supportsAsset, vaultAddress, wstETH } from './functions.js' +import type { AssetToPTokenParams, CheckBalanceParams, RewardTokenAddressesParams, SupportsAssetParams } from './functions.js' + +export class Contract extends ContractBase { + assetToPToken(_0: AssetToPTokenParams["_0"]) { + return this.eth_call(assetToPToken, {_0}) + } + + auraRewardPoolAddress() { + return this.eth_call(auraRewardPoolAddress, {}) + } + + balancerPoolId() { + return this.eth_call(balancerPoolId, {}) + } + + balancerVault() { + return this.eth_call(balancerVault, {}) + } + + checkBalance(_asset: CheckBalanceParams["_asset"]) { + return this.eth_call(checkBalance, {_asset}) + } + + checkBalance_1() { + return this.eth_call(checkBalance_1, {}) + } + + frxETH() { + return this.eth_call(frxETH, {}) + } + + getRewardTokenAddresses() { + return this.eth_call(getRewardTokenAddresses, {}) + } + + governor() { + return this.eth_call(governor, {}) + } + + harvesterAddress() { + return this.eth_call(harvesterAddress, {}) + } + + isGovernor() { + return this.eth_call(isGovernor, {}) + } + + maxDepositDeviation() { + return this.eth_call(maxDepositDeviation, {}) + } + + maxWithdrawalDeviation() { + return this.eth_call(maxWithdrawalDeviation, {}) + } + + platformAddress() { + return this.eth_call(platformAddress, {}) + } + + rETH() { + return this.eth_call(rETH, {}) + } + + rewardTokenAddresses(_0: RewardTokenAddressesParams["_0"]) { + return this.eth_call(rewardTokenAddresses, {_0}) + } + + sfrxETH() { + return this.eth_call(sfrxETH, {}) + } + + stETH() { + return this.eth_call(stETH, {}) + } + + supportsAsset(_asset: SupportsAssetParams["_asset"]) { + return this.eth_call(supportsAsset, {_asset}) + } + + vaultAddress() { + return this.eth_call(vaultAddress, {}) + } + + wstETH() { + return this.eth_call(wstETH, {}) + } +} diff --git a/src/abi/balancer-meta-pool-strategy/events.ts b/src/abi/balancer-meta-pool-strategy/events.ts new file mode 100644 index 00000000..9908e795 --- /dev/null +++ b/src/abi/balancer-meta-pool-strategy/events.ts @@ -0,0 +1,83 @@ +import { address, array, uint256 } from '@subsquid/evm-codec' +import { event, indexed } from '../abi.support.js' +import type { EventParams as EParams } from '../abi.support.js' + +/** Deposit(address,address,uint256) */ +export const Deposit = event('0x5548c837ab068cf56a2c2479df0882a4922fd203edb7517321831d95078c5f62', { + _asset: indexed(address), + _pToken: address, + _amount: uint256, +}) +export type DepositEventArgs = EParams + +/** GovernorshipTransferred(address,address) */ +export const GovernorshipTransferred = event('0xc7c0c772add429241571afb3805861fb3cfa2af374534088b76cdb4325a87e9a', { + previousGovernor: indexed(address), + newGovernor: indexed(address), +}) +export type GovernorshipTransferredEventArgs = EParams + +/** HarvesterAddressesUpdated(address,address) */ +export const HarvesterAddressesUpdated = event('0xe48386b84419f4d36e0f96c10cc3510b6fb1a33795620c5098b22472bbe90796', { + _oldHarvesterAddress: address, + _newHarvesterAddress: address, +}) +export type HarvesterAddressesUpdatedEventArgs = EParams + +/** MaxDepositDeviationUpdated(uint256,uint256) */ +export const MaxDepositDeviationUpdated = event('0x42ef8699937e03e56ce59a64b430e1a18719693244c594c7884f9cb7c1c98e5c', { + _prevMaxDeviationPercentage: uint256, + _newMaxDeviationPercentage: uint256, +}) +export type MaxDepositDeviationUpdatedEventArgs = EParams + +/** MaxWithdrawalDeviationUpdated(uint256,uint256) */ +export const MaxWithdrawalDeviationUpdated = event('0xdea5bd7251b6797372e2785ac437c2b046149b71216727e0d33ab3140b11d6f7', { + _prevMaxDeviationPercentage: uint256, + _newMaxDeviationPercentage: uint256, +}) +export type MaxWithdrawalDeviationUpdatedEventArgs = EParams + +/** PTokenAdded(address,address) */ +export const PTokenAdded = event('0xef6485b84315f9b1483beffa32aae9a0596890395e3d7521f1c5fbb51790e765', { + _asset: indexed(address), + _pToken: address, +}) +export type PTokenAddedEventArgs = EParams + +/** PTokenRemoved(address,address) */ +export const PTokenRemoved = event('0x16b7600acff27e39a8a96056b3d533045298de927507f5c1d97e4accde60488c', { + _asset: indexed(address), + _pToken: address, +}) +export type PTokenRemovedEventArgs = EParams + +/** PendingGovernorshipTransfer(address,address) */ +export const PendingGovernorshipTransfer = event('0xa39cc5eb22d0f34d8beaefee8a3f17cc229c1a1d1ef87a5ad47313487b1c4f0d', { + previousGovernor: indexed(address), + newGovernor: indexed(address), +}) +export type PendingGovernorshipTransferEventArgs = EParams + +/** RewardTokenAddressesUpdated(address[],address[]) */ +export const RewardTokenAddressesUpdated = event('0x04c0b9649497d316554306e53678d5f5f5dbc3a06f97dec13ff4cfe98b986bbc', { + _oldAddresses: array(address), + _newAddresses: array(address), +}) +export type RewardTokenAddressesUpdatedEventArgs = EParams + +/** RewardTokenCollected(address,address,uint256) */ +export const RewardTokenCollected = event('0xf6c07a063ed4e63808eb8da7112d46dbcd38de2b40a73dbcc9353c5a94c72353', { + recipient: address, + rewardToken: address, + amount: uint256, +}) +export type RewardTokenCollectedEventArgs = EParams + +/** Withdrawal(address,address,uint256) */ +export const Withdrawal = event('0x2717ead6b9200dd235aad468c9809ea400fe33ac69b5bfaa6d3e90fc922b6398', { + _asset: indexed(address), + _pToken: address, + _amount: uint256, +}) +export type WithdrawalEventArgs = EParams diff --git a/src/abi/balancer-meta-pool-strategy/functions.ts b/src/abi/balancer-meta-pool-strategy/functions.ts new file mode 100644 index 00000000..7173fc8c --- /dev/null +++ b/src/abi/balancer-meta-pool-strategy/functions.ts @@ -0,0 +1,242 @@ +import { address, array, bool, bytes32, uint256 } from '@subsquid/evm-codec' +import { func } from '../abi.support.js' +import type { FunctionArguments, FunctionReturn } from '../abi.support.js' + +/** assetToPToken(address) */ +export const assetToPToken = func('0x0fc3b4c4', { + _0: address, +}, address) +export type AssetToPTokenParams = FunctionArguments +export type AssetToPTokenReturn = FunctionReturn + +/** auraRewardPoolAddress() */ +export const auraRewardPoolAddress = func('0x3132a21d', {}, address) +export type AuraRewardPoolAddressParams = FunctionArguments +export type AuraRewardPoolAddressReturn = FunctionReturn + +/** balancerPoolId() */ +export const balancerPoolId = func('0xdbbb64b9', {}, bytes32) +export type BalancerPoolIdParams = FunctionArguments +export type BalancerPoolIdReturn = FunctionReturn + +/** balancerVault() */ +export const balancerVault = func('0x158274a5', {}, address) +export type BalancerVaultParams = FunctionArguments +export type BalancerVaultReturn = FunctionReturn + +/** checkBalance(address) */ +export const checkBalance = func('0x5f515226', { + _asset: address, +}, uint256) +export type CheckBalanceParams = FunctionArguments +export type CheckBalanceReturn = FunctionReturn + +/** checkBalance() */ +export const checkBalance_1 = func('0xc71daccb', {}, uint256) +export type CheckBalanceParams_1 = FunctionArguments +export type CheckBalanceReturn_1 = FunctionReturn + +/** claimGovernance() */ +export const claimGovernance = func('0x5d36b190', {}) +export type ClaimGovernanceParams = FunctionArguments +export type ClaimGovernanceReturn = FunctionReturn + +/** collectRewardTokens() */ +export const collectRewardTokens = func('0x5a063f63', {}) +export type CollectRewardTokensParams = FunctionArguments +export type CollectRewardTokensReturn = FunctionReturn + +/** deposit(address,uint256) */ +export const deposit = func('0x47e7ef24', { + _0: address, + _1: uint256, +}) +export type DepositParams = FunctionArguments +export type DepositReturn = FunctionReturn + +/** deposit(address[],uint256[]) */ +export const deposit_1 = func('0xefc908a1', { + _0: array(address), + _1: array(uint256), +}) +export type DepositParams_1 = FunctionArguments +export type DepositReturn_1 = FunctionReturn + +/** depositAll() */ +export const depositAll = func('0xde5f6268', {}) +export type DepositAllParams = FunctionArguments +export type DepositAllReturn = FunctionReturn + +/** frxETH() */ +export const frxETH = func('0x565d3e6e', {}, address) +export type FrxETHParams = FunctionArguments +export type FrxETHReturn = FunctionReturn + +/** getRewardTokenAddresses() */ +export const getRewardTokenAddresses = func('0xf6ca71b0', {}, array(address)) +export type GetRewardTokenAddressesParams = FunctionArguments +export type GetRewardTokenAddressesReturn = FunctionReturn + +/** governor() */ +export const governor = func('0x0c340a24', {}, address) +export type GovernorParams = FunctionArguments +export type GovernorReturn = FunctionReturn + +/** harvesterAddress() */ +export const harvesterAddress = func('0x67c7066c', {}, address) +export type HarvesterAddressParams = FunctionArguments +export type HarvesterAddressReturn = FunctionReturn + +/** initialize(address[],address[],address[]) */ +export const initialize = func('0x435356d1', { + _rewardTokenAddresses: array(address), + _assets: array(address), + _pTokens: array(address), +}) +export type InitializeParams = FunctionArguments +export type InitializeReturn = FunctionReturn + +/** isGovernor() */ +export const isGovernor = func('0xc7af3352', {}, bool) +export type IsGovernorParams = FunctionArguments +export type IsGovernorReturn = FunctionReturn + +/** maxDepositDeviation() */ +export const maxDepositDeviation = func('0x3f6f7a14', {}, uint256) +export type MaxDepositDeviationParams = FunctionArguments +export type MaxDepositDeviationReturn = FunctionReturn + +/** maxWithdrawalDeviation() */ +export const maxWithdrawalDeviation = func('0x14f0747e', {}, uint256) +export type MaxWithdrawalDeviationParams = FunctionArguments +export type MaxWithdrawalDeviationReturn = FunctionReturn + +/** platformAddress() */ +export const platformAddress = func('0xdbe55e56', {}, address) +export type PlatformAddressParams = FunctionArguments +export type PlatformAddressReturn = FunctionReturn + +/** rETH() */ +export const rETH = func('0xca8aa0e4', {}, address) +export type RETHParams = FunctionArguments +export type RETHReturn = FunctionReturn + +/** removePToken(uint256) */ +export const removePToken = func('0x9136616a', { + _assetIndex: uint256, +}) +export type RemovePTokenParams = FunctionArguments +export type RemovePTokenReturn = FunctionReturn + +/** rewardTokenAddresses(uint256) */ +export const rewardTokenAddresses = func('0x7b2d9b2c', { + _0: uint256, +}, address) +export type RewardTokenAddressesParams = FunctionArguments +export type RewardTokenAddressesReturn = FunctionReturn + +/** safeApproveAllTokens() */ +export const safeApproveAllTokens = func('0xad1728cb', {}) +export type SafeApproveAllTokensParams = FunctionArguments +export type SafeApproveAllTokensReturn = FunctionReturn + +/** setHarvesterAddress(address) */ +export const setHarvesterAddress = func('0xc2e1e3f4', { + _harvesterAddress: address, +}) +export type SetHarvesterAddressParams = FunctionArguments +export type SetHarvesterAddressReturn = FunctionReturn + +/** setMaxDepositDeviation(uint256) */ +export const setMaxDepositDeviation = func('0x683c1ef9', { + _maxDepositDeviation: uint256, +}) +export type SetMaxDepositDeviationParams = FunctionArguments +export type SetMaxDepositDeviationReturn = FunctionReturn + +/** setMaxWithdrawalDeviation(uint256) */ +export const setMaxWithdrawalDeviation = func('0x79e66fcc', { + _maxWithdrawalDeviation: uint256, +}) +export type SetMaxWithdrawalDeviationParams = FunctionArguments +export type SetMaxWithdrawalDeviationReturn = FunctionReturn + +/** setPTokenAddress(address,address) */ +export const setPTokenAddress = func('0x0ed57b3a', { + _asset: address, + _pToken: address, +}) +export type SetPTokenAddressParams = FunctionArguments +export type SetPTokenAddressReturn = FunctionReturn + +/** setRewardTokenAddresses(address[]) */ +export const setRewardTokenAddresses = func('0x96d538bb', { + _rewardTokenAddresses: array(address), +}) +export type SetRewardTokenAddressesParams = FunctionArguments +export type SetRewardTokenAddressesReturn = FunctionReturn + +/** sfrxETH() */ +export const sfrxETH = func('0xc9ac8c8e', {}, address) +export type SfrxETHParams = FunctionArguments +export type SfrxETHReturn = FunctionReturn + +/** stETH() */ +export const stETH = func('0xc1fe3e48', {}, address) +export type StETHParams = FunctionArguments +export type StETHReturn = FunctionReturn + +/** supportsAsset(address) */ +export const supportsAsset = func('0xaa388af6', { + _asset: address, +}, bool) +export type SupportsAssetParams = FunctionArguments +export type SupportsAssetReturn = FunctionReturn + +/** transferGovernance(address) */ +export const transferGovernance = func('0xd38bfff4', { + _newGovernor: address, +}) +export type TransferGovernanceParams = FunctionArguments +export type TransferGovernanceReturn = FunctionReturn + +/** transferToken(address,uint256) */ +export const transferToken = func('0x1072cbea', { + _asset: address, + _amount: uint256, +}) +export type TransferTokenParams = FunctionArguments +export type TransferTokenReturn = FunctionReturn + +/** vaultAddress() */ +export const vaultAddress = func('0x430bf08a', {}, address) +export type VaultAddressParams = FunctionArguments +export type VaultAddressReturn = FunctionReturn + +/** withdraw(address,address,uint256) */ +export const withdraw = func('0xd9caed12', { + _recipient: address, + _strategyAsset: address, + _strategyAmount: uint256, +}) +export type WithdrawParams = FunctionArguments +export type WithdrawReturn = FunctionReturn + +/** withdraw(address,address[],uint256[]) */ +export const withdraw_1 = func('0xedbd7668', { + _recipient: address, + _strategyAssets: array(address), + _strategyAmounts: array(uint256), +}) +export type WithdrawParams_1 = FunctionArguments +export type WithdrawReturn_1 = FunctionReturn + +/** withdrawAll() */ +export const withdrawAll = func('0x853828b6', {}) +export type WithdrawAllParams = FunctionArguments +export type WithdrawAllReturn = FunctionReturn + +/** wstETH() */ +export const wstETH = func('0x4aa07e64', {}, address) +export type WstETHParams = FunctionArguments +export type WstETHReturn = FunctionReturn diff --git a/src/abi/balancer-meta-pool-strategy/index.ts b/src/abi/balancer-meta-pool-strategy/index.ts new file mode 100644 index 00000000..11829d6e --- /dev/null +++ b/src/abi/balancer-meta-pool-strategy/index.ts @@ -0,0 +1,4 @@ +export * as events from './events.js' +export * as functions from './functions.js' + +export { Contract } from './contract.js' diff --git a/src/abi/balancer-meta-stable-pool.ts b/src/abi/balancer-meta-stable-pool.ts deleted file mode 100644 index 5d3a1e70..00000000 --- a/src/abi/balancer-meta-stable-pool.ts +++ /dev/null @@ -1,338 +0,0 @@ -import * as p from '@subsquid/evm-codec' -import { event, fun, viewFun, indexed, ContractBase } from '@subsquid/evm-abi' -import type { EventParams as EParams, FunctionArguments, FunctionReturn } from '@subsquid/evm-abi' - -export const events = { - AmpUpdateStarted: event("0x1835882ee7a34ac194f717a35e09bb1d24c82a3b9d854ab6c9749525b714cdf2", "AmpUpdateStarted(uint256,uint256,uint256,uint256)", {"startValue": p.uint256, "endValue": p.uint256, "startTime": p.uint256, "endTime": p.uint256}), - AmpUpdateStopped: event("0xa0d01593e47e69d07e0ccd87bece09411e07dd1ed40ca8f2e7af2976542a0233", "AmpUpdateStopped(uint256)", {"currentValue": p.uint256}), - Approval: event("0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925", "Approval(address,address,uint256)", {"owner": indexed(p.address), "spender": indexed(p.address), "value": p.uint256}), - OracleEnabledChanged: event("0x3e350b41e86a8e10f804ade6d35340d620be35569cc75ac943e8bb14ab80ead1", "OracleEnabledChanged(bool)", {"enabled": p.bool}), - PausedStateChanged: event("0x9e3a5e37224532dea67b89face185703738a228a6e8a23dee546960180d3be64", "PausedStateChanged(bool)", {"paused": p.bool}), - PriceRateCacheUpdated: event("0xc1a224b14823b63c7711127f125fbf592434682f38881ebb61408747a303affc", "PriceRateCacheUpdated(address,uint256)", {"token": indexed(p.address), "rate": p.uint256}), - PriceRateProviderSet: event("0xca6c2c5b6b44b5f3f0c08f0e28e5b6deda1cb38c3fe1113e8031d926c1e8c6d0", "PriceRateProviderSet(address,address,uint256)", {"token": indexed(p.address), "provider": indexed(p.address), "cacheDuration": p.uint256}), - SwapFeePercentageChanged: event("0xa9ba3ffe0b6c366b81232caab38605a0699ad5398d6cce76f91ee809e322dafc", "SwapFeePercentageChanged(uint256)", {"swapFeePercentage": p.uint256}), - Transfer: event("0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", "Transfer(address,address,uint256)", {"from": indexed(p.address), "to": indexed(p.address), "value": p.uint256}), -} - -export const functions = { - DOMAIN_SEPARATOR: viewFun("0x3644e515", "DOMAIN_SEPARATOR()", {}, p.bytes32), - allowance: viewFun("0xdd62ed3e", "allowance(address,address)", {"owner": p.address, "spender": p.address}, p.uint256), - approve: fun("0x095ea7b3", "approve(address,uint256)", {"spender": p.address, "amount": p.uint256}, p.bool), - balanceOf: viewFun("0x70a08231", "balanceOf(address)", {"account": p.address}, p.uint256), - decimals: viewFun("0x313ce567", "decimals()", {}, p.uint8), - decreaseAllowance: fun("0xa457c2d7", "decreaseAllowance(address,uint256)", {"spender": p.address, "amount": p.uint256}, p.bool), - enableOracle: fun("0x292c914a", "enableOracle()", {}, ), - getActionId: viewFun("0x851c1bb3", "getActionId(bytes4)", {"selector": p.bytes4}, p.bytes32), - getAmplificationParameter: viewFun("0x6daccffa", "getAmplificationParameter()", {}, {"value": p.uint256, "isUpdating": p.bool, "precision": p.uint256}), - getAuthorizer: viewFun("0xaaabadc5", "getAuthorizer()", {}, p.address), - getLargestSafeQueryWindow: viewFun("0xffd088eb", "getLargestSafeQueryWindow()", {}, p.uint256), - getLastInvariant: viewFun("0x9b02cdde", "getLastInvariant()", {}, {"lastInvariant": p.uint256, "lastInvariantAmp": p.uint256}), - getLatest: viewFun("0xb10be739", "getLatest(uint8)", {"variable": p.uint8}, p.uint256), - getOracleMiscData: viewFun("0x1ed4eddc", "getOracleMiscData()", {}, {"logInvariant": p.int256, "logTotalSupply": p.int256, "oracleSampleCreationTimestamp": p.uint256, "oracleIndex": p.uint256, "oracleEnabled": p.bool}), - getOwner: viewFun("0x893d20e8", "getOwner()", {}, p.address), - getPastAccumulators: viewFun("0x6b843239", "getPastAccumulators((uint8,uint256)[])", {"queries": p.array(p.struct({"variable": p.uint8, "ago": p.uint256}))}, p.array(p.int256)), - getPausedState: viewFun("0x1c0de051", "getPausedState()", {}, {"paused": p.bool, "pauseWindowEndTime": p.uint256, "bufferPeriodEndTime": p.uint256}), - getPoolId: viewFun("0x38fff2d0", "getPoolId()", {}, p.bytes32), - getPriceRateCache: viewFun("0xb867ee5a", "getPriceRateCache(address)", {"token": p.address}, {"rate": p.uint256, "duration": p.uint256, "expires": p.uint256}), - getRate: viewFun("0x679aefce", "getRate()", {}, p.uint256), - getRateProviders: viewFun("0x238a2d59", "getRateProviders()", {}, p.array(p.address)), - getSample: viewFun("0x60d1507c", "getSample(uint256)", {"index": p.uint256}, {"logPairPrice": p.int256, "accLogPairPrice": p.int256, "logBptPrice": p.int256, "accLogBptPrice": p.int256, "logInvariant": p.int256, "accLogInvariant": p.int256, "timestamp": p.uint256}), - getScalingFactors: viewFun("0x1dd746ea", "getScalingFactors()", {}, p.array(p.uint256)), - getSwapFeePercentage: viewFun("0x55c67628", "getSwapFeePercentage()", {}, p.uint256), - getTimeWeightedAverage: viewFun("0x1dccd830", "getTimeWeightedAverage((uint8,uint256,uint256)[])", {"queries": p.array(p.struct({"variable": p.uint8, "secs": p.uint256, "ago": p.uint256}))}, p.array(p.uint256)), - getTotalSamples: viewFun("0xb48b5b40", "getTotalSamples()", {}, p.uint256), - getVault: viewFun("0x8d928af8", "getVault()", {}, p.address), - increaseAllowance: fun("0x39509351", "increaseAllowance(address,uint256)", {"spender": p.address, "addedValue": p.uint256}, p.bool), - name: viewFun("0x06fdde03", "name()", {}, p.string), - nonces: viewFun("0x7ecebe00", "nonces(address)", {"owner": p.address}, p.uint256), - onExitPool: fun("0x74f3b009", "onExitPool(bytes32,address,address,uint256[],uint256,uint256,bytes)", {"poolId": p.bytes32, "sender": p.address, "recipient": p.address, "balances": p.array(p.uint256), "lastChangeBlock": p.uint256, "protocolSwapFeePercentage": p.uint256, "userData": p.bytes}, {"amountsOut": p.array(p.uint256), "dueProtocolFeeAmounts": p.array(p.uint256)}), - onJoinPool: fun("0xd5c096c4", "onJoinPool(bytes32,address,address,uint256[],uint256,uint256,bytes)", {"poolId": p.bytes32, "sender": p.address, "recipient": p.address, "balances": p.array(p.uint256), "lastChangeBlock": p.uint256, "protocolSwapFeePercentage": p.uint256, "userData": p.bytes}, {"amountsIn": p.array(p.uint256), "dueProtocolFeeAmounts": p.array(p.uint256)}), - 'onSwap((uint8,address,address,uint256,bytes32,uint256,address,address,bytes),uint256[],uint256,uint256)': fun("0x01ec954a", "onSwap((uint8,address,address,uint256,bytes32,uint256,address,address,bytes),uint256[],uint256,uint256)", {"request": p.struct({"kind": p.uint8, "tokenIn": p.address, "tokenOut": p.address, "amount": p.uint256, "poolId": p.bytes32, "lastChangeBlock": p.uint256, "from": p.address, "to": p.address, "userData": p.bytes}), "balances": p.array(p.uint256), "indexIn": p.uint256, "indexOut": p.uint256}, p.uint256), - 'onSwap((uint8,address,address,uint256,bytes32,uint256,address,address,bytes),uint256,uint256)': fun("0x9d2c110c", "onSwap((uint8,address,address,uint256,bytes32,uint256,address,address,bytes),uint256,uint256)", {"request": p.struct({"kind": p.uint8, "tokenIn": p.address, "tokenOut": p.address, "amount": p.uint256, "poolId": p.bytes32, "lastChangeBlock": p.uint256, "from": p.address, "to": p.address, "userData": p.bytes}), "balanceTokenIn": p.uint256, "balanceTokenOut": p.uint256}, p.uint256), - permit: fun("0xd505accf", "permit(address,address,uint256,uint256,uint8,bytes32,bytes32)", {"owner": p.address, "spender": p.address, "value": p.uint256, "deadline": p.uint256, "v": p.uint8, "r": p.bytes32, "s": p.bytes32}, ), - queryExit: fun("0x6028bfd4", "queryExit(bytes32,address,address,uint256[],uint256,uint256,bytes)", {"poolId": p.bytes32, "sender": p.address, "recipient": p.address, "balances": p.array(p.uint256), "lastChangeBlock": p.uint256, "protocolSwapFeePercentage": p.uint256, "userData": p.bytes}, {"bptIn": p.uint256, "amountsOut": p.array(p.uint256)}), - queryJoin: fun("0x87ec6817", "queryJoin(bytes32,address,address,uint256[],uint256,uint256,bytes)", {"poolId": p.bytes32, "sender": p.address, "recipient": p.address, "balances": p.array(p.uint256), "lastChangeBlock": p.uint256, "protocolSwapFeePercentage": p.uint256, "userData": p.bytes}, {"bptOut": p.uint256, "amountsIn": p.array(p.uint256)}), - setAssetManagerPoolConfig: fun("0x50dd6ed9", "setAssetManagerPoolConfig(address,bytes)", {"token": p.address, "poolConfig": p.bytes}, ), - setPaused: fun("0x16c38b3c", "setPaused(bool)", {"paused": p.bool}, ), - setPriceRateCacheDuration: fun("0xb7710251", "setPriceRateCacheDuration(address,uint256)", {"token": p.address, "duration": p.uint256}, ), - setSwapFeePercentage: fun("0x38e9922e", "setSwapFeePercentage(uint256)", {"swapFeePercentage": p.uint256}, ), - startAmplificationParameterUpdate: fun("0x2f1a0bc9", "startAmplificationParameterUpdate(uint256,uint256)", {"rawEndValue": p.uint256, "endTime": p.uint256}, ), - stopAmplificationParameterUpdate: fun("0xeb0f24d6", "stopAmplificationParameterUpdate()", {}, ), - symbol: viewFun("0x95d89b41", "symbol()", {}, p.string), - totalSupply: viewFun("0x18160ddd", "totalSupply()", {}, p.uint256), - transfer: fun("0xa9059cbb", "transfer(address,uint256)", {"recipient": p.address, "amount": p.uint256}, p.bool), - transferFrom: fun("0x23b872dd", "transferFrom(address,address,uint256)", {"sender": p.address, "recipient": p.address, "amount": p.uint256}, p.bool), - updatePriceRateCache: fun("0xa0daaed0", "updatePriceRateCache(address)", {"token": p.address}, ), -} - -export class Contract extends ContractBase { - - DOMAIN_SEPARATOR() { - return this.eth_call(functions.DOMAIN_SEPARATOR, {}) - } - - allowance(owner: AllowanceParams["owner"], spender: AllowanceParams["spender"]) { - return this.eth_call(functions.allowance, {owner, spender}) - } - - balanceOf(account: BalanceOfParams["account"]) { - return this.eth_call(functions.balanceOf, {account}) - } - - decimals() { - return this.eth_call(functions.decimals, {}) - } - - getActionId(selector: GetActionIdParams["selector"]) { - return this.eth_call(functions.getActionId, {selector}) - } - - getAmplificationParameter() { - return this.eth_call(functions.getAmplificationParameter, {}) - } - - getAuthorizer() { - return this.eth_call(functions.getAuthorizer, {}) - } - - getLargestSafeQueryWindow() { - return this.eth_call(functions.getLargestSafeQueryWindow, {}) - } - - getLastInvariant() { - return this.eth_call(functions.getLastInvariant, {}) - } - - getLatest(variable: GetLatestParams["variable"]) { - return this.eth_call(functions.getLatest, {variable}) - } - - getOracleMiscData() { - return this.eth_call(functions.getOracleMiscData, {}) - } - - getOwner() { - return this.eth_call(functions.getOwner, {}) - } - - getPastAccumulators(queries: GetPastAccumulatorsParams["queries"]) { - return this.eth_call(functions.getPastAccumulators, {queries}) - } - - getPausedState() { - return this.eth_call(functions.getPausedState, {}) - } - - getPoolId() { - return this.eth_call(functions.getPoolId, {}) - } - - getPriceRateCache(token: GetPriceRateCacheParams["token"]) { - return this.eth_call(functions.getPriceRateCache, {token}) - } - - getRate() { - return this.eth_call(functions.getRate, {}) - } - - getRateProviders() { - return this.eth_call(functions.getRateProviders, {}) - } - - getSample(index: GetSampleParams["index"]) { - return this.eth_call(functions.getSample, {index}) - } - - getScalingFactors() { - return this.eth_call(functions.getScalingFactors, {}) - } - - getSwapFeePercentage() { - return this.eth_call(functions.getSwapFeePercentage, {}) - } - - getTimeWeightedAverage(queries: GetTimeWeightedAverageParams["queries"]) { - return this.eth_call(functions.getTimeWeightedAverage, {queries}) - } - - getTotalSamples() { - return this.eth_call(functions.getTotalSamples, {}) - } - - getVault() { - return this.eth_call(functions.getVault, {}) - } - - name() { - return this.eth_call(functions.name, {}) - } - - nonces(owner: NoncesParams["owner"]) { - return this.eth_call(functions.nonces, {owner}) - } - - symbol() { - return this.eth_call(functions.symbol, {}) - } - - totalSupply() { - return this.eth_call(functions.totalSupply, {}) - } -} - -/// Event types -export type AmpUpdateStartedEventArgs = EParams -export type AmpUpdateStoppedEventArgs = EParams -export type ApprovalEventArgs = EParams -export type OracleEnabledChangedEventArgs = EParams -export type PausedStateChangedEventArgs = EParams -export type PriceRateCacheUpdatedEventArgs = EParams -export type PriceRateProviderSetEventArgs = EParams -export type SwapFeePercentageChangedEventArgs = EParams -export type TransferEventArgs = EParams - -/// Function types -export type DOMAIN_SEPARATORParams = FunctionArguments -export type DOMAIN_SEPARATORReturn = FunctionReturn - -export type AllowanceParams = FunctionArguments -export type AllowanceReturn = FunctionReturn - -export type ApproveParams = FunctionArguments -export type ApproveReturn = FunctionReturn - -export type BalanceOfParams = FunctionArguments -export type BalanceOfReturn = FunctionReturn - -export type DecimalsParams = FunctionArguments -export type DecimalsReturn = FunctionReturn - -export type DecreaseAllowanceParams = FunctionArguments -export type DecreaseAllowanceReturn = FunctionReturn - -export type EnableOracleParams = FunctionArguments -export type EnableOracleReturn = FunctionReturn - -export type GetActionIdParams = FunctionArguments -export type GetActionIdReturn = FunctionReturn - -export type GetAmplificationParameterParams = FunctionArguments -export type GetAmplificationParameterReturn = FunctionReturn - -export type GetAuthorizerParams = FunctionArguments -export type GetAuthorizerReturn = FunctionReturn - -export type GetLargestSafeQueryWindowParams = FunctionArguments -export type GetLargestSafeQueryWindowReturn = FunctionReturn - -export type GetLastInvariantParams = FunctionArguments -export type GetLastInvariantReturn = FunctionReturn - -export type GetLatestParams = FunctionArguments -export type GetLatestReturn = FunctionReturn - -export type GetOracleMiscDataParams = FunctionArguments -export type GetOracleMiscDataReturn = FunctionReturn - -export type GetOwnerParams = FunctionArguments -export type GetOwnerReturn = FunctionReturn - -export type GetPastAccumulatorsParams = FunctionArguments -export type GetPastAccumulatorsReturn = FunctionReturn - -export type GetPausedStateParams = FunctionArguments -export type GetPausedStateReturn = FunctionReturn - -export type GetPoolIdParams = FunctionArguments -export type GetPoolIdReturn = FunctionReturn - -export type GetPriceRateCacheParams = FunctionArguments -export type GetPriceRateCacheReturn = FunctionReturn - -export type GetRateParams = FunctionArguments -export type GetRateReturn = FunctionReturn - -export type GetRateProvidersParams = FunctionArguments -export type GetRateProvidersReturn = FunctionReturn - -export type GetSampleParams = FunctionArguments -export type GetSampleReturn = FunctionReturn - -export type GetScalingFactorsParams = FunctionArguments -export type GetScalingFactorsReturn = FunctionReturn - -export type GetSwapFeePercentageParams = FunctionArguments -export type GetSwapFeePercentageReturn = FunctionReturn - -export type GetTimeWeightedAverageParams = FunctionArguments -export type GetTimeWeightedAverageReturn = FunctionReturn - -export type GetTotalSamplesParams = FunctionArguments -export type GetTotalSamplesReturn = FunctionReturn - -export type GetVaultParams = FunctionArguments -export type GetVaultReturn = FunctionReturn - -export type IncreaseAllowanceParams = FunctionArguments -export type IncreaseAllowanceReturn = FunctionReturn - -export type NameParams = FunctionArguments -export type NameReturn = FunctionReturn - -export type NoncesParams = FunctionArguments -export type NoncesReturn = FunctionReturn - -export type OnExitPoolParams = FunctionArguments -export type OnExitPoolReturn = FunctionReturn - -export type OnJoinPoolParams = FunctionArguments -export type OnJoinPoolReturn = FunctionReturn - -export type OnSwapParams_0 = FunctionArguments -export type OnSwapReturn_0 = FunctionReturn - -export type OnSwapParams_1 = FunctionArguments -export type OnSwapReturn_1 = FunctionReturn - -export type PermitParams = FunctionArguments -export type PermitReturn = FunctionReturn - -export type QueryExitParams = FunctionArguments -export type QueryExitReturn = FunctionReturn - -export type QueryJoinParams = FunctionArguments -export type QueryJoinReturn = FunctionReturn - -export type SetAssetManagerPoolConfigParams = FunctionArguments -export type SetAssetManagerPoolConfigReturn = FunctionReturn - -export type SetPausedParams = FunctionArguments -export type SetPausedReturn = FunctionReturn - -export type SetPriceRateCacheDurationParams = FunctionArguments -export type SetPriceRateCacheDurationReturn = FunctionReturn - -export type SetSwapFeePercentageParams = FunctionArguments -export type SetSwapFeePercentageReturn = FunctionReturn - -export type StartAmplificationParameterUpdateParams = FunctionArguments -export type StartAmplificationParameterUpdateReturn = FunctionReturn - -export type StopAmplificationParameterUpdateParams = FunctionArguments -export type StopAmplificationParameterUpdateReturn = FunctionReturn - -export type SymbolParams = FunctionArguments -export type SymbolReturn = FunctionReturn - -export type TotalSupplyParams = FunctionArguments -export type TotalSupplyReturn = FunctionReturn - -export type TransferParams = FunctionArguments -export type TransferReturn = FunctionReturn - -export type TransferFromParams = FunctionArguments -export type TransferFromReturn = FunctionReturn - -export type UpdatePriceRateCacheParams = FunctionArguments -export type UpdatePriceRateCacheReturn = FunctionReturn - diff --git a/src/abi/balancer-meta-stable-pool/contract.ts b/src/abi/balancer-meta-stable-pool/contract.ts new file mode 100644 index 00000000..6b29e541 --- /dev/null +++ b/src/abi/balancer-meta-stable-pool/contract.ts @@ -0,0 +1,161 @@ +import { ContractBase } from '../abi.support.js' +import { DOMAIN_SEPARATOR, allowance, approve, balanceOf, decimals, decreaseAllowance, getActionId, getAmplificationParameter, getAuthorizer, getLargestSafeQueryWindow, getLastInvariant, getLatest, getOracleMiscData, getOwner, getPastAccumulators, getPausedState, getPoolId, getPriceRateCache, getRate, getRateProviders, getSample, getScalingFactors, getSwapFeePercentage, getTimeWeightedAverage, getTotalSamples, getVault, increaseAllowance, name, nonces, onExitPool, onJoinPool, onSwap, onSwap_1, queryExit, queryJoin, symbol, totalSupply, transfer, transferFrom } from './functions.js' +import type { AllowanceParams, ApproveParams, BalanceOfParams, DecreaseAllowanceParams, GetActionIdParams, GetLatestParams, GetPastAccumulatorsParams, GetPriceRateCacheParams, GetSampleParams, GetTimeWeightedAverageParams, IncreaseAllowanceParams, NoncesParams, OnExitPoolParams, OnJoinPoolParams, OnSwapParams, OnSwapParams_1, QueryExitParams, QueryJoinParams, TransferFromParams, TransferParams } from './functions.js' + +export class Contract extends ContractBase { + DOMAIN_SEPARATOR() { + return this.eth_call(DOMAIN_SEPARATOR, {}) + } + + allowance(owner: AllowanceParams["owner"], spender: AllowanceParams["spender"]) { + return this.eth_call(allowance, {owner, spender}) + } + + approve(spender: ApproveParams["spender"], amount: ApproveParams["amount"]) { + return this.eth_call(approve, {spender, amount}) + } + + balanceOf(account: BalanceOfParams["account"]) { + return this.eth_call(balanceOf, {account}) + } + + decimals() { + return this.eth_call(decimals, {}) + } + + decreaseAllowance(spender: DecreaseAllowanceParams["spender"], amount: DecreaseAllowanceParams["amount"]) { + return this.eth_call(decreaseAllowance, {spender, amount}) + } + + getActionId(selector: GetActionIdParams["selector"]) { + return this.eth_call(getActionId, {selector}) + } + + getAmplificationParameter() { + return this.eth_call(getAmplificationParameter, {}) + } + + getAuthorizer() { + return this.eth_call(getAuthorizer, {}) + } + + getLargestSafeQueryWindow() { + return this.eth_call(getLargestSafeQueryWindow, {}) + } + + getLastInvariant() { + return this.eth_call(getLastInvariant, {}) + } + + getLatest(variable: GetLatestParams["variable"]) { + return this.eth_call(getLatest, {variable}) + } + + getOracleMiscData() { + return this.eth_call(getOracleMiscData, {}) + } + + getOwner() { + return this.eth_call(getOwner, {}) + } + + getPastAccumulators(queries: GetPastAccumulatorsParams["queries"]) { + return this.eth_call(getPastAccumulators, {queries}) + } + + getPausedState() { + return this.eth_call(getPausedState, {}) + } + + getPoolId() { + return this.eth_call(getPoolId, {}) + } + + getPriceRateCache(token: GetPriceRateCacheParams["token"]) { + return this.eth_call(getPriceRateCache, {token}) + } + + getRate() { + return this.eth_call(getRate, {}) + } + + getRateProviders() { + return this.eth_call(getRateProviders, {}) + } + + getSample(index: GetSampleParams["index"]) { + return this.eth_call(getSample, {index}) + } + + getScalingFactors() { + return this.eth_call(getScalingFactors, {}) + } + + getSwapFeePercentage() { + return this.eth_call(getSwapFeePercentage, {}) + } + + getTimeWeightedAverage(queries: GetTimeWeightedAverageParams["queries"]) { + return this.eth_call(getTimeWeightedAverage, {queries}) + } + + getTotalSamples() { + return this.eth_call(getTotalSamples, {}) + } + + getVault() { + return this.eth_call(getVault, {}) + } + + increaseAllowance(spender: IncreaseAllowanceParams["spender"], addedValue: IncreaseAllowanceParams["addedValue"]) { + return this.eth_call(increaseAllowance, {spender, addedValue}) + } + + name() { + return this.eth_call(name, {}) + } + + nonces(owner: NoncesParams["owner"]) { + return this.eth_call(nonces, {owner}) + } + + onExitPool(poolId: OnExitPoolParams["poolId"], sender: OnExitPoolParams["sender"], recipient: OnExitPoolParams["recipient"], balances: OnExitPoolParams["balances"], lastChangeBlock: OnExitPoolParams["lastChangeBlock"], protocolSwapFeePercentage: OnExitPoolParams["protocolSwapFeePercentage"], userData: OnExitPoolParams["userData"]) { + return this.eth_call(onExitPool, {poolId, sender, recipient, balances, lastChangeBlock, protocolSwapFeePercentage, userData}) + } + + onJoinPool(poolId: OnJoinPoolParams["poolId"], sender: OnJoinPoolParams["sender"], recipient: OnJoinPoolParams["recipient"], balances: OnJoinPoolParams["balances"], lastChangeBlock: OnJoinPoolParams["lastChangeBlock"], protocolSwapFeePercentage: OnJoinPoolParams["protocolSwapFeePercentage"], userData: OnJoinPoolParams["userData"]) { + return this.eth_call(onJoinPool, {poolId, sender, recipient, balances, lastChangeBlock, protocolSwapFeePercentage, userData}) + } + + onSwap(request: OnSwapParams["request"], balances: OnSwapParams["balances"], indexIn: OnSwapParams["indexIn"], indexOut: OnSwapParams["indexOut"]) { + return this.eth_call(onSwap, {request, balances, indexIn, indexOut}) + } + + onSwap_1(request: OnSwapParams_1["request"], balanceTokenIn: OnSwapParams_1["balanceTokenIn"], balanceTokenOut: OnSwapParams_1["balanceTokenOut"]) { + return this.eth_call(onSwap_1, {request, balanceTokenIn, balanceTokenOut}) + } + + queryExit(poolId: QueryExitParams["poolId"], sender: QueryExitParams["sender"], recipient: QueryExitParams["recipient"], balances: QueryExitParams["balances"], lastChangeBlock: QueryExitParams["lastChangeBlock"], protocolSwapFeePercentage: QueryExitParams["protocolSwapFeePercentage"], userData: QueryExitParams["userData"]) { + return this.eth_call(queryExit, {poolId, sender, recipient, balances, lastChangeBlock, protocolSwapFeePercentage, userData}) + } + + queryJoin(poolId: QueryJoinParams["poolId"], sender: QueryJoinParams["sender"], recipient: QueryJoinParams["recipient"], balances: QueryJoinParams["balances"], lastChangeBlock: QueryJoinParams["lastChangeBlock"], protocolSwapFeePercentage: QueryJoinParams["protocolSwapFeePercentage"], userData: QueryJoinParams["userData"]) { + return this.eth_call(queryJoin, {poolId, sender, recipient, balances, lastChangeBlock, protocolSwapFeePercentage, userData}) + } + + symbol() { + return this.eth_call(symbol, {}) + } + + totalSupply() { + return this.eth_call(totalSupply, {}) + } + + transfer(recipient: TransferParams["recipient"], amount: TransferParams["amount"]) { + return this.eth_call(transfer, {recipient, amount}) + } + + transferFrom(sender: TransferFromParams["sender"], recipient: TransferFromParams["recipient"], amount: TransferFromParams["amount"]) { + return this.eth_call(transferFrom, {sender, recipient, amount}) + } +} diff --git a/src/abi/balancer-meta-stable-pool/events.ts b/src/abi/balancer-meta-stable-pool/events.ts new file mode 100644 index 00000000..855cfe32 --- /dev/null +++ b/src/abi/balancer-meta-stable-pool/events.ts @@ -0,0 +1,67 @@ +import { address, bool, uint256 } from '@subsquid/evm-codec' +import { event, indexed } from '../abi.support.js' +import type { EventParams as EParams } from '../abi.support.js' + +/** AmpUpdateStarted(uint256,uint256,uint256,uint256) */ +export const AmpUpdateStarted = event('0x1835882ee7a34ac194f717a35e09bb1d24c82a3b9d854ab6c9749525b714cdf2', { + startValue: uint256, + endValue: uint256, + startTime: uint256, + endTime: uint256, +}) +export type AmpUpdateStartedEventArgs = EParams + +/** AmpUpdateStopped(uint256) */ +export const AmpUpdateStopped = event('0xa0d01593e47e69d07e0ccd87bece09411e07dd1ed40ca8f2e7af2976542a0233', { + currentValue: uint256, +}) +export type AmpUpdateStoppedEventArgs = EParams + +/** Approval(address,address,uint256) */ +export const Approval = event('0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925', { + owner: indexed(address), + spender: indexed(address), + value: uint256, +}) +export type ApprovalEventArgs = EParams + +/** OracleEnabledChanged(bool) */ +export const OracleEnabledChanged = event('0x3e350b41e86a8e10f804ade6d35340d620be35569cc75ac943e8bb14ab80ead1', { + enabled: bool, +}) +export type OracleEnabledChangedEventArgs = EParams + +/** PausedStateChanged(bool) */ +export const PausedStateChanged = event('0x9e3a5e37224532dea67b89face185703738a228a6e8a23dee546960180d3be64', { + paused: bool, +}) +export type PausedStateChangedEventArgs = EParams + +/** PriceRateCacheUpdated(address,uint256) */ +export const PriceRateCacheUpdated = event('0xc1a224b14823b63c7711127f125fbf592434682f38881ebb61408747a303affc', { + token: indexed(address), + rate: uint256, +}) +export type PriceRateCacheUpdatedEventArgs = EParams + +/** PriceRateProviderSet(address,address,uint256) */ +export const PriceRateProviderSet = event('0xca6c2c5b6b44b5f3f0c08f0e28e5b6deda1cb38c3fe1113e8031d926c1e8c6d0', { + token: indexed(address), + provider: indexed(address), + cacheDuration: uint256, +}) +export type PriceRateProviderSetEventArgs = EParams + +/** SwapFeePercentageChanged(uint256) */ +export const SwapFeePercentageChanged = event('0xa9ba3ffe0b6c366b81232caab38605a0699ad5398d6cce76f91ee809e322dafc', { + swapFeePercentage: uint256, +}) +export type SwapFeePercentageChangedEventArgs = EParams + +/** Transfer(address,address,uint256) */ +export const Transfer = event('0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', { + from: indexed(address), + to: indexed(address), + value: uint256, +}) +export type TransferEventArgs = EParams diff --git a/src/abi/balancer-meta-stable-pool/functions.ts b/src/abi/balancer-meta-stable-pool/functions.ts new file mode 100644 index 00000000..98c0f86b --- /dev/null +++ b/src/abi/balancer-meta-stable-pool/functions.ts @@ -0,0 +1,410 @@ +import { address, array, bool, bytes, bytes32, bytes4, int256, string, struct, uint256, uint8 } from '@subsquid/evm-codec' +import { func } from '../abi.support.js' +import type { FunctionArguments, FunctionReturn } from '../abi.support.js' + +/** DOMAIN_SEPARATOR() */ +export const DOMAIN_SEPARATOR = func('0x3644e515', {}, bytes32) +export type DOMAIN_SEPARATORParams = FunctionArguments +export type DOMAIN_SEPARATORReturn = FunctionReturn + +/** allowance(address,address) */ +export const allowance = func('0xdd62ed3e', { + owner: address, + spender: address, +}, uint256) +export type AllowanceParams = FunctionArguments +export type AllowanceReturn = FunctionReturn + +/** approve(address,uint256) */ +export const approve = func('0x095ea7b3', { + spender: address, + amount: uint256, +}, bool) +export type ApproveParams = FunctionArguments +export type ApproveReturn = FunctionReturn + +/** balanceOf(address) */ +export const balanceOf = func('0x70a08231', { + account: address, +}, uint256) +export type BalanceOfParams = FunctionArguments +export type BalanceOfReturn = FunctionReturn + +/** decimals() */ +export const decimals = func('0x313ce567', {}, uint8) +export type DecimalsParams = FunctionArguments +export type DecimalsReturn = FunctionReturn + +/** decreaseAllowance(address,uint256) */ +export const decreaseAllowance = func('0xa457c2d7', { + spender: address, + amount: uint256, +}, bool) +export type DecreaseAllowanceParams = FunctionArguments +export type DecreaseAllowanceReturn = FunctionReturn + +/** enableOracle() */ +export const enableOracle = func('0x292c914a', {}) +export type EnableOracleParams = FunctionArguments +export type EnableOracleReturn = FunctionReturn + +/** getActionId(bytes4) */ +export const getActionId = func('0x851c1bb3', { + selector: bytes4, +}, bytes32) +export type GetActionIdParams = FunctionArguments +export type GetActionIdReturn = FunctionReturn + +/** getAmplificationParameter() */ +export const getAmplificationParameter = func('0x6daccffa', {}, struct({ + value: uint256, + isUpdating: bool, + precision: uint256, +})) +export type GetAmplificationParameterParams = FunctionArguments +export type GetAmplificationParameterReturn = FunctionReturn + +/** getAuthorizer() */ +export const getAuthorizer = func('0xaaabadc5', {}, address) +export type GetAuthorizerParams = FunctionArguments +export type GetAuthorizerReturn = FunctionReturn + +/** getLargestSafeQueryWindow() */ +export const getLargestSafeQueryWindow = func('0xffd088eb', {}, uint256) +export type GetLargestSafeQueryWindowParams = FunctionArguments +export type GetLargestSafeQueryWindowReturn = FunctionReturn + +/** getLastInvariant() */ +export const getLastInvariant = func('0x9b02cdde', {}, struct({ + lastInvariant: uint256, + lastInvariantAmp: uint256, +})) +export type GetLastInvariantParams = FunctionArguments +export type GetLastInvariantReturn = FunctionReturn + +/** getLatest(uint8) */ +export const getLatest = func('0xb10be739', { + variable: uint8, +}, uint256) +export type GetLatestParams = FunctionArguments +export type GetLatestReturn = FunctionReturn + +/** getOracleMiscData() */ +export const getOracleMiscData = func('0x1ed4eddc', {}, struct({ + logInvariant: int256, + logTotalSupply: int256, + oracleSampleCreationTimestamp: uint256, + oracleIndex: uint256, + oracleEnabled: bool, +})) +export type GetOracleMiscDataParams = FunctionArguments +export type GetOracleMiscDataReturn = FunctionReturn + +/** getOwner() */ +export const getOwner = func('0x893d20e8', {}, address) +export type GetOwnerParams = FunctionArguments +export type GetOwnerReturn = FunctionReturn + +/** getPastAccumulators((uint8,uint256)[]) */ +export const getPastAccumulators = func('0x6b843239', { + queries: array(struct({ + variable: uint8, + ago: uint256, + })), +}, array(int256)) +export type GetPastAccumulatorsParams = FunctionArguments +export type GetPastAccumulatorsReturn = FunctionReturn + +/** getPausedState() */ +export const getPausedState = func('0x1c0de051', {}, struct({ + paused: bool, + pauseWindowEndTime: uint256, + bufferPeriodEndTime: uint256, +})) +export type GetPausedStateParams = FunctionArguments +export type GetPausedStateReturn = FunctionReturn + +/** getPoolId() */ +export const getPoolId = func('0x38fff2d0', {}, bytes32) +export type GetPoolIdParams = FunctionArguments +export type GetPoolIdReturn = FunctionReturn + +/** getPriceRateCache(address) */ +export const getPriceRateCache = func('0xb867ee5a', { + token: address, +}, struct({ + rate: uint256, + duration: uint256, + expires: uint256, +})) +export type GetPriceRateCacheParams = FunctionArguments +export type GetPriceRateCacheReturn = FunctionReturn + +/** getRate() */ +export const getRate = func('0x679aefce', {}, uint256) +export type GetRateParams = FunctionArguments +export type GetRateReturn = FunctionReturn + +/** getRateProviders() */ +export const getRateProviders = func('0x238a2d59', {}, array(address)) +export type GetRateProvidersParams = FunctionArguments +export type GetRateProvidersReturn = FunctionReturn + +/** getSample(uint256) */ +export const getSample = func('0x60d1507c', { + index: uint256, +}, struct({ + logPairPrice: int256, + accLogPairPrice: int256, + logBptPrice: int256, + accLogBptPrice: int256, + logInvariant: int256, + accLogInvariant: int256, + timestamp: uint256, +})) +export type GetSampleParams = FunctionArguments +export type GetSampleReturn = FunctionReturn + +/** getScalingFactors() */ +export const getScalingFactors = func('0x1dd746ea', {}, array(uint256)) +export type GetScalingFactorsParams = FunctionArguments +export type GetScalingFactorsReturn = FunctionReturn + +/** getSwapFeePercentage() */ +export const getSwapFeePercentage = func('0x55c67628', {}, uint256) +export type GetSwapFeePercentageParams = FunctionArguments +export type GetSwapFeePercentageReturn = FunctionReturn + +/** getTimeWeightedAverage((uint8,uint256,uint256)[]) */ +export const getTimeWeightedAverage = func('0x1dccd830', { + queries: array(struct({ + variable: uint8, + secs: uint256, + ago: uint256, + })), +}, array(uint256)) +export type GetTimeWeightedAverageParams = FunctionArguments +export type GetTimeWeightedAverageReturn = FunctionReturn + +/** getTotalSamples() */ +export const getTotalSamples = func('0xb48b5b40', {}, uint256) +export type GetTotalSamplesParams = FunctionArguments +export type GetTotalSamplesReturn = FunctionReturn + +/** getVault() */ +export const getVault = func('0x8d928af8', {}, address) +export type GetVaultParams = FunctionArguments +export type GetVaultReturn = FunctionReturn + +/** increaseAllowance(address,uint256) */ +export const increaseAllowance = func('0x39509351', { + spender: address, + addedValue: uint256, +}, bool) +export type IncreaseAllowanceParams = FunctionArguments +export type IncreaseAllowanceReturn = FunctionReturn + +/** name() */ +export const name = func('0x06fdde03', {}, string) +export type NameParams = FunctionArguments +export type NameReturn = FunctionReturn + +/** nonces(address) */ +export const nonces = func('0x7ecebe00', { + owner: address, +}, uint256) +export type NoncesParams = FunctionArguments +export type NoncesReturn = FunctionReturn + +/** onExitPool(bytes32,address,address,uint256[],uint256,uint256,bytes) */ +export const onExitPool = func('0x74f3b009', { + poolId: bytes32, + sender: address, + recipient: address, + balances: array(uint256), + lastChangeBlock: uint256, + protocolSwapFeePercentage: uint256, + userData: bytes, +}, struct({ + amountsOut: array(uint256), + dueProtocolFeeAmounts: array(uint256), +})) +export type OnExitPoolParams = FunctionArguments +export type OnExitPoolReturn = FunctionReturn + +/** onJoinPool(bytes32,address,address,uint256[],uint256,uint256,bytes) */ +export const onJoinPool = func('0xd5c096c4', { + poolId: bytes32, + sender: address, + recipient: address, + balances: array(uint256), + lastChangeBlock: uint256, + protocolSwapFeePercentage: uint256, + userData: bytes, +}, struct({ + amountsIn: array(uint256), + dueProtocolFeeAmounts: array(uint256), +})) +export type OnJoinPoolParams = FunctionArguments +export type OnJoinPoolReturn = FunctionReturn + +/** onSwap((uint8,address,address,uint256,bytes32,uint256,address,address,bytes),uint256[],uint256,uint256) */ +export const onSwap = func('0x01ec954a', { + request: struct({ + kind: uint8, + tokenIn: address, + tokenOut: address, + amount: uint256, + poolId: bytes32, + lastChangeBlock: uint256, + from: address, + to: address, + userData: bytes, + }), + balances: array(uint256), + indexIn: uint256, + indexOut: uint256, +}, uint256) +export type OnSwapParams = FunctionArguments +export type OnSwapReturn = FunctionReturn + +/** onSwap((uint8,address,address,uint256,bytes32,uint256,address,address,bytes),uint256,uint256) */ +export const onSwap_1 = func('0x9d2c110c', { + request: struct({ + kind: uint8, + tokenIn: address, + tokenOut: address, + amount: uint256, + poolId: bytes32, + lastChangeBlock: uint256, + from: address, + to: address, + userData: bytes, + }), + balanceTokenIn: uint256, + balanceTokenOut: uint256, +}, uint256) +export type OnSwapParams_1 = FunctionArguments +export type OnSwapReturn_1 = FunctionReturn + +/** permit(address,address,uint256,uint256,uint8,bytes32,bytes32) */ +export const permit = func('0xd505accf', { + owner: address, + spender: address, + value: uint256, + deadline: uint256, + v: uint8, + r: bytes32, + s: bytes32, +}) +export type PermitParams = FunctionArguments +export type PermitReturn = FunctionReturn + +/** queryExit(bytes32,address,address,uint256[],uint256,uint256,bytes) */ +export const queryExit = func('0x6028bfd4', { + poolId: bytes32, + sender: address, + recipient: address, + balances: array(uint256), + lastChangeBlock: uint256, + protocolSwapFeePercentage: uint256, + userData: bytes, +}, struct({ + bptIn: uint256, + amountsOut: array(uint256), +})) +export type QueryExitParams = FunctionArguments +export type QueryExitReturn = FunctionReturn + +/** queryJoin(bytes32,address,address,uint256[],uint256,uint256,bytes) */ +export const queryJoin = func('0x87ec6817', { + poolId: bytes32, + sender: address, + recipient: address, + balances: array(uint256), + lastChangeBlock: uint256, + protocolSwapFeePercentage: uint256, + userData: bytes, +}, struct({ + bptOut: uint256, + amountsIn: array(uint256), +})) +export type QueryJoinParams = FunctionArguments +export type QueryJoinReturn = FunctionReturn + +/** setAssetManagerPoolConfig(address,bytes) */ +export const setAssetManagerPoolConfig = func('0x50dd6ed9', { + token: address, + poolConfig: bytes, +}) +export type SetAssetManagerPoolConfigParams = FunctionArguments +export type SetAssetManagerPoolConfigReturn = FunctionReturn + +/** setPaused(bool) */ +export const setPaused = func('0x16c38b3c', { + paused: bool, +}) +export type SetPausedParams = FunctionArguments +export type SetPausedReturn = FunctionReturn + +/** setPriceRateCacheDuration(address,uint256) */ +export const setPriceRateCacheDuration = func('0xb7710251', { + token: address, + duration: uint256, +}) +export type SetPriceRateCacheDurationParams = FunctionArguments +export type SetPriceRateCacheDurationReturn = FunctionReturn + +/** setSwapFeePercentage(uint256) */ +export const setSwapFeePercentage = func('0x38e9922e', { + swapFeePercentage: uint256, +}) +export type SetSwapFeePercentageParams = FunctionArguments +export type SetSwapFeePercentageReturn = FunctionReturn + +/** startAmplificationParameterUpdate(uint256,uint256) */ +export const startAmplificationParameterUpdate = func('0x2f1a0bc9', { + rawEndValue: uint256, + endTime: uint256, +}) +export type StartAmplificationParameterUpdateParams = FunctionArguments +export type StartAmplificationParameterUpdateReturn = FunctionReturn + +/** stopAmplificationParameterUpdate() */ +export const stopAmplificationParameterUpdate = func('0xeb0f24d6', {}) +export type StopAmplificationParameterUpdateParams = FunctionArguments +export type StopAmplificationParameterUpdateReturn = FunctionReturn + +/** symbol() */ +export const symbol = func('0x95d89b41', {}, string) +export type SymbolParams = FunctionArguments +export type SymbolReturn = FunctionReturn + +/** totalSupply() */ +export const totalSupply = func('0x18160ddd', {}, uint256) +export type TotalSupplyParams = FunctionArguments +export type TotalSupplyReturn = FunctionReturn + +/** transfer(address,uint256) */ +export const transfer = func('0xa9059cbb', { + recipient: address, + amount: uint256, +}, bool) +export type TransferParams = FunctionArguments +export type TransferReturn = FunctionReturn + +/** transferFrom(address,address,uint256) */ +export const transferFrom = func('0x23b872dd', { + sender: address, + recipient: address, + amount: uint256, +}, bool) +export type TransferFromParams = FunctionArguments +export type TransferFromReturn = FunctionReturn + +/** updatePriceRateCache(address) */ +export const updatePriceRateCache = func('0xa0daaed0', { + token: address, +}) +export type UpdatePriceRateCacheParams = FunctionArguments +export type UpdatePriceRateCacheReturn = FunctionReturn diff --git a/src/abi/balancer-meta-stable-pool/index.ts b/src/abi/balancer-meta-stable-pool/index.ts new file mode 100644 index 00000000..11829d6e --- /dev/null +++ b/src/abi/balancer-meta-stable-pool/index.ts @@ -0,0 +1,4 @@ +export * as events from './events.js' +export * as functions from './functions.js' + +export { Contract } from './contract.js' diff --git a/src/abi/balancer-rate-provider.ts b/src/abi/balancer-rate-provider.ts deleted file mode 100644 index 51477955..00000000 --- a/src/abi/balancer-rate-provider.ts +++ /dev/null @@ -1,27 +0,0 @@ -import * as p from '@subsquid/evm-codec' -import { event, fun, viewFun, indexed, ContractBase } from '@subsquid/evm-abi' -import type { EventParams as EParams, FunctionArguments, FunctionReturn } from '@subsquid/evm-abi' - -export const functions = { - getRate: viewFun("0x679aefce", "getRate()", {}, p.uint256), - rocketTokenRETH: viewFun("0xdb5dacc9", "rocketTokenRETH()", {}, p.address), -} - -export class Contract extends ContractBase { - - getRate() { - return this.eth_call(functions.getRate, {}) - } - - rocketTokenRETH() { - return this.eth_call(functions.rocketTokenRETH, {}) - } -} - -/// Function types -export type GetRateParams = FunctionArguments -export type GetRateReturn = FunctionReturn - -export type RocketTokenRETHParams = FunctionArguments -export type RocketTokenRETHReturn = FunctionReturn - diff --git a/src/abi/balancer-rate-provider/contract.ts b/src/abi/balancer-rate-provider/contract.ts new file mode 100644 index 00000000..a2ba56d5 --- /dev/null +++ b/src/abi/balancer-rate-provider/contract.ts @@ -0,0 +1,12 @@ +import { ContractBase } from '../abi.support.js' +import { getRate, rocketTokenRETH } from './functions.js' + +export class Contract extends ContractBase { + getRate() { + return this.eth_call(getRate, {}) + } + + rocketTokenRETH() { + return this.eth_call(rocketTokenRETH, {}) + } +} diff --git a/src/abi/balancer-rate-provider/functions.ts b/src/abi/balancer-rate-provider/functions.ts new file mode 100644 index 00000000..dc65f15a --- /dev/null +++ b/src/abi/balancer-rate-provider/functions.ts @@ -0,0 +1,13 @@ +import { address, uint256 } from '@subsquid/evm-codec' +import { func } from '../abi.support.js' +import type { FunctionArguments, FunctionReturn } from '../abi.support.js' + +/** getRate() */ +export const getRate = func('0x679aefce', {}, uint256) +export type GetRateParams = FunctionArguments +export type GetRateReturn = FunctionReturn + +/** rocketTokenRETH() */ +export const rocketTokenRETH = func('0xdb5dacc9', {}, address) +export type RocketTokenRETHParams = FunctionArguments +export type RocketTokenRETHReturn = FunctionReturn diff --git a/src/abi/balancer-rate-provider/index.ts b/src/abi/balancer-rate-provider/index.ts new file mode 100644 index 00000000..ed5306bd --- /dev/null +++ b/src/abi/balancer-rate-provider/index.ts @@ -0,0 +1,3 @@ +export * as functions from './functions.js' + +export { Contract } from './contract.js' diff --git a/src/abi/balancer-vault.ts b/src/abi/balancer-vault.ts deleted file mode 100644 index 60110113..00000000 --- a/src/abi/balancer-vault.ts +++ /dev/null @@ -1,192 +0,0 @@ -import * as p from '@subsquid/evm-codec' -import { event, fun, viewFun, indexed, ContractBase } from '@subsquid/evm-abi' -import type { EventParams as EParams, FunctionArguments, FunctionReturn } from '@subsquid/evm-abi' - -export const events = { - AuthorizerChanged: event("0x94b979b6831a51293e2641426f97747feed46f17779fed9cd18d1ecefcfe92ef", "AuthorizerChanged(address)", {"newAuthorizer": indexed(p.address)}), - ExternalBalanceTransfer: event("0x540a1a3f28340caec336c81d8d7b3df139ee5cdc1839a4f283d7ebb7eaae2d5c", "ExternalBalanceTransfer(address,address,address,uint256)", {"token": indexed(p.address), "sender": indexed(p.address), "recipient": p.address, "amount": p.uint256}), - FlashLoan: event("0x0d7d75e01ab95780d3cd1c8ec0dd6c2ce19e3a20427eec8bf53283b6fb8e95f0", "FlashLoan(address,address,uint256,uint256)", {"recipient": indexed(p.address), "token": indexed(p.address), "amount": p.uint256, "feeAmount": p.uint256}), - InternalBalanceChanged: event("0x18e1ea4139e68413d7d08aa752e71568e36b2c5bf940893314c2c5b01eaa0c42", "InternalBalanceChanged(address,address,int256)", {"user": indexed(p.address), "token": indexed(p.address), "delta": p.int256}), - PausedStateChanged: event("0x9e3a5e37224532dea67b89face185703738a228a6e8a23dee546960180d3be64", "PausedStateChanged(bool)", {"paused": p.bool}), - PoolBalanceChanged: event("0xe5ce249087ce04f05a957192435400fd97868dba0e6a4b4c049abf8af80dae78", "PoolBalanceChanged(bytes32,address,address[],int256[],uint256[])", {"poolId": indexed(p.bytes32), "liquidityProvider": indexed(p.address), "tokens": p.array(p.address), "deltas": p.array(p.int256), "protocolFeeAmounts": p.array(p.uint256)}), - PoolBalanceManaged: event("0x6edcaf6241105b4c94c2efdbf3a6b12458eb3d07be3a0e81d24b13c44045fe7a", "PoolBalanceManaged(bytes32,address,address,int256,int256)", {"poolId": indexed(p.bytes32), "assetManager": indexed(p.address), "token": indexed(p.address), "cashDelta": p.int256, "managedDelta": p.int256}), - PoolRegistered: event("0x3c13bc30b8e878c53fd2a36b679409c073afd75950be43d8858768e956fbc20e", "PoolRegistered(bytes32,address,uint8)", {"poolId": indexed(p.bytes32), "poolAddress": indexed(p.address), "specialization": p.uint8}), - RelayerApprovalChanged: event("0x46961fdb4502b646d5095fba7600486a8ac05041d55cdf0f16ed677180b5cad8", "RelayerApprovalChanged(address,address,bool)", {"relayer": indexed(p.address), "sender": indexed(p.address), "approved": p.bool}), - Swap: event("0x2170c741c41531aec20e7c107c24eecfdd15e69c9bb0a8dd37b1840b9e0b207b", "Swap(bytes32,address,address,uint256,uint256)", {"poolId": indexed(p.bytes32), "tokenIn": indexed(p.address), "tokenOut": indexed(p.address), "amountIn": p.uint256, "amountOut": p.uint256}), - TokensDeregistered: event("0x7dcdc6d02ef40c7c1a7046a011b058bd7f988fa14e20a66344f9d4e60657d610", "TokensDeregistered(bytes32,address[])", {"poolId": indexed(p.bytes32), "tokens": p.array(p.address)}), - TokensRegistered: event("0xf5847d3f2197b16cdcd2098ec95d0905cd1abdaf415f07bb7cef2bba8ac5dec4", "TokensRegistered(bytes32,address[],address[])", {"poolId": indexed(p.bytes32), "tokens": p.array(p.address), "assetManagers": p.array(p.address)}), -} - -export const functions = { - WETH: viewFun("0xad5c4648", "WETH()", {}, p.address), - batchSwap: fun("0x945bcec9", "batchSwap(uint8,(bytes32,uint256,uint256,uint256,bytes)[],address[],(address,bool,address,bool),int256[],uint256)", {"kind": p.uint8, "swaps": p.array(p.struct({"poolId": p.bytes32, "assetInIndex": p.uint256, "assetOutIndex": p.uint256, "amount": p.uint256, "userData": p.bytes})), "assets": p.array(p.address), "funds": p.struct({"sender": p.address, "fromInternalBalance": p.bool, "recipient": p.address, "toInternalBalance": p.bool}), "limits": p.array(p.int256), "deadline": p.uint256}, p.array(p.int256)), - deregisterTokens: fun("0x7d3aeb96", "deregisterTokens(bytes32,address[])", {"poolId": p.bytes32, "tokens": p.array(p.address)}, ), - exitPool: fun("0x8bdb3913", "exitPool(bytes32,address,address,(address[],uint256[],bytes,bool))", {"poolId": p.bytes32, "sender": p.address, "recipient": p.address, "request": p.struct({"assets": p.array(p.address), "minAmountsOut": p.array(p.uint256), "userData": p.bytes, "toInternalBalance": p.bool})}, ), - flashLoan: fun("0x5c38449e", "flashLoan(address,address[],uint256[],bytes)", {"recipient": p.address, "tokens": p.array(p.address), "amounts": p.array(p.uint256), "userData": p.bytes}, ), - getActionId: viewFun("0x851c1bb3", "getActionId(bytes4)", {"selector": p.bytes4}, p.bytes32), - getAuthorizer: viewFun("0xaaabadc5", "getAuthorizer()", {}, p.address), - getDomainSeparator: viewFun("0xed24911d", "getDomainSeparator()", {}, p.bytes32), - getInternalBalance: viewFun("0x0f5a6efa", "getInternalBalance(address,address[])", {"user": p.address, "tokens": p.array(p.address)}, p.array(p.uint256)), - getNextNonce: viewFun("0x90193b7c", "getNextNonce(address)", {"user": p.address}, p.uint256), - getPausedState: viewFun("0x1c0de051", "getPausedState()", {}, {"paused": p.bool, "pauseWindowEndTime": p.uint256, "bufferPeriodEndTime": p.uint256}), - getPool: viewFun("0xf6c00927", "getPool(bytes32)", {"poolId": p.bytes32}, {"_0": p.address, "_1": p.uint8}), - getPoolTokenInfo: viewFun("0xb05f8e48", "getPoolTokenInfo(bytes32,address)", {"poolId": p.bytes32, "token": p.address}, {"cash": p.uint256, "managed": p.uint256, "lastChangeBlock": p.uint256, "assetManager": p.address}), - getPoolTokens: viewFun("0xf94d4668", "getPoolTokens(bytes32)", {"poolId": p.bytes32}, {"tokens": p.array(p.address), "balances": p.array(p.uint256), "lastChangeBlock": p.uint256}), - getProtocolFeesCollector: viewFun("0xd2946c2b", "getProtocolFeesCollector()", {}, p.address), - hasApprovedRelayer: viewFun("0xfec90d72", "hasApprovedRelayer(address,address)", {"user": p.address, "relayer": p.address}, p.bool), - joinPool: fun("0xb95cac28", "joinPool(bytes32,address,address,(address[],uint256[],bytes,bool))", {"poolId": p.bytes32, "sender": p.address, "recipient": p.address, "request": p.struct({"assets": p.array(p.address), "maxAmountsIn": p.array(p.uint256), "userData": p.bytes, "fromInternalBalance": p.bool})}, ), - managePoolBalance: fun("0xe6c46092", "managePoolBalance((uint8,bytes32,address,uint256)[])", {"ops": p.array(p.struct({"kind": p.uint8, "poolId": p.bytes32, "token": p.address, "amount": p.uint256}))}, ), - manageUserBalance: fun("0x0e8e3e84", "manageUserBalance((uint8,address,uint256,address,address)[])", {"ops": p.array(p.struct({"kind": p.uint8, "asset": p.address, "amount": p.uint256, "sender": p.address, "recipient": p.address}))}, ), - queryBatchSwap: fun("0xf84d066e", "queryBatchSwap(uint8,(bytes32,uint256,uint256,uint256,bytes)[],address[],(address,bool,address,bool))", {"kind": p.uint8, "swaps": p.array(p.struct({"poolId": p.bytes32, "assetInIndex": p.uint256, "assetOutIndex": p.uint256, "amount": p.uint256, "userData": p.bytes})), "assets": p.array(p.address), "funds": p.struct({"sender": p.address, "fromInternalBalance": p.bool, "recipient": p.address, "toInternalBalance": p.bool})}, p.array(p.int256)), - registerPool: fun("0x09b2760f", "registerPool(uint8)", {"specialization": p.uint8}, p.bytes32), - registerTokens: fun("0x66a9c7d2", "registerTokens(bytes32,address[],address[])", {"poolId": p.bytes32, "tokens": p.array(p.address), "assetManagers": p.array(p.address)}, ), - setAuthorizer: fun("0x058a628f", "setAuthorizer(address)", {"newAuthorizer": p.address}, ), - setPaused: fun("0x16c38b3c", "setPaused(bool)", {"paused": p.bool}, ), - setRelayerApproval: fun("0xfa6e671d", "setRelayerApproval(address,address,bool)", {"sender": p.address, "relayer": p.address, "approved": p.bool}, ), - swap: fun("0x52bbbe29", "swap((bytes32,uint8,address,address,uint256,bytes),(address,bool,address,bool),uint256,uint256)", {"singleSwap": p.struct({"poolId": p.bytes32, "kind": p.uint8, "assetIn": p.address, "assetOut": p.address, "amount": p.uint256, "userData": p.bytes}), "funds": p.struct({"sender": p.address, "fromInternalBalance": p.bool, "recipient": p.address, "toInternalBalance": p.bool}), "limit": p.uint256, "deadline": p.uint256}, p.uint256), -} - -export class Contract extends ContractBase { - - WETH() { - return this.eth_call(functions.WETH, {}) - } - - getActionId(selector: GetActionIdParams["selector"]) { - return this.eth_call(functions.getActionId, {selector}) - } - - getAuthorizer() { - return this.eth_call(functions.getAuthorizer, {}) - } - - getDomainSeparator() { - return this.eth_call(functions.getDomainSeparator, {}) - } - - getInternalBalance(user: GetInternalBalanceParams["user"], tokens: GetInternalBalanceParams["tokens"]) { - return this.eth_call(functions.getInternalBalance, {user, tokens}) - } - - getNextNonce(user: GetNextNonceParams["user"]) { - return this.eth_call(functions.getNextNonce, {user}) - } - - getPausedState() { - return this.eth_call(functions.getPausedState, {}) - } - - getPool(poolId: GetPoolParams["poolId"]) { - return this.eth_call(functions.getPool, {poolId}) - } - - getPoolTokenInfo(poolId: GetPoolTokenInfoParams["poolId"], token: GetPoolTokenInfoParams["token"]) { - return this.eth_call(functions.getPoolTokenInfo, {poolId, token}) - } - - getPoolTokens(poolId: GetPoolTokensParams["poolId"]) { - return this.eth_call(functions.getPoolTokens, {poolId}) - } - - getProtocolFeesCollector() { - return this.eth_call(functions.getProtocolFeesCollector, {}) - } - - hasApprovedRelayer(user: HasApprovedRelayerParams["user"], relayer: HasApprovedRelayerParams["relayer"]) { - return this.eth_call(functions.hasApprovedRelayer, {user, relayer}) - } -} - -/// Event types -export type AuthorizerChangedEventArgs = EParams -export type ExternalBalanceTransferEventArgs = EParams -export type FlashLoanEventArgs = EParams -export type InternalBalanceChangedEventArgs = EParams -export type PausedStateChangedEventArgs = EParams -export type PoolBalanceChangedEventArgs = EParams -export type PoolBalanceManagedEventArgs = EParams -export type PoolRegisteredEventArgs = EParams -export type RelayerApprovalChangedEventArgs = EParams -export type SwapEventArgs = EParams -export type TokensDeregisteredEventArgs = EParams -export type TokensRegisteredEventArgs = EParams - -/// Function types -export type WETHParams = FunctionArguments -export type WETHReturn = FunctionReturn - -export type BatchSwapParams = FunctionArguments -export type BatchSwapReturn = FunctionReturn - -export type DeregisterTokensParams = FunctionArguments -export type DeregisterTokensReturn = FunctionReturn - -export type ExitPoolParams = FunctionArguments -export type ExitPoolReturn = FunctionReturn - -export type FlashLoanParams = FunctionArguments -export type FlashLoanReturn = FunctionReturn - -export type GetActionIdParams = FunctionArguments -export type GetActionIdReturn = FunctionReturn - -export type GetAuthorizerParams = FunctionArguments -export type GetAuthorizerReturn = FunctionReturn - -export type GetDomainSeparatorParams = FunctionArguments -export type GetDomainSeparatorReturn = FunctionReturn - -export type GetInternalBalanceParams = FunctionArguments -export type GetInternalBalanceReturn = FunctionReturn - -export type GetNextNonceParams = FunctionArguments -export type GetNextNonceReturn = FunctionReturn - -export type GetPausedStateParams = FunctionArguments -export type GetPausedStateReturn = FunctionReturn - -export type GetPoolParams = FunctionArguments -export type GetPoolReturn = FunctionReturn - -export type GetPoolTokenInfoParams = FunctionArguments -export type GetPoolTokenInfoReturn = FunctionReturn - -export type GetPoolTokensParams = FunctionArguments -export type GetPoolTokensReturn = FunctionReturn - -export type GetProtocolFeesCollectorParams = FunctionArguments -export type GetProtocolFeesCollectorReturn = FunctionReturn - -export type HasApprovedRelayerParams = FunctionArguments -export type HasApprovedRelayerReturn = FunctionReturn - -export type JoinPoolParams = FunctionArguments -export type JoinPoolReturn = FunctionReturn - -export type ManagePoolBalanceParams = FunctionArguments -export type ManagePoolBalanceReturn = FunctionReturn - -export type ManageUserBalanceParams = FunctionArguments -export type ManageUserBalanceReturn = FunctionReturn - -export type QueryBatchSwapParams = FunctionArguments -export type QueryBatchSwapReturn = FunctionReturn - -export type RegisterPoolParams = FunctionArguments -export type RegisterPoolReturn = FunctionReturn - -export type RegisterTokensParams = FunctionArguments -export type RegisterTokensReturn = FunctionReturn - -export type SetAuthorizerParams = FunctionArguments -export type SetAuthorizerReturn = FunctionReturn - -export type SetPausedParams = FunctionArguments -export type SetPausedReturn = FunctionReturn - -export type SetRelayerApprovalParams = FunctionArguments -export type SetRelayerApprovalReturn = FunctionReturn - -export type SwapParams = FunctionArguments -export type SwapReturn = FunctionReturn - diff --git a/src/abi/balancer-vault/contract.ts b/src/abi/balancer-vault/contract.ts new file mode 100644 index 00000000..35cc2db5 --- /dev/null +++ b/src/abi/balancer-vault/contract.ts @@ -0,0 +1,69 @@ +import { ContractBase } from '../abi.support.js' +import { WETH, batchSwap, getActionId, getAuthorizer, getDomainSeparator, getInternalBalance, getNextNonce, getPausedState, getPool, getPoolTokenInfo, getPoolTokens, getProtocolFeesCollector, hasApprovedRelayer, queryBatchSwap, registerPool, swap } from './functions.js' +import type { BatchSwapParams, GetActionIdParams, GetInternalBalanceParams, GetNextNonceParams, GetPoolParams, GetPoolTokenInfoParams, GetPoolTokensParams, HasApprovedRelayerParams, QueryBatchSwapParams, RegisterPoolParams, SwapParams } from './functions.js' + +export class Contract extends ContractBase { + WETH() { + return this.eth_call(WETH, {}) + } + + batchSwap(kind: BatchSwapParams["kind"], swaps: BatchSwapParams["swaps"], assets: BatchSwapParams["assets"], funds: BatchSwapParams["funds"], limits: BatchSwapParams["limits"], deadline: BatchSwapParams["deadline"]) { + return this.eth_call(batchSwap, {kind, swaps, assets, funds, limits, deadline}) + } + + getActionId(selector: GetActionIdParams["selector"]) { + return this.eth_call(getActionId, {selector}) + } + + getAuthorizer() { + return this.eth_call(getAuthorizer, {}) + } + + getDomainSeparator() { + return this.eth_call(getDomainSeparator, {}) + } + + getInternalBalance(user: GetInternalBalanceParams["user"], tokens: GetInternalBalanceParams["tokens"]) { + return this.eth_call(getInternalBalance, {user, tokens}) + } + + getNextNonce(user: GetNextNonceParams["user"]) { + return this.eth_call(getNextNonce, {user}) + } + + getPausedState() { + return this.eth_call(getPausedState, {}) + } + + getPool(poolId: GetPoolParams["poolId"]) { + return this.eth_call(getPool, {poolId}) + } + + getPoolTokenInfo(poolId: GetPoolTokenInfoParams["poolId"], token: GetPoolTokenInfoParams["token"]) { + return this.eth_call(getPoolTokenInfo, {poolId, token}) + } + + getPoolTokens(poolId: GetPoolTokensParams["poolId"]) { + return this.eth_call(getPoolTokens, {poolId}) + } + + getProtocolFeesCollector() { + return this.eth_call(getProtocolFeesCollector, {}) + } + + hasApprovedRelayer(user: HasApprovedRelayerParams["user"], relayer: HasApprovedRelayerParams["relayer"]) { + return this.eth_call(hasApprovedRelayer, {user, relayer}) + } + + queryBatchSwap(kind: QueryBatchSwapParams["kind"], swaps: QueryBatchSwapParams["swaps"], assets: QueryBatchSwapParams["assets"], funds: QueryBatchSwapParams["funds"]) { + return this.eth_call(queryBatchSwap, {kind, swaps, assets, funds}) + } + + registerPool(specialization: RegisterPoolParams["specialization"]) { + return this.eth_call(registerPool, {specialization}) + } + + swap(singleSwap: SwapParams["singleSwap"], funds: SwapParams["funds"], limit: SwapParams["limit"], deadline: SwapParams["deadline"]) { + return this.eth_call(swap, {singleSwap, funds, limit, deadline}) + } +} diff --git a/src/abi/balancer-vault/events.ts b/src/abi/balancer-vault/events.ts new file mode 100644 index 00000000..1d94c004 --- /dev/null +++ b/src/abi/balancer-vault/events.ts @@ -0,0 +1,102 @@ +import { address, array, bool, bytes32, int256, uint256, uint8 } from '@subsquid/evm-codec' +import { event, indexed } from '../abi.support.js' +import type { EventParams as EParams } from '../abi.support.js' + +/** AuthorizerChanged(address) */ +export const AuthorizerChanged = event('0x94b979b6831a51293e2641426f97747feed46f17779fed9cd18d1ecefcfe92ef', { + newAuthorizer: indexed(address), +}) +export type AuthorizerChangedEventArgs = EParams + +/** ExternalBalanceTransfer(address,address,address,uint256) */ +export const ExternalBalanceTransfer = event('0x540a1a3f28340caec336c81d8d7b3df139ee5cdc1839a4f283d7ebb7eaae2d5c', { + token: indexed(address), + sender: indexed(address), + recipient: address, + amount: uint256, +}) +export type ExternalBalanceTransferEventArgs = EParams + +/** FlashLoan(address,address,uint256,uint256) */ +export const FlashLoan = event('0x0d7d75e01ab95780d3cd1c8ec0dd6c2ce19e3a20427eec8bf53283b6fb8e95f0', { + recipient: indexed(address), + token: indexed(address), + amount: uint256, + feeAmount: uint256, +}) +export type FlashLoanEventArgs = EParams + +/** InternalBalanceChanged(address,address,int256) */ +export const InternalBalanceChanged = event('0x18e1ea4139e68413d7d08aa752e71568e36b2c5bf940893314c2c5b01eaa0c42', { + user: indexed(address), + token: indexed(address), + delta: int256, +}) +export type InternalBalanceChangedEventArgs = EParams + +/** PausedStateChanged(bool) */ +export const PausedStateChanged = event('0x9e3a5e37224532dea67b89face185703738a228a6e8a23dee546960180d3be64', { + paused: bool, +}) +export type PausedStateChangedEventArgs = EParams + +/** PoolBalanceChanged(bytes32,address,address[],int256[],uint256[]) */ +export const PoolBalanceChanged = event('0xe5ce249087ce04f05a957192435400fd97868dba0e6a4b4c049abf8af80dae78', { + poolId: indexed(bytes32), + liquidityProvider: indexed(address), + tokens: array(address), + deltas: array(int256), + protocolFeeAmounts: array(uint256), +}) +export type PoolBalanceChangedEventArgs = EParams + +/** PoolBalanceManaged(bytes32,address,address,int256,int256) */ +export const PoolBalanceManaged = event('0x6edcaf6241105b4c94c2efdbf3a6b12458eb3d07be3a0e81d24b13c44045fe7a', { + poolId: indexed(bytes32), + assetManager: indexed(address), + token: indexed(address), + cashDelta: int256, + managedDelta: int256, +}) +export type PoolBalanceManagedEventArgs = EParams + +/** PoolRegistered(bytes32,address,uint8) */ +export const PoolRegistered = event('0x3c13bc30b8e878c53fd2a36b679409c073afd75950be43d8858768e956fbc20e', { + poolId: indexed(bytes32), + poolAddress: indexed(address), + specialization: uint8, +}) +export type PoolRegisteredEventArgs = EParams + +/** RelayerApprovalChanged(address,address,bool) */ +export const RelayerApprovalChanged = event('0x46961fdb4502b646d5095fba7600486a8ac05041d55cdf0f16ed677180b5cad8', { + relayer: indexed(address), + sender: indexed(address), + approved: bool, +}) +export type RelayerApprovalChangedEventArgs = EParams + +/** Swap(bytes32,address,address,uint256,uint256) */ +export const Swap = event('0x2170c741c41531aec20e7c107c24eecfdd15e69c9bb0a8dd37b1840b9e0b207b', { + poolId: indexed(bytes32), + tokenIn: indexed(address), + tokenOut: indexed(address), + amountIn: uint256, + amountOut: uint256, +}) +export type SwapEventArgs = EParams + +/** TokensDeregistered(bytes32,address[]) */ +export const TokensDeregistered = event('0x7dcdc6d02ef40c7c1a7046a011b058bd7f988fa14e20a66344f9d4e60657d610', { + poolId: indexed(bytes32), + tokens: array(address), +}) +export type TokensDeregisteredEventArgs = EParams + +/** TokensRegistered(bytes32,address[],address[]) */ +export const TokensRegistered = event('0xf5847d3f2197b16cdcd2098ec95d0905cd1abdaf415f07bb7cef2bba8ac5dec4', { + poolId: indexed(bytes32), + tokens: array(address), + assetManagers: array(address), +}) +export type TokensRegisteredEventArgs = EParams diff --git a/src/abi/balancer-vault/functions.ts b/src/abi/balancer-vault/functions.ts new file mode 100644 index 00000000..a5da3d33 --- /dev/null +++ b/src/abi/balancer-vault/functions.ts @@ -0,0 +1,274 @@ +import { address, array, bool, bytes, bytes32, bytes4, int256, struct, uint256, uint8 } from '@subsquid/evm-codec' +import { func } from '../abi.support.js' +import type { FunctionArguments, FunctionReturn } from '../abi.support.js' + +/** WETH() */ +export const WETH = func('0xad5c4648', {}, address) +export type WETHParams = FunctionArguments +export type WETHReturn = FunctionReturn + +/** batchSwap(uint8,(bytes32,uint256,uint256,uint256,bytes)[],address[],(address,bool,address,bool),int256[],uint256) */ +export const batchSwap = func('0x945bcec9', { + kind: uint8, + swaps: array(struct({ + poolId: bytes32, + assetInIndex: uint256, + assetOutIndex: uint256, + amount: uint256, + userData: bytes, + })), + assets: array(address), + funds: struct({ + sender: address, + fromInternalBalance: bool, + recipient: address, + toInternalBalance: bool, + }), + limits: array(int256), + deadline: uint256, +}, array(int256)) +export type BatchSwapParams = FunctionArguments +export type BatchSwapReturn = FunctionReturn + +/** deregisterTokens(bytes32,address[]) */ +export const deregisterTokens = func('0x7d3aeb96', { + poolId: bytes32, + tokens: array(address), +}) +export type DeregisterTokensParams = FunctionArguments +export type DeregisterTokensReturn = FunctionReturn + +/** exitPool(bytes32,address,address,(address[],uint256[],bytes,bool)) */ +export const exitPool = func('0x8bdb3913', { + poolId: bytes32, + sender: address, + recipient: address, + request: struct({ + assets: array(address), + minAmountsOut: array(uint256), + userData: bytes, + toInternalBalance: bool, + }), +}) +export type ExitPoolParams = FunctionArguments +export type ExitPoolReturn = FunctionReturn + +/** flashLoan(address,address[],uint256[],bytes) */ +export const flashLoan = func('0x5c38449e', { + recipient: address, + tokens: array(address), + amounts: array(uint256), + userData: bytes, +}) +export type FlashLoanParams = FunctionArguments +export type FlashLoanReturn = FunctionReturn + +/** getActionId(bytes4) */ +export const getActionId = func('0x851c1bb3', { + selector: bytes4, +}, bytes32) +export type GetActionIdParams = FunctionArguments +export type GetActionIdReturn = FunctionReturn + +/** getAuthorizer() */ +export const getAuthorizer = func('0xaaabadc5', {}, address) +export type GetAuthorizerParams = FunctionArguments +export type GetAuthorizerReturn = FunctionReturn + +/** getDomainSeparator() */ +export const getDomainSeparator = func('0xed24911d', {}, bytes32) +export type GetDomainSeparatorParams = FunctionArguments +export type GetDomainSeparatorReturn = FunctionReturn + +/** getInternalBalance(address,address[]) */ +export const getInternalBalance = func('0x0f5a6efa', { + user: address, + tokens: array(address), +}, array(uint256)) +export type GetInternalBalanceParams = FunctionArguments +export type GetInternalBalanceReturn = FunctionReturn + +/** getNextNonce(address) */ +export const getNextNonce = func('0x90193b7c', { + user: address, +}, uint256) +export type GetNextNonceParams = FunctionArguments +export type GetNextNonceReturn = FunctionReturn + +/** getPausedState() */ +export const getPausedState = func('0x1c0de051', {}, struct({ + paused: bool, + pauseWindowEndTime: uint256, + bufferPeriodEndTime: uint256, +})) +export type GetPausedStateParams = FunctionArguments +export type GetPausedStateReturn = FunctionReturn + +/** getPool(bytes32) */ +export const getPool = func('0xf6c00927', { + poolId: bytes32, +}, struct({ + _0: address, + _1: uint8, +})) +export type GetPoolParams = FunctionArguments +export type GetPoolReturn = FunctionReturn + +/** getPoolTokenInfo(bytes32,address) */ +export const getPoolTokenInfo = func('0xb05f8e48', { + poolId: bytes32, + token: address, +}, struct({ + cash: uint256, + managed: uint256, + lastChangeBlock: uint256, + assetManager: address, +})) +export type GetPoolTokenInfoParams = FunctionArguments +export type GetPoolTokenInfoReturn = FunctionReturn + +/** getPoolTokens(bytes32) */ +export const getPoolTokens = func('0xf94d4668', { + poolId: bytes32, +}, struct({ + tokens: array(address), + balances: array(uint256), + lastChangeBlock: uint256, +})) +export type GetPoolTokensParams = FunctionArguments +export type GetPoolTokensReturn = FunctionReturn + +/** getProtocolFeesCollector() */ +export const getProtocolFeesCollector = func('0xd2946c2b', {}, address) +export type GetProtocolFeesCollectorParams = FunctionArguments +export type GetProtocolFeesCollectorReturn = FunctionReturn + +/** hasApprovedRelayer(address,address) */ +export const hasApprovedRelayer = func('0xfec90d72', { + user: address, + relayer: address, +}, bool) +export type HasApprovedRelayerParams = FunctionArguments +export type HasApprovedRelayerReturn = FunctionReturn + +/** joinPool(bytes32,address,address,(address[],uint256[],bytes,bool)) */ +export const joinPool = func('0xb95cac28', { + poolId: bytes32, + sender: address, + recipient: address, + request: struct({ + assets: array(address), + maxAmountsIn: array(uint256), + userData: bytes, + fromInternalBalance: bool, + }), +}) +export type JoinPoolParams = FunctionArguments +export type JoinPoolReturn = FunctionReturn + +/** managePoolBalance((uint8,bytes32,address,uint256)[]) */ +export const managePoolBalance = func('0xe6c46092', { + ops: array(struct({ + kind: uint8, + poolId: bytes32, + token: address, + amount: uint256, + })), +}) +export type ManagePoolBalanceParams = FunctionArguments +export type ManagePoolBalanceReturn = FunctionReturn + +/** manageUserBalance((uint8,address,uint256,address,address)[]) */ +export const manageUserBalance = func('0x0e8e3e84', { + ops: array(struct({ + kind: uint8, + asset: address, + amount: uint256, + sender: address, + recipient: address, + })), +}) +export type ManageUserBalanceParams = FunctionArguments +export type ManageUserBalanceReturn = FunctionReturn + +/** queryBatchSwap(uint8,(bytes32,uint256,uint256,uint256,bytes)[],address[],(address,bool,address,bool)) */ +export const queryBatchSwap = func('0xf84d066e', { + kind: uint8, + swaps: array(struct({ + poolId: bytes32, + assetInIndex: uint256, + assetOutIndex: uint256, + amount: uint256, + userData: bytes, + })), + assets: array(address), + funds: struct({ + sender: address, + fromInternalBalance: bool, + recipient: address, + toInternalBalance: bool, + }), +}, array(int256)) +export type QueryBatchSwapParams = FunctionArguments +export type QueryBatchSwapReturn = FunctionReturn + +/** registerPool(uint8) */ +export const registerPool = func('0x09b2760f', { + specialization: uint8, +}, bytes32) +export type RegisterPoolParams = FunctionArguments +export type RegisterPoolReturn = FunctionReturn + +/** registerTokens(bytes32,address[],address[]) */ +export const registerTokens = func('0x66a9c7d2', { + poolId: bytes32, + tokens: array(address), + assetManagers: array(address), +}) +export type RegisterTokensParams = FunctionArguments +export type RegisterTokensReturn = FunctionReturn + +/** setAuthorizer(address) */ +export const setAuthorizer = func('0x058a628f', { + newAuthorizer: address, +}) +export type SetAuthorizerParams = FunctionArguments +export type SetAuthorizerReturn = FunctionReturn + +/** setPaused(bool) */ +export const setPaused = func('0x16c38b3c', { + paused: bool, +}) +export type SetPausedParams = FunctionArguments +export type SetPausedReturn = FunctionReturn + +/** setRelayerApproval(address,address,bool) */ +export const setRelayerApproval = func('0xfa6e671d', { + sender: address, + relayer: address, + approved: bool, +}) +export type SetRelayerApprovalParams = FunctionArguments +export type SetRelayerApprovalReturn = FunctionReturn + +/** swap((bytes32,uint8,address,address,uint256,bytes),(address,bool,address,bool),uint256,uint256) */ +export const swap = func('0x52bbbe29', { + singleSwap: struct({ + poolId: bytes32, + kind: uint8, + assetIn: address, + assetOut: address, + amount: uint256, + userData: bytes, + }), + funds: struct({ + sender: address, + fromInternalBalance: bool, + recipient: address, + toInternalBalance: bool, + }), + limit: uint256, + deadline: uint256, +}, uint256) +export type SwapParams = FunctionArguments +export type SwapReturn = FunctionReturn diff --git a/src/abi/balancer-vault/index.ts b/src/abi/balancer-vault/index.ts new file mode 100644 index 00000000..11829d6e --- /dev/null +++ b/src/abi/balancer-vault/index.ts @@ -0,0 +1,4 @@ +export * as events from './events.js' +export * as functions from './functions.js' + +export { Contract } from './contract.js' diff --git a/src/abi/base-reward-pool.ts b/src/abi/base-reward-pool.ts deleted file mode 100644 index 197b8f38..00000000 --- a/src/abi/base-reward-pool.ts +++ /dev/null @@ -1,260 +0,0 @@ -import * as p from '@subsquid/evm-codec' -import { event, fun, viewFun, indexed, ContractBase } from '@subsquid/evm-abi' -import type { EventParams as EParams, FunctionArguments, FunctionReturn } from '@subsquid/evm-abi' - -export const events = { - RewardAdded: event("0xde88a922e0d3b88b24e9623efeb464919c6bf9f66857a65e2bfcf2ce87a9433d", "RewardAdded(uint256)", {"reward": p.uint256}), - RewardPaid: event("0xe2403640ba68fed3a2f88b7557551d1993f84b99bb10ff833f0cf8db0c5e0486", "RewardPaid(address,uint256)", {"user": indexed(p.address), "reward": p.uint256}), - Staked: event("0x9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d", "Staked(address,uint256)", {"user": indexed(p.address), "amount": p.uint256}), - Withdrawn: event("0x7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5", "Withdrawn(address,uint256)", {"user": indexed(p.address), "amount": p.uint256}), -} - -export const functions = { - addExtraReward: fun("0x5e43c47b", "addExtraReward(address)", {"_reward": p.address}, p.bool), - balanceOf: viewFun("0x70a08231", "balanceOf(address)", {"account": p.address}, p.uint256), - clearExtraRewards: fun("0x0569d388", "clearExtraRewards()", {}, ), - currentRewards: viewFun("0x901a7d53", "currentRewards()", {}, p.uint256), - donate: fun("0xf14faf6f", "donate(uint256)", {"_amount": p.uint256}, p.bool), - duration: viewFun("0x0fb5a6b4", "duration()", {}, p.uint256), - earned: viewFun("0x008cc262", "earned(address)", {"account": p.address}, p.uint256), - extraRewards: viewFun("0x40c35446", "extraRewards(uint256)", {"_0": p.uint256}, p.address), - extraRewardsLength: viewFun("0xd55a23f4", "extraRewardsLength()", {}, p.uint256), - 'getReward()': fun("0x3d18b912", "getReward()", {}, p.bool), - 'getReward(address,bool)': fun("0x7050ccd9", "getReward(address,bool)", {"_account": p.address, "_claimExtras": p.bool}, p.bool), - historicalRewards: viewFun("0x262d3d6d", "historicalRewards()", {}, p.uint256), - lastTimeRewardApplicable: viewFun("0x80faa57d", "lastTimeRewardApplicable()", {}, p.uint256), - lastUpdateTime: viewFun("0xc8f33c91", "lastUpdateTime()", {}, p.uint256), - newRewardRatio: viewFun("0x6c8bcee8", "newRewardRatio()", {}, p.uint256), - operator: viewFun("0x570ca735", "operator()", {}, p.address), - periodFinish: viewFun("0xebe2b12b", "periodFinish()", {}, p.uint256), - pid: viewFun("0xf1068454", "pid()", {}, p.uint256), - queueNewRewards: fun("0x590a41f5", "queueNewRewards(uint256)", {"_rewards": p.uint256}, p.bool), - queuedRewards: viewFun("0x63d38c3b", "queuedRewards()", {}, p.uint256), - rewardManager: viewFun("0x0f4ef8a6", "rewardManager()", {}, p.address), - rewardPerToken: viewFun("0xcd3daf9d", "rewardPerToken()", {}, p.uint256), - rewardPerTokenStored: viewFun("0xdf136d65", "rewardPerTokenStored()", {}, p.uint256), - rewardRate: viewFun("0x7b0a47ee", "rewardRate()", {}, p.uint256), - rewardToken: viewFun("0xf7c618c1", "rewardToken()", {}, p.address), - rewards: viewFun("0x0700037d", "rewards(address)", {"_0": p.address}, p.uint256), - stake: fun("0xa694fc3a", "stake(uint256)", {"_amount": p.uint256}, p.bool), - stakeAll: fun("0x8dcb4061", "stakeAll()", {}, p.bool), - stakeFor: fun("0x2ee40908", "stakeFor(address,uint256)", {"_for": p.address, "_amount": p.uint256}, p.bool), - stakingToken: viewFun("0x72f702f3", "stakingToken()", {}, p.address), - totalSupply: viewFun("0x18160ddd", "totalSupply()", {}, p.uint256), - userRewardPerTokenPaid: viewFun("0x8b876347", "userRewardPerTokenPaid(address)", {"_0": p.address}, p.uint256), - withdraw: fun("0x38d07436", "withdraw(uint256,bool)", {"amount": p.uint256, "claim": p.bool}, p.bool), - withdrawAll: fun("0x1c1c6fe5", "withdrawAll(bool)", {"claim": p.bool}, ), - withdrawAllAndUnwrap: fun("0x49f039a2", "withdrawAllAndUnwrap(bool)", {"claim": p.bool}, ), - withdrawAndUnwrap: fun("0xc32e7202", "withdrawAndUnwrap(uint256,bool)", {"amount": p.uint256, "claim": p.bool}, p.bool), -} - -export class Contract extends ContractBase { - - balanceOf(account: BalanceOfParams["account"]) { - return this.eth_call(functions.balanceOf, {account}) - } - - currentRewards() { - return this.eth_call(functions.currentRewards, {}) - } - - duration() { - return this.eth_call(functions.duration, {}) - } - - earned(account: EarnedParams["account"]) { - return this.eth_call(functions.earned, {account}) - } - - extraRewards(_0: ExtraRewardsParams["_0"]) { - return this.eth_call(functions.extraRewards, {_0}) - } - - extraRewardsLength() { - return this.eth_call(functions.extraRewardsLength, {}) - } - - historicalRewards() { - return this.eth_call(functions.historicalRewards, {}) - } - - lastTimeRewardApplicable() { - return this.eth_call(functions.lastTimeRewardApplicable, {}) - } - - lastUpdateTime() { - return this.eth_call(functions.lastUpdateTime, {}) - } - - newRewardRatio() { - return this.eth_call(functions.newRewardRatio, {}) - } - - operator() { - return this.eth_call(functions.operator, {}) - } - - periodFinish() { - return this.eth_call(functions.periodFinish, {}) - } - - pid() { - return this.eth_call(functions.pid, {}) - } - - queuedRewards() { - return this.eth_call(functions.queuedRewards, {}) - } - - rewardManager() { - return this.eth_call(functions.rewardManager, {}) - } - - rewardPerToken() { - return this.eth_call(functions.rewardPerToken, {}) - } - - rewardPerTokenStored() { - return this.eth_call(functions.rewardPerTokenStored, {}) - } - - rewardRate() { - return this.eth_call(functions.rewardRate, {}) - } - - rewardToken() { - return this.eth_call(functions.rewardToken, {}) - } - - rewards(_0: RewardsParams["_0"]) { - return this.eth_call(functions.rewards, {_0}) - } - - stakingToken() { - return this.eth_call(functions.stakingToken, {}) - } - - totalSupply() { - return this.eth_call(functions.totalSupply, {}) - } - - userRewardPerTokenPaid(_0: UserRewardPerTokenPaidParams["_0"]) { - return this.eth_call(functions.userRewardPerTokenPaid, {_0}) - } -} - -/// Event types -export type RewardAddedEventArgs = EParams -export type RewardPaidEventArgs = EParams -export type StakedEventArgs = EParams -export type WithdrawnEventArgs = EParams - -/// Function types -export type AddExtraRewardParams = FunctionArguments -export type AddExtraRewardReturn = FunctionReturn - -export type BalanceOfParams = FunctionArguments -export type BalanceOfReturn = FunctionReturn - -export type ClearExtraRewardsParams = FunctionArguments -export type ClearExtraRewardsReturn = FunctionReturn - -export type CurrentRewardsParams = FunctionArguments -export type CurrentRewardsReturn = FunctionReturn - -export type DonateParams = FunctionArguments -export type DonateReturn = FunctionReturn - -export type DurationParams = FunctionArguments -export type DurationReturn = FunctionReturn - -export type EarnedParams = FunctionArguments -export type EarnedReturn = FunctionReturn - -export type ExtraRewardsParams = FunctionArguments -export type ExtraRewardsReturn = FunctionReturn - -export type ExtraRewardsLengthParams = FunctionArguments -export type ExtraRewardsLengthReturn = FunctionReturn - -export type GetRewardParams_0 = FunctionArguments -export type GetRewardReturn_0 = FunctionReturn - -export type GetRewardParams_1 = FunctionArguments -export type GetRewardReturn_1 = FunctionReturn - -export type HistoricalRewardsParams = FunctionArguments -export type HistoricalRewardsReturn = FunctionReturn - -export type LastTimeRewardApplicableParams = FunctionArguments -export type LastTimeRewardApplicableReturn = FunctionReturn - -export type LastUpdateTimeParams = FunctionArguments -export type LastUpdateTimeReturn = FunctionReturn - -export type NewRewardRatioParams = FunctionArguments -export type NewRewardRatioReturn = FunctionReturn - -export type OperatorParams = FunctionArguments -export type OperatorReturn = FunctionReturn - -export type PeriodFinishParams = FunctionArguments -export type PeriodFinishReturn = FunctionReturn - -export type PidParams = FunctionArguments -export type PidReturn = FunctionReturn - -export type QueueNewRewardsParams = FunctionArguments -export type QueueNewRewardsReturn = FunctionReturn - -export type QueuedRewardsParams = FunctionArguments -export type QueuedRewardsReturn = FunctionReturn - -export type RewardManagerParams = FunctionArguments -export type RewardManagerReturn = FunctionReturn - -export type RewardPerTokenParams = FunctionArguments -export type RewardPerTokenReturn = FunctionReturn - -export type RewardPerTokenStoredParams = FunctionArguments -export type RewardPerTokenStoredReturn = FunctionReturn - -export type RewardRateParams = FunctionArguments -export type RewardRateReturn = FunctionReturn - -export type RewardTokenParams = FunctionArguments -export type RewardTokenReturn = FunctionReturn - -export type RewardsParams = FunctionArguments -export type RewardsReturn = FunctionReturn - -export type StakeParams = FunctionArguments -export type StakeReturn = FunctionReturn - -export type StakeAllParams = FunctionArguments -export type StakeAllReturn = FunctionReturn - -export type StakeForParams = FunctionArguments -export type StakeForReturn = FunctionReturn - -export type StakingTokenParams = FunctionArguments -export type StakingTokenReturn = FunctionReturn - -export type TotalSupplyParams = FunctionArguments -export type TotalSupplyReturn = FunctionReturn - -export type UserRewardPerTokenPaidParams = FunctionArguments -export type UserRewardPerTokenPaidReturn = FunctionReturn - -export type WithdrawParams = FunctionArguments -export type WithdrawReturn = FunctionReturn - -export type WithdrawAllParams = FunctionArguments -export type WithdrawAllReturn = FunctionReturn - -export type WithdrawAllAndUnwrapParams = FunctionArguments -export type WithdrawAllAndUnwrapReturn = FunctionReturn - -export type WithdrawAndUnwrapParams = FunctionArguments -export type WithdrawAndUnwrapReturn = FunctionReturn - diff --git a/src/abi/base-reward-pool/contract.ts b/src/abi/base-reward-pool/contract.ts new file mode 100644 index 00000000..04c6da6e --- /dev/null +++ b/src/abi/base-reward-pool/contract.ts @@ -0,0 +1,137 @@ +import { ContractBase } from '../abi.support.js' +import { addExtraReward, balanceOf, currentRewards, donate, duration, earned, extraRewards, extraRewardsLength, getReward, getReward_1, historicalRewards, lastTimeRewardApplicable, lastUpdateTime, newRewardRatio, operator, periodFinish, pid, queueNewRewards, queuedRewards, rewardManager, rewardPerToken, rewardPerTokenStored, rewardRate, rewardToken, rewards, stake, stakeAll, stakeFor, stakingToken, totalSupply, userRewardPerTokenPaid, withdraw, withdrawAndUnwrap } from './functions.js' +import type { AddExtraRewardParams, BalanceOfParams, DonateParams, EarnedParams, ExtraRewardsParams, GetRewardParams_1, QueueNewRewardsParams, RewardsParams, StakeForParams, StakeParams, UserRewardPerTokenPaidParams, WithdrawAndUnwrapParams, WithdrawParams } from './functions.js' + +export class Contract extends ContractBase { + addExtraReward(_reward: AddExtraRewardParams["_reward"]) { + return this.eth_call(addExtraReward, {_reward}) + } + + balanceOf(account: BalanceOfParams["account"]) { + return this.eth_call(balanceOf, {account}) + } + + currentRewards() { + return this.eth_call(currentRewards, {}) + } + + donate(_amount: DonateParams["_amount"]) { + return this.eth_call(donate, {_amount}) + } + + duration() { + return this.eth_call(duration, {}) + } + + earned(account: EarnedParams["account"]) { + return this.eth_call(earned, {account}) + } + + extraRewards(_0: ExtraRewardsParams["_0"]) { + return this.eth_call(extraRewards, {_0}) + } + + extraRewardsLength() { + return this.eth_call(extraRewardsLength, {}) + } + + getReward() { + return this.eth_call(getReward, {}) + } + + getReward_1(_account: GetRewardParams_1["_account"], _claimExtras: GetRewardParams_1["_claimExtras"]) { + return this.eth_call(getReward_1, {_account, _claimExtras}) + } + + historicalRewards() { + return this.eth_call(historicalRewards, {}) + } + + lastTimeRewardApplicable() { + return this.eth_call(lastTimeRewardApplicable, {}) + } + + lastUpdateTime() { + return this.eth_call(lastUpdateTime, {}) + } + + newRewardRatio() { + return this.eth_call(newRewardRatio, {}) + } + + operator() { + return this.eth_call(operator, {}) + } + + periodFinish() { + return this.eth_call(periodFinish, {}) + } + + pid() { + return this.eth_call(pid, {}) + } + + queueNewRewards(_rewards: QueueNewRewardsParams["_rewards"]) { + return this.eth_call(queueNewRewards, {_rewards}) + } + + queuedRewards() { + return this.eth_call(queuedRewards, {}) + } + + rewardManager() { + return this.eth_call(rewardManager, {}) + } + + rewardPerToken() { + return this.eth_call(rewardPerToken, {}) + } + + rewardPerTokenStored() { + return this.eth_call(rewardPerTokenStored, {}) + } + + rewardRate() { + return this.eth_call(rewardRate, {}) + } + + rewardToken() { + return this.eth_call(rewardToken, {}) + } + + rewards(_0: RewardsParams["_0"]) { + return this.eth_call(rewards, {_0}) + } + + stake(_amount: StakeParams["_amount"]) { + return this.eth_call(stake, {_amount}) + } + + stakeAll() { + return this.eth_call(stakeAll, {}) + } + + stakeFor(_for: StakeForParams["_for"], _amount: StakeForParams["_amount"]) { + return this.eth_call(stakeFor, {_for, _amount}) + } + + stakingToken() { + return this.eth_call(stakingToken, {}) + } + + totalSupply() { + return this.eth_call(totalSupply, {}) + } + + userRewardPerTokenPaid(_0: UserRewardPerTokenPaidParams["_0"]) { + return this.eth_call(userRewardPerTokenPaid, {_0}) + } + + withdraw(amount: WithdrawParams["amount"], claim: WithdrawParams["claim"]) { + return this.eth_call(withdraw, {amount, claim}) + } + + withdrawAndUnwrap(amount: WithdrawAndUnwrapParams["amount"], claim: WithdrawAndUnwrapParams["claim"]) { + return this.eth_call(withdrawAndUnwrap, {amount, claim}) + } +} diff --git a/src/abi/base-reward-pool/events.ts b/src/abi/base-reward-pool/events.ts new file mode 100644 index 00000000..0551f7e4 --- /dev/null +++ b/src/abi/base-reward-pool/events.ts @@ -0,0 +1,30 @@ +import { address, uint256 } from '@subsquid/evm-codec' +import { event, indexed } from '../abi.support.js' +import type { EventParams as EParams } from '../abi.support.js' + +/** RewardAdded(uint256) */ +export const RewardAdded = event('0xde88a922e0d3b88b24e9623efeb464919c6bf9f66857a65e2bfcf2ce87a9433d', { + reward: uint256, +}) +export type RewardAddedEventArgs = EParams + +/** RewardPaid(address,uint256) */ +export const RewardPaid = event('0xe2403640ba68fed3a2f88b7557551d1993f84b99bb10ff833f0cf8db0c5e0486', { + user: indexed(address), + reward: uint256, +}) +export type RewardPaidEventArgs = EParams + +/** Staked(address,uint256) */ +export const Staked = event('0x9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d', { + user: indexed(address), + amount: uint256, +}) +export type StakedEventArgs = EParams + +/** Withdrawn(address,uint256) */ +export const Withdrawn = event('0x7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5', { + user: indexed(address), + amount: uint256, +}) +export type WithdrawnEventArgs = EParams diff --git a/src/abi/base-reward-pool/functions.ts b/src/abi/base-reward-pool/functions.ts new file mode 100644 index 00000000..7c300de4 --- /dev/null +++ b/src/abi/base-reward-pool/functions.ts @@ -0,0 +1,217 @@ +import { address, bool, uint256 } from '@subsquid/evm-codec' +import { func } from '../abi.support.js' +import type { FunctionArguments, FunctionReturn } from '../abi.support.js' + +/** addExtraReward(address) */ +export const addExtraReward = func('0x5e43c47b', { + _reward: address, +}, bool) +export type AddExtraRewardParams = FunctionArguments +export type AddExtraRewardReturn = FunctionReturn + +/** balanceOf(address) */ +export const balanceOf = func('0x70a08231', { + account: address, +}, uint256) +export type BalanceOfParams = FunctionArguments +export type BalanceOfReturn = FunctionReturn + +/** clearExtraRewards() */ +export const clearExtraRewards = func('0x0569d388', {}) +export type ClearExtraRewardsParams = FunctionArguments +export type ClearExtraRewardsReturn = FunctionReturn + +/** currentRewards() */ +export const currentRewards = func('0x901a7d53', {}, uint256) +export type CurrentRewardsParams = FunctionArguments +export type CurrentRewardsReturn = FunctionReturn + +/** donate(uint256) */ +export const donate = func('0xf14faf6f', { + _amount: uint256, +}, bool) +export type DonateParams = FunctionArguments +export type DonateReturn = FunctionReturn + +/** duration() */ +export const duration = func('0x0fb5a6b4', {}, uint256) +export type DurationParams = FunctionArguments +export type DurationReturn = FunctionReturn + +/** earned(address) */ +export const earned = func('0x008cc262', { + account: address, +}, uint256) +export type EarnedParams = FunctionArguments +export type EarnedReturn = FunctionReturn + +/** extraRewards(uint256) */ +export const extraRewards = func('0x40c35446', { + _0: uint256, +}, address) +export type ExtraRewardsParams = FunctionArguments +export type ExtraRewardsReturn = FunctionReturn + +/** extraRewardsLength() */ +export const extraRewardsLength = func('0xd55a23f4', {}, uint256) +export type ExtraRewardsLengthParams = FunctionArguments +export type ExtraRewardsLengthReturn = FunctionReturn + +/** getReward() */ +export const getReward = func('0x3d18b912', {}, bool) +export type GetRewardParams = FunctionArguments +export type GetRewardReturn = FunctionReturn + +/** getReward(address,bool) */ +export const getReward_1 = func('0x7050ccd9', { + _account: address, + _claimExtras: bool, +}, bool) +export type GetRewardParams_1 = FunctionArguments +export type GetRewardReturn_1 = FunctionReturn + +/** historicalRewards() */ +export const historicalRewards = func('0x262d3d6d', {}, uint256) +export type HistoricalRewardsParams = FunctionArguments +export type HistoricalRewardsReturn = FunctionReturn + +/** lastTimeRewardApplicable() */ +export const lastTimeRewardApplicable = func('0x80faa57d', {}, uint256) +export type LastTimeRewardApplicableParams = FunctionArguments +export type LastTimeRewardApplicableReturn = FunctionReturn + +/** lastUpdateTime() */ +export const lastUpdateTime = func('0xc8f33c91', {}, uint256) +export type LastUpdateTimeParams = FunctionArguments +export type LastUpdateTimeReturn = FunctionReturn + +/** newRewardRatio() */ +export const newRewardRatio = func('0x6c8bcee8', {}, uint256) +export type NewRewardRatioParams = FunctionArguments +export type NewRewardRatioReturn = FunctionReturn + +/** operator() */ +export const operator = func('0x570ca735', {}, address) +export type OperatorParams = FunctionArguments +export type OperatorReturn = FunctionReturn + +/** periodFinish() */ +export const periodFinish = func('0xebe2b12b', {}, uint256) +export type PeriodFinishParams = FunctionArguments +export type PeriodFinishReturn = FunctionReturn + +/** pid() */ +export const pid = func('0xf1068454', {}, uint256) +export type PidParams = FunctionArguments +export type PidReturn = FunctionReturn + +/** queueNewRewards(uint256) */ +export const queueNewRewards = func('0x590a41f5', { + _rewards: uint256, +}, bool) +export type QueueNewRewardsParams = FunctionArguments +export type QueueNewRewardsReturn = FunctionReturn + +/** queuedRewards() */ +export const queuedRewards = func('0x63d38c3b', {}, uint256) +export type QueuedRewardsParams = FunctionArguments +export type QueuedRewardsReturn = FunctionReturn + +/** rewardManager() */ +export const rewardManager = func('0x0f4ef8a6', {}, address) +export type RewardManagerParams = FunctionArguments +export type RewardManagerReturn = FunctionReturn + +/** rewardPerToken() */ +export const rewardPerToken = func('0xcd3daf9d', {}, uint256) +export type RewardPerTokenParams = FunctionArguments +export type RewardPerTokenReturn = FunctionReturn + +/** rewardPerTokenStored() */ +export const rewardPerTokenStored = func('0xdf136d65', {}, uint256) +export type RewardPerTokenStoredParams = FunctionArguments +export type RewardPerTokenStoredReturn = FunctionReturn + +/** rewardRate() */ +export const rewardRate = func('0x7b0a47ee', {}, uint256) +export type RewardRateParams = FunctionArguments +export type RewardRateReturn = FunctionReturn + +/** rewardToken() */ +export const rewardToken = func('0xf7c618c1', {}, address) +export type RewardTokenParams = FunctionArguments +export type RewardTokenReturn = FunctionReturn + +/** rewards(address) */ +export const rewards = func('0x0700037d', { + _0: address, +}, uint256) +export type RewardsParams = FunctionArguments +export type RewardsReturn = FunctionReturn + +/** stake(uint256) */ +export const stake = func('0xa694fc3a', { + _amount: uint256, +}, bool) +export type StakeParams = FunctionArguments +export type StakeReturn = FunctionReturn + +/** stakeAll() */ +export const stakeAll = func('0x8dcb4061', {}, bool) +export type StakeAllParams = FunctionArguments +export type StakeAllReturn = FunctionReturn + +/** stakeFor(address,uint256) */ +export const stakeFor = func('0x2ee40908', { + _for: address, + _amount: uint256, +}, bool) +export type StakeForParams = FunctionArguments +export type StakeForReturn = FunctionReturn + +/** stakingToken() */ +export const stakingToken = func('0x72f702f3', {}, address) +export type StakingTokenParams = FunctionArguments +export type StakingTokenReturn = FunctionReturn + +/** totalSupply() */ +export const totalSupply = func('0x18160ddd', {}, uint256) +export type TotalSupplyParams = FunctionArguments +export type TotalSupplyReturn = FunctionReturn + +/** userRewardPerTokenPaid(address) */ +export const userRewardPerTokenPaid = func('0x8b876347', { + _0: address, +}, uint256) +export type UserRewardPerTokenPaidParams = FunctionArguments +export type UserRewardPerTokenPaidReturn = FunctionReturn + +/** withdraw(uint256,bool) */ +export const withdraw = func('0x38d07436', { + amount: uint256, + claim: bool, +}, bool) +export type WithdrawParams = FunctionArguments +export type WithdrawReturn = FunctionReturn + +/** withdrawAll(bool) */ +export const withdrawAll = func('0x1c1c6fe5', { + claim: bool, +}) +export type WithdrawAllParams = FunctionArguments +export type WithdrawAllReturn = FunctionReturn + +/** withdrawAllAndUnwrap(bool) */ +export const withdrawAllAndUnwrap = func('0x49f039a2', { + claim: bool, +}) +export type WithdrawAllAndUnwrapParams = FunctionArguments +export type WithdrawAllAndUnwrapReturn = FunctionReturn + +/** withdrawAndUnwrap(uint256,bool) */ +export const withdrawAndUnwrap = func('0xc32e7202', { + amount: uint256, + claim: bool, +}, bool) +export type WithdrawAndUnwrapParams = FunctionArguments +export type WithdrawAndUnwrapReturn = FunctionReturn diff --git a/src/abi/base-reward-pool/index.ts b/src/abi/base-reward-pool/index.ts new file mode 100644 index 00000000..11829d6e --- /dev/null +++ b/src/abi/base-reward-pool/index.ts @@ -0,0 +1,4 @@ +export * as events from './events.js' +export * as functions from './functions.js' + +export { Contract } from './contract.js' diff --git a/src/abi/beacon-deposit-contract.ts b/src/abi/beacon-deposit-contract.ts deleted file mode 100644 index f2d3beeb..00000000 --- a/src/abi/beacon-deposit-contract.ts +++ /dev/null @@ -1,46 +0,0 @@ -import * as p from '@subsquid/evm-codec' -import { event, fun, viewFun, indexed, ContractBase } from '@subsquid/evm-abi' -import type { EventParams as EParams, FunctionArguments, FunctionReturn } from '@subsquid/evm-abi' - -export const events = { - DepositEvent: event("0x649bbc62d0e31342afea4e5cd82d4049e7e1ee912fc0889aa790803be39038c5", "DepositEvent(bytes,bytes,bytes,bytes,bytes)", {"pubkey": p.bytes, "withdrawal_credentials": p.bytes, "amount": p.bytes, "signature": p.bytes, "index": p.bytes}), -} - -export const functions = { - deposit: fun("0x22895118", "deposit(bytes,bytes,bytes,bytes32)", {"pubkey": p.bytes, "withdrawal_credentials": p.bytes, "signature": p.bytes, "deposit_data_root": p.bytes32}, ), - get_deposit_count: viewFun("0x621fd130", "get_deposit_count()", {}, p.bytes), - get_deposit_root: viewFun("0xc5f2892f", "get_deposit_root()", {}, p.bytes32), - supportsInterface: viewFun("0x01ffc9a7", "supportsInterface(bytes4)", {"interfaceId": p.bytes4}, p.bool), -} - -export class Contract extends ContractBase { - - get_deposit_count() { - return this.eth_call(functions.get_deposit_count, {}) - } - - get_deposit_root() { - return this.eth_call(functions.get_deposit_root, {}) - } - - supportsInterface(interfaceId: SupportsInterfaceParams["interfaceId"]) { - return this.eth_call(functions.supportsInterface, {interfaceId}) - } -} - -/// Event types -export type DepositEventEventArgs = EParams - -/// Function types -export type DepositParams = FunctionArguments -export type DepositReturn = FunctionReturn - -export type Get_deposit_countParams = FunctionArguments -export type Get_deposit_countReturn = FunctionReturn - -export type Get_deposit_rootParams = FunctionArguments -export type Get_deposit_rootReturn = FunctionReturn - -export type SupportsInterfaceParams = FunctionArguments -export type SupportsInterfaceReturn = FunctionReturn - diff --git a/src/abi/beacon-deposit-contract/contract.ts b/src/abi/beacon-deposit-contract/contract.ts new file mode 100644 index 00000000..75ac5199 --- /dev/null +++ b/src/abi/beacon-deposit-contract/contract.ts @@ -0,0 +1,17 @@ +import { ContractBase } from '../abi.support.js' +import { get_deposit_count, get_deposit_root, supportsInterface } from './functions.js' +import type { SupportsInterfaceParams } from './functions.js' + +export class Contract extends ContractBase { + get_deposit_count() { + return this.eth_call(get_deposit_count, {}) + } + + get_deposit_root() { + return this.eth_call(get_deposit_root, {}) + } + + supportsInterface(interfaceId: SupportsInterfaceParams["interfaceId"]) { + return this.eth_call(supportsInterface, {interfaceId}) + } +} diff --git a/src/abi/beacon-deposit-contract/events.ts b/src/abi/beacon-deposit-contract/events.ts new file mode 100644 index 00000000..6a7a9651 --- /dev/null +++ b/src/abi/beacon-deposit-contract/events.ts @@ -0,0 +1,13 @@ +import { bytes } from '@subsquid/evm-codec' +import { event } from '../abi.support.js' +import type { EventParams as EParams } from '../abi.support.js' + +/** DepositEvent(bytes,bytes,bytes,bytes,bytes) */ +export const DepositEvent = event('0x649bbc62d0e31342afea4e5cd82d4049e7e1ee912fc0889aa790803be39038c5', { + pubkey: bytes, + withdrawal_credentials: bytes, + amount: bytes, + signature: bytes, + index: bytes, +}) +export type DepositEventEventArgs = EParams diff --git a/src/abi/beacon-deposit-contract/functions.ts b/src/abi/beacon-deposit-contract/functions.ts new file mode 100644 index 00000000..84532ce1 --- /dev/null +++ b/src/abi/beacon-deposit-contract/functions.ts @@ -0,0 +1,30 @@ +import { bool, bytes, bytes32, bytes4 } from '@subsquid/evm-codec' +import { func } from '../abi.support.js' +import type { FunctionArguments, FunctionReturn } from '../abi.support.js' + +/** deposit(bytes,bytes,bytes,bytes32) */ +export const deposit = func('0x22895118', { + pubkey: bytes, + withdrawal_credentials: bytes, + signature: bytes, + deposit_data_root: bytes32, +}) +export type DepositParams = FunctionArguments +export type DepositReturn = FunctionReturn + +/** get_deposit_count() */ +export const get_deposit_count = func('0x621fd130', {}, bytes) +export type Get_deposit_countParams = FunctionArguments +export type Get_deposit_countReturn = FunctionReturn + +/** get_deposit_root() */ +export const get_deposit_root = func('0xc5f2892f', {}, bytes32) +export type Get_deposit_rootParams = FunctionArguments +export type Get_deposit_rootReturn = FunctionReturn + +/** supportsInterface(bytes4) */ +export const supportsInterface = func('0x01ffc9a7', { + interfaceId: bytes4, +}, bool) +export type SupportsInterfaceParams = FunctionArguments +export type SupportsInterfaceReturn = FunctionReturn diff --git a/src/abi/beacon-deposit-contract/index.ts b/src/abi/beacon-deposit-contract/index.ts new file mode 100644 index 00000000..11829d6e --- /dev/null +++ b/src/abi/beacon-deposit-contract/index.ts @@ -0,0 +1,4 @@ +export * as events from './events.js' +export * as functions from './functions.js' + +export { Contract } from './contract.js' diff --git a/src/abi/ccip-evm2evmofframp.ts b/src/abi/ccip-evm2evmofframp.ts deleted file mode 100644 index 800635ce..00000000 --- a/src/abi/ccip-evm2evmofframp.ts +++ /dev/null @@ -1,206 +0,0 @@ -import * as p from '@subsquid/evm-codec' -import { event, fun, viewFun, indexed, ContractBase } from '@subsquid/evm-abi' -import type { EventParams as EParams, FunctionArguments, FunctionReturn } from '@subsquid/evm-abi' - -export const events = { - AdminSet: event("0x8fe72c3e0020beb3234e76ae6676fa576fbfcae600af1c4fea44784cf0db329c", "AdminSet(address)", {"newAdmin": p.address}), - 'ConfigSet((address,uint64,uint64,address,address,address),(uint32,address,address,uint16,uint32,uint32))': event("0xe668e1a4644c1a030b909bbfd837f5cfa914994ed5e0bb2e9c34a5c37753128a", "ConfigSet((address,uint64,uint64,address,address,address),(uint32,address,address,uint16,uint32,uint32))", {"staticConfig": p.struct({"commitStore": p.address, "chainSelector": p.uint64, "sourceChainSelector": p.uint64, "onRamp": p.address, "prevOffRamp": p.address, "armProxy": p.address}), "dynamicConfig": p.struct({"permissionLessExecutionThresholdSeconds": p.uint32, "router": p.address, "priceRegistry": p.address, "maxNumberOfTokensPerMsg": p.uint16, "maxDataBytes": p.uint32, "maxPoolReleaseOrMintGas": p.uint32})}), - 'ConfigSet(uint32,bytes32,uint64,address[],address[],uint8,bytes,uint64,bytes)': event("0x1591690b8638f5fb2dbec82ac741805ac5da8b45dc5263f4875b0496fdce4e05", "ConfigSet(uint32,bytes32,uint64,address[],address[],uint8,bytes,uint64,bytes)", {"previousConfigBlockNumber": p.uint32, "configDigest": p.bytes32, "configCount": p.uint64, "signers": p.array(p.address), "transmitters": p.array(p.address), "f": p.uint8, "onchainConfig": p.bytes, "offchainConfigVersion": p.uint64, "offchainConfig": p.bytes}), - ExecutionStateChanged: event("0xd4f851956a5d67c3997d1c9205045fef79bae2947fdee7e9e2641abc7391ef65", "ExecutionStateChanged(uint64,bytes32,uint8,bytes)", {"sequenceNumber": indexed(p.uint64), "messageId": indexed(p.bytes32), "state": p.uint8, "returnData": p.bytes}), - OwnershipTransferRequested: event("0xed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae1278", "OwnershipTransferRequested(address,address)", {"from": indexed(p.address), "to": indexed(p.address)}), - OwnershipTransferred: event("0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", "OwnershipTransferred(address,address)", {"from": indexed(p.address), "to": indexed(p.address)}), - PoolAdded: event("0x95f865c2808f8b2a85eea2611db7843150ee7835ef1403f9755918a97d76933c", "PoolAdded(address,address)", {"token": p.address, "pool": p.address}), - PoolRemoved: event("0x987eb3c2f78454541205f72f34839b434c306c9eaf4922efd7c0c3060fdb2e4c", "PoolRemoved(address,address)", {"token": p.address, "pool": p.address}), - SkippedIncorrectNonce: event("0xd32ddb11d71e3d63411d37b09f9a8b28664f1cb1338bfd1413c173b0ebf41237", "SkippedIncorrectNonce(uint64,address)", {"nonce": indexed(p.uint64), "sender": indexed(p.address)}), - SkippedSenderWithPreviousRampMessageInflight: event("0xe44a20935573a783dd0d5991c92d7b6a0eb3173566530364db3ec10e9a990b5d", "SkippedSenderWithPreviousRampMessageInflight(uint64,address)", {"nonce": indexed(p.uint64), "sender": indexed(p.address)}), - Transmitted: event("0xb04e63db38c49950639fa09d29872f21f5d49d614f3a969d8adf3d4b52e41a62", "Transmitted(bytes32,uint32)", {"configDigest": p.bytes32, "epoch": p.uint32}), -} - -export const functions = { - acceptOwnership: fun("0x79ba5097", "acceptOwnership()", {}, ), - applyPoolUpdates: fun("0x3a87ac53", "applyPoolUpdates((address,address)[],(address,address)[])", {"removes": p.array(p.struct({"token": p.address, "pool": p.address})), "adds": p.array(p.struct({"token": p.address, "pool": p.address}))}, ), - ccipReceive: viewFun("0x85572ffb", "ccipReceive((bytes32,uint64,bytes,bytes,(address,uint256)[]))", {"_0": p.struct({"messageId": p.bytes32, "sourceChainSelector": p.uint64, "sender": p.bytes, "data": p.bytes, "destTokenAmounts": p.array(p.struct({"token": p.address, "amount": p.uint256}))})}, ), - currentRateLimiterState: viewFun("0x546719cd", "currentRateLimiterState()", {}, p.struct({"tokens": p.uint128, "lastUpdated": p.uint32, "isEnabled": p.bool, "capacity": p.uint128, "rate": p.uint128})), - executeSingleMessage: fun("0xf52121a5", "executeSingleMessage((uint64,address,address,uint64,uint256,bool,uint64,address,uint256,bytes,(address,uint256)[],bytes[],bytes32),bytes[])", {"message": p.struct({"sourceChainSelector": p.uint64, "sender": p.address, "receiver": p.address, "sequenceNumber": p.uint64, "gasLimit": p.uint256, "strict": p.bool, "nonce": p.uint64, "feeToken": p.address, "feeTokenAmount": p.uint256, "data": p.bytes, "tokenAmounts": p.array(p.struct({"token": p.address, "amount": p.uint256})), "sourceTokenData": p.array(p.bytes), "messageId": p.bytes32}), "offchainTokenData": p.array(p.bytes)}, ), - getDestinationToken: viewFun("0xb4069b31", "getDestinationToken(address)", {"sourceToken": p.address}, p.address), - getDestinationTokens: viewFun("0x681fba16", "getDestinationTokens()", {}, p.array(p.address)), - getDynamicConfig: viewFun("0x7437ff9f", "getDynamicConfig()", {}, p.struct({"permissionLessExecutionThresholdSeconds": p.uint32, "router": p.address, "priceRegistry": p.address, "maxNumberOfTokensPerMsg": p.uint16, "maxDataBytes": p.uint32, "maxPoolReleaseOrMintGas": p.uint32})), - getExecutionState: viewFun("0x142a98fc", "getExecutionState(uint64)", {"sequenceNumber": p.uint64}, p.uint8), - getPoolByDestToken: viewFun("0xd7e2bb50", "getPoolByDestToken(address)", {"destToken": p.address}, p.address), - getPoolBySourceToken: viewFun("0x5d86f141", "getPoolBySourceToken(address)", {"sourceToken": p.address}, p.address), - getSenderNonce: viewFun("0x856c8247", "getSenderNonce(address)", {"sender": p.address}, p.uint64), - getStaticConfig: viewFun("0x06285c69", "getStaticConfig()", {}, p.struct({"commitStore": p.address, "chainSelector": p.uint64, "sourceChainSelector": p.uint64, "onRamp": p.address, "prevOffRamp": p.address, "armProxy": p.address})), - getSupportedTokens: viewFun("0xd3c7c2c7", "getSupportedTokens()", {}, p.array(p.address)), - getTokenLimitAdmin: viewFun("0x599f6431", "getTokenLimitAdmin()", {}, p.address), - getTransmitters: viewFun("0x666cab8d", "getTransmitters()", {}, p.array(p.address)), - latestConfigDetails: viewFun("0x81ff7048", "latestConfigDetails()", {}, {"configCount": p.uint32, "blockNumber": p.uint32, "configDigest": p.bytes32}), - latestConfigDigestAndEpoch: viewFun("0xafcb95d7", "latestConfigDigestAndEpoch()", {}, {"scanLogs": p.bool, "configDigest": p.bytes32, "epoch": p.uint32}), - manuallyExecute: fun("0x740f4150", "manuallyExecute(((uint64,address,address,uint64,uint256,bool,uint64,address,uint256,bytes,(address,uint256)[],bytes[],bytes32)[],bytes[][],bytes32[],uint256),uint256[])", {"report": p.struct({"messages": p.array(p.struct({"sourceChainSelector": p.uint64, "sender": p.address, "receiver": p.address, "sequenceNumber": p.uint64, "gasLimit": p.uint256, "strict": p.bool, "nonce": p.uint64, "feeToken": p.address, "feeTokenAmount": p.uint256, "data": p.bytes, "tokenAmounts": p.array(p.struct({"token": p.address, "amount": p.uint256})), "sourceTokenData": p.array(p.bytes), "messageId": p.bytes32})), "offchainTokenData": p.array(p.array(p.bytes)), "proofs": p.array(p.bytes32), "proofFlagBits": p.uint256}), "gasLimitOverrides": p.array(p.uint256)}, ), - owner: viewFun("0x8da5cb5b", "owner()", {}, p.address), - setAdmin: fun("0x704b6c02", "setAdmin(address)", {"newAdmin": p.address}, ), - setOCR2Config: fun("0x1ef38174", "setOCR2Config(address[],address[],uint8,bytes,uint64,bytes)", {"signers": p.array(p.address), "transmitters": p.array(p.address), "f": p.uint8, "onchainConfig": p.bytes, "offchainConfigVersion": p.uint64, "offchainConfig": p.bytes}, ), - setRateLimiterConfig: fun("0xc92b2832", "setRateLimiterConfig((bool,uint128,uint128))", {"config": p.struct({"isEnabled": p.bool, "capacity": p.uint128, "rate": p.uint128})}, ), - transferOwnership: fun("0xf2fde38b", "transferOwnership(address)", {"to": p.address}, ), - transmit: fun("0xb1dc65a4", "transmit(bytes32[3],bytes,bytes32[],bytes32[],bytes32)", {"reportContext": p.fixedSizeArray(p.bytes32, 3), "report": p.bytes, "rs": p.array(p.bytes32), "ss": p.array(p.bytes32), "_4": p.bytes32}, ), - typeAndVersion: viewFun("0x181f5a77", "typeAndVersion()", {}, p.string), -} - -export class Contract extends ContractBase { - - currentRateLimiterState() { - return this.eth_call(functions.currentRateLimiterState, {}) - } - - getDestinationToken(sourceToken: GetDestinationTokenParams["sourceToken"]) { - return this.eth_call(functions.getDestinationToken, {sourceToken}) - } - - getDestinationTokens() { - return this.eth_call(functions.getDestinationTokens, {}) - } - - getDynamicConfig() { - return this.eth_call(functions.getDynamicConfig, {}) - } - - getExecutionState(sequenceNumber: GetExecutionStateParams["sequenceNumber"]) { - return this.eth_call(functions.getExecutionState, {sequenceNumber}) - } - - getPoolByDestToken(destToken: GetPoolByDestTokenParams["destToken"]) { - return this.eth_call(functions.getPoolByDestToken, {destToken}) - } - - getPoolBySourceToken(sourceToken: GetPoolBySourceTokenParams["sourceToken"]) { - return this.eth_call(functions.getPoolBySourceToken, {sourceToken}) - } - - getSenderNonce(sender: GetSenderNonceParams["sender"]) { - return this.eth_call(functions.getSenderNonce, {sender}) - } - - getStaticConfig() { - return this.eth_call(functions.getStaticConfig, {}) - } - - getSupportedTokens() { - return this.eth_call(functions.getSupportedTokens, {}) - } - - getTokenLimitAdmin() { - return this.eth_call(functions.getTokenLimitAdmin, {}) - } - - getTransmitters() { - return this.eth_call(functions.getTransmitters, {}) - } - - latestConfigDetails() { - return this.eth_call(functions.latestConfigDetails, {}) - } - - latestConfigDigestAndEpoch() { - return this.eth_call(functions.latestConfigDigestAndEpoch, {}) - } - - owner() { - return this.eth_call(functions.owner, {}) - } - - typeAndVersion() { - return this.eth_call(functions.typeAndVersion, {}) - } -} - -/// Event types -export type AdminSetEventArgs = EParams -export type ConfigSetEventArgs_0 = EParams -export type ConfigSetEventArgs_1 = EParams -export type ExecutionStateChangedEventArgs = EParams -export type OwnershipTransferRequestedEventArgs = EParams -export type OwnershipTransferredEventArgs = EParams -export type PoolAddedEventArgs = EParams -export type PoolRemovedEventArgs = EParams -export type SkippedIncorrectNonceEventArgs = EParams -export type SkippedSenderWithPreviousRampMessageInflightEventArgs = EParams -export type TransmittedEventArgs = EParams - -/// Function types -export type AcceptOwnershipParams = FunctionArguments -export type AcceptOwnershipReturn = FunctionReturn - -export type ApplyPoolUpdatesParams = FunctionArguments -export type ApplyPoolUpdatesReturn = FunctionReturn - -export type CcipReceiveParams = FunctionArguments -export type CcipReceiveReturn = FunctionReturn - -export type CurrentRateLimiterStateParams = FunctionArguments -export type CurrentRateLimiterStateReturn = FunctionReturn - -export type ExecuteSingleMessageParams = FunctionArguments -export type ExecuteSingleMessageReturn = FunctionReturn - -export type GetDestinationTokenParams = FunctionArguments -export type GetDestinationTokenReturn = FunctionReturn - -export type GetDestinationTokensParams = FunctionArguments -export type GetDestinationTokensReturn = FunctionReturn - -export type GetDynamicConfigParams = FunctionArguments -export type GetDynamicConfigReturn = FunctionReturn - -export type GetExecutionStateParams = FunctionArguments -export type GetExecutionStateReturn = FunctionReturn - -export type GetPoolByDestTokenParams = FunctionArguments -export type GetPoolByDestTokenReturn = FunctionReturn - -export type GetPoolBySourceTokenParams = FunctionArguments -export type GetPoolBySourceTokenReturn = FunctionReturn - -export type GetSenderNonceParams = FunctionArguments -export type GetSenderNonceReturn = FunctionReturn - -export type GetStaticConfigParams = FunctionArguments -export type GetStaticConfigReturn = FunctionReturn - -export type GetSupportedTokensParams = FunctionArguments -export type GetSupportedTokensReturn = FunctionReturn - -export type GetTokenLimitAdminParams = FunctionArguments -export type GetTokenLimitAdminReturn = FunctionReturn - -export type GetTransmittersParams = FunctionArguments -export type GetTransmittersReturn = FunctionReturn - -export type LatestConfigDetailsParams = FunctionArguments -export type LatestConfigDetailsReturn = FunctionReturn - -export type LatestConfigDigestAndEpochParams = FunctionArguments -export type LatestConfigDigestAndEpochReturn = FunctionReturn - -export type ManuallyExecuteParams = FunctionArguments -export type ManuallyExecuteReturn = FunctionReturn - -export type OwnerParams = FunctionArguments -export type OwnerReturn = FunctionReturn - -export type SetAdminParams = FunctionArguments -export type SetAdminReturn = FunctionReturn - -export type SetOCR2ConfigParams = FunctionArguments -export type SetOCR2ConfigReturn = FunctionReturn - -export type SetRateLimiterConfigParams = FunctionArguments -export type SetRateLimiterConfigReturn = FunctionReturn - -export type TransferOwnershipParams = FunctionArguments -export type TransferOwnershipReturn = FunctionReturn - -export type TransmitParams = FunctionArguments -export type TransmitReturn = FunctionReturn - -export type TypeAndVersionParams = FunctionArguments -export type TypeAndVersionReturn = FunctionReturn - diff --git a/src/abi/ccip-evm2evmofframp/contract.ts b/src/abi/ccip-evm2evmofframp/contract.ts new file mode 100644 index 00000000..3df0f23a --- /dev/null +++ b/src/abi/ccip-evm2evmofframp/contract.ts @@ -0,0 +1,69 @@ +import { ContractBase } from '../abi.support.js' +import { currentRateLimiterState, getDestinationToken, getDestinationTokens, getDynamicConfig, getExecutionState, getPoolByDestToken, getPoolBySourceToken, getSenderNonce, getStaticConfig, getSupportedTokens, getTokenLimitAdmin, getTransmitters, latestConfigDetails, latestConfigDigestAndEpoch, owner, typeAndVersion } from './functions.js' +import type { GetDestinationTokenParams, GetExecutionStateParams, GetPoolByDestTokenParams, GetPoolBySourceTokenParams, GetSenderNonceParams } from './functions.js' + +export class Contract extends ContractBase { + currentRateLimiterState() { + return this.eth_call(currentRateLimiterState, {}) + } + + getDestinationToken(sourceToken: GetDestinationTokenParams["sourceToken"]) { + return this.eth_call(getDestinationToken, {sourceToken}) + } + + getDestinationTokens() { + return this.eth_call(getDestinationTokens, {}) + } + + getDynamicConfig() { + return this.eth_call(getDynamicConfig, {}) + } + + getExecutionState(sequenceNumber: GetExecutionStateParams["sequenceNumber"]) { + return this.eth_call(getExecutionState, {sequenceNumber}) + } + + getPoolByDestToken(destToken: GetPoolByDestTokenParams["destToken"]) { + return this.eth_call(getPoolByDestToken, {destToken}) + } + + getPoolBySourceToken(sourceToken: GetPoolBySourceTokenParams["sourceToken"]) { + return this.eth_call(getPoolBySourceToken, {sourceToken}) + } + + getSenderNonce(sender: GetSenderNonceParams["sender"]) { + return this.eth_call(getSenderNonce, {sender}) + } + + getStaticConfig() { + return this.eth_call(getStaticConfig, {}) + } + + getSupportedTokens() { + return this.eth_call(getSupportedTokens, {}) + } + + getTokenLimitAdmin() { + return this.eth_call(getTokenLimitAdmin, {}) + } + + getTransmitters() { + return this.eth_call(getTransmitters, {}) + } + + latestConfigDetails() { + return this.eth_call(latestConfigDetails, {}) + } + + latestConfigDigestAndEpoch() { + return this.eth_call(latestConfigDigestAndEpoch, {}) + } + + owner() { + return this.eth_call(owner, {}) + } + + typeAndVersion() { + return this.eth_call(typeAndVersion, {}) + } +} diff --git a/src/abi/ccip-evm2evmofframp/events.ts b/src/abi/ccip-evm2evmofframp/events.ts new file mode 100644 index 00000000..a2674e0f --- /dev/null +++ b/src/abi/ccip-evm2evmofframp/events.ts @@ -0,0 +1,102 @@ +import { address, array, bytes, bytes32, struct, uint16, uint32, uint64, uint8 } from '@subsquid/evm-codec' +import { event, indexed } from '../abi.support.js' +import type { EventParams as EParams } from '../abi.support.js' + +/** AdminSet(address) */ +export const AdminSet = event('0x8fe72c3e0020beb3234e76ae6676fa576fbfcae600af1c4fea44784cf0db329c', { + newAdmin: address, +}) +export type AdminSetEventArgs = EParams + +/** ConfigSet((address,uint64,uint64,address,address,address),(uint32,address,address,uint16,uint32,uint32)) */ +export const ConfigSet = event('0xe668e1a4644c1a030b909bbfd837f5cfa914994ed5e0bb2e9c34a5c37753128a', { + staticConfig: struct({ + commitStore: address, + chainSelector: uint64, + sourceChainSelector: uint64, + onRamp: address, + prevOffRamp: address, + armProxy: address, + }), + dynamicConfig: struct({ + permissionLessExecutionThresholdSeconds: uint32, + router: address, + priceRegistry: address, + maxNumberOfTokensPerMsg: uint16, + maxDataBytes: uint32, + maxPoolReleaseOrMintGas: uint32, + }), +}) +export type ConfigSetEventArgs = EParams + +/** ConfigSet(uint32,bytes32,uint64,address[],address[],uint8,bytes,uint64,bytes) */ +export const ConfigSet_1 = event('0x1591690b8638f5fb2dbec82ac741805ac5da8b45dc5263f4875b0496fdce4e05', { + previousConfigBlockNumber: uint32, + configDigest: bytes32, + configCount: uint64, + signers: array(address), + transmitters: array(address), + f: uint8, + onchainConfig: bytes, + offchainConfigVersion: uint64, + offchainConfig: bytes, +}) +export type ConfigSetEventArgs_1 = EParams + +/** ExecutionStateChanged(uint64,bytes32,uint8,bytes) */ +export const ExecutionStateChanged = event('0xd4f851956a5d67c3997d1c9205045fef79bae2947fdee7e9e2641abc7391ef65', { + sequenceNumber: indexed(uint64), + messageId: indexed(bytes32), + state: uint8, + returnData: bytes, +}) +export type ExecutionStateChangedEventArgs = EParams + +/** OwnershipTransferRequested(address,address) */ +export const OwnershipTransferRequested = event('0xed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae1278', { + from: indexed(address), + to: indexed(address), +}) +export type OwnershipTransferRequestedEventArgs = EParams + +/** OwnershipTransferred(address,address) */ +export const OwnershipTransferred = event('0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0', { + from: indexed(address), + to: indexed(address), +}) +export type OwnershipTransferredEventArgs = EParams + +/** PoolAdded(address,address) */ +export const PoolAdded = event('0x95f865c2808f8b2a85eea2611db7843150ee7835ef1403f9755918a97d76933c', { + token: address, + pool: address, +}) +export type PoolAddedEventArgs = EParams + +/** PoolRemoved(address,address) */ +export const PoolRemoved = event('0x987eb3c2f78454541205f72f34839b434c306c9eaf4922efd7c0c3060fdb2e4c', { + token: address, + pool: address, +}) +export type PoolRemovedEventArgs = EParams + +/** SkippedIncorrectNonce(uint64,address) */ +export const SkippedIncorrectNonce = event('0xd32ddb11d71e3d63411d37b09f9a8b28664f1cb1338bfd1413c173b0ebf41237', { + nonce: indexed(uint64), + sender: indexed(address), +}) +export type SkippedIncorrectNonceEventArgs = EParams + +/** SkippedSenderWithPreviousRampMessageInflight(uint64,address) */ +export const SkippedSenderWithPreviousRampMessageInflight = event('0xe44a20935573a783dd0d5991c92d7b6a0eb3173566530364db3ec10e9a990b5d', { + nonce: indexed(uint64), + sender: indexed(address), +}) +export type SkippedSenderWithPreviousRampMessageInflightEventArgs = EParams + +/** Transmitted(bytes32,uint32) */ +export const Transmitted = event('0xb04e63db38c49950639fa09d29872f21f5d49d614f3a969d8adf3d4b52e41a62', { + configDigest: bytes32, + epoch: uint32, +}) +export type TransmittedEventArgs = EParams diff --git a/src/abi/ccip-evm2evmofframp/functions.ts b/src/abi/ccip-evm2evmofframp/functions.ts new file mode 100644 index 00000000..cf892c2b --- /dev/null +++ b/src/abi/ccip-evm2evmofframp/functions.ts @@ -0,0 +1,259 @@ +import { address, array, bool, bytes, bytes32, fixedSizeArray, string, struct, uint128, uint16, uint256, uint32, uint64, uint8 } from '@subsquid/evm-codec' +import { func } from '../abi.support.js' +import type { FunctionArguments, FunctionReturn } from '../abi.support.js' + +/** acceptOwnership() */ +export const acceptOwnership = func('0x79ba5097', {}) +export type AcceptOwnershipParams = FunctionArguments +export type AcceptOwnershipReturn = FunctionReturn + +/** applyPoolUpdates((address,address)[],(address,address)[]) */ +export const applyPoolUpdates = func('0x3a87ac53', { + removes: array(struct({ + token: address, + pool: address, + })), + adds: array(struct({ + token: address, + pool: address, + })), +}) +export type ApplyPoolUpdatesParams = FunctionArguments +export type ApplyPoolUpdatesReturn = FunctionReturn + +/** ccipReceive((bytes32,uint64,bytes,bytes,(address,uint256)[])) */ +export const ccipReceive = func('0x85572ffb', { + _0: struct({ + messageId: bytes32, + sourceChainSelector: uint64, + sender: bytes, + data: bytes, + destTokenAmounts: array(struct({ + token: address, + amount: uint256, + })), + }), +}) +export type CcipReceiveParams = FunctionArguments +export type CcipReceiveReturn = FunctionReturn + +/** currentRateLimiterState() */ +export const currentRateLimiterState = func('0x546719cd', {}, struct({ + tokens: uint128, + lastUpdated: uint32, + isEnabled: bool, + capacity: uint128, + rate: uint128, +})) +export type CurrentRateLimiterStateParams = FunctionArguments +export type CurrentRateLimiterStateReturn = FunctionReturn + +/** executeSingleMessage((uint64,address,address,uint64,uint256,bool,uint64,address,uint256,bytes,(address,uint256)[],bytes[],bytes32),bytes[]) */ +export const executeSingleMessage = func('0xf52121a5', { + message: struct({ + sourceChainSelector: uint64, + sender: address, + receiver: address, + sequenceNumber: uint64, + gasLimit: uint256, + strict: bool, + nonce: uint64, + feeToken: address, + feeTokenAmount: uint256, + data: bytes, + tokenAmounts: array(struct({ + token: address, + amount: uint256, + })), + sourceTokenData: array(bytes), + messageId: bytes32, + }), + offchainTokenData: array(bytes), +}) +export type ExecuteSingleMessageParams = FunctionArguments +export type ExecuteSingleMessageReturn = FunctionReturn + +/** getDestinationToken(address) */ +export const getDestinationToken = func('0xb4069b31', { + sourceToken: address, +}, address) +export type GetDestinationTokenParams = FunctionArguments +export type GetDestinationTokenReturn = FunctionReturn + +/** getDestinationTokens() */ +export const getDestinationTokens = func('0x681fba16', {}, array(address)) +export type GetDestinationTokensParams = FunctionArguments +export type GetDestinationTokensReturn = FunctionReturn + +/** getDynamicConfig() */ +export const getDynamicConfig = func('0x7437ff9f', {}, struct({ + permissionLessExecutionThresholdSeconds: uint32, + router: address, + priceRegistry: address, + maxNumberOfTokensPerMsg: uint16, + maxDataBytes: uint32, + maxPoolReleaseOrMintGas: uint32, +})) +export type GetDynamicConfigParams = FunctionArguments +export type GetDynamicConfigReturn = FunctionReturn + +/** getExecutionState(uint64) */ +export const getExecutionState = func('0x142a98fc', { + sequenceNumber: uint64, +}, uint8) +export type GetExecutionStateParams = FunctionArguments +export type GetExecutionStateReturn = FunctionReturn + +/** getPoolByDestToken(address) */ +export const getPoolByDestToken = func('0xd7e2bb50', { + destToken: address, +}, address) +export type GetPoolByDestTokenParams = FunctionArguments +export type GetPoolByDestTokenReturn = FunctionReturn + +/** getPoolBySourceToken(address) */ +export const getPoolBySourceToken = func('0x5d86f141', { + sourceToken: address, +}, address) +export type GetPoolBySourceTokenParams = FunctionArguments +export type GetPoolBySourceTokenReturn = FunctionReturn + +/** getSenderNonce(address) */ +export const getSenderNonce = func('0x856c8247', { + sender: address, +}, uint64) +export type GetSenderNonceParams = FunctionArguments +export type GetSenderNonceReturn = FunctionReturn + +/** getStaticConfig() */ +export const getStaticConfig = func('0x06285c69', {}, struct({ + commitStore: address, + chainSelector: uint64, + sourceChainSelector: uint64, + onRamp: address, + prevOffRamp: address, + armProxy: address, +})) +export type GetStaticConfigParams = FunctionArguments +export type GetStaticConfigReturn = FunctionReturn + +/** getSupportedTokens() */ +export const getSupportedTokens = func('0xd3c7c2c7', {}, array(address)) +export type GetSupportedTokensParams = FunctionArguments +export type GetSupportedTokensReturn = FunctionReturn + +/** getTokenLimitAdmin() */ +export const getTokenLimitAdmin = func('0x599f6431', {}, address) +export type GetTokenLimitAdminParams = FunctionArguments +export type GetTokenLimitAdminReturn = FunctionReturn + +/** getTransmitters() */ +export const getTransmitters = func('0x666cab8d', {}, array(address)) +export type GetTransmittersParams = FunctionArguments +export type GetTransmittersReturn = FunctionReturn + +/** latestConfigDetails() */ +export const latestConfigDetails = func('0x81ff7048', {}, struct({ + configCount: uint32, + blockNumber: uint32, + configDigest: bytes32, +})) +export type LatestConfigDetailsParams = FunctionArguments +export type LatestConfigDetailsReturn = FunctionReturn + +/** latestConfigDigestAndEpoch() */ +export const latestConfigDigestAndEpoch = func('0xafcb95d7', {}, struct({ + scanLogs: bool, + configDigest: bytes32, + epoch: uint32, +})) +export type LatestConfigDigestAndEpochParams = FunctionArguments +export type LatestConfigDigestAndEpochReturn = FunctionReturn + +/** manuallyExecute(((uint64,address,address,uint64,uint256,bool,uint64,address,uint256,bytes,(address,uint256)[],bytes[],bytes32)[],bytes[][],bytes32[],uint256),uint256[]) */ +export const manuallyExecute = func('0x740f4150', { + report: struct({ + messages: array(struct({ + sourceChainSelector: uint64, + sender: address, + receiver: address, + sequenceNumber: uint64, + gasLimit: uint256, + strict: bool, + nonce: uint64, + feeToken: address, + feeTokenAmount: uint256, + data: bytes, + tokenAmounts: array(struct({ + token: address, + amount: uint256, + })), + sourceTokenData: array(bytes), + messageId: bytes32, + })), + offchainTokenData: array(array(bytes)), + proofs: array(bytes32), + proofFlagBits: uint256, + }), + gasLimitOverrides: array(uint256), +}) +export type ManuallyExecuteParams = FunctionArguments +export type ManuallyExecuteReturn = FunctionReturn + +/** owner() */ +export const owner = func('0x8da5cb5b', {}, address) +export type OwnerParams = FunctionArguments +export type OwnerReturn = FunctionReturn + +/** setAdmin(address) */ +export const setAdmin = func('0x704b6c02', { + newAdmin: address, +}) +export type SetAdminParams = FunctionArguments +export type SetAdminReturn = FunctionReturn + +/** setOCR2Config(address[],address[],uint8,bytes,uint64,bytes) */ +export const setOCR2Config = func('0x1ef38174', { + signers: array(address), + transmitters: array(address), + f: uint8, + onchainConfig: bytes, + offchainConfigVersion: uint64, + offchainConfig: bytes, +}) +export type SetOCR2ConfigParams = FunctionArguments +export type SetOCR2ConfigReturn = FunctionReturn + +/** setRateLimiterConfig((bool,uint128,uint128)) */ +export const setRateLimiterConfig = func('0xc92b2832', { + config: struct({ + isEnabled: bool, + capacity: uint128, + rate: uint128, + }), +}) +export type SetRateLimiterConfigParams = FunctionArguments +export type SetRateLimiterConfigReturn = FunctionReturn + +/** transferOwnership(address) */ +export const transferOwnership = func('0xf2fde38b', { + to: address, +}) +export type TransferOwnershipParams = FunctionArguments +export type TransferOwnershipReturn = FunctionReturn + +/** transmit(bytes32[3],bytes,bytes32[],bytes32[],bytes32) */ +export const transmit = func('0xb1dc65a4', { + reportContext: fixedSizeArray(bytes32, 3), + report: bytes, + rs: array(bytes32), + ss: array(bytes32), + _4: bytes32, +}) +export type TransmitParams = FunctionArguments +export type TransmitReturn = FunctionReturn + +/** typeAndVersion() */ +export const typeAndVersion = func('0x181f5a77', {}, string) +export type TypeAndVersionParams = FunctionArguments +export type TypeAndVersionReturn = FunctionReturn diff --git a/src/abi/ccip-evm2evmofframp/index.ts b/src/abi/ccip-evm2evmofframp/index.ts new file mode 100644 index 00000000..11829d6e --- /dev/null +++ b/src/abi/ccip-evm2evmofframp/index.ts @@ -0,0 +1,4 @@ +export * as events from './events.js' +export * as functions from './functions.js' + +export { Contract } from './contract.js' diff --git a/src/abi/ccip-evm2evmonramp.ts b/src/abi/ccip-evm2evmonramp.ts deleted file mode 100644 index 087e45c0..00000000 --- a/src/abi/ccip-evm2evmonramp.ts +++ /dev/null @@ -1,214 +0,0 @@ -import * as p from '@subsquid/evm-codec' -import { event, fun, viewFun, indexed, ContractBase } from '@subsquid/evm-abi' -import type { EventParams as EParams, FunctionArguments, FunctionReturn } from '@subsquid/evm-abi' - -export const events = { - AdminSet: event("0x8fe72c3e0020beb3234e76ae6676fa576fbfcae600af1c4fea44784cf0db329c", "AdminSet(address)", {"newAdmin": p.address}), - CCIPSendRequested: event("0xd0c3c799bf9e2639de44391e7f524d229b2b55f5b1ea94b2bf7da42f7243dddd", "CCIPSendRequested((uint64,address,address,uint64,uint256,bool,uint64,address,uint256,bytes,(address,uint256)[],bytes[],bytes32))", {"message": p.struct({"sourceChainSelector": p.uint64, "sender": p.address, "receiver": p.address, "sequenceNumber": p.uint64, "gasLimit": p.uint256, "strict": p.bool, "nonce": p.uint64, "feeToken": p.address, "feeTokenAmount": p.uint256, "data": p.bytes, "tokenAmounts": p.array(p.struct({"token": p.address, "amount": p.uint256})), "sourceTokenData": p.array(p.bytes), "messageId": p.bytes32})}), - ConfigSet: event("0x2a57f7c2027cf032c78b77d4d8d2fbd20ad22e5d5e5b5fb23ac7d7820d44adc6", "ConfigSet((address,uint64,uint64,uint64,uint96,address,address),(address,uint16,uint32,uint16,uint32,uint16,uint16,address,uint32,uint32))", {"staticConfig": p.struct({"linkToken": p.address, "chainSelector": p.uint64, "destChainSelector": p.uint64, "defaultTxGasLimit": p.uint64, "maxNopFeesJuels": p.uint96, "prevOnRamp": p.address, "armProxy": p.address}), "dynamicConfig": p.struct({"router": p.address, "maxNumberOfTokensPerMsg": p.uint16, "destGasOverhead": p.uint32, "destGasPerPayloadByte": p.uint16, "destDataAvailabilityOverheadGas": p.uint32, "destGasPerDataAvailabilityByte": p.uint16, "destDataAvailabilityMultiplierBps": p.uint16, "priceRegistry": p.address, "maxDataBytes": p.uint32, "maxPerMsgGasLimit": p.uint32})}), - FeeConfigSet: event("0x067924bf9277d905a9a4631a06d959bc032ace86b3caa835ae7e403d4f39010e", "FeeConfigSet((address,uint32,uint64,uint64,bool)[])", {"feeConfig": p.array(p.struct({"token": p.address, "networkFeeUSDCents": p.uint32, "gasMultiplierWeiPerEth": p.uint64, "premiumMultiplierWeiPerEth": p.uint64, "enabled": p.bool}))}), - NopPaid: event("0x55fdec2aab60a41fa5abb106670eb1006f5aeaee1ba7afea2bc89b5b3ec7678f", "NopPaid(address,uint256)", {"nop": indexed(p.address), "amount": p.uint256}), - NopsSet: event("0x8c337bff38141c507abd25c547606bdde78fe8c12e941ab613f3a565fea6cd24", "NopsSet(uint256,(address,uint16)[])", {"nopWeightsTotal": p.uint256, "nopsAndWeights": p.array(p.struct({"nop": p.address, "weight": p.uint16}))}), - OwnershipTransferRequested: event("0xed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae1278", "OwnershipTransferRequested(address,address)", {"from": indexed(p.address), "to": indexed(p.address)}), - OwnershipTransferred: event("0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", "OwnershipTransferred(address,address)", {"from": indexed(p.address), "to": indexed(p.address)}), - PoolAdded: event("0x95f865c2808f8b2a85eea2611db7843150ee7835ef1403f9755918a97d76933c", "PoolAdded(address,address)", {"token": p.address, "pool": p.address}), - PoolRemoved: event("0x987eb3c2f78454541205f72f34839b434c306c9eaf4922efd7c0c3060fdb2e4c", "PoolRemoved(address,address)", {"token": p.address, "pool": p.address}), - TokenTransferFeeConfigSet: event("0x555c74101f7a15746d31c6731170310e667bcc607996b2fc0b981a7b26a416e9", "TokenTransferFeeConfigSet((address,uint32,uint32,uint16,uint32,uint32)[])", {"transferFeeConfig": p.array(p.struct({"token": p.address, "minFeeUSDCents": p.uint32, "maxFeeUSDCents": p.uint32, "deciBps": p.uint16, "destGasOverhead": p.uint32, "destBytesOverhead": p.uint32}))}), -} - -export const functions = { - acceptOwnership: fun("0x79ba5097", "acceptOwnership()", {}, ), - applyPoolUpdates: fun("0x3a87ac53", "applyPoolUpdates((address,address)[],(address,address)[])", {"removes": p.array(p.struct({"token": p.address, "pool": p.address})), "adds": p.array(p.struct({"token": p.address, "pool": p.address}))}, ), - currentRateLimiterState: viewFun("0x546719cd", "currentRateLimiterState()", {}, p.struct({"tokens": p.uint128, "lastUpdated": p.uint32, "isEnabled": p.bool, "capacity": p.uint128, "rate": p.uint128})), - forwardFromRouter: fun("0xdf0aa9e9", "forwardFromRouter(uint64,(bytes,bytes,(address,uint256)[],address,bytes),uint256,address)", {"destChainSelector": p.uint64, "message": p.struct({"receiver": p.bytes, "data": p.bytes, "tokenAmounts": p.array(p.struct({"token": p.address, "amount": p.uint256})), "feeToken": p.address, "extraArgs": p.bytes}), "feeTokenAmount": p.uint256, "originalSender": p.address}, p.bytes32), - getDynamicConfig: viewFun("0x7437ff9f", "getDynamicConfig()", {}, p.struct({"router": p.address, "maxNumberOfTokensPerMsg": p.uint16, "destGasOverhead": p.uint32, "destGasPerPayloadByte": p.uint16, "destDataAvailabilityOverheadGas": p.uint32, "destGasPerDataAvailabilityByte": p.uint16, "destDataAvailabilityMultiplierBps": p.uint16, "priceRegistry": p.address, "maxDataBytes": p.uint32, "maxPerMsgGasLimit": p.uint32})), - getExpectedNextSequenceNumber: viewFun("0x4120fccd", "getExpectedNextSequenceNumber()", {}, p.uint64), - getFee: viewFun("0x20487ded", "getFee(uint64,(bytes,bytes,(address,uint256)[],address,bytes))", {"destChainSelector": p.uint64, "message": p.struct({"receiver": p.bytes, "data": p.bytes, "tokenAmounts": p.array(p.struct({"token": p.address, "amount": p.uint256})), "feeToken": p.address, "extraArgs": p.bytes})}, p.uint256), - getFeeTokenConfig: viewFun("0x9a113c36", "getFeeTokenConfig(address)", {"token": p.address}, p.struct({"networkFeeUSDCents": p.uint32, "gasMultiplierWeiPerEth": p.uint64, "premiumMultiplierWeiPerEth": p.uint64, "enabled": p.bool})), - getNopFeesJuels: viewFun("0x54b71468", "getNopFeesJuels()", {}, p.uint96), - getNops: viewFun("0xb06d41bc", "getNops()", {}, {"nopsAndWeights": p.array(p.struct({"nop": p.address, "weight": p.uint16})), "weightsTotal": p.uint256}), - getPoolBySourceToken: viewFun("0x48a98aa4", "getPoolBySourceToken(uint64,address)", {"_0": p.uint64, "sourceToken": p.address}, p.address), - getSenderNonce: viewFun("0x856c8247", "getSenderNonce(address)", {"sender": p.address}, p.uint64), - getStaticConfig: viewFun("0x06285c69", "getStaticConfig()", {}, p.struct({"linkToken": p.address, "chainSelector": p.uint64, "destChainSelector": p.uint64, "defaultTxGasLimit": p.uint64, "maxNopFeesJuels": p.uint96, "prevOnRamp": p.address, "armProxy": p.address})), - getSupportedTokens: viewFun("0xfbca3b74", "getSupportedTokens(uint64)", {"_0": p.uint64}, p.array(p.address)), - getTokenLimitAdmin: viewFun("0x599f6431", "getTokenLimitAdmin()", {}, p.address), - getTokenTransferFeeConfig: viewFun("0x1772047e", "getTokenTransferFeeConfig(address)", {"token": p.address}, p.struct({"minFeeUSDCents": p.uint32, "maxFeeUSDCents": p.uint32, "deciBps": p.uint16, "destGasOverhead": p.uint32, "destBytesOverhead": p.uint32})), - linkAvailableForPayment: viewFun("0xd09dc339", "linkAvailableForPayment()", {}, p.int256), - owner: viewFun("0x8da5cb5b", "owner()", {}, p.address), - payNops: fun("0xeff7cc48", "payNops()", {}, ), - setAdmin: fun("0x704b6c02", "setAdmin(address)", {"newAdmin": p.address}, ), - setDynamicConfig: fun("0xe687b40a", "setDynamicConfig((address,uint16,uint32,uint16,uint32,uint16,uint16,address,uint32,uint32))", {"dynamicConfig": p.struct({"router": p.address, "maxNumberOfTokensPerMsg": p.uint16, "destGasOverhead": p.uint32, "destGasPerPayloadByte": p.uint16, "destDataAvailabilityOverheadGas": p.uint32, "destGasPerDataAvailabilityByte": p.uint16, "destDataAvailabilityMultiplierBps": p.uint16, "priceRegistry": p.address, "maxDataBytes": p.uint32, "maxPerMsgGasLimit": p.uint32})}, ), - setFeeTokenConfig: fun("0xf25561fd", "setFeeTokenConfig((address,uint32,uint64,uint64,bool)[])", {"feeTokenConfigArgs": p.array(p.struct({"token": p.address, "networkFeeUSDCents": p.uint32, "gasMultiplierWeiPerEth": p.uint64, "premiumMultiplierWeiPerEth": p.uint64, "enabled": p.bool}))}, ), - setNops: fun("0x76f6ae76", "setNops((address,uint16)[])", {"nopsAndWeights": p.array(p.struct({"nop": p.address, "weight": p.uint16}))}, ), - setRateLimiterConfig: fun("0xc92b2832", "setRateLimiterConfig((bool,uint128,uint128))", {"config": p.struct({"isEnabled": p.bool, "capacity": p.uint128, "rate": p.uint128})}, ), - setTokenTransferFeeConfig: fun("0x7ec75751", "setTokenTransferFeeConfig((address,uint32,uint32,uint16,uint32,uint32)[])", {"tokenTransferFeeConfigArgs": p.array(p.struct({"token": p.address, "minFeeUSDCents": p.uint32, "maxFeeUSDCents": p.uint32, "deciBps": p.uint16, "destGasOverhead": p.uint32, "destBytesOverhead": p.uint32}))}, ), - transferOwnership: fun("0xf2fde38b", "transferOwnership(address)", {"to": p.address}, ), - typeAndVersion: viewFun("0x181f5a77", "typeAndVersion()", {}, p.string), - withdrawNonLinkFees: fun("0x549e946f", "withdrawNonLinkFees(address,address)", {"feeToken": p.address, "to": p.address}, ), -} - -export class Contract extends ContractBase { - - currentRateLimiterState() { - return this.eth_call(functions.currentRateLimiterState, {}) - } - - getDynamicConfig() { - return this.eth_call(functions.getDynamicConfig, {}) - } - - getExpectedNextSequenceNumber() { - return this.eth_call(functions.getExpectedNextSequenceNumber, {}) - } - - getFee(destChainSelector: GetFeeParams["destChainSelector"], message: GetFeeParams["message"]) { - return this.eth_call(functions.getFee, {destChainSelector, message}) - } - - getFeeTokenConfig(token: GetFeeTokenConfigParams["token"]) { - return this.eth_call(functions.getFeeTokenConfig, {token}) - } - - getNopFeesJuels() { - return this.eth_call(functions.getNopFeesJuels, {}) - } - - getNops() { - return this.eth_call(functions.getNops, {}) - } - - getPoolBySourceToken(_0: GetPoolBySourceTokenParams["_0"], sourceToken: GetPoolBySourceTokenParams["sourceToken"]) { - return this.eth_call(functions.getPoolBySourceToken, {_0, sourceToken}) - } - - getSenderNonce(sender: GetSenderNonceParams["sender"]) { - return this.eth_call(functions.getSenderNonce, {sender}) - } - - getStaticConfig() { - return this.eth_call(functions.getStaticConfig, {}) - } - - getSupportedTokens(_0: GetSupportedTokensParams["_0"]) { - return this.eth_call(functions.getSupportedTokens, {_0}) - } - - getTokenLimitAdmin() { - return this.eth_call(functions.getTokenLimitAdmin, {}) - } - - getTokenTransferFeeConfig(token: GetTokenTransferFeeConfigParams["token"]) { - return this.eth_call(functions.getTokenTransferFeeConfig, {token}) - } - - linkAvailableForPayment() { - return this.eth_call(functions.linkAvailableForPayment, {}) - } - - owner() { - return this.eth_call(functions.owner, {}) - } - - typeAndVersion() { - return this.eth_call(functions.typeAndVersion, {}) - } -} - -/// Event types -export type AdminSetEventArgs = EParams -export type CCIPSendRequestedEventArgs = EParams -export type ConfigSetEventArgs = EParams -export type FeeConfigSetEventArgs = EParams -export type NopPaidEventArgs = EParams -export type NopsSetEventArgs = EParams -export type OwnershipTransferRequestedEventArgs = EParams -export type OwnershipTransferredEventArgs = EParams -export type PoolAddedEventArgs = EParams -export type PoolRemovedEventArgs = EParams -export type TokenTransferFeeConfigSetEventArgs = EParams - -/// Function types -export type AcceptOwnershipParams = FunctionArguments -export type AcceptOwnershipReturn = FunctionReturn - -export type ApplyPoolUpdatesParams = FunctionArguments -export type ApplyPoolUpdatesReturn = FunctionReturn - -export type CurrentRateLimiterStateParams = FunctionArguments -export type CurrentRateLimiterStateReturn = FunctionReturn - -export type ForwardFromRouterParams = FunctionArguments -export type ForwardFromRouterReturn = FunctionReturn - -export type GetDynamicConfigParams = FunctionArguments -export type GetDynamicConfigReturn = FunctionReturn - -export type GetExpectedNextSequenceNumberParams = FunctionArguments -export type GetExpectedNextSequenceNumberReturn = FunctionReturn - -export type GetFeeParams = FunctionArguments -export type GetFeeReturn = FunctionReturn - -export type GetFeeTokenConfigParams = FunctionArguments -export type GetFeeTokenConfigReturn = FunctionReturn - -export type GetNopFeesJuelsParams = FunctionArguments -export type GetNopFeesJuelsReturn = FunctionReturn - -export type GetNopsParams = FunctionArguments -export type GetNopsReturn = FunctionReturn - -export type GetPoolBySourceTokenParams = FunctionArguments -export type GetPoolBySourceTokenReturn = FunctionReturn - -export type GetSenderNonceParams = FunctionArguments -export type GetSenderNonceReturn = FunctionReturn - -export type GetStaticConfigParams = FunctionArguments -export type GetStaticConfigReturn = FunctionReturn - -export type GetSupportedTokensParams = FunctionArguments -export type GetSupportedTokensReturn = FunctionReturn - -export type GetTokenLimitAdminParams = FunctionArguments -export type GetTokenLimitAdminReturn = FunctionReturn - -export type GetTokenTransferFeeConfigParams = FunctionArguments -export type GetTokenTransferFeeConfigReturn = FunctionReturn - -export type LinkAvailableForPaymentParams = FunctionArguments -export type LinkAvailableForPaymentReturn = FunctionReturn - -export type OwnerParams = FunctionArguments -export type OwnerReturn = FunctionReturn - -export type PayNopsParams = FunctionArguments -export type PayNopsReturn = FunctionReturn - -export type SetAdminParams = FunctionArguments -export type SetAdminReturn = FunctionReturn - -export type SetDynamicConfigParams = FunctionArguments -export type SetDynamicConfigReturn = FunctionReturn - -export type SetFeeTokenConfigParams = FunctionArguments -export type SetFeeTokenConfigReturn = FunctionReturn - -export type SetNopsParams = FunctionArguments -export type SetNopsReturn = FunctionReturn - -export type SetRateLimiterConfigParams = FunctionArguments -export type SetRateLimiterConfigReturn = FunctionReturn - -export type SetTokenTransferFeeConfigParams = FunctionArguments -export type SetTokenTransferFeeConfigReturn = FunctionReturn - -export type TransferOwnershipParams = FunctionArguments -export type TransferOwnershipReturn = FunctionReturn - -export type TypeAndVersionParams = FunctionArguments -export type TypeAndVersionReturn = FunctionReturn - -export type WithdrawNonLinkFeesParams = FunctionArguments -export type WithdrawNonLinkFeesReturn = FunctionReturn - diff --git a/src/abi/ccip-evm2evmonramp/contract.ts b/src/abi/ccip-evm2evmonramp/contract.ts new file mode 100644 index 00000000..2d8d5cd4 --- /dev/null +++ b/src/abi/ccip-evm2evmonramp/contract.ts @@ -0,0 +1,73 @@ +import { ContractBase } from '../abi.support.js' +import { currentRateLimiterState, forwardFromRouter, getDynamicConfig, getExpectedNextSequenceNumber, getFee, getFeeTokenConfig, getNopFeesJuels, getNops, getPoolBySourceToken, getSenderNonce, getStaticConfig, getSupportedTokens, getTokenLimitAdmin, getTokenTransferFeeConfig, linkAvailableForPayment, owner, typeAndVersion } from './functions.js' +import type { ForwardFromRouterParams, GetFeeParams, GetFeeTokenConfigParams, GetPoolBySourceTokenParams, GetSenderNonceParams, GetSupportedTokensParams, GetTokenTransferFeeConfigParams } from './functions.js' + +export class Contract extends ContractBase { + currentRateLimiterState() { + return this.eth_call(currentRateLimiterState, {}) + } + + forwardFromRouter(destChainSelector: ForwardFromRouterParams["destChainSelector"], message: ForwardFromRouterParams["message"], feeTokenAmount: ForwardFromRouterParams["feeTokenAmount"], originalSender: ForwardFromRouterParams["originalSender"]) { + return this.eth_call(forwardFromRouter, {destChainSelector, message, feeTokenAmount, originalSender}) + } + + getDynamicConfig() { + return this.eth_call(getDynamicConfig, {}) + } + + getExpectedNextSequenceNumber() { + return this.eth_call(getExpectedNextSequenceNumber, {}) + } + + getFee(destChainSelector: GetFeeParams["destChainSelector"], message: GetFeeParams["message"]) { + return this.eth_call(getFee, {destChainSelector, message}) + } + + getFeeTokenConfig(token: GetFeeTokenConfigParams["token"]) { + return this.eth_call(getFeeTokenConfig, {token}) + } + + getNopFeesJuels() { + return this.eth_call(getNopFeesJuels, {}) + } + + getNops() { + return this.eth_call(getNops, {}) + } + + getPoolBySourceToken(_0: GetPoolBySourceTokenParams["_0"], sourceToken: GetPoolBySourceTokenParams["sourceToken"]) { + return this.eth_call(getPoolBySourceToken, {_0, sourceToken}) + } + + getSenderNonce(sender: GetSenderNonceParams["sender"]) { + return this.eth_call(getSenderNonce, {sender}) + } + + getStaticConfig() { + return this.eth_call(getStaticConfig, {}) + } + + getSupportedTokens(_0: GetSupportedTokensParams["_0"]) { + return this.eth_call(getSupportedTokens, {_0}) + } + + getTokenLimitAdmin() { + return this.eth_call(getTokenLimitAdmin, {}) + } + + getTokenTransferFeeConfig(token: GetTokenTransferFeeConfigParams["token"]) { + return this.eth_call(getTokenTransferFeeConfig, {token}) + } + + linkAvailableForPayment() { + return this.eth_call(linkAvailableForPayment, {}) + } + + owner() { + return this.eth_call(owner, {}) + } + + typeAndVersion() { + return this.eth_call(typeAndVersion, {}) + } +} diff --git a/src/abi/ccip-evm2evmonramp/events.ts b/src/abi/ccip-evm2evmonramp/events.ts new file mode 100644 index 00000000..03cebb13 --- /dev/null +++ b/src/abi/ccip-evm2evmonramp/events.ts @@ -0,0 +1,128 @@ +import { address, array, bool, bytes, bytes32, struct, uint16, uint256, uint32, uint64, uint96 } from '@subsquid/evm-codec' +import { event, indexed } from '../abi.support.js' +import type { EventParams as EParams } from '../abi.support.js' + +/** AdminSet(address) */ +export const AdminSet = event('0x8fe72c3e0020beb3234e76ae6676fa576fbfcae600af1c4fea44784cf0db329c', { + newAdmin: address, +}) +export type AdminSetEventArgs = EParams + +/** CCIPSendRequested((uint64,address,address,uint64,uint256,bool,uint64,address,uint256,bytes,(address,uint256)[],bytes[],bytes32)) */ +export const CCIPSendRequested = event('0xd0c3c799bf9e2639de44391e7f524d229b2b55f5b1ea94b2bf7da42f7243dddd', { + message: struct({ + sourceChainSelector: uint64, + sender: address, + receiver: address, + sequenceNumber: uint64, + gasLimit: uint256, + strict: bool, + nonce: uint64, + feeToken: address, + feeTokenAmount: uint256, + data: bytes, + tokenAmounts: array(struct({ + token: address, + amount: uint256, + })), + sourceTokenData: array(bytes), + messageId: bytes32, + }), +}) +export type CCIPSendRequestedEventArgs = EParams + +/** ConfigSet((address,uint64,uint64,uint64,uint96,address,address),(address,uint16,uint32,uint16,uint32,uint16,uint16,address,uint32,uint32)) */ +export const ConfigSet = event('0x2a57f7c2027cf032c78b77d4d8d2fbd20ad22e5d5e5b5fb23ac7d7820d44adc6', { + staticConfig: struct({ + linkToken: address, + chainSelector: uint64, + destChainSelector: uint64, + defaultTxGasLimit: uint64, + maxNopFeesJuels: uint96, + prevOnRamp: address, + armProxy: address, + }), + dynamicConfig: struct({ + router: address, + maxNumberOfTokensPerMsg: uint16, + destGasOverhead: uint32, + destGasPerPayloadByte: uint16, + destDataAvailabilityOverheadGas: uint32, + destGasPerDataAvailabilityByte: uint16, + destDataAvailabilityMultiplierBps: uint16, + priceRegistry: address, + maxDataBytes: uint32, + maxPerMsgGasLimit: uint32, + }), +}) +export type ConfigSetEventArgs = EParams + +/** FeeConfigSet((address,uint32,uint64,uint64,bool)[]) */ +export const FeeConfigSet = event('0x067924bf9277d905a9a4631a06d959bc032ace86b3caa835ae7e403d4f39010e', { + feeConfig: array(struct({ + token: address, + networkFeeUSDCents: uint32, + gasMultiplierWeiPerEth: uint64, + premiumMultiplierWeiPerEth: uint64, + enabled: bool, + })), +}) +export type FeeConfigSetEventArgs = EParams + +/** NopPaid(address,uint256) */ +export const NopPaid = event('0x55fdec2aab60a41fa5abb106670eb1006f5aeaee1ba7afea2bc89b5b3ec7678f', { + nop: indexed(address), + amount: uint256, +}) +export type NopPaidEventArgs = EParams + +/** NopsSet(uint256,(address,uint16)[]) */ +export const NopsSet = event('0x8c337bff38141c507abd25c547606bdde78fe8c12e941ab613f3a565fea6cd24', { + nopWeightsTotal: uint256, + nopsAndWeights: array(struct({ + nop: address, + weight: uint16, + })), +}) +export type NopsSetEventArgs = EParams + +/** OwnershipTransferRequested(address,address) */ +export const OwnershipTransferRequested = event('0xed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae1278', { + from: indexed(address), + to: indexed(address), +}) +export type OwnershipTransferRequestedEventArgs = EParams + +/** OwnershipTransferred(address,address) */ +export const OwnershipTransferred = event('0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0', { + from: indexed(address), + to: indexed(address), +}) +export type OwnershipTransferredEventArgs = EParams + +/** PoolAdded(address,address) */ +export const PoolAdded = event('0x95f865c2808f8b2a85eea2611db7843150ee7835ef1403f9755918a97d76933c', { + token: address, + pool: address, +}) +export type PoolAddedEventArgs = EParams + +/** PoolRemoved(address,address) */ +export const PoolRemoved = event('0x987eb3c2f78454541205f72f34839b434c306c9eaf4922efd7c0c3060fdb2e4c', { + token: address, + pool: address, +}) +export type PoolRemovedEventArgs = EParams + +/** TokenTransferFeeConfigSet((address,uint32,uint32,uint16,uint32,uint32)[]) */ +export const TokenTransferFeeConfigSet = event('0x555c74101f7a15746d31c6731170310e667bcc607996b2fc0b981a7b26a416e9', { + transferFeeConfig: array(struct({ + token: address, + minFeeUSDCents: uint32, + maxFeeUSDCents: uint32, + deciBps: uint16, + destGasOverhead: uint32, + destBytesOverhead: uint32, + })), +}) +export type TokenTransferFeeConfigSetEventArgs = EParams diff --git a/src/abi/ccip-evm2evmonramp/functions.ts b/src/abi/ccip-evm2evmonramp/functions.ts new file mode 100644 index 00000000..52240eb9 --- /dev/null +++ b/src/abi/ccip-evm2evmonramp/functions.ts @@ -0,0 +1,279 @@ +import { address, array, bool, bytes, bytes32, int256, string, struct, uint128, uint16, uint256, uint32, uint64, uint96 } from '@subsquid/evm-codec' +import { func } from '../abi.support.js' +import type { FunctionArguments, FunctionReturn } from '../abi.support.js' + +/** acceptOwnership() */ +export const acceptOwnership = func('0x79ba5097', {}) +export type AcceptOwnershipParams = FunctionArguments +export type AcceptOwnershipReturn = FunctionReturn + +/** applyPoolUpdates((address,address)[],(address,address)[]) */ +export const applyPoolUpdates = func('0x3a87ac53', { + removes: array(struct({ + token: address, + pool: address, + })), + adds: array(struct({ + token: address, + pool: address, + })), +}) +export type ApplyPoolUpdatesParams = FunctionArguments +export type ApplyPoolUpdatesReturn = FunctionReturn + +/** currentRateLimiterState() */ +export const currentRateLimiterState = func('0x546719cd', {}, struct({ + tokens: uint128, + lastUpdated: uint32, + isEnabled: bool, + capacity: uint128, + rate: uint128, +})) +export type CurrentRateLimiterStateParams = FunctionArguments +export type CurrentRateLimiterStateReturn = FunctionReturn + +/** forwardFromRouter(uint64,(bytes,bytes,(address,uint256)[],address,bytes),uint256,address) */ +export const forwardFromRouter = func('0xdf0aa9e9', { + destChainSelector: uint64, + message: struct({ + receiver: bytes, + data: bytes, + tokenAmounts: array(struct({ + token: address, + amount: uint256, + })), + feeToken: address, + extraArgs: bytes, + }), + feeTokenAmount: uint256, + originalSender: address, +}, bytes32) +export type ForwardFromRouterParams = FunctionArguments +export type ForwardFromRouterReturn = FunctionReturn + +/** getDynamicConfig() */ +export const getDynamicConfig = func('0x7437ff9f', {}, struct({ + router: address, + maxNumberOfTokensPerMsg: uint16, + destGasOverhead: uint32, + destGasPerPayloadByte: uint16, + destDataAvailabilityOverheadGas: uint32, + destGasPerDataAvailabilityByte: uint16, + destDataAvailabilityMultiplierBps: uint16, + priceRegistry: address, + maxDataBytes: uint32, + maxPerMsgGasLimit: uint32, +})) +export type GetDynamicConfigParams = FunctionArguments +export type GetDynamicConfigReturn = FunctionReturn + +/** getExpectedNextSequenceNumber() */ +export const getExpectedNextSequenceNumber = func('0x4120fccd', {}, uint64) +export type GetExpectedNextSequenceNumberParams = FunctionArguments +export type GetExpectedNextSequenceNumberReturn = FunctionReturn + +/** getFee(uint64,(bytes,bytes,(address,uint256)[],address,bytes)) */ +export const getFee = func('0x20487ded', { + destChainSelector: uint64, + message: struct({ + receiver: bytes, + data: bytes, + tokenAmounts: array(struct({ + token: address, + amount: uint256, + })), + feeToken: address, + extraArgs: bytes, + }), +}, uint256) +export type GetFeeParams = FunctionArguments +export type GetFeeReturn = FunctionReturn + +/** getFeeTokenConfig(address) */ +export const getFeeTokenConfig = func('0x9a113c36', { + token: address, +}, struct({ + networkFeeUSDCents: uint32, + gasMultiplierWeiPerEth: uint64, + premiumMultiplierWeiPerEth: uint64, + enabled: bool, +})) +export type GetFeeTokenConfigParams = FunctionArguments +export type GetFeeTokenConfigReturn = FunctionReturn + +/** getNopFeesJuels() */ +export const getNopFeesJuels = func('0x54b71468', {}, uint96) +export type GetNopFeesJuelsParams = FunctionArguments +export type GetNopFeesJuelsReturn = FunctionReturn + +/** getNops() */ +export const getNops = func('0xb06d41bc', {}, struct({ + nopsAndWeights: array(struct({ + nop: address, + weight: uint16, + })), + weightsTotal: uint256, +})) +export type GetNopsParams = FunctionArguments +export type GetNopsReturn = FunctionReturn + +/** getPoolBySourceToken(uint64,address) */ +export const getPoolBySourceToken = func('0x48a98aa4', { + _0: uint64, + sourceToken: address, +}, address) +export type GetPoolBySourceTokenParams = FunctionArguments +export type GetPoolBySourceTokenReturn = FunctionReturn + +/** getSenderNonce(address) */ +export const getSenderNonce = func('0x856c8247', { + sender: address, +}, uint64) +export type GetSenderNonceParams = FunctionArguments +export type GetSenderNonceReturn = FunctionReturn + +/** getStaticConfig() */ +export const getStaticConfig = func('0x06285c69', {}, struct({ + linkToken: address, + chainSelector: uint64, + destChainSelector: uint64, + defaultTxGasLimit: uint64, + maxNopFeesJuels: uint96, + prevOnRamp: address, + armProxy: address, +})) +export type GetStaticConfigParams = FunctionArguments +export type GetStaticConfigReturn = FunctionReturn + +/** getSupportedTokens(uint64) */ +export const getSupportedTokens = func('0xfbca3b74', { + _0: uint64, +}, array(address)) +export type GetSupportedTokensParams = FunctionArguments +export type GetSupportedTokensReturn = FunctionReturn + +/** getTokenLimitAdmin() */ +export const getTokenLimitAdmin = func('0x599f6431', {}, address) +export type GetTokenLimitAdminParams = FunctionArguments +export type GetTokenLimitAdminReturn = FunctionReturn + +/** getTokenTransferFeeConfig(address) */ +export const getTokenTransferFeeConfig = func('0x1772047e', { + token: address, +}, struct({ + minFeeUSDCents: uint32, + maxFeeUSDCents: uint32, + deciBps: uint16, + destGasOverhead: uint32, + destBytesOverhead: uint32, +})) +export type GetTokenTransferFeeConfigParams = FunctionArguments +export type GetTokenTransferFeeConfigReturn = FunctionReturn + +/** linkAvailableForPayment() */ +export const linkAvailableForPayment = func('0xd09dc339', {}, int256) +export type LinkAvailableForPaymentParams = FunctionArguments +export type LinkAvailableForPaymentReturn = FunctionReturn + +/** owner() */ +export const owner = func('0x8da5cb5b', {}, address) +export type OwnerParams = FunctionArguments +export type OwnerReturn = FunctionReturn + +/** payNops() */ +export const payNops = func('0xeff7cc48', {}) +export type PayNopsParams = FunctionArguments +export type PayNopsReturn = FunctionReturn + +/** setAdmin(address) */ +export const setAdmin = func('0x704b6c02', { + newAdmin: address, +}) +export type SetAdminParams = FunctionArguments +export type SetAdminReturn = FunctionReturn + +/** setDynamicConfig((address,uint16,uint32,uint16,uint32,uint16,uint16,address,uint32,uint32)) */ +export const setDynamicConfig = func('0xe687b40a', { + dynamicConfig: struct({ + router: address, + maxNumberOfTokensPerMsg: uint16, + destGasOverhead: uint32, + destGasPerPayloadByte: uint16, + destDataAvailabilityOverheadGas: uint32, + destGasPerDataAvailabilityByte: uint16, + destDataAvailabilityMultiplierBps: uint16, + priceRegistry: address, + maxDataBytes: uint32, + maxPerMsgGasLimit: uint32, + }), +}) +export type SetDynamicConfigParams = FunctionArguments +export type SetDynamicConfigReturn = FunctionReturn + +/** setFeeTokenConfig((address,uint32,uint64,uint64,bool)[]) */ +export const setFeeTokenConfig = func('0xf25561fd', { + feeTokenConfigArgs: array(struct({ + token: address, + networkFeeUSDCents: uint32, + gasMultiplierWeiPerEth: uint64, + premiumMultiplierWeiPerEth: uint64, + enabled: bool, + })), +}) +export type SetFeeTokenConfigParams = FunctionArguments +export type SetFeeTokenConfigReturn = FunctionReturn + +/** setNops((address,uint16)[]) */ +export const setNops = func('0x76f6ae76', { + nopsAndWeights: array(struct({ + nop: address, + weight: uint16, + })), +}) +export type SetNopsParams = FunctionArguments +export type SetNopsReturn = FunctionReturn + +/** setRateLimiterConfig((bool,uint128,uint128)) */ +export const setRateLimiterConfig = func('0xc92b2832', { + config: struct({ + isEnabled: bool, + capacity: uint128, + rate: uint128, + }), +}) +export type SetRateLimiterConfigParams = FunctionArguments +export type SetRateLimiterConfigReturn = FunctionReturn + +/** setTokenTransferFeeConfig((address,uint32,uint32,uint16,uint32,uint32)[]) */ +export const setTokenTransferFeeConfig = func('0x7ec75751', { + tokenTransferFeeConfigArgs: array(struct({ + token: address, + minFeeUSDCents: uint32, + maxFeeUSDCents: uint32, + deciBps: uint16, + destGasOverhead: uint32, + destBytesOverhead: uint32, + })), +}) +export type SetTokenTransferFeeConfigParams = FunctionArguments +export type SetTokenTransferFeeConfigReturn = FunctionReturn + +/** transferOwnership(address) */ +export const transferOwnership = func('0xf2fde38b', { + to: address, +}) +export type TransferOwnershipParams = FunctionArguments +export type TransferOwnershipReturn = FunctionReturn + +/** typeAndVersion() */ +export const typeAndVersion = func('0x181f5a77', {}, string) +export type TypeAndVersionParams = FunctionArguments +export type TypeAndVersionReturn = FunctionReturn + +/** withdrawNonLinkFees(address,address) */ +export const withdrawNonLinkFees = func('0x549e946f', { + feeToken: address, + to: address, +}) +export type WithdrawNonLinkFeesParams = FunctionArguments +export type WithdrawNonLinkFeesReturn = FunctionReturn diff --git a/src/abi/ccip-evm2evmonramp/index.ts b/src/abi/ccip-evm2evmonramp/index.ts new file mode 100644 index 00000000..11829d6e --- /dev/null +++ b/src/abi/ccip-evm2evmonramp/index.ts @@ -0,0 +1,4 @@ +export * as events from './events.js' +export * as functions from './functions.js' + +export { Contract } from './contract.js' diff --git a/src/abi/ccip-router.ts b/src/abi/ccip-router.ts deleted file mode 100644 index b3a53500..00000000 --- a/src/abi/ccip-router.ts +++ /dev/null @@ -1,144 +0,0 @@ -import * as p from '@subsquid/evm-codec' -import { event, fun, viewFun, indexed, ContractBase } from '@subsquid/evm-abi' -import type { EventParams as EParams, FunctionArguments, FunctionReturn } from '@subsquid/evm-abi' - -export const events = { - MessageExecuted: event("0x9b877de93ea9895756e337442c657f95a34fc68e7eb988bdfa693d5be83016b6", "MessageExecuted(bytes32,uint64,address,bytes32)", {"messageId": p.bytes32, "sourceChainSelector": p.uint64, "offRamp": p.address, "calldataHash": p.bytes32}), - OffRampAdded: event("0xa4bdf64ebdf3316320601a081916a75aa144bcef6c4beeb0e9fb1982cacc6b94", "OffRampAdded(uint64,address)", {"sourceChainSelector": indexed(p.uint64), "offRamp": p.address}), - OffRampRemoved: event("0xa823809efda3ba66c873364eec120fa0923d9fabda73bc97dd5663341e2d9bcb", "OffRampRemoved(uint64,address)", {"sourceChainSelector": indexed(p.uint64), "offRamp": p.address}), - OnRampSet: event("0x1f7d0ec248b80e5c0dde0ee531c4fc8fdb6ce9a2b3d90f560c74acd6a7202f23", "OnRampSet(uint64,address)", {"destChainSelector": indexed(p.uint64), "onRamp": p.address}), - OwnershipTransferRequested: event("0xed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae1278", "OwnershipTransferRequested(address,address)", {"from": indexed(p.address), "to": indexed(p.address)}), - OwnershipTransferred: event("0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", "OwnershipTransferred(address,address)", {"from": indexed(p.address), "to": indexed(p.address)}), -} - -export const functions = { - MAX_RET_BYTES: viewFun("0x787350e3", "MAX_RET_BYTES()", {}, p.uint16), - acceptOwnership: fun("0x79ba5097", "acceptOwnership()", {}, ), - applyRampUpdates: fun("0xda5fcac8", "applyRampUpdates((uint64,address)[],(uint64,address)[],(uint64,address)[])", {"onRampUpdates": p.array(p.struct({"destChainSelector": p.uint64, "onRamp": p.address})), "offRampRemoves": p.array(p.struct({"sourceChainSelector": p.uint64, "offRamp": p.address})), "offRampAdds": p.array(p.struct({"sourceChainSelector": p.uint64, "offRamp": p.address}))}, ), - ccipSend: fun("0x96f4e9f9", "ccipSend(uint64,(bytes,bytes,(address,uint256)[],address,bytes))", {"destinationChainSelector": p.uint64, "message": p.struct({"receiver": p.bytes, "data": p.bytes, "tokenAmounts": p.array(p.struct({"token": p.address, "amount": p.uint256})), "feeToken": p.address, "extraArgs": p.bytes})}, p.bytes32), - getArmProxy: viewFun("0x5246492f", "getArmProxy()", {}, p.address), - getFee: viewFun("0x20487ded", "getFee(uint64,(bytes,bytes,(address,uint256)[],address,bytes))", {"destinationChainSelector": p.uint64, "message": p.struct({"receiver": p.bytes, "data": p.bytes, "tokenAmounts": p.array(p.struct({"token": p.address, "amount": p.uint256})), "feeToken": p.address, "extraArgs": p.bytes})}, p.uint256), - getOffRamps: viewFun("0xa40e69c7", "getOffRamps()", {}, p.array(p.struct({"sourceChainSelector": p.uint64, "offRamp": p.address}))), - getOnRamp: viewFun("0xa8d87a3b", "getOnRamp(uint64)", {"destChainSelector": p.uint64}, p.address), - getSupportedTokens: viewFun("0xfbca3b74", "getSupportedTokens(uint64)", {"chainSelector": p.uint64}, p.array(p.address)), - getWrappedNative: viewFun("0xe861e907", "getWrappedNative()", {}, p.address), - isChainSupported: viewFun("0xa48a9058", "isChainSupported(uint64)", {"chainSelector": p.uint64}, p.bool), - isOffRamp: viewFun("0x83826b2b", "isOffRamp(uint64,address)", {"sourceChainSelector": p.uint64, "offRamp": p.address}, p.bool), - owner: viewFun("0x8da5cb5b", "owner()", {}, p.address), - recoverTokens: fun("0x5f3e849f", "recoverTokens(address,address,uint256)", {"tokenAddress": p.address, "to": p.address, "amount": p.uint256}, ), - routeMessage: fun("0x3cf97983", "routeMessage((bytes32,uint64,bytes,bytes,(address,uint256)[]),uint16,uint256,address)", {"message": p.struct({"messageId": p.bytes32, "sourceChainSelector": p.uint64, "sender": p.bytes, "data": p.bytes, "destTokenAmounts": p.array(p.struct({"token": p.address, "amount": p.uint256}))}), "gasForCallExactCheck": p.uint16, "gasLimit": p.uint256, "receiver": p.address}, {"success": p.bool, "retData": p.bytes, "gasUsed": p.uint256}), - setWrappedNative: fun("0x52cb60ca", "setWrappedNative(address)", {"wrappedNative": p.address}, ), - transferOwnership: fun("0xf2fde38b", "transferOwnership(address)", {"to": p.address}, ), - typeAndVersion: viewFun("0x181f5a77", "typeAndVersion()", {}, p.string), -} - -export class Contract extends ContractBase { - - MAX_RET_BYTES() { - return this.eth_call(functions.MAX_RET_BYTES, {}) - } - - getArmProxy() { - return this.eth_call(functions.getArmProxy, {}) - } - - getFee(destinationChainSelector: GetFeeParams["destinationChainSelector"], message: GetFeeParams["message"]) { - return this.eth_call(functions.getFee, {destinationChainSelector, message}) - } - - getOffRamps() { - return this.eth_call(functions.getOffRamps, {}) - } - - getOnRamp(destChainSelector: GetOnRampParams["destChainSelector"]) { - return this.eth_call(functions.getOnRamp, {destChainSelector}) - } - - getSupportedTokens(chainSelector: GetSupportedTokensParams["chainSelector"]) { - return this.eth_call(functions.getSupportedTokens, {chainSelector}) - } - - getWrappedNative() { - return this.eth_call(functions.getWrappedNative, {}) - } - - isChainSupported(chainSelector: IsChainSupportedParams["chainSelector"]) { - return this.eth_call(functions.isChainSupported, {chainSelector}) - } - - isOffRamp(sourceChainSelector: IsOffRampParams["sourceChainSelector"], offRamp: IsOffRampParams["offRamp"]) { - return this.eth_call(functions.isOffRamp, {sourceChainSelector, offRamp}) - } - - owner() { - return this.eth_call(functions.owner, {}) - } - - typeAndVersion() { - return this.eth_call(functions.typeAndVersion, {}) - } -} - -/// Event types -export type MessageExecutedEventArgs = EParams -export type OffRampAddedEventArgs = EParams -export type OffRampRemovedEventArgs = EParams -export type OnRampSetEventArgs = EParams -export type OwnershipTransferRequestedEventArgs = EParams -export type OwnershipTransferredEventArgs = EParams - -/// Function types -export type MAX_RET_BYTESParams = FunctionArguments -export type MAX_RET_BYTESReturn = FunctionReturn - -export type AcceptOwnershipParams = FunctionArguments -export type AcceptOwnershipReturn = FunctionReturn - -export type ApplyRampUpdatesParams = FunctionArguments -export type ApplyRampUpdatesReturn = FunctionReturn - -export type CcipSendParams = FunctionArguments -export type CcipSendReturn = FunctionReturn - -export type GetArmProxyParams = FunctionArguments -export type GetArmProxyReturn = FunctionReturn - -export type GetFeeParams = FunctionArguments -export type GetFeeReturn = FunctionReturn - -export type GetOffRampsParams = FunctionArguments -export type GetOffRampsReturn = FunctionReturn - -export type GetOnRampParams = FunctionArguments -export type GetOnRampReturn = FunctionReturn - -export type GetSupportedTokensParams = FunctionArguments -export type GetSupportedTokensReturn = FunctionReturn - -export type GetWrappedNativeParams = FunctionArguments -export type GetWrappedNativeReturn = FunctionReturn - -export type IsChainSupportedParams = FunctionArguments -export type IsChainSupportedReturn = FunctionReturn - -export type IsOffRampParams = FunctionArguments -export type IsOffRampReturn = FunctionReturn - -export type OwnerParams = FunctionArguments -export type OwnerReturn = FunctionReturn - -export type RecoverTokensParams = FunctionArguments -export type RecoverTokensReturn = FunctionReturn - -export type RouteMessageParams = FunctionArguments -export type RouteMessageReturn = FunctionReturn - -export type SetWrappedNativeParams = FunctionArguments -export type SetWrappedNativeReturn = FunctionReturn - -export type TransferOwnershipParams = FunctionArguments -export type TransferOwnershipReturn = FunctionReturn - -export type TypeAndVersionParams = FunctionArguments -export type TypeAndVersionReturn = FunctionReturn - diff --git a/src/abi/ccip-router/contract.ts b/src/abi/ccip-router/contract.ts new file mode 100644 index 00000000..719c8e82 --- /dev/null +++ b/src/abi/ccip-router/contract.ts @@ -0,0 +1,57 @@ +import { ContractBase } from '../abi.support.js' +import { MAX_RET_BYTES, ccipSend, getArmProxy, getFee, getOffRamps, getOnRamp, getSupportedTokens, getWrappedNative, isChainSupported, isOffRamp, owner, routeMessage, typeAndVersion } from './functions.js' +import type { CcipSendParams, GetFeeParams, GetOnRampParams, GetSupportedTokensParams, IsChainSupportedParams, IsOffRampParams, RouteMessageParams } from './functions.js' + +export class Contract extends ContractBase { + MAX_RET_BYTES() { + return this.eth_call(MAX_RET_BYTES, {}) + } + + ccipSend(destinationChainSelector: CcipSendParams["destinationChainSelector"], message: CcipSendParams["message"]) { + return this.eth_call(ccipSend, {destinationChainSelector, message}) + } + + getArmProxy() { + return this.eth_call(getArmProxy, {}) + } + + getFee(destinationChainSelector: GetFeeParams["destinationChainSelector"], message: GetFeeParams["message"]) { + return this.eth_call(getFee, {destinationChainSelector, message}) + } + + getOffRamps() { + return this.eth_call(getOffRamps, {}) + } + + getOnRamp(destChainSelector: GetOnRampParams["destChainSelector"]) { + return this.eth_call(getOnRamp, {destChainSelector}) + } + + getSupportedTokens(chainSelector: GetSupportedTokensParams["chainSelector"]) { + return this.eth_call(getSupportedTokens, {chainSelector}) + } + + getWrappedNative() { + return this.eth_call(getWrappedNative, {}) + } + + isChainSupported(chainSelector: IsChainSupportedParams["chainSelector"]) { + return this.eth_call(isChainSupported, {chainSelector}) + } + + isOffRamp(sourceChainSelector: IsOffRampParams["sourceChainSelector"], offRamp: IsOffRampParams["offRamp"]) { + return this.eth_call(isOffRamp, {sourceChainSelector, offRamp}) + } + + owner() { + return this.eth_call(owner, {}) + } + + routeMessage(message: RouteMessageParams["message"], gasForCallExactCheck: RouteMessageParams["gasForCallExactCheck"], gasLimit: RouteMessageParams["gasLimit"], receiver: RouteMessageParams["receiver"]) { + return this.eth_call(routeMessage, {message, gasForCallExactCheck, gasLimit, receiver}) + } + + typeAndVersion() { + return this.eth_call(typeAndVersion, {}) + } +} diff --git a/src/abi/ccip-router/events.ts b/src/abi/ccip-router/events.ts new file mode 100644 index 00000000..b8768e1f --- /dev/null +++ b/src/abi/ccip-router/events.ts @@ -0,0 +1,47 @@ +import { address, bytes32, uint64 } from '@subsquid/evm-codec' +import { event, indexed } from '../abi.support.js' +import type { EventParams as EParams } from '../abi.support.js' + +/** MessageExecuted(bytes32,uint64,address,bytes32) */ +export const MessageExecuted = event('0x9b877de93ea9895756e337442c657f95a34fc68e7eb988bdfa693d5be83016b6', { + messageId: bytes32, + sourceChainSelector: uint64, + offRamp: address, + calldataHash: bytes32, +}) +export type MessageExecutedEventArgs = EParams + +/** OffRampAdded(uint64,address) */ +export const OffRampAdded = event('0xa4bdf64ebdf3316320601a081916a75aa144bcef6c4beeb0e9fb1982cacc6b94', { + sourceChainSelector: indexed(uint64), + offRamp: address, +}) +export type OffRampAddedEventArgs = EParams + +/** OffRampRemoved(uint64,address) */ +export const OffRampRemoved = event('0xa823809efda3ba66c873364eec120fa0923d9fabda73bc97dd5663341e2d9bcb', { + sourceChainSelector: indexed(uint64), + offRamp: address, +}) +export type OffRampRemovedEventArgs = EParams + +/** OnRampSet(uint64,address) */ +export const OnRampSet = event('0x1f7d0ec248b80e5c0dde0ee531c4fc8fdb6ce9a2b3d90f560c74acd6a7202f23', { + destChainSelector: indexed(uint64), + onRamp: address, +}) +export type OnRampSetEventArgs = EParams + +/** OwnershipTransferRequested(address,address) */ +export const OwnershipTransferRequested = event('0xed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae1278', { + from: indexed(address), + to: indexed(address), +}) +export type OwnershipTransferRequestedEventArgs = EParams + +/** OwnershipTransferred(address,address) */ +export const OwnershipTransferred = event('0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0', { + from: indexed(address), + to: indexed(address), +}) +export type OwnershipTransferredEventArgs = EParams diff --git a/src/abi/ccip-router/functions.ts b/src/abi/ccip-router/functions.ts new file mode 100644 index 00000000..f489a094 --- /dev/null +++ b/src/abi/ccip-router/functions.ts @@ -0,0 +1,168 @@ +import { address, array, bool, bytes, bytes32, string, struct, uint16, uint256, uint64 } from '@subsquid/evm-codec' +import { func } from '../abi.support.js' +import type { FunctionArguments, FunctionReturn } from '../abi.support.js' + +/** MAX_RET_BYTES() */ +export const MAX_RET_BYTES = func('0x787350e3', {}, uint16) +export type MAX_RET_BYTESParams = FunctionArguments +export type MAX_RET_BYTESReturn = FunctionReturn + +/** acceptOwnership() */ +export const acceptOwnership = func('0x79ba5097', {}) +export type AcceptOwnershipParams = FunctionArguments +export type AcceptOwnershipReturn = FunctionReturn + +/** applyRampUpdates((uint64,address)[],(uint64,address)[],(uint64,address)[]) */ +export const applyRampUpdates = func('0xda5fcac8', { + onRampUpdates: array(struct({ + destChainSelector: uint64, + onRamp: address, + })), + offRampRemoves: array(struct({ + sourceChainSelector: uint64, + offRamp: address, + })), + offRampAdds: array(struct({ + sourceChainSelector: uint64, + offRamp: address, + })), +}) +export type ApplyRampUpdatesParams = FunctionArguments +export type ApplyRampUpdatesReturn = FunctionReturn + +/** ccipSend(uint64,(bytes,bytes,(address,uint256)[],address,bytes)) */ +export const ccipSend = func('0x96f4e9f9', { + destinationChainSelector: uint64, + message: struct({ + receiver: bytes, + data: bytes, + tokenAmounts: array(struct({ + token: address, + amount: uint256, + })), + feeToken: address, + extraArgs: bytes, + }), +}, bytes32) +export type CcipSendParams = FunctionArguments +export type CcipSendReturn = FunctionReturn + +/** getArmProxy() */ +export const getArmProxy = func('0x5246492f', {}, address) +export type GetArmProxyParams = FunctionArguments +export type GetArmProxyReturn = FunctionReturn + +/** getFee(uint64,(bytes,bytes,(address,uint256)[],address,bytes)) */ +export const getFee = func('0x20487ded', { + destinationChainSelector: uint64, + message: struct({ + receiver: bytes, + data: bytes, + tokenAmounts: array(struct({ + token: address, + amount: uint256, + })), + feeToken: address, + extraArgs: bytes, + }), +}, uint256) +export type GetFeeParams = FunctionArguments +export type GetFeeReturn = FunctionReturn + +/** getOffRamps() */ +export const getOffRamps = func('0xa40e69c7', {}, array(struct({ + sourceChainSelector: uint64, + offRamp: address, +}))) +export type GetOffRampsParams = FunctionArguments +export type GetOffRampsReturn = FunctionReturn + +/** getOnRamp(uint64) */ +export const getOnRamp = func('0xa8d87a3b', { + destChainSelector: uint64, +}, address) +export type GetOnRampParams = FunctionArguments +export type GetOnRampReturn = FunctionReturn + +/** getSupportedTokens(uint64) */ +export const getSupportedTokens = func('0xfbca3b74', { + chainSelector: uint64, +}, array(address)) +export type GetSupportedTokensParams = FunctionArguments +export type GetSupportedTokensReturn = FunctionReturn + +/** getWrappedNative() */ +export const getWrappedNative = func('0xe861e907', {}, address) +export type GetWrappedNativeParams = FunctionArguments +export type GetWrappedNativeReturn = FunctionReturn + +/** isChainSupported(uint64) */ +export const isChainSupported = func('0xa48a9058', { + chainSelector: uint64, +}, bool) +export type IsChainSupportedParams = FunctionArguments +export type IsChainSupportedReturn = FunctionReturn + +/** isOffRamp(uint64,address) */ +export const isOffRamp = func('0x83826b2b', { + sourceChainSelector: uint64, + offRamp: address, +}, bool) +export type IsOffRampParams = FunctionArguments +export type IsOffRampReturn = FunctionReturn + +/** owner() */ +export const owner = func('0x8da5cb5b', {}, address) +export type OwnerParams = FunctionArguments +export type OwnerReturn = FunctionReturn + +/** recoverTokens(address,address,uint256) */ +export const recoverTokens = func('0x5f3e849f', { + tokenAddress: address, + to: address, + amount: uint256, +}) +export type RecoverTokensParams = FunctionArguments +export type RecoverTokensReturn = FunctionReturn + +/** routeMessage((bytes32,uint64,bytes,bytes,(address,uint256)[]),uint16,uint256,address) */ +export const routeMessage = func('0x3cf97983', { + message: struct({ + messageId: bytes32, + sourceChainSelector: uint64, + sender: bytes, + data: bytes, + destTokenAmounts: array(struct({ + token: address, + amount: uint256, + })), + }), + gasForCallExactCheck: uint16, + gasLimit: uint256, + receiver: address, +}, struct({ + success: bool, + retData: bytes, + gasUsed: uint256, +})) +export type RouteMessageParams = FunctionArguments +export type RouteMessageReturn = FunctionReturn + +/** setWrappedNative(address) */ +export const setWrappedNative = func('0x52cb60ca', { + wrappedNative: address, +}) +export type SetWrappedNativeParams = FunctionArguments +export type SetWrappedNativeReturn = FunctionReturn + +/** transferOwnership(address) */ +export const transferOwnership = func('0xf2fde38b', { + to: address, +}) +export type TransferOwnershipParams = FunctionArguments +export type TransferOwnershipReturn = FunctionReturn + +/** typeAndVersion() */ +export const typeAndVersion = func('0x181f5a77', {}, string) +export type TypeAndVersionParams = FunctionArguments +export type TypeAndVersionReturn = FunctionReturn diff --git a/src/abi/ccip-router/index.ts b/src/abi/ccip-router/index.ts new file mode 100644 index 00000000..11829d6e --- /dev/null +++ b/src/abi/ccip-router/index.ts @@ -0,0 +1,4 @@ +export * as events from './events.js' +export * as functions from './functions.js' + +export { Contract } from './contract.js' diff --git a/src/abi/chainlink-feed-registry.ts b/src/abi/chainlink-feed-registry.ts deleted file mode 100644 index 37e78abc..00000000 --- a/src/abi/chainlink-feed-registry.ts +++ /dev/null @@ -1,246 +0,0 @@ -import * as p from '@subsquid/evm-codec' -import { event, fun, viewFun, indexed, ContractBase } from '@subsquid/evm-abi' -import type { EventParams as EParams, FunctionArguments, FunctionReturn } from '@subsquid/evm-abi' - -export const events = { - AccessControllerSet: event("0x953e92b1a6442e9c3242531154a3f6f6eb00b4e9c719ba8118fa6235e4ce89b6", "AccessControllerSet(address,address)", {"accessController": indexed(p.address), "sender": indexed(p.address)}), - FeedConfirmed: event("0x27a180c70f2642f63d1694eb252b7df52e7ab2565e3f67adf7748acb7d82b9bc", "FeedConfirmed(address,address,address,address,uint16,address)", {"asset": indexed(p.address), "denomination": indexed(p.address), "latestAggregator": indexed(p.address), "previousAggregator": p.address, "nextPhaseId": p.uint16, "sender": p.address}), - FeedProposed: event("0xb56c4f88c3e344891ef92e51f036d7116e886f4ea57f5ba93e28b5f44925b9ce", "FeedProposed(address,address,address,address,address)", {"asset": indexed(p.address), "denomination": indexed(p.address), "proposedAggregator": indexed(p.address), "currentAggregator": p.address, "sender": p.address}), - OwnershipTransferRequested: event("0xed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae1278", "OwnershipTransferRequested(address,address)", {"from": indexed(p.address), "to": indexed(p.address)}), - OwnershipTransferred: event("0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", "OwnershipTransferred(address,address)", {"from": indexed(p.address), "to": indexed(p.address)}), -} - -export const functions = { - acceptOwnership: fun("0x79ba5097", "acceptOwnership()", {}, ), - confirmFeed: fun("0x045abf4b", "confirmFeed(address,address,address)", {"base": p.address, "quote": p.address, "aggregator": p.address}, ), - decimals: viewFun("0x58e2d3a8", "decimals(address,address)", {"base": p.address, "quote": p.address}, p.uint8), - description: viewFun("0xfa820de9", "description(address,address)", {"base": p.address, "quote": p.address}, p.string), - getAccessController: viewFun("0x16d6b5f6", "getAccessController()", {}, p.address), - getAnswer: viewFun("0x15cd4ad2", "getAnswer(address,address,uint256)", {"base": p.address, "quote": p.address, "roundId": p.uint256}, p.int256), - getCurrentPhaseId: viewFun("0x30322818", "getCurrentPhaseId(address,address)", {"base": p.address, "quote": p.address}, p.uint16), - getFeed: viewFun("0xd2edb6dd", "getFeed(address,address)", {"base": p.address, "quote": p.address}, p.address), - getNextRoundId: viewFun("0xa051538e", "getNextRoundId(address,address,uint80)", {"base": p.address, "quote": p.address, "roundId": p.uint80}, p.uint80), - getPhase: viewFun("0xff0601c0", "getPhase(address,address,uint16)", {"base": p.address, "quote": p.address, "phaseId": p.uint16}, p.struct({"phaseId": p.uint16, "startingAggregatorRoundId": p.uint80, "endingAggregatorRoundId": p.uint80})), - getPhaseFeed: viewFun("0x52dbeb8b", "getPhaseFeed(address,address,uint16)", {"base": p.address, "quote": p.address, "phaseId": p.uint16}, p.address), - getPhaseRange: viewFun("0xc1ce86fc", "getPhaseRange(address,address,uint16)", {"base": p.address, "quote": p.address, "phaseId": p.uint16}, {"startingRoundId": p.uint80, "endingRoundId": p.uint80}), - getPreviousRoundId: viewFun("0x9e3ff6fd", "getPreviousRoundId(address,address,uint80)", {"base": p.address, "quote": p.address, "roundId": p.uint80}, p.uint80), - getProposedFeed: viewFun("0x5ad9d9df", "getProposedFeed(address,address)", {"base": p.address, "quote": p.address}, p.address), - getRoundData: viewFun("0xfc58749e", "getRoundData(address,address,uint80)", {"base": p.address, "quote": p.address, "_roundId": p.uint80}, {"roundId": p.uint80, "answer": p.int256, "startedAt": p.uint256, "updatedAt": p.uint256, "answeredInRound": p.uint80}), - getRoundFeed: viewFun("0xc639cd91", "getRoundFeed(address,address,uint80)", {"base": p.address, "quote": p.address, "roundId": p.uint80}, p.address), - getTimestamp: viewFun("0x91624c95", "getTimestamp(address,address,uint256)", {"base": p.address, "quote": p.address, "roundId": p.uint256}, p.uint256), - isFeedEnabled: viewFun("0xb099d43b", "isFeedEnabled(address)", {"aggregator": p.address}, p.bool), - latestAnswer: viewFun("0xd4c282a3", "latestAnswer(address,address)", {"base": p.address, "quote": p.address}, p.int256), - latestRound: viewFun("0xec62f44b", "latestRound(address,address)", {"base": p.address, "quote": p.address}, p.uint256), - latestRoundData: viewFun("0xbcfd032d", "latestRoundData(address,address)", {"base": p.address, "quote": p.address}, {"roundId": p.uint80, "answer": p.int256, "startedAt": p.uint256, "updatedAt": p.uint256, "answeredInRound": p.uint80}), - latestTimestamp: viewFun("0x672ff44f", "latestTimestamp(address,address)", {"base": p.address, "quote": p.address}, p.uint256), - owner: viewFun("0x8da5cb5b", "owner()", {}, p.address), - proposeFeed: fun("0x9eed82b0", "proposeFeed(address,address,address)", {"base": p.address, "quote": p.address, "aggregator": p.address}, ), - proposedGetRoundData: viewFun("0x8916524a", "proposedGetRoundData(address,address,uint80)", {"base": p.address, "quote": p.address, "roundId": p.uint80}, {"id": p.uint80, "answer": p.int256, "startedAt": p.uint256, "updatedAt": p.uint256, "answeredInRound": p.uint80}), - proposedLatestRoundData: viewFun("0xd0188fc6", "proposedLatestRoundData(address,address)", {"base": p.address, "quote": p.address}, {"id": p.uint80, "answer": p.int256, "startedAt": p.uint256, "updatedAt": p.uint256, "answeredInRound": p.uint80}), - setAccessController: fun("0xf08391d8", "setAccessController(address)", {"_accessController": p.address}, ), - transferOwnership: fun("0xf2fde38b", "transferOwnership(address)", {"to": p.address}, ), - typeAndVersion: viewFun("0x181f5a77", "typeAndVersion()", {}, p.string), - version: viewFun("0xaf34b03a", "version(address,address)", {"base": p.address, "quote": p.address}, p.uint256), -} - -export class Contract extends ContractBase { - - decimals(base: DecimalsParams["base"], quote: DecimalsParams["quote"]) { - return this.eth_call(functions.decimals, {base, quote}) - } - - description(base: DescriptionParams["base"], quote: DescriptionParams["quote"]) { - return this.eth_call(functions.description, {base, quote}) - } - - getAccessController() { - return this.eth_call(functions.getAccessController, {}) - } - - getAnswer(base: GetAnswerParams["base"], quote: GetAnswerParams["quote"], roundId: GetAnswerParams["roundId"]) { - return this.eth_call(functions.getAnswer, {base, quote, roundId}) - } - - getCurrentPhaseId(base: GetCurrentPhaseIdParams["base"], quote: GetCurrentPhaseIdParams["quote"]) { - return this.eth_call(functions.getCurrentPhaseId, {base, quote}) - } - - getFeed(base: GetFeedParams["base"], quote: GetFeedParams["quote"]) { - return this.eth_call(functions.getFeed, {base, quote}) - } - - getNextRoundId(base: GetNextRoundIdParams["base"], quote: GetNextRoundIdParams["quote"], roundId: GetNextRoundIdParams["roundId"]) { - return this.eth_call(functions.getNextRoundId, {base, quote, roundId}) - } - - getPhase(base: GetPhaseParams["base"], quote: GetPhaseParams["quote"], phaseId: GetPhaseParams["phaseId"]) { - return this.eth_call(functions.getPhase, {base, quote, phaseId}) - } - - getPhaseFeed(base: GetPhaseFeedParams["base"], quote: GetPhaseFeedParams["quote"], phaseId: GetPhaseFeedParams["phaseId"]) { - return this.eth_call(functions.getPhaseFeed, {base, quote, phaseId}) - } - - getPhaseRange(base: GetPhaseRangeParams["base"], quote: GetPhaseRangeParams["quote"], phaseId: GetPhaseRangeParams["phaseId"]) { - return this.eth_call(functions.getPhaseRange, {base, quote, phaseId}) - } - - getPreviousRoundId(base: GetPreviousRoundIdParams["base"], quote: GetPreviousRoundIdParams["quote"], roundId: GetPreviousRoundIdParams["roundId"]) { - return this.eth_call(functions.getPreviousRoundId, {base, quote, roundId}) - } - - getProposedFeed(base: GetProposedFeedParams["base"], quote: GetProposedFeedParams["quote"]) { - return this.eth_call(functions.getProposedFeed, {base, quote}) - } - - getRoundData(base: GetRoundDataParams["base"], quote: GetRoundDataParams["quote"], _roundId: GetRoundDataParams["_roundId"]) { - return this.eth_call(functions.getRoundData, {base, quote, _roundId}) - } - - getRoundFeed(base: GetRoundFeedParams["base"], quote: GetRoundFeedParams["quote"], roundId: GetRoundFeedParams["roundId"]) { - return this.eth_call(functions.getRoundFeed, {base, quote, roundId}) - } - - getTimestamp(base: GetTimestampParams["base"], quote: GetTimestampParams["quote"], roundId: GetTimestampParams["roundId"]) { - return this.eth_call(functions.getTimestamp, {base, quote, roundId}) - } - - isFeedEnabled(aggregator: IsFeedEnabledParams["aggregator"]) { - return this.eth_call(functions.isFeedEnabled, {aggregator}) - } - - latestAnswer(base: LatestAnswerParams["base"], quote: LatestAnswerParams["quote"]) { - return this.eth_call(functions.latestAnswer, {base, quote}) - } - - latestRound(base: LatestRoundParams["base"], quote: LatestRoundParams["quote"]) { - return this.eth_call(functions.latestRound, {base, quote}) - } - - latestRoundData(base: LatestRoundDataParams["base"], quote: LatestRoundDataParams["quote"]) { - return this.eth_call(functions.latestRoundData, {base, quote}) - } - - latestTimestamp(base: LatestTimestampParams["base"], quote: LatestTimestampParams["quote"]) { - return this.eth_call(functions.latestTimestamp, {base, quote}) - } - - owner() { - return this.eth_call(functions.owner, {}) - } - - proposedGetRoundData(base: ProposedGetRoundDataParams["base"], quote: ProposedGetRoundDataParams["quote"], roundId: ProposedGetRoundDataParams["roundId"]) { - return this.eth_call(functions.proposedGetRoundData, {base, quote, roundId}) - } - - proposedLatestRoundData(base: ProposedLatestRoundDataParams["base"], quote: ProposedLatestRoundDataParams["quote"]) { - return this.eth_call(functions.proposedLatestRoundData, {base, quote}) - } - - typeAndVersion() { - return this.eth_call(functions.typeAndVersion, {}) - } - - version(base: VersionParams["base"], quote: VersionParams["quote"]) { - return this.eth_call(functions.version, {base, quote}) - } -} - -/// Event types -export type AccessControllerSetEventArgs = EParams -export type FeedConfirmedEventArgs = EParams -export type FeedProposedEventArgs = EParams -export type OwnershipTransferRequestedEventArgs = EParams -export type OwnershipTransferredEventArgs = EParams - -/// Function types -export type AcceptOwnershipParams = FunctionArguments -export type AcceptOwnershipReturn = FunctionReturn - -export type ConfirmFeedParams = FunctionArguments -export type ConfirmFeedReturn = FunctionReturn - -export type DecimalsParams = FunctionArguments -export type DecimalsReturn = FunctionReturn - -export type DescriptionParams = FunctionArguments -export type DescriptionReturn = FunctionReturn - -export type GetAccessControllerParams = FunctionArguments -export type GetAccessControllerReturn = FunctionReturn - -export type GetAnswerParams = FunctionArguments -export type GetAnswerReturn = FunctionReturn - -export type GetCurrentPhaseIdParams = FunctionArguments -export type GetCurrentPhaseIdReturn = FunctionReturn - -export type GetFeedParams = FunctionArguments -export type GetFeedReturn = FunctionReturn - -export type GetNextRoundIdParams = FunctionArguments -export type GetNextRoundIdReturn = FunctionReturn - -export type GetPhaseParams = FunctionArguments -export type GetPhaseReturn = FunctionReturn - -export type GetPhaseFeedParams = FunctionArguments -export type GetPhaseFeedReturn = FunctionReturn - -export type GetPhaseRangeParams = FunctionArguments -export type GetPhaseRangeReturn = FunctionReturn - -export type GetPreviousRoundIdParams = FunctionArguments -export type GetPreviousRoundIdReturn = FunctionReturn - -export type GetProposedFeedParams = FunctionArguments -export type GetProposedFeedReturn = FunctionReturn - -export type GetRoundDataParams = FunctionArguments -export type GetRoundDataReturn = FunctionReturn - -export type GetRoundFeedParams = FunctionArguments -export type GetRoundFeedReturn = FunctionReturn - -export type GetTimestampParams = FunctionArguments -export type GetTimestampReturn = FunctionReturn - -export type IsFeedEnabledParams = FunctionArguments -export type IsFeedEnabledReturn = FunctionReturn - -export type LatestAnswerParams = FunctionArguments -export type LatestAnswerReturn = FunctionReturn - -export type LatestRoundParams = FunctionArguments -export type LatestRoundReturn = FunctionReturn - -export type LatestRoundDataParams = FunctionArguments -export type LatestRoundDataReturn = FunctionReturn - -export type LatestTimestampParams = FunctionArguments -export type LatestTimestampReturn = FunctionReturn - -export type OwnerParams = FunctionArguments -export type OwnerReturn = FunctionReturn - -export type ProposeFeedParams = FunctionArguments -export type ProposeFeedReturn = FunctionReturn - -export type ProposedGetRoundDataParams = FunctionArguments -export type ProposedGetRoundDataReturn = FunctionReturn - -export type ProposedLatestRoundDataParams = FunctionArguments -export type ProposedLatestRoundDataReturn = FunctionReturn - -export type SetAccessControllerParams = FunctionArguments -export type SetAccessControllerReturn = FunctionReturn - -export type TransferOwnershipParams = FunctionArguments -export type TransferOwnershipReturn = FunctionReturn - -export type TypeAndVersionParams = FunctionArguments -export type TypeAndVersionReturn = FunctionReturn - -export type VersionParams = FunctionArguments -export type VersionReturn = FunctionReturn - diff --git a/src/abi/chainlink-feed-registry/contract.ts b/src/abi/chainlink-feed-registry/contract.ts new file mode 100644 index 00000000..9af9da7c --- /dev/null +++ b/src/abi/chainlink-feed-registry/contract.ts @@ -0,0 +1,105 @@ +import { ContractBase } from '../abi.support.js' +import { decimals, description, getAccessController, getAnswer, getCurrentPhaseId, getFeed, getNextRoundId, getPhase, getPhaseFeed, getPhaseRange, getPreviousRoundId, getProposedFeed, getRoundData, getRoundFeed, getTimestamp, isFeedEnabled, latestAnswer, latestRound, latestRoundData, latestTimestamp, owner, proposedGetRoundData, proposedLatestRoundData, typeAndVersion, version } from './functions.js' +import type { DecimalsParams, DescriptionParams, GetAnswerParams, GetCurrentPhaseIdParams, GetFeedParams, GetNextRoundIdParams, GetPhaseFeedParams, GetPhaseParams, GetPhaseRangeParams, GetPreviousRoundIdParams, GetProposedFeedParams, GetRoundDataParams, GetRoundFeedParams, GetTimestampParams, IsFeedEnabledParams, LatestAnswerParams, LatestRoundDataParams, LatestRoundParams, LatestTimestampParams, ProposedGetRoundDataParams, ProposedLatestRoundDataParams, VersionParams } from './functions.js' + +export class Contract extends ContractBase { + decimals(base: DecimalsParams["base"], quote: DecimalsParams["quote"]) { + return this.eth_call(decimals, {base, quote}) + } + + description(base: DescriptionParams["base"], quote: DescriptionParams["quote"]) { + return this.eth_call(description, {base, quote}) + } + + getAccessController() { + return this.eth_call(getAccessController, {}) + } + + getAnswer(base: GetAnswerParams["base"], quote: GetAnswerParams["quote"], roundId: GetAnswerParams["roundId"]) { + return this.eth_call(getAnswer, {base, quote, roundId}) + } + + getCurrentPhaseId(base: GetCurrentPhaseIdParams["base"], quote: GetCurrentPhaseIdParams["quote"]) { + return this.eth_call(getCurrentPhaseId, {base, quote}) + } + + getFeed(base: GetFeedParams["base"], quote: GetFeedParams["quote"]) { + return this.eth_call(getFeed, {base, quote}) + } + + getNextRoundId(base: GetNextRoundIdParams["base"], quote: GetNextRoundIdParams["quote"], roundId: GetNextRoundIdParams["roundId"]) { + return this.eth_call(getNextRoundId, {base, quote, roundId}) + } + + getPhase(base: GetPhaseParams["base"], quote: GetPhaseParams["quote"], phaseId: GetPhaseParams["phaseId"]) { + return this.eth_call(getPhase, {base, quote, phaseId}) + } + + getPhaseFeed(base: GetPhaseFeedParams["base"], quote: GetPhaseFeedParams["quote"], phaseId: GetPhaseFeedParams["phaseId"]) { + return this.eth_call(getPhaseFeed, {base, quote, phaseId}) + } + + getPhaseRange(base: GetPhaseRangeParams["base"], quote: GetPhaseRangeParams["quote"], phaseId: GetPhaseRangeParams["phaseId"]) { + return this.eth_call(getPhaseRange, {base, quote, phaseId}) + } + + getPreviousRoundId(base: GetPreviousRoundIdParams["base"], quote: GetPreviousRoundIdParams["quote"], roundId: GetPreviousRoundIdParams["roundId"]) { + return this.eth_call(getPreviousRoundId, {base, quote, roundId}) + } + + getProposedFeed(base: GetProposedFeedParams["base"], quote: GetProposedFeedParams["quote"]) { + return this.eth_call(getProposedFeed, {base, quote}) + } + + getRoundData(base: GetRoundDataParams["base"], quote: GetRoundDataParams["quote"], _roundId: GetRoundDataParams["_roundId"]) { + return this.eth_call(getRoundData, {base, quote, _roundId}) + } + + getRoundFeed(base: GetRoundFeedParams["base"], quote: GetRoundFeedParams["quote"], roundId: GetRoundFeedParams["roundId"]) { + return this.eth_call(getRoundFeed, {base, quote, roundId}) + } + + getTimestamp(base: GetTimestampParams["base"], quote: GetTimestampParams["quote"], roundId: GetTimestampParams["roundId"]) { + return this.eth_call(getTimestamp, {base, quote, roundId}) + } + + isFeedEnabled(aggregator: IsFeedEnabledParams["aggregator"]) { + return this.eth_call(isFeedEnabled, {aggregator}) + } + + latestAnswer(base: LatestAnswerParams["base"], quote: LatestAnswerParams["quote"]) { + return this.eth_call(latestAnswer, {base, quote}) + } + + latestRound(base: LatestRoundParams["base"], quote: LatestRoundParams["quote"]) { + return this.eth_call(latestRound, {base, quote}) + } + + latestRoundData(base: LatestRoundDataParams["base"], quote: LatestRoundDataParams["quote"]) { + return this.eth_call(latestRoundData, {base, quote}) + } + + latestTimestamp(base: LatestTimestampParams["base"], quote: LatestTimestampParams["quote"]) { + return this.eth_call(latestTimestamp, {base, quote}) + } + + owner() { + return this.eth_call(owner, {}) + } + + proposedGetRoundData(base: ProposedGetRoundDataParams["base"], quote: ProposedGetRoundDataParams["quote"], roundId: ProposedGetRoundDataParams["roundId"]) { + return this.eth_call(proposedGetRoundData, {base, quote, roundId}) + } + + proposedLatestRoundData(base: ProposedLatestRoundDataParams["base"], quote: ProposedLatestRoundDataParams["quote"]) { + return this.eth_call(proposedLatestRoundData, {base, quote}) + } + + typeAndVersion() { + return this.eth_call(typeAndVersion, {}) + } + + version(base: VersionParams["base"], quote: VersionParams["quote"]) { + return this.eth_call(version, {base, quote}) + } +} diff --git a/src/abi/chainlink-feed-registry/events.ts b/src/abi/chainlink-feed-registry/events.ts new file mode 100644 index 00000000..4c76f7ae --- /dev/null +++ b/src/abi/chainlink-feed-registry/events.ts @@ -0,0 +1,45 @@ +import { address, uint16 } from '@subsquid/evm-codec' +import { event, indexed } from '../abi.support.js' +import type { EventParams as EParams } from '../abi.support.js' + +/** AccessControllerSet(address,address) */ +export const AccessControllerSet = event('0x953e92b1a6442e9c3242531154a3f6f6eb00b4e9c719ba8118fa6235e4ce89b6', { + accessController: indexed(address), + sender: indexed(address), +}) +export type AccessControllerSetEventArgs = EParams + +/** FeedConfirmed(address,address,address,address,uint16,address) */ +export const FeedConfirmed = event('0x27a180c70f2642f63d1694eb252b7df52e7ab2565e3f67adf7748acb7d82b9bc', { + asset: indexed(address), + denomination: indexed(address), + latestAggregator: indexed(address), + previousAggregator: address, + nextPhaseId: uint16, + sender: address, +}) +export type FeedConfirmedEventArgs = EParams + +/** FeedProposed(address,address,address,address,address) */ +export const FeedProposed = event('0xb56c4f88c3e344891ef92e51f036d7116e886f4ea57f5ba93e28b5f44925b9ce', { + asset: indexed(address), + denomination: indexed(address), + proposedAggregator: indexed(address), + currentAggregator: address, + sender: address, +}) +export type FeedProposedEventArgs = EParams + +/** OwnershipTransferRequested(address,address) */ +export const OwnershipTransferRequested = event('0xed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae1278', { + from: indexed(address), + to: indexed(address), +}) +export type OwnershipTransferRequestedEventArgs = EParams + +/** OwnershipTransferred(address,address) */ +export const OwnershipTransferred = event('0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0', { + from: indexed(address), + to: indexed(address), +}) +export type OwnershipTransferredEventArgs = EParams diff --git a/src/abi/chainlink-feed-registry/functions.ts b/src/abi/chainlink-feed-registry/functions.ts new file mode 100644 index 00000000..436c6d6e --- /dev/null +++ b/src/abi/chainlink-feed-registry/functions.ts @@ -0,0 +1,271 @@ +import { address, bool, int256, string, struct, uint16, uint256, uint8, uint80 } from '@subsquid/evm-codec' +import { func } from '../abi.support.js' +import type { FunctionArguments, FunctionReturn } from '../abi.support.js' + +/** acceptOwnership() */ +export const acceptOwnership = func('0x79ba5097', {}) +export type AcceptOwnershipParams = FunctionArguments +export type AcceptOwnershipReturn = FunctionReturn + +/** confirmFeed(address,address,address) */ +export const confirmFeed = func('0x045abf4b', { + base: address, + quote: address, + aggregator: address, +}) +export type ConfirmFeedParams = FunctionArguments +export type ConfirmFeedReturn = FunctionReturn + +/** decimals(address,address) */ +export const decimals = func('0x58e2d3a8', { + base: address, + quote: address, +}, uint8) +export type DecimalsParams = FunctionArguments +export type DecimalsReturn = FunctionReturn + +/** description(address,address) */ +export const description = func('0xfa820de9', { + base: address, + quote: address, +}, string) +export type DescriptionParams = FunctionArguments +export type DescriptionReturn = FunctionReturn + +/** getAccessController() */ +export const getAccessController = func('0x16d6b5f6', {}, address) +export type GetAccessControllerParams = FunctionArguments +export type GetAccessControllerReturn = FunctionReturn + +/** getAnswer(address,address,uint256) */ +export const getAnswer = func('0x15cd4ad2', { + base: address, + quote: address, + roundId: uint256, +}, int256) +export type GetAnswerParams = FunctionArguments +export type GetAnswerReturn = FunctionReturn + +/** getCurrentPhaseId(address,address) */ +export const getCurrentPhaseId = func('0x30322818', { + base: address, + quote: address, +}, uint16) +export type GetCurrentPhaseIdParams = FunctionArguments +export type GetCurrentPhaseIdReturn = FunctionReturn + +/** getFeed(address,address) */ +export const getFeed = func('0xd2edb6dd', { + base: address, + quote: address, +}, address) +export type GetFeedParams = FunctionArguments +export type GetFeedReturn = FunctionReturn + +/** getNextRoundId(address,address,uint80) */ +export const getNextRoundId = func('0xa051538e', { + base: address, + quote: address, + roundId: uint80, +}, uint80) +export type GetNextRoundIdParams = FunctionArguments +export type GetNextRoundIdReturn = FunctionReturn + +/** getPhase(address,address,uint16) */ +export const getPhase = func('0xff0601c0', { + base: address, + quote: address, + phaseId: uint16, +}, struct({ + phaseId: uint16, + startingAggregatorRoundId: uint80, + endingAggregatorRoundId: uint80, +})) +export type GetPhaseParams = FunctionArguments +export type GetPhaseReturn = FunctionReturn + +/** getPhaseFeed(address,address,uint16) */ +export const getPhaseFeed = func('0x52dbeb8b', { + base: address, + quote: address, + phaseId: uint16, +}, address) +export type GetPhaseFeedParams = FunctionArguments +export type GetPhaseFeedReturn = FunctionReturn + +/** getPhaseRange(address,address,uint16) */ +export const getPhaseRange = func('0xc1ce86fc', { + base: address, + quote: address, + phaseId: uint16, +}, struct({ + startingRoundId: uint80, + endingRoundId: uint80, +})) +export type GetPhaseRangeParams = FunctionArguments +export type GetPhaseRangeReturn = FunctionReturn + +/** getPreviousRoundId(address,address,uint80) */ +export const getPreviousRoundId = func('0x9e3ff6fd', { + base: address, + quote: address, + roundId: uint80, +}, uint80) +export type GetPreviousRoundIdParams = FunctionArguments +export type GetPreviousRoundIdReturn = FunctionReturn + +/** getProposedFeed(address,address) */ +export const getProposedFeed = func('0x5ad9d9df', { + base: address, + quote: address, +}, address) +export type GetProposedFeedParams = FunctionArguments +export type GetProposedFeedReturn = FunctionReturn + +/** getRoundData(address,address,uint80) */ +export const getRoundData = func('0xfc58749e', { + base: address, + quote: address, + _roundId: uint80, +}, struct({ + roundId: uint80, + answer: int256, + startedAt: uint256, + updatedAt: uint256, + answeredInRound: uint80, +})) +export type GetRoundDataParams = FunctionArguments +export type GetRoundDataReturn = FunctionReturn + +/** getRoundFeed(address,address,uint80) */ +export const getRoundFeed = func('0xc639cd91', { + base: address, + quote: address, + roundId: uint80, +}, address) +export type GetRoundFeedParams = FunctionArguments +export type GetRoundFeedReturn = FunctionReturn + +/** getTimestamp(address,address,uint256) */ +export const getTimestamp = func('0x91624c95', { + base: address, + quote: address, + roundId: uint256, +}, uint256) +export type GetTimestampParams = FunctionArguments +export type GetTimestampReturn = FunctionReturn + +/** isFeedEnabled(address) */ +export const isFeedEnabled = func('0xb099d43b', { + aggregator: address, +}, bool) +export type IsFeedEnabledParams = FunctionArguments +export type IsFeedEnabledReturn = FunctionReturn + +/** latestAnswer(address,address) */ +export const latestAnswer = func('0xd4c282a3', { + base: address, + quote: address, +}, int256) +export type LatestAnswerParams = FunctionArguments +export type LatestAnswerReturn = FunctionReturn + +/** latestRound(address,address) */ +export const latestRound = func('0xec62f44b', { + base: address, + quote: address, +}, uint256) +export type LatestRoundParams = FunctionArguments +export type LatestRoundReturn = FunctionReturn + +/** latestRoundData(address,address) */ +export const latestRoundData = func('0xbcfd032d', { + base: address, + quote: address, +}, struct({ + roundId: uint80, + answer: int256, + startedAt: uint256, + updatedAt: uint256, + answeredInRound: uint80, +})) +export type LatestRoundDataParams = FunctionArguments +export type LatestRoundDataReturn = FunctionReturn + +/** latestTimestamp(address,address) */ +export const latestTimestamp = func('0x672ff44f', { + base: address, + quote: address, +}, uint256) +export type LatestTimestampParams = FunctionArguments +export type LatestTimestampReturn = FunctionReturn + +/** owner() */ +export const owner = func('0x8da5cb5b', {}, address) +export type OwnerParams = FunctionArguments +export type OwnerReturn = FunctionReturn + +/** proposeFeed(address,address,address) */ +export const proposeFeed = func('0x9eed82b0', { + base: address, + quote: address, + aggregator: address, +}) +export type ProposeFeedParams = FunctionArguments +export type ProposeFeedReturn = FunctionReturn + +/** proposedGetRoundData(address,address,uint80) */ +export const proposedGetRoundData = func('0x8916524a', { + base: address, + quote: address, + roundId: uint80, +}, struct({ + id: uint80, + answer: int256, + startedAt: uint256, + updatedAt: uint256, + answeredInRound: uint80, +})) +export type ProposedGetRoundDataParams = FunctionArguments +export type ProposedGetRoundDataReturn = FunctionReturn + +/** proposedLatestRoundData(address,address) */ +export const proposedLatestRoundData = func('0xd0188fc6', { + base: address, + quote: address, +}, struct({ + id: uint80, + answer: int256, + startedAt: uint256, + updatedAt: uint256, + answeredInRound: uint80, +})) +export type ProposedLatestRoundDataParams = FunctionArguments +export type ProposedLatestRoundDataReturn = FunctionReturn + +/** setAccessController(address) */ +export const setAccessController = func('0xf08391d8', { + _accessController: address, +}) +export type SetAccessControllerParams = FunctionArguments +export type SetAccessControllerReturn = FunctionReturn + +/** transferOwnership(address) */ +export const transferOwnership = func('0xf2fde38b', { + to: address, +}) +export type TransferOwnershipParams = FunctionArguments +export type TransferOwnershipReturn = FunctionReturn + +/** typeAndVersion() */ +export const typeAndVersion = func('0x181f5a77', {}, string) +export type TypeAndVersionParams = FunctionArguments +export type TypeAndVersionReturn = FunctionReturn + +/** version(address,address) */ +export const version = func('0xaf34b03a', { + base: address, + quote: address, +}, uint256) +export type VersionParams = FunctionArguments +export type VersionReturn = FunctionReturn diff --git a/src/abi/chainlink-feed-registry/index.ts b/src/abi/chainlink-feed-registry/index.ts new file mode 100644 index 00000000..11829d6e --- /dev/null +++ b/src/abi/chainlink-feed-registry/index.ts @@ -0,0 +1,4 @@ +export * as events from './events.js' +export * as functions from './functions.js' + +export { Contract } from './contract.js' diff --git a/src/abi/cow-swap-settlement.ts b/src/abi/cow-swap-settlement.ts deleted file mode 100644 index aa271f78..00000000 --- a/src/abi/cow-swap-settlement.ts +++ /dev/null @@ -1,114 +0,0 @@ -import * as p from '@subsquid/evm-codec' -import { event, fun, viewFun, indexed, ContractBase } from '@subsquid/evm-abi' -import type { EventParams as EParams, FunctionArguments, FunctionReturn } from '@subsquid/evm-abi' - -export const events = { - Interaction: event("0xed99827efb37016f2275f98c4bcf71c7551c75d59e9b450f79fa32e60be672c2", "Interaction(address,uint256,bytes4)", {"target": indexed(p.address), "value": p.uint256, "selector": p.bytes4}), - OrderInvalidated: event("0x875b6cb035bbd4ac6500fabc6d1e4ca5bdc58a3e2b424ccb5c24cdbebeb009a9", "OrderInvalidated(address,bytes)", {"owner": indexed(p.address), "orderUid": p.bytes}), - PreSignature: event("0x01bf7c8b0ca55deecbea89d7e58295b7ffbf685fd0d96801034ba8c6ffe1c68d", "PreSignature(address,bytes,bool)", {"owner": indexed(p.address), "orderUid": p.bytes, "signed": p.bool}), - Settlement: event("0x40338ce1a7c49204f0099533b1e9a7ee0a3d261f84974ab7af36105b8c4e9db4", "Settlement(address)", {"solver": indexed(p.address)}), - Trade: event("0xa07a543ab8a018198e99ca0184c93fe9050a79400a0a723441f84de1d972cc17", "Trade(address,address,address,uint256,uint256,uint256,bytes)", {"owner": indexed(p.address), "sellToken": p.address, "buyToken": p.address, "sellAmount": p.uint256, "buyAmount": p.uint256, "feeAmount": p.uint256, "orderUid": p.bytes}), -} - -export const functions = { - authenticator: viewFun("0x2335c76b", "authenticator()", {}, p.address), - domainSeparator: viewFun("0xf698da25", "domainSeparator()", {}, p.bytes32), - filledAmount: viewFun("0x2479fb6e", "filledAmount(bytes)", {"_0": p.bytes}, p.uint256), - freeFilledAmountStorage: fun("0xed9f35ce", "freeFilledAmountStorage(bytes[])", {"orderUids": p.array(p.bytes)}, ), - freePreSignatureStorage: fun("0xa2a7d51b", "freePreSignatureStorage(bytes[])", {"orderUids": p.array(p.bytes)}, ), - getStorageAt: viewFun("0x5624b25b", "getStorageAt(uint256,uint256)", {"offset": p.uint256, "length": p.uint256}, p.bytes), - invalidateOrder: fun("0x15337bc0", "invalidateOrder(bytes)", {"orderUid": p.bytes}, ), - preSignature: viewFun("0xd08d33d1", "preSignature(bytes)", {"_0": p.bytes}, p.uint256), - setPreSignature: fun("0xec6cb13f", "setPreSignature(bytes,bool)", {"orderUid": p.bytes, "signed": p.bool}, ), - settle: fun("0x13d79a0b", "settle(address[],uint256[],(uint256,uint256,address,uint256,uint256,uint32,bytes32,uint256,uint256,uint256,bytes)[],(address,uint256,bytes)[][3])", {"tokens": p.array(p.address), "clearingPrices": p.array(p.uint256), "trades": p.array(p.struct({"sellTokenIndex": p.uint256, "buyTokenIndex": p.uint256, "receiver": p.address, "sellAmount": p.uint256, "buyAmount": p.uint256, "validTo": p.uint32, "appData": p.bytes32, "feeAmount": p.uint256, "flags": p.uint256, "executedAmount": p.uint256, "signature": p.bytes})), "interactions": p.fixedSizeArray(p.array(p.struct({"target": p.address, "value": p.uint256, "callData": p.bytes})), 3)}, ), - simulateDelegatecall: fun("0xf84436bd", "simulateDelegatecall(address,bytes)", {"targetContract": p.address, "calldataPayload": p.bytes}, p.bytes), - simulateDelegatecallInternal: fun("0x43218e19", "simulateDelegatecallInternal(address,bytes)", {"targetContract": p.address, "calldataPayload": p.bytes}, p.bytes), - swap: fun("0x845a101f", "swap((bytes32,uint256,uint256,uint256,bytes)[],address[],(uint256,uint256,address,uint256,uint256,uint32,bytes32,uint256,uint256,uint256,bytes))", {"swaps": p.array(p.struct({"poolId": p.bytes32, "assetInIndex": p.uint256, "assetOutIndex": p.uint256, "amount": p.uint256, "userData": p.bytes})), "tokens": p.array(p.address), "trade": p.struct({"sellTokenIndex": p.uint256, "buyTokenIndex": p.uint256, "receiver": p.address, "sellAmount": p.uint256, "buyAmount": p.uint256, "validTo": p.uint32, "appData": p.bytes32, "feeAmount": p.uint256, "flags": p.uint256, "executedAmount": p.uint256, "signature": p.bytes})}, ), - vault: viewFun("0xfbfa77cf", "vault()", {}, p.address), - vaultRelayer: viewFun("0x9b552cc2", "vaultRelayer()", {}, p.address), -} - -export class Contract extends ContractBase { - - authenticator() { - return this.eth_call(functions.authenticator, {}) - } - - domainSeparator() { - return this.eth_call(functions.domainSeparator, {}) - } - - filledAmount(_0: FilledAmountParams["_0"]) { - return this.eth_call(functions.filledAmount, {_0}) - } - - getStorageAt(offset: GetStorageAtParams["offset"], length: GetStorageAtParams["length"]) { - return this.eth_call(functions.getStorageAt, {offset, length}) - } - - preSignature(_0: PreSignatureParams["_0"]) { - return this.eth_call(functions.preSignature, {_0}) - } - - vault() { - return this.eth_call(functions.vault, {}) - } - - vaultRelayer() { - return this.eth_call(functions.vaultRelayer, {}) - } -} - -/// Event types -export type InteractionEventArgs = EParams -export type OrderInvalidatedEventArgs = EParams -export type PreSignatureEventArgs = EParams -export type SettlementEventArgs = EParams -export type TradeEventArgs = EParams - -/// Function types -export type AuthenticatorParams = FunctionArguments -export type AuthenticatorReturn = FunctionReturn - -export type DomainSeparatorParams = FunctionArguments -export type DomainSeparatorReturn = FunctionReturn - -export type FilledAmountParams = FunctionArguments -export type FilledAmountReturn = FunctionReturn - -export type FreeFilledAmountStorageParams = FunctionArguments -export type FreeFilledAmountStorageReturn = FunctionReturn - -export type FreePreSignatureStorageParams = FunctionArguments -export type FreePreSignatureStorageReturn = FunctionReturn - -export type GetStorageAtParams = FunctionArguments -export type GetStorageAtReturn = FunctionReturn - -export type InvalidateOrderParams = FunctionArguments -export type InvalidateOrderReturn = FunctionReturn - -export type PreSignatureParams = FunctionArguments -export type PreSignatureReturn = FunctionReturn - -export type SetPreSignatureParams = FunctionArguments -export type SetPreSignatureReturn = FunctionReturn - -export type SettleParams = FunctionArguments -export type SettleReturn = FunctionReturn - -export type SimulateDelegatecallParams = FunctionArguments -export type SimulateDelegatecallReturn = FunctionReturn - -export type SimulateDelegatecallInternalParams = FunctionArguments -export type SimulateDelegatecallInternalReturn = FunctionReturn - -export type SwapParams = FunctionArguments -export type SwapReturn = FunctionReturn - -export type VaultParams = FunctionArguments -export type VaultReturn = FunctionReturn - -export type VaultRelayerParams = FunctionArguments -export type VaultRelayerReturn = FunctionReturn - diff --git a/src/abi/cow-swap-settlement/contract.ts b/src/abi/cow-swap-settlement/contract.ts new file mode 100644 index 00000000..39c5bc55 --- /dev/null +++ b/src/abi/cow-swap-settlement/contract.ts @@ -0,0 +1,41 @@ +import { ContractBase } from '../abi.support.js' +import { authenticator, domainSeparator, filledAmount, getStorageAt, preSignature, simulateDelegatecall, simulateDelegatecallInternal, vault, vaultRelayer } from './functions.js' +import type { FilledAmountParams, GetStorageAtParams, PreSignatureParams, SimulateDelegatecallInternalParams, SimulateDelegatecallParams } from './functions.js' + +export class Contract extends ContractBase { + authenticator() { + return this.eth_call(authenticator, {}) + } + + domainSeparator() { + return this.eth_call(domainSeparator, {}) + } + + filledAmount(_0: FilledAmountParams["_0"]) { + return this.eth_call(filledAmount, {_0}) + } + + getStorageAt(offset: GetStorageAtParams["offset"], length: GetStorageAtParams["length"]) { + return this.eth_call(getStorageAt, {offset, length}) + } + + preSignature(_0: PreSignatureParams["_0"]) { + return this.eth_call(preSignature, {_0}) + } + + simulateDelegatecall(targetContract: SimulateDelegatecallParams["targetContract"], calldataPayload: SimulateDelegatecallParams["calldataPayload"]) { + return this.eth_call(simulateDelegatecall, {targetContract, calldataPayload}) + } + + simulateDelegatecallInternal(targetContract: SimulateDelegatecallInternalParams["targetContract"], calldataPayload: SimulateDelegatecallInternalParams["calldataPayload"]) { + return this.eth_call(simulateDelegatecallInternal, {targetContract, calldataPayload}) + } + + vault() { + return this.eth_call(vault, {}) + } + + vaultRelayer() { + return this.eth_call(vaultRelayer, {}) + } +} diff --git a/src/abi/cow-swap-settlement/events.ts b/src/abi/cow-swap-settlement/events.ts new file mode 100644 index 00000000..2ad50d50 --- /dev/null +++ b/src/abi/cow-swap-settlement/events.ts @@ -0,0 +1,44 @@ +import { address, bool, bytes, bytes4, uint256 } from '@subsquid/evm-codec' +import { event, indexed } from '../abi.support.js' +import type { EventParams as EParams } from '../abi.support.js' + +/** Interaction(address,uint256,bytes4) */ +export const Interaction = event('0xed99827efb37016f2275f98c4bcf71c7551c75d59e9b450f79fa32e60be672c2', { + target: indexed(address), + value: uint256, + selector: bytes4, +}) +export type InteractionEventArgs = EParams + +/** OrderInvalidated(address,bytes) */ +export const OrderInvalidated = event('0x875b6cb035bbd4ac6500fabc6d1e4ca5bdc58a3e2b424ccb5c24cdbebeb009a9', { + owner: indexed(address), + orderUid: bytes, +}) +export type OrderInvalidatedEventArgs = EParams + +/** PreSignature(address,bytes,bool) */ +export const PreSignature = event('0x01bf7c8b0ca55deecbea89d7e58295b7ffbf685fd0d96801034ba8c6ffe1c68d', { + owner: indexed(address), + orderUid: bytes, + signed: bool, +}) +export type PreSignatureEventArgs = EParams + +/** Settlement(address) */ +export const Settlement = event('0x40338ce1a7c49204f0099533b1e9a7ee0a3d261f84974ab7af36105b8c4e9db4', { + solver: indexed(address), +}) +export type SettlementEventArgs = EParams + +/** Trade(address,address,address,uint256,uint256,uint256,bytes) */ +export const Trade = event('0xa07a543ab8a018198e99ca0184c93fe9050a79400a0a723441f84de1d972cc17', { + owner: indexed(address), + sellToken: address, + buyToken: address, + sellAmount: uint256, + buyAmount: uint256, + feeAmount: uint256, + orderUid: bytes, +}) +export type TradeEventArgs = EParams diff --git a/src/abi/cow-swap-settlement/functions.ts b/src/abi/cow-swap-settlement/functions.ts new file mode 100644 index 00000000..ee254542 --- /dev/null +++ b/src/abi/cow-swap-settlement/functions.ts @@ -0,0 +1,143 @@ +import { address, array, bool, bytes, bytes32, fixedSizeArray, struct, uint256, uint32 } from '@subsquid/evm-codec' +import { func } from '../abi.support.js' +import type { FunctionArguments, FunctionReturn } from '../abi.support.js' + +/** authenticator() */ +export const authenticator = func('0x2335c76b', {}, address) +export type AuthenticatorParams = FunctionArguments +export type AuthenticatorReturn = FunctionReturn + +/** domainSeparator() */ +export const domainSeparator = func('0xf698da25', {}, bytes32) +export type DomainSeparatorParams = FunctionArguments +export type DomainSeparatorReturn = FunctionReturn + +/** filledAmount(bytes) */ +export const filledAmount = func('0x2479fb6e', { + _0: bytes, +}, uint256) +export type FilledAmountParams = FunctionArguments +export type FilledAmountReturn = FunctionReturn + +/** freeFilledAmountStorage(bytes[]) */ +export const freeFilledAmountStorage = func('0xed9f35ce', { + orderUids: array(bytes), +}) +export type FreeFilledAmountStorageParams = FunctionArguments +export type FreeFilledAmountStorageReturn = FunctionReturn + +/** freePreSignatureStorage(bytes[]) */ +export const freePreSignatureStorage = func('0xa2a7d51b', { + orderUids: array(bytes), +}) +export type FreePreSignatureStorageParams = FunctionArguments +export type FreePreSignatureStorageReturn = FunctionReturn + +/** getStorageAt(uint256,uint256) */ +export const getStorageAt = func('0x5624b25b', { + offset: uint256, + length: uint256, +}, bytes) +export type GetStorageAtParams = FunctionArguments +export type GetStorageAtReturn = FunctionReturn + +/** invalidateOrder(bytes) */ +export const invalidateOrder = func('0x15337bc0', { + orderUid: bytes, +}) +export type InvalidateOrderParams = FunctionArguments +export type InvalidateOrderReturn = FunctionReturn + +/** preSignature(bytes) */ +export const preSignature = func('0xd08d33d1', { + _0: bytes, +}, uint256) +export type PreSignatureParams = FunctionArguments +export type PreSignatureReturn = FunctionReturn + +/** setPreSignature(bytes,bool) */ +export const setPreSignature = func('0xec6cb13f', { + orderUid: bytes, + signed: bool, +}) +export type SetPreSignatureParams = FunctionArguments +export type SetPreSignatureReturn = FunctionReturn + +/** settle(address[],uint256[],(uint256,uint256,address,uint256,uint256,uint32,bytes32,uint256,uint256,uint256,bytes)[],(address,uint256,bytes)[][3]) */ +export const settle = func('0x13d79a0b', { + tokens: array(address), + clearingPrices: array(uint256), + trades: array(struct({ + sellTokenIndex: uint256, + buyTokenIndex: uint256, + receiver: address, + sellAmount: uint256, + buyAmount: uint256, + validTo: uint32, + appData: bytes32, + feeAmount: uint256, + flags: uint256, + executedAmount: uint256, + signature: bytes, + })), + interactions: fixedSizeArray(array(struct({ + target: address, + value: uint256, + callData: bytes, + })), 3), +}) +export type SettleParams = FunctionArguments +export type SettleReturn = FunctionReturn + +/** simulateDelegatecall(address,bytes) */ +export const simulateDelegatecall = func('0xf84436bd', { + targetContract: address, + calldataPayload: bytes, +}, bytes) +export type SimulateDelegatecallParams = FunctionArguments +export type SimulateDelegatecallReturn = FunctionReturn + +/** simulateDelegatecallInternal(address,bytes) */ +export const simulateDelegatecallInternal = func('0x43218e19', { + targetContract: address, + calldataPayload: bytes, +}, bytes) +export type SimulateDelegatecallInternalParams = FunctionArguments +export type SimulateDelegatecallInternalReturn = FunctionReturn + +/** swap((bytes32,uint256,uint256,uint256,bytes)[],address[],(uint256,uint256,address,uint256,uint256,uint32,bytes32,uint256,uint256,uint256,bytes)) */ +export const swap = func('0x845a101f', { + swaps: array(struct({ + poolId: bytes32, + assetInIndex: uint256, + assetOutIndex: uint256, + amount: uint256, + userData: bytes, + })), + tokens: array(address), + trade: struct({ + sellTokenIndex: uint256, + buyTokenIndex: uint256, + receiver: address, + sellAmount: uint256, + buyAmount: uint256, + validTo: uint32, + appData: bytes32, + feeAmount: uint256, + flags: uint256, + executedAmount: uint256, + signature: bytes, + }), +}) +export type SwapParams = FunctionArguments +export type SwapReturn = FunctionReturn + +/** vault() */ +export const vault = func('0xfbfa77cf', {}, address) +export type VaultParams = FunctionArguments +export type VaultReturn = FunctionReturn + +/** vaultRelayer() */ +export const vaultRelayer = func('0x9b552cc2', {}, address) +export type VaultRelayerParams = FunctionArguments +export type VaultRelayerReturn = FunctionReturn diff --git a/src/abi/cow-swap-settlement/index.ts b/src/abi/cow-swap-settlement/index.ts new file mode 100644 index 00000000..11829d6e --- /dev/null +++ b/src/abi/cow-swap-settlement/index.ts @@ -0,0 +1,4 @@ +export * as events from './events.js' +export * as functions from './functions.js' + +export { Contract } from './contract.js' diff --git a/src/abi/curve-lp-token.ts b/src/abi/curve-lp-token.ts deleted file mode 100644 index bd3fa6e3..00000000 --- a/src/abi/curve-lp-token.ts +++ /dev/null @@ -1,386 +0,0 @@ -import * as p from '@subsquid/evm-codec' -import { event, fun, viewFun, indexed, ContractBase } from '@subsquid/evm-abi' -import type { EventParams as EParams, FunctionArguments, FunctionReturn } from '@subsquid/evm-abi' - -export const events = { - Transfer: event("0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", "Transfer(address,address,uint256)", {"sender": indexed(p.address), "receiver": indexed(p.address), "value": p.uint256}), - Approval: event("0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925", "Approval(address,address,uint256)", {"owner": indexed(p.address), "spender": indexed(p.address), "value": p.uint256}), - TokenExchange: event("0x8b3e96f2b889fa771c53c981b40daf005f63f637f1869f707052d15a3dd97140", "TokenExchange(address,int128,uint256,int128,uint256)", {"buyer": indexed(p.address), "sold_id": p.int128, "tokens_sold": p.uint256, "bought_id": p.int128, "tokens_bought": p.uint256}), - AddLiquidity: event("0x26f55a85081d24974e85c6c00045d0f0453991e95873f52bff0d21af4079a768", "AddLiquidity(address,uint256[2],uint256[2],uint256,uint256)", {"provider": indexed(p.address), "token_amounts": p.fixedSizeArray(p.uint256, 2), "fees": p.fixedSizeArray(p.uint256, 2), "invariant": p.uint256, "token_supply": p.uint256}), - RemoveLiquidity: event("0x7c363854ccf79623411f8995b362bce5eddff18c927edc6f5dbbb5e05819a82c", "RemoveLiquidity(address,uint256[2],uint256[2],uint256)", {"provider": indexed(p.address), "token_amounts": p.fixedSizeArray(p.uint256, 2), "fees": p.fixedSizeArray(p.uint256, 2), "token_supply": p.uint256}), - RemoveLiquidityOne: event("0x5ad056f2e28a8cec232015406b843668c1e36cda598127ec3b8c59b8c72773a0", "RemoveLiquidityOne(address,uint256,uint256,uint256)", {"provider": indexed(p.address), "token_amount": p.uint256, "coin_amount": p.uint256, "token_supply": p.uint256}), - RemoveLiquidityImbalance: event("0x2b5508378d7e19e0d5fa338419034731416c4f5b219a10379956f764317fd47e", "RemoveLiquidityImbalance(address,uint256[2],uint256[2],uint256,uint256)", {"provider": indexed(p.address), "token_amounts": p.fixedSizeArray(p.uint256, 2), "fees": p.fixedSizeArray(p.uint256, 2), "invariant": p.uint256, "token_supply": p.uint256}), - RampA: event("0xa2b71ec6df949300b59aab36b55e189697b750119dd349fcfa8c0f779e83c254", "RampA(uint256,uint256,uint256,uint256)", {"old_A": p.uint256, "new_A": p.uint256, "initial_time": p.uint256, "future_time": p.uint256}), - StopRampA: event("0x46e22fb3709ad289f62ce63d469248536dbc78d82b84a3d7e74ad606dc201938", "StopRampA(uint256,uint256)", {"A": p.uint256, "t": p.uint256}), - CommitNewFee: event("0x878eb36b3f197f05821c06953d9bc8f14b332a227b1e26df06a4215bbfe5d73f", "CommitNewFee(uint256)", {"new_fee": p.uint256}), - ApplyNewFee: event("0xa8715770654f54603947addf38c689adbd7182e21673b28bcf306a957aaba215", "ApplyNewFee(uint256)", {"fee": p.uint256}), -} - -export const functions = { - initialize: fun("0xa461b3c8", "initialize(string,string,address[4],uint256[4],uint256,uint256)", {"_name": p.string, "_symbol": p.string, "_coins": p.fixedSizeArray(p.address, 4), "_rate_multipliers": p.fixedSizeArray(p.uint256, 4), "_A": p.uint256, "_fee": p.uint256}, ), - decimals: viewFun("0x313ce567", "decimals()", {}, p.uint256), - transfer: fun("0xa9059cbb", "transfer(address,uint256)", {"_to": p.address, "_value": p.uint256}, p.bool), - transferFrom: fun("0x23b872dd", "transferFrom(address,address,uint256)", {"_from": p.address, "_to": p.address, "_value": p.uint256}, p.bool), - approve: fun("0x095ea7b3", "approve(address,uint256)", {"_spender": p.address, "_value": p.uint256}, p.bool), - permit: fun("0xd505accf", "permit(address,address,uint256,uint256,uint8,bytes32,bytes32)", {"_owner": p.address, "_spender": p.address, "_value": p.uint256, "_deadline": p.uint256, "_v": p.uint8, "_r": p.bytes32, "_s": p.bytes32}, p.bool), - last_price: viewFun("0xfde625e6", "last_price()", {}, p.uint256), - ema_price: viewFun("0xc24c7c29", "ema_price()", {}, p.uint256), - get_balances: viewFun("0x14f05979", "get_balances()", {}, p.fixedSizeArray(p.uint256, 2)), - admin_fee: viewFun("0xfee3f7f9", "admin_fee()", {}, p.uint256), - A: viewFun("0xf446c1d0", "A()", {}, p.uint256), - A_precise: viewFun("0x76a2f0f0", "A_precise()", {}, p.uint256), - get_p: viewFun("0xf2388acb", "get_p()", {}, p.uint256), - price_oracle: viewFun("0x86fc88d3", "price_oracle()", {}, p.uint256), - get_virtual_price: viewFun("0xbb7b8b80", "get_virtual_price()", {}, p.uint256), - calc_token_amount: viewFun("0xed8e84f3", "calc_token_amount(uint256[2],bool)", {"_amounts": p.fixedSizeArray(p.uint256, 2), "_is_deposit": p.bool}, p.uint256), - 'add_liquidity(uint256[2],uint256)': fun("0x0b4c7e4d", "add_liquidity(uint256[2],uint256)", {"_amounts": p.fixedSizeArray(p.uint256, 2), "_min_mint_amount": p.uint256}, p.uint256), - 'add_liquidity(uint256[2],uint256,address)': fun("0x0c3e4b54", "add_liquidity(uint256[2],uint256,address)", {"_amounts": p.fixedSizeArray(p.uint256, 2), "_min_mint_amount": p.uint256, "_receiver": p.address}, p.uint256), - get_dy: viewFun("0x5e0d443f", "get_dy(int128,int128,uint256)", {"i": p.int128, "j": p.int128, "dx": p.uint256}, p.uint256), - 'exchange(int128,int128,uint256,uint256)': fun("0x3df02124", "exchange(int128,int128,uint256,uint256)", {"i": p.int128, "j": p.int128, "_dx": p.uint256, "_min_dy": p.uint256}, p.uint256), - 'exchange(int128,int128,uint256,uint256,address)': fun("0xddc1f59d", "exchange(int128,int128,uint256,uint256,address)", {"i": p.int128, "j": p.int128, "_dx": p.uint256, "_min_dy": p.uint256, "_receiver": p.address}, p.uint256), - 'remove_liquidity(uint256,uint256[2])': fun("0x5b36389c", "remove_liquidity(uint256,uint256[2])", {"_burn_amount": p.uint256, "_min_amounts": p.fixedSizeArray(p.uint256, 2)}, p.fixedSizeArray(p.uint256, 2)), - 'remove_liquidity(uint256,uint256[2],address)': fun("0x3eb1719f", "remove_liquidity(uint256,uint256[2],address)", {"_burn_amount": p.uint256, "_min_amounts": p.fixedSizeArray(p.uint256, 2), "_receiver": p.address}, p.fixedSizeArray(p.uint256, 2)), - 'remove_liquidity_imbalance(uint256[2],uint256)': fun("0xe3103273", "remove_liquidity_imbalance(uint256[2],uint256)", {"_amounts": p.fixedSizeArray(p.uint256, 2), "_max_burn_amount": p.uint256}, p.uint256), - 'remove_liquidity_imbalance(uint256[2],uint256,address)': fun("0x52d2cfdd", "remove_liquidity_imbalance(uint256[2],uint256,address)", {"_amounts": p.fixedSizeArray(p.uint256, 2), "_max_burn_amount": p.uint256, "_receiver": p.address}, p.uint256), - calc_withdraw_one_coin: viewFun("0xcc2b27d7", "calc_withdraw_one_coin(uint256,int128)", {"_burn_amount": p.uint256, "i": p.int128}, p.uint256), - 'remove_liquidity_one_coin(uint256,int128,uint256)': fun("0x1a4d01d2", "remove_liquidity_one_coin(uint256,int128,uint256)", {"_burn_amount": p.uint256, "i": p.int128, "_min_received": p.uint256}, p.uint256), - 'remove_liquidity_one_coin(uint256,int128,uint256,address)': fun("0x081579a5", "remove_liquidity_one_coin(uint256,int128,uint256,address)", {"_burn_amount": p.uint256, "i": p.int128, "_min_received": p.uint256, "_receiver": p.address}, p.uint256), - ramp_A: fun("0x3c157e64", "ramp_A(uint256,uint256)", {"_future_A": p.uint256, "_future_time": p.uint256}, ), - stop_ramp_A: fun("0x551a6588", "stop_ramp_A()", {}, ), - admin_balances: viewFun("0xe2e7d264", "admin_balances(uint256)", {"i": p.uint256}, p.uint256), - withdraw_admin_fees: fun("0x30c54085", "withdraw_admin_fees()", {}, ), - commit_new_fee: fun("0xa48eac9d", "commit_new_fee(uint256)", {"_new_fee": p.uint256}, ), - apply_new_fee: fun("0x4f12fe97", "apply_new_fee()", {}, ), - set_ma_exp_time: fun("0x7f3e17cb", "set_ma_exp_time(uint256)", {"_ma_exp_time": p.uint256}, ), - version: viewFun("0x54fd4d50", "version()", {}, p.string), - coins: viewFun("0xc6610657", "coins(uint256)", {"arg0": p.uint256}, p.address), - balances: viewFun("0x4903b0d1", "balances(uint256)", {"arg0": p.uint256}, p.uint256), - fee: viewFun("0xddca3f43", "fee()", {}, p.uint256), - future_fee: viewFun("0x58680d0b", "future_fee()", {}, p.uint256), - admin_action_deadline: viewFun("0xe66f43f5", "admin_action_deadline()", {}, p.uint256), - initial_A: viewFun("0x5409491a", "initial_A()", {}, p.uint256), - future_A: viewFun("0xb4b577ad", "future_A()", {}, p.uint256), - initial_A_time: viewFun("0x2081066c", "initial_A_time()", {}, p.uint256), - future_A_time: viewFun("0x14052288", "future_A_time()", {}, p.uint256), - name: viewFun("0x06fdde03", "name()", {}, p.string), - symbol: viewFun("0x95d89b41", "symbol()", {}, p.string), - balanceOf: viewFun("0x70a08231", "balanceOf(address)", {"arg0": p.address}, p.uint256), - allowance: viewFun("0xdd62ed3e", "allowance(address,address)", {"arg0": p.address, "arg1": p.address}, p.uint256), - totalSupply: viewFun("0x18160ddd", "totalSupply()", {}, p.uint256), - DOMAIN_SEPARATOR: viewFun("0x3644e515", "DOMAIN_SEPARATOR()", {}, p.bytes32), - nonces: viewFun("0x7ecebe00", "nonces(address)", {"arg0": p.address}, p.uint256), - ma_exp_time: viewFun("0x1be913a5", "ma_exp_time()", {}, p.uint256), - ma_last_time: viewFun("0x1ddc3b01", "ma_last_time()", {}, p.uint256), -} - -export class Contract extends ContractBase { - - decimals() { - return this.eth_call(functions.decimals, {}) - } - - last_price() { - return this.eth_call(functions.last_price, {}) - } - - ema_price() { - return this.eth_call(functions.ema_price, {}) - } - - get_balances() { - return this.eth_call(functions.get_balances, {}) - } - - admin_fee() { - return this.eth_call(functions.admin_fee, {}) - } - - A() { - return this.eth_call(functions.A, {}) - } - - A_precise() { - return this.eth_call(functions.A_precise, {}) - } - - get_p() { - return this.eth_call(functions.get_p, {}) - } - - price_oracle() { - return this.eth_call(functions.price_oracle, {}) - } - - get_virtual_price() { - return this.eth_call(functions.get_virtual_price, {}) - } - - calc_token_amount(_amounts: Calc_token_amountParams["_amounts"], _is_deposit: Calc_token_amountParams["_is_deposit"]) { - return this.eth_call(functions.calc_token_amount, {_amounts, _is_deposit}) - } - - get_dy(i: Get_dyParams["i"], j: Get_dyParams["j"], dx: Get_dyParams["dx"]) { - return this.eth_call(functions.get_dy, {i, j, dx}) - } - - calc_withdraw_one_coin(_burn_amount: Calc_withdraw_one_coinParams["_burn_amount"], i: Calc_withdraw_one_coinParams["i"]) { - return this.eth_call(functions.calc_withdraw_one_coin, {_burn_amount, i}) - } - - admin_balances(i: Admin_balancesParams["i"]) { - return this.eth_call(functions.admin_balances, {i}) - } - - version() { - return this.eth_call(functions.version, {}) - } - - coins(arg0: CoinsParams["arg0"]) { - return this.eth_call(functions.coins, {arg0}) - } - - balances(arg0: BalancesParams["arg0"]) { - return this.eth_call(functions.balances, {arg0}) - } - - fee() { - return this.eth_call(functions.fee, {}) - } - - future_fee() { - return this.eth_call(functions.future_fee, {}) - } - - admin_action_deadline() { - return this.eth_call(functions.admin_action_deadline, {}) - } - - initial_A() { - return this.eth_call(functions.initial_A, {}) - } - - future_A() { - return this.eth_call(functions.future_A, {}) - } - - initial_A_time() { - return this.eth_call(functions.initial_A_time, {}) - } - - future_A_time() { - return this.eth_call(functions.future_A_time, {}) - } - - name() { - return this.eth_call(functions.name, {}) - } - - symbol() { - return this.eth_call(functions.symbol, {}) - } - - balanceOf(arg0: BalanceOfParams["arg0"]) { - return this.eth_call(functions.balanceOf, {arg0}) - } - - allowance(arg0: AllowanceParams["arg0"], arg1: AllowanceParams["arg1"]) { - return this.eth_call(functions.allowance, {arg0, arg1}) - } - - totalSupply() { - return this.eth_call(functions.totalSupply, {}) - } - - DOMAIN_SEPARATOR() { - return this.eth_call(functions.DOMAIN_SEPARATOR, {}) - } - - nonces(arg0: NoncesParams["arg0"]) { - return this.eth_call(functions.nonces, {arg0}) - } - - ma_exp_time() { - return this.eth_call(functions.ma_exp_time, {}) - } - - ma_last_time() { - return this.eth_call(functions.ma_last_time, {}) - } -} - -/// Event types -export type TransferEventArgs = EParams -export type ApprovalEventArgs = EParams -export type TokenExchangeEventArgs = EParams -export type AddLiquidityEventArgs = EParams -export type RemoveLiquidityEventArgs = EParams -export type RemoveLiquidityOneEventArgs = EParams -export type RemoveLiquidityImbalanceEventArgs = EParams -export type RampAEventArgs = EParams -export type StopRampAEventArgs = EParams -export type CommitNewFeeEventArgs = EParams -export type ApplyNewFeeEventArgs = EParams - -/// Function types -export type InitializeParams = FunctionArguments -export type InitializeReturn = FunctionReturn - -export type DecimalsParams = FunctionArguments -export type DecimalsReturn = FunctionReturn - -export type TransferParams = FunctionArguments -export type TransferReturn = FunctionReturn - -export type TransferFromParams = FunctionArguments -export type TransferFromReturn = FunctionReturn - -export type ApproveParams = FunctionArguments -export type ApproveReturn = FunctionReturn - -export type PermitParams = FunctionArguments -export type PermitReturn = FunctionReturn - -export type Last_priceParams = FunctionArguments -export type Last_priceReturn = FunctionReturn - -export type Ema_priceParams = FunctionArguments -export type Ema_priceReturn = FunctionReturn - -export type Get_balancesParams = FunctionArguments -export type Get_balancesReturn = FunctionReturn - -export type Admin_feeParams = FunctionArguments -export type Admin_feeReturn = FunctionReturn - -export type AParams = FunctionArguments -export type AReturn = FunctionReturn - -export type A_preciseParams = FunctionArguments -export type A_preciseReturn = FunctionReturn - -export type Get_pParams = FunctionArguments -export type Get_pReturn = FunctionReturn - -export type Price_oracleParams = FunctionArguments -export type Price_oracleReturn = FunctionReturn - -export type Get_virtual_priceParams = FunctionArguments -export type Get_virtual_priceReturn = FunctionReturn - -export type Calc_token_amountParams = FunctionArguments -export type Calc_token_amountReturn = FunctionReturn - -export type Add_liquidityParams_0 = FunctionArguments -export type Add_liquidityReturn_0 = FunctionReturn - -export type Add_liquidityParams_1 = FunctionArguments -export type Add_liquidityReturn_1 = FunctionReturn - -export type Get_dyParams = FunctionArguments -export type Get_dyReturn = FunctionReturn - -export type ExchangeParams_0 = FunctionArguments -export type ExchangeReturn_0 = FunctionReturn - -export type ExchangeParams_1 = FunctionArguments -export type ExchangeReturn_1 = FunctionReturn - -export type Remove_liquidityParams_0 = FunctionArguments -export type Remove_liquidityReturn_0 = FunctionReturn - -export type Remove_liquidityParams_1 = FunctionArguments -export type Remove_liquidityReturn_1 = FunctionReturn - -export type Remove_liquidity_imbalanceParams_0 = FunctionArguments -export type Remove_liquidity_imbalanceReturn_0 = FunctionReturn - -export type Remove_liquidity_imbalanceParams_1 = FunctionArguments -export type Remove_liquidity_imbalanceReturn_1 = FunctionReturn - -export type Calc_withdraw_one_coinParams = FunctionArguments -export type Calc_withdraw_one_coinReturn = FunctionReturn - -export type Remove_liquidity_one_coinParams_0 = FunctionArguments -export type Remove_liquidity_one_coinReturn_0 = FunctionReturn - -export type Remove_liquidity_one_coinParams_1 = FunctionArguments -export type Remove_liquidity_one_coinReturn_1 = FunctionReturn - -export type Ramp_AParams = FunctionArguments -export type Ramp_AReturn = FunctionReturn - -export type Stop_ramp_AParams = FunctionArguments -export type Stop_ramp_AReturn = FunctionReturn - -export type Admin_balancesParams = FunctionArguments -export type Admin_balancesReturn = FunctionReturn - -export type Withdraw_admin_feesParams = FunctionArguments -export type Withdraw_admin_feesReturn = FunctionReturn - -export type Commit_new_feeParams = FunctionArguments -export type Commit_new_feeReturn = FunctionReturn - -export type Apply_new_feeParams = FunctionArguments -export type Apply_new_feeReturn = FunctionReturn - -export type Set_ma_exp_timeParams = FunctionArguments -export type Set_ma_exp_timeReturn = FunctionReturn - -export type VersionParams = FunctionArguments -export type VersionReturn = FunctionReturn - -export type CoinsParams = FunctionArguments -export type CoinsReturn = FunctionReturn - -export type BalancesParams = FunctionArguments -export type BalancesReturn = FunctionReturn - -export type FeeParams = FunctionArguments -export type FeeReturn = FunctionReturn - -export type Future_feeParams = FunctionArguments -export type Future_feeReturn = FunctionReturn - -export type Admin_action_deadlineParams = FunctionArguments -export type Admin_action_deadlineReturn = FunctionReturn - -export type Initial_AParams = FunctionArguments -export type Initial_AReturn = FunctionReturn - -export type Future_AParams = FunctionArguments -export type Future_AReturn = FunctionReturn - -export type Initial_A_timeParams = FunctionArguments -export type Initial_A_timeReturn = FunctionReturn - -export type Future_A_timeParams = FunctionArguments -export type Future_A_timeReturn = FunctionReturn - -export type NameParams = FunctionArguments -export type NameReturn = FunctionReturn - -export type SymbolParams = FunctionArguments -export type SymbolReturn = FunctionReturn - -export type BalanceOfParams = FunctionArguments -export type BalanceOfReturn = FunctionReturn - -export type AllowanceParams = FunctionArguments -export type AllowanceReturn = FunctionReturn - -export type TotalSupplyParams = FunctionArguments -export type TotalSupplyReturn = FunctionReturn - -export type DOMAIN_SEPARATORParams = FunctionArguments -export type DOMAIN_SEPARATORReturn = FunctionReturn - -export type NoncesParams = FunctionArguments -export type NoncesReturn = FunctionReturn - -export type Ma_exp_timeParams = FunctionArguments -export type Ma_exp_timeReturn = FunctionReturn - -export type Ma_last_timeParams = FunctionArguments -export type Ma_last_timeReturn = FunctionReturn - diff --git a/src/abi/curve-lp-token/contract.ts b/src/abi/curve-lp-token/contract.ts new file mode 100644 index 00000000..9d6e2cd9 --- /dev/null +++ b/src/abi/curve-lp-token/contract.ts @@ -0,0 +1,193 @@ +import { ContractBase } from '../abi.support.js' +import { A, A_precise, DOMAIN_SEPARATOR, add_liquidity, add_liquidity_1, admin_action_deadline, admin_balances, admin_fee, allowance, approve, balanceOf, balances, calc_token_amount, calc_withdraw_one_coin, coins, decimals, ema_price, exchange, exchange_1, fee, future_A, future_A_time, future_fee, get_balances, get_dy, get_p, get_virtual_price, initial_A, initial_A_time, last_price, ma_exp_time, ma_last_time, name, nonces, permit, price_oracle, remove_liquidity, remove_liquidity_1, remove_liquidity_imbalance, remove_liquidity_imbalance_1, remove_liquidity_one_coin, remove_liquidity_one_coin_1, symbol, totalSupply, transfer, transferFrom, version } from './functions.js' +import type { Add_liquidityParams, Add_liquidityParams_1, Admin_balancesParams, AllowanceParams, ApproveParams, BalanceOfParams, BalancesParams, Calc_token_amountParams, Calc_withdraw_one_coinParams, CoinsParams, ExchangeParams, ExchangeParams_1, Get_dyParams, NoncesParams, PermitParams, Remove_liquidityParams, Remove_liquidityParams_1, Remove_liquidity_imbalanceParams, Remove_liquidity_imbalanceParams_1, Remove_liquidity_one_coinParams, Remove_liquidity_one_coinParams_1, TransferFromParams, TransferParams } from './functions.js' + +export class Contract extends ContractBase { + decimals() { + return this.eth_call(decimals, {}) + } + + transfer(_to: TransferParams["_to"], _value: TransferParams["_value"]) { + return this.eth_call(transfer, {_to, _value}) + } + + transferFrom(_from: TransferFromParams["_from"], _to: TransferFromParams["_to"], _value: TransferFromParams["_value"]) { + return this.eth_call(transferFrom, {_from, _to, _value}) + } + + approve(_spender: ApproveParams["_spender"], _value: ApproveParams["_value"]) { + return this.eth_call(approve, {_spender, _value}) + } + + permit(_owner: PermitParams["_owner"], _spender: PermitParams["_spender"], _value: PermitParams["_value"], _deadline: PermitParams["_deadline"], _v: PermitParams["_v"], _r: PermitParams["_r"], _s: PermitParams["_s"]) { + return this.eth_call(permit, {_owner, _spender, _value, _deadline, _v, _r, _s}) + } + + last_price() { + return this.eth_call(last_price, {}) + } + + ema_price() { + return this.eth_call(ema_price, {}) + } + + get_balances() { + return this.eth_call(get_balances, {}) + } + + admin_fee() { + return this.eth_call(admin_fee, {}) + } + + A() { + return this.eth_call(A, {}) + } + + A_precise() { + return this.eth_call(A_precise, {}) + } + + get_p() { + return this.eth_call(get_p, {}) + } + + price_oracle() { + return this.eth_call(price_oracle, {}) + } + + get_virtual_price() { + return this.eth_call(get_virtual_price, {}) + } + + calc_token_amount(_amounts: Calc_token_amountParams["_amounts"], _is_deposit: Calc_token_amountParams["_is_deposit"]) { + return this.eth_call(calc_token_amount, {_amounts, _is_deposit}) + } + + add_liquidity(_amounts: Add_liquidityParams["_amounts"], _min_mint_amount: Add_liquidityParams["_min_mint_amount"]) { + return this.eth_call(add_liquidity, {_amounts, _min_mint_amount}) + } + + add_liquidity_1(_amounts: Add_liquidityParams_1["_amounts"], _min_mint_amount: Add_liquidityParams_1["_min_mint_amount"], _receiver: Add_liquidityParams_1["_receiver"]) { + return this.eth_call(add_liquidity_1, {_amounts, _min_mint_amount, _receiver}) + } + + get_dy(i: Get_dyParams["i"], j: Get_dyParams["j"], dx: Get_dyParams["dx"]) { + return this.eth_call(get_dy, {i, j, dx}) + } + + exchange(i: ExchangeParams["i"], j: ExchangeParams["j"], _dx: ExchangeParams["_dx"], _min_dy: ExchangeParams["_min_dy"]) { + return this.eth_call(exchange, {i, j, _dx, _min_dy}) + } + + exchange_1(i: ExchangeParams_1["i"], j: ExchangeParams_1["j"], _dx: ExchangeParams_1["_dx"], _min_dy: ExchangeParams_1["_min_dy"], _receiver: ExchangeParams_1["_receiver"]) { + return this.eth_call(exchange_1, {i, j, _dx, _min_dy, _receiver}) + } + + remove_liquidity(_burn_amount: Remove_liquidityParams["_burn_amount"], _min_amounts: Remove_liquidityParams["_min_amounts"]) { + return this.eth_call(remove_liquidity, {_burn_amount, _min_amounts}) + } + + remove_liquidity_1(_burn_amount: Remove_liquidityParams_1["_burn_amount"], _min_amounts: Remove_liquidityParams_1["_min_amounts"], _receiver: Remove_liquidityParams_1["_receiver"]) { + return this.eth_call(remove_liquidity_1, {_burn_amount, _min_amounts, _receiver}) + } + + remove_liquidity_imbalance(_amounts: Remove_liquidity_imbalanceParams["_amounts"], _max_burn_amount: Remove_liquidity_imbalanceParams["_max_burn_amount"]) { + return this.eth_call(remove_liquidity_imbalance, {_amounts, _max_burn_amount}) + } + + remove_liquidity_imbalance_1(_amounts: Remove_liquidity_imbalanceParams_1["_amounts"], _max_burn_amount: Remove_liquidity_imbalanceParams_1["_max_burn_amount"], _receiver: Remove_liquidity_imbalanceParams_1["_receiver"]) { + return this.eth_call(remove_liquidity_imbalance_1, {_amounts, _max_burn_amount, _receiver}) + } + + calc_withdraw_one_coin(_burn_amount: Calc_withdraw_one_coinParams["_burn_amount"], i: Calc_withdraw_one_coinParams["i"]) { + return this.eth_call(calc_withdraw_one_coin, {_burn_amount, i}) + } + + remove_liquidity_one_coin(_burn_amount: Remove_liquidity_one_coinParams["_burn_amount"], i: Remove_liquidity_one_coinParams["i"], _min_received: Remove_liquidity_one_coinParams["_min_received"]) { + return this.eth_call(remove_liquidity_one_coin, {_burn_amount, i, _min_received}) + } + + remove_liquidity_one_coin_1(_burn_amount: Remove_liquidity_one_coinParams_1["_burn_amount"], i: Remove_liquidity_one_coinParams_1["i"], _min_received: Remove_liquidity_one_coinParams_1["_min_received"], _receiver: Remove_liquidity_one_coinParams_1["_receiver"]) { + return this.eth_call(remove_liquidity_one_coin_1, {_burn_amount, i, _min_received, _receiver}) + } + + admin_balances(i: Admin_balancesParams["i"]) { + return this.eth_call(admin_balances, {i}) + } + + version() { + return this.eth_call(version, {}) + } + + coins(arg0: CoinsParams["arg0"]) { + return this.eth_call(coins, {arg0}) + } + + balances(arg0: BalancesParams["arg0"]) { + return this.eth_call(balances, {arg0}) + } + + fee() { + return this.eth_call(fee, {}) + } + + future_fee() { + return this.eth_call(future_fee, {}) + } + + admin_action_deadline() { + return this.eth_call(admin_action_deadline, {}) + } + + initial_A() { + return this.eth_call(initial_A, {}) + } + + future_A() { + return this.eth_call(future_A, {}) + } + + initial_A_time() { + return this.eth_call(initial_A_time, {}) + } + + future_A_time() { + return this.eth_call(future_A_time, {}) + } + + name() { + return this.eth_call(name, {}) + } + + symbol() { + return this.eth_call(symbol, {}) + } + + balanceOf(arg0: BalanceOfParams["arg0"]) { + return this.eth_call(balanceOf, {arg0}) + } + + allowance(arg0: AllowanceParams["arg0"], arg1: AllowanceParams["arg1"]) { + return this.eth_call(allowance, {arg0, arg1}) + } + + totalSupply() { + return this.eth_call(totalSupply, {}) + } + + DOMAIN_SEPARATOR() { + return this.eth_call(DOMAIN_SEPARATOR, {}) + } + + nonces(arg0: NoncesParams["arg0"]) { + return this.eth_call(nonces, {arg0}) + } + + ma_exp_time() { + return this.eth_call(ma_exp_time, {}) + } + + ma_last_time() { + return this.eth_call(ma_last_time, {}) + } +} diff --git a/src/abi/curve-lp-token/events.ts b/src/abi/curve-lp-token/events.ts new file mode 100644 index 00000000..adaf307c --- /dev/null +++ b/src/abi/curve-lp-token/events.ts @@ -0,0 +1,95 @@ +import { address, fixedSizeArray, int128, uint256 } from '@subsquid/evm-codec' +import { event, indexed } from '../abi.support.js' +import type { EventParams as EParams } from '../abi.support.js' + +/** Transfer(address,address,uint256) */ +export const Transfer = event('0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', { + sender: indexed(address), + receiver: indexed(address), + value: uint256, +}) +export type TransferEventArgs = EParams + +/** Approval(address,address,uint256) */ +export const Approval = event('0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925', { + owner: indexed(address), + spender: indexed(address), + value: uint256, +}) +export type ApprovalEventArgs = EParams + +/** TokenExchange(address,int128,uint256,int128,uint256) */ +export const TokenExchange = event('0x8b3e96f2b889fa771c53c981b40daf005f63f637f1869f707052d15a3dd97140', { + buyer: indexed(address), + sold_id: int128, + tokens_sold: uint256, + bought_id: int128, + tokens_bought: uint256, +}) +export type TokenExchangeEventArgs = EParams + +/** AddLiquidity(address,uint256[2],uint256[2],uint256,uint256) */ +export const AddLiquidity = event('0x26f55a85081d24974e85c6c00045d0f0453991e95873f52bff0d21af4079a768', { + provider: indexed(address), + token_amounts: fixedSizeArray(uint256, 2), + fees: fixedSizeArray(uint256, 2), + invariant: uint256, + token_supply: uint256, +}) +export type AddLiquidityEventArgs = EParams + +/** RemoveLiquidity(address,uint256[2],uint256[2],uint256) */ +export const RemoveLiquidity = event('0x7c363854ccf79623411f8995b362bce5eddff18c927edc6f5dbbb5e05819a82c', { + provider: indexed(address), + token_amounts: fixedSizeArray(uint256, 2), + fees: fixedSizeArray(uint256, 2), + token_supply: uint256, +}) +export type RemoveLiquidityEventArgs = EParams + +/** RemoveLiquidityOne(address,uint256,uint256,uint256) */ +export const RemoveLiquidityOne = event('0x5ad056f2e28a8cec232015406b843668c1e36cda598127ec3b8c59b8c72773a0', { + provider: indexed(address), + token_amount: uint256, + coin_amount: uint256, + token_supply: uint256, +}) +export type RemoveLiquidityOneEventArgs = EParams + +/** RemoveLiquidityImbalance(address,uint256[2],uint256[2],uint256,uint256) */ +export const RemoveLiquidityImbalance = event('0x2b5508378d7e19e0d5fa338419034731416c4f5b219a10379956f764317fd47e', { + provider: indexed(address), + token_amounts: fixedSizeArray(uint256, 2), + fees: fixedSizeArray(uint256, 2), + invariant: uint256, + token_supply: uint256, +}) +export type RemoveLiquidityImbalanceEventArgs = EParams + +/** RampA(uint256,uint256,uint256,uint256) */ +export const RampA = event('0xa2b71ec6df949300b59aab36b55e189697b750119dd349fcfa8c0f779e83c254', { + old_A: uint256, + new_A: uint256, + initial_time: uint256, + future_time: uint256, +}) +export type RampAEventArgs = EParams + +/** StopRampA(uint256,uint256) */ +export const StopRampA = event('0x46e22fb3709ad289f62ce63d469248536dbc78d82b84a3d7e74ad606dc201938', { + A: uint256, + t: uint256, +}) +export type StopRampAEventArgs = EParams + +/** CommitNewFee(uint256) */ +export const CommitNewFee = event('0x878eb36b3f197f05821c06953d9bc8f14b332a227b1e26df06a4215bbfe5d73f', { + new_fee: uint256, +}) +export type CommitNewFeeEventArgs = EParams + +/** ApplyNewFee(uint256) */ +export const ApplyNewFee = event('0xa8715770654f54603947addf38c689adbd7182e21673b28bcf306a957aaba215', { + fee: uint256, +}) +export type ApplyNewFeeEventArgs = EParams diff --git a/src/abi/curve-lp-token/functions.ts b/src/abi/curve-lp-token/functions.ts new file mode 100644 index 00000000..298cb207 --- /dev/null +++ b/src/abi/curve-lp-token/functions.ts @@ -0,0 +1,369 @@ +import { address, bool, bytes32, fixedSizeArray, int128, string, uint256, uint8 } from '@subsquid/evm-codec' +import { func } from '../abi.support.js' +import type { FunctionArguments, FunctionReturn } from '../abi.support.js' + +/** initialize(string,string,address[4],uint256[4],uint256,uint256) */ +export const initialize = func('0xa461b3c8', { + _name: string, + _symbol: string, + _coins: fixedSizeArray(address, 4), + _rate_multipliers: fixedSizeArray(uint256, 4), + _A: uint256, + _fee: uint256, +}) +export type InitializeParams = FunctionArguments +export type InitializeReturn = FunctionReturn + +/** decimals() */ +export const decimals = func('0x313ce567', {}, uint256) +export type DecimalsParams = FunctionArguments +export type DecimalsReturn = FunctionReturn + +/** transfer(address,uint256) */ +export const transfer = func('0xa9059cbb', { + _to: address, + _value: uint256, +}, bool) +export type TransferParams = FunctionArguments +export type TransferReturn = FunctionReturn + +/** transferFrom(address,address,uint256) */ +export const transferFrom = func('0x23b872dd', { + _from: address, + _to: address, + _value: uint256, +}, bool) +export type TransferFromParams = FunctionArguments +export type TransferFromReturn = FunctionReturn + +/** approve(address,uint256) */ +export const approve = func('0x095ea7b3', { + _spender: address, + _value: uint256, +}, bool) +export type ApproveParams = FunctionArguments +export type ApproveReturn = FunctionReturn + +/** permit(address,address,uint256,uint256,uint8,bytes32,bytes32) */ +export const permit = func('0xd505accf', { + _owner: address, + _spender: address, + _value: uint256, + _deadline: uint256, + _v: uint8, + _r: bytes32, + _s: bytes32, +}, bool) +export type PermitParams = FunctionArguments +export type PermitReturn = FunctionReturn + +/** last_price() */ +export const last_price = func('0xfde625e6', {}, uint256) +export type Last_priceParams = FunctionArguments +export type Last_priceReturn = FunctionReturn + +/** ema_price() */ +export const ema_price = func('0xc24c7c29', {}, uint256) +export type Ema_priceParams = FunctionArguments +export type Ema_priceReturn = FunctionReturn + +/** get_balances() */ +export const get_balances = func('0x14f05979', {}, fixedSizeArray(uint256, 2)) +export type Get_balancesParams = FunctionArguments +export type Get_balancesReturn = FunctionReturn + +/** admin_fee() */ +export const admin_fee = func('0xfee3f7f9', {}, uint256) +export type Admin_feeParams = FunctionArguments +export type Admin_feeReturn = FunctionReturn + +/** A() */ +export const A = func('0xf446c1d0', {}, uint256) +export type AParams = FunctionArguments +export type AReturn = FunctionReturn + +/** A_precise() */ +export const A_precise = func('0x76a2f0f0', {}, uint256) +export type A_preciseParams = FunctionArguments +export type A_preciseReturn = FunctionReturn + +/** get_p() */ +export const get_p = func('0xf2388acb', {}, uint256) +export type Get_pParams = FunctionArguments +export type Get_pReturn = FunctionReturn + +/** price_oracle() */ +export const price_oracle = func('0x86fc88d3', {}, uint256) +export type Price_oracleParams = FunctionArguments +export type Price_oracleReturn = FunctionReturn + +/** get_virtual_price() */ +export const get_virtual_price = func('0xbb7b8b80', {}, uint256) +export type Get_virtual_priceParams = FunctionArguments +export type Get_virtual_priceReturn = FunctionReturn + +/** calc_token_amount(uint256[2],bool) */ +export const calc_token_amount = func('0xed8e84f3', { + _amounts: fixedSizeArray(uint256, 2), + _is_deposit: bool, +}, uint256) +export type Calc_token_amountParams = FunctionArguments +export type Calc_token_amountReturn = FunctionReturn + +/** add_liquidity(uint256[2],uint256) */ +export const add_liquidity = func('0x0b4c7e4d', { + _amounts: fixedSizeArray(uint256, 2), + _min_mint_amount: uint256, +}, uint256) +export type Add_liquidityParams = FunctionArguments +export type Add_liquidityReturn = FunctionReturn + +/** add_liquidity(uint256[2],uint256,address) */ +export const add_liquidity_1 = func('0x0c3e4b54', { + _amounts: fixedSizeArray(uint256, 2), + _min_mint_amount: uint256, + _receiver: address, +}, uint256) +export type Add_liquidityParams_1 = FunctionArguments +export type Add_liquidityReturn_1 = FunctionReturn + +/** get_dy(int128,int128,uint256) */ +export const get_dy = func('0x5e0d443f', { + i: int128, + j: int128, + dx: uint256, +}, uint256) +export type Get_dyParams = FunctionArguments +export type Get_dyReturn = FunctionReturn + +/** exchange(int128,int128,uint256,uint256) */ +export const exchange = func('0x3df02124', { + i: int128, + j: int128, + _dx: uint256, + _min_dy: uint256, +}, uint256) +export type ExchangeParams = FunctionArguments +export type ExchangeReturn = FunctionReturn + +/** exchange(int128,int128,uint256,uint256,address) */ +export const exchange_1 = func('0xddc1f59d', { + i: int128, + j: int128, + _dx: uint256, + _min_dy: uint256, + _receiver: address, +}, uint256) +export type ExchangeParams_1 = FunctionArguments +export type ExchangeReturn_1 = FunctionReturn + +/** remove_liquidity(uint256,uint256[2]) */ +export const remove_liquidity = func('0x5b36389c', { + _burn_amount: uint256, + _min_amounts: fixedSizeArray(uint256, 2), +}, fixedSizeArray(uint256, 2)) +export type Remove_liquidityParams = FunctionArguments +export type Remove_liquidityReturn = FunctionReturn + +/** remove_liquidity(uint256,uint256[2],address) */ +export const remove_liquidity_1 = func('0x3eb1719f', { + _burn_amount: uint256, + _min_amounts: fixedSizeArray(uint256, 2), + _receiver: address, +}, fixedSizeArray(uint256, 2)) +export type Remove_liquidityParams_1 = FunctionArguments +export type Remove_liquidityReturn_1 = FunctionReturn + +/** remove_liquidity_imbalance(uint256[2],uint256) */ +export const remove_liquidity_imbalance = func('0xe3103273', { + _amounts: fixedSizeArray(uint256, 2), + _max_burn_amount: uint256, +}, uint256) +export type Remove_liquidity_imbalanceParams = FunctionArguments +export type Remove_liquidity_imbalanceReturn = FunctionReturn + +/** remove_liquidity_imbalance(uint256[2],uint256,address) */ +export const remove_liquidity_imbalance_1 = func('0x52d2cfdd', { + _amounts: fixedSizeArray(uint256, 2), + _max_burn_amount: uint256, + _receiver: address, +}, uint256) +export type Remove_liquidity_imbalanceParams_1 = FunctionArguments +export type Remove_liquidity_imbalanceReturn_1 = FunctionReturn + +/** calc_withdraw_one_coin(uint256,int128) */ +export const calc_withdraw_one_coin = func('0xcc2b27d7', { + _burn_amount: uint256, + i: int128, +}, uint256) +export type Calc_withdraw_one_coinParams = FunctionArguments +export type Calc_withdraw_one_coinReturn = FunctionReturn + +/** remove_liquidity_one_coin(uint256,int128,uint256) */ +export const remove_liquidity_one_coin = func('0x1a4d01d2', { + _burn_amount: uint256, + i: int128, + _min_received: uint256, +}, uint256) +export type Remove_liquidity_one_coinParams = FunctionArguments +export type Remove_liquidity_one_coinReturn = FunctionReturn + +/** remove_liquidity_one_coin(uint256,int128,uint256,address) */ +export const remove_liquidity_one_coin_1 = func('0x081579a5', { + _burn_amount: uint256, + i: int128, + _min_received: uint256, + _receiver: address, +}, uint256) +export type Remove_liquidity_one_coinParams_1 = FunctionArguments +export type Remove_liquidity_one_coinReturn_1 = FunctionReturn + +/** ramp_A(uint256,uint256) */ +export const ramp_A = func('0x3c157e64', { + _future_A: uint256, + _future_time: uint256, +}) +export type Ramp_AParams = FunctionArguments +export type Ramp_AReturn = FunctionReturn + +/** stop_ramp_A() */ +export const stop_ramp_A = func('0x551a6588', {}) +export type Stop_ramp_AParams = FunctionArguments +export type Stop_ramp_AReturn = FunctionReturn + +/** admin_balances(uint256) */ +export const admin_balances = func('0xe2e7d264', { + i: uint256, +}, uint256) +export type Admin_balancesParams = FunctionArguments +export type Admin_balancesReturn = FunctionReturn + +/** withdraw_admin_fees() */ +export const withdraw_admin_fees = func('0x30c54085', {}) +export type Withdraw_admin_feesParams = FunctionArguments +export type Withdraw_admin_feesReturn = FunctionReturn + +/** commit_new_fee(uint256) */ +export const commit_new_fee = func('0xa48eac9d', { + _new_fee: uint256, +}) +export type Commit_new_feeParams = FunctionArguments +export type Commit_new_feeReturn = FunctionReturn + +/** apply_new_fee() */ +export const apply_new_fee = func('0x4f12fe97', {}) +export type Apply_new_feeParams = FunctionArguments +export type Apply_new_feeReturn = FunctionReturn + +/** set_ma_exp_time(uint256) */ +export const set_ma_exp_time = func('0x7f3e17cb', { + _ma_exp_time: uint256, +}) +export type Set_ma_exp_timeParams = FunctionArguments +export type Set_ma_exp_timeReturn = FunctionReturn + +/** version() */ +export const version = func('0x54fd4d50', {}, string) +export type VersionParams = FunctionArguments +export type VersionReturn = FunctionReturn + +/** coins(uint256) */ +export const coins = func('0xc6610657', { + arg0: uint256, +}, address) +export type CoinsParams = FunctionArguments +export type CoinsReturn = FunctionReturn + +/** balances(uint256) */ +export const balances = func('0x4903b0d1', { + arg0: uint256, +}, uint256) +export type BalancesParams = FunctionArguments +export type BalancesReturn = FunctionReturn + +/** fee() */ +export const fee = func('0xddca3f43', {}, uint256) +export type FeeParams = FunctionArguments +export type FeeReturn = FunctionReturn + +/** future_fee() */ +export const future_fee = func('0x58680d0b', {}, uint256) +export type Future_feeParams = FunctionArguments +export type Future_feeReturn = FunctionReturn + +/** admin_action_deadline() */ +export const admin_action_deadline = func('0xe66f43f5', {}, uint256) +export type Admin_action_deadlineParams = FunctionArguments +export type Admin_action_deadlineReturn = FunctionReturn + +/** initial_A() */ +export const initial_A = func('0x5409491a', {}, uint256) +export type Initial_AParams = FunctionArguments +export type Initial_AReturn = FunctionReturn + +/** future_A() */ +export const future_A = func('0xb4b577ad', {}, uint256) +export type Future_AParams = FunctionArguments +export type Future_AReturn = FunctionReturn + +/** initial_A_time() */ +export const initial_A_time = func('0x2081066c', {}, uint256) +export type Initial_A_timeParams = FunctionArguments +export type Initial_A_timeReturn = FunctionReturn + +/** future_A_time() */ +export const future_A_time = func('0x14052288', {}, uint256) +export type Future_A_timeParams = FunctionArguments +export type Future_A_timeReturn = FunctionReturn + +/** name() */ +export const name = func('0x06fdde03', {}, string) +export type NameParams = FunctionArguments +export type NameReturn = FunctionReturn + +/** symbol() */ +export const symbol = func('0x95d89b41', {}, string) +export type SymbolParams = FunctionArguments +export type SymbolReturn = FunctionReturn + +/** balanceOf(address) */ +export const balanceOf = func('0x70a08231', { + arg0: address, +}, uint256) +export type BalanceOfParams = FunctionArguments +export type BalanceOfReturn = FunctionReturn + +/** allowance(address,address) */ +export const allowance = func('0xdd62ed3e', { + arg0: address, + arg1: address, +}, uint256) +export type AllowanceParams = FunctionArguments +export type AllowanceReturn = FunctionReturn + +/** totalSupply() */ +export const totalSupply = func('0x18160ddd', {}, uint256) +export type TotalSupplyParams = FunctionArguments +export type TotalSupplyReturn = FunctionReturn + +/** DOMAIN_SEPARATOR() */ +export const DOMAIN_SEPARATOR = func('0x3644e515', {}, bytes32) +export type DOMAIN_SEPARATORParams = FunctionArguments +export type DOMAIN_SEPARATORReturn = FunctionReturn + +/** nonces(address) */ +export const nonces = func('0x7ecebe00', { + arg0: address, +}, uint256) +export type NoncesParams = FunctionArguments +export type NoncesReturn = FunctionReturn + +/** ma_exp_time() */ +export const ma_exp_time = func('0x1be913a5', {}, uint256) +export type Ma_exp_timeParams = FunctionArguments +export type Ma_exp_timeReturn = FunctionReturn + +/** ma_last_time() */ +export const ma_last_time = func('0x1ddc3b01', {}, uint256) +export type Ma_last_timeParams = FunctionArguments +export type Ma_last_timeReturn = FunctionReturn diff --git a/src/abi/curve-lp-token/index.ts b/src/abi/curve-lp-token/index.ts new file mode 100644 index 00000000..11829d6e --- /dev/null +++ b/src/abi/curve-lp-token/index.ts @@ -0,0 +1,4 @@ +export * as events from './events.js' +export * as functions from './functions.js' + +export { Contract } from './contract.js' diff --git a/src/abi/curve-registry-exchange.abi.ts b/src/abi/curve-registry-exchange.abi.ts deleted file mode 100644 index a5fc9681..00000000 --- a/src/abi/curve-registry-exchange.abi.ts +++ /dev/null @@ -1,746 +0,0 @@ -export const ABI_JSON = [ - { - "type": "event", - "anonymous": false, - "name": "TokenExchange", - "inputs": [ - { - "type": "address", - "name": "buyer", - "indexed": true - }, - { - "type": "address", - "name": "receiver", - "indexed": true - }, - { - "type": "address", - "name": "pool", - "indexed": true - }, - { - "type": "address", - "name": "token_sold", - "indexed": false - }, - { - "type": "address", - "name": "token_bought", - "indexed": false - }, - { - "type": "uint256", - "name": "amount_sold", - "indexed": false - }, - { - "type": "uint256", - "name": "amount_bought", - "indexed": false - } - ] - }, - { - "type": "event", - "anonymous": false, - "name": "ExchangeMultiple", - "inputs": [ - { - "type": "address", - "name": "buyer", - "indexed": true - }, - { - "type": "address", - "name": "receiver", - "indexed": true - }, - { - "type": "address[9]", - "name": "route" - }, - { - "type": "uint256[3][4]", - "name": "swap_params" - }, - { - "type": "address[4]", - "name": "pools" - }, - { - "type": "uint256", - "name": "amount_sold", - "indexed": false - }, - { - "type": "uint256", - "name": "amount_bought", - "indexed": false - } - ] - }, - { - "type": "constructor", - "stateMutability": "undefined", - "payable": false, - "inputs": [ - { - "type": "address", - "name": "_address_provider" - }, - { - "type": "address", - "name": "_calculator" - }, - { - "type": "address", - "name": "_weth" - } - ] - }, - { - "type": "fallback", - "stateMutability": "payable" - }, - { - "type": "function", - "name": "exchange_with_best_rate", - "constant": false, - "stateMutability": "payable", - "payable": true, - "inputs": [ - { - "type": "address", - "name": "_from" - }, - { - "type": "address", - "name": "_to" - }, - { - "type": "uint256", - "name": "_amount" - }, - { - "type": "uint256", - "name": "_expected" - } - ], - "outputs": [ - { - "type": "uint256", - "name": "" - } - ] - }, - { - "type": "function", - "name": "exchange_with_best_rate", - "constant": false, - "stateMutability": "payable", - "payable": true, - "inputs": [ - { - "type": "address", - "name": "_from" - }, - { - "type": "address", - "name": "_to" - }, - { - "type": "uint256", - "name": "_amount" - }, - { - "type": "uint256", - "name": "_expected" - }, - { - "type": "address", - "name": "_receiver" - } - ], - "outputs": [ - { - "type": "uint256", - "name": "" - } - ] - }, - { - "type": "function", - "name": "exchange", - "constant": false, - "stateMutability": "payable", - "payable": true, - "inputs": [ - { - "type": "address", - "name": "_pool" - }, - { - "type": "address", - "name": "_from" - }, - { - "type": "address", - "name": "_to" - }, - { - "type": "uint256", - "name": "_amount" - }, - { - "type": "uint256", - "name": "_expected" - } - ], - "outputs": [ - { - "type": "uint256", - "name": "" - } - ] - }, - { - "type": "function", - "name": "exchange", - "constant": false, - "stateMutability": "payable", - "payable": true, - "inputs": [ - { - "type": "address", - "name": "_pool" - }, - { - "type": "address", - "name": "_from" - }, - { - "type": "address", - "name": "_to" - }, - { - "type": "uint256", - "name": "_amount" - }, - { - "type": "uint256", - "name": "_expected" - }, - { - "type": "address", - "name": "_receiver" - } - ], - "outputs": [ - { - "type": "uint256", - "name": "" - } - ] - }, - { - "type": "function", - "name": "exchange_multiple", - "constant": false, - "stateMutability": "payable", - "payable": true, - "inputs": [ - { - "type": "address[9]", - "name": "_route" - }, - { - "type": "uint256[3][4]", - "name": "_swap_params" - }, - { - "type": "uint256", - "name": "_amount" - }, - { - "type": "uint256", - "name": "_expected" - } - ], - "outputs": [ - { - "type": "uint256", - "name": "" - } - ] - }, - { - "type": "function", - "name": "exchange_multiple", - "constant": false, - "stateMutability": "payable", - "payable": true, - "inputs": [ - { - "type": "address[9]", - "name": "_route" - }, - { - "type": "uint256[3][4]", - "name": "_swap_params" - }, - { - "type": "uint256", - "name": "_amount" - }, - { - "type": "uint256", - "name": "_expected" - }, - { - "type": "address[4]", - "name": "_pools" - } - ], - "outputs": [ - { - "type": "uint256", - "name": "" - } - ] - }, - { - "type": "function", - "name": "exchange_multiple", - "constant": false, - "stateMutability": "payable", - "payable": true, - "inputs": [ - { - "type": "address[9]", - "name": "_route" - }, - { - "type": "uint256[3][4]", - "name": "_swap_params" - }, - { - "type": "uint256", - "name": "_amount" - }, - { - "type": "uint256", - "name": "_expected" - }, - { - "type": "address[4]", - "name": "_pools" - }, - { - "type": "address", - "name": "_receiver" - } - ], - "outputs": [ - { - "type": "uint256", - "name": "" - } - ] - }, - { - "type": "function", - "name": "get_best_rate", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [ - { - "type": "address", - "name": "_from" - }, - { - "type": "address", - "name": "_to" - }, - { - "type": "uint256", - "name": "_amount" - } - ], - "outputs": [ - { - "type": "address", - "name": "" - }, - { - "type": "uint256", - "name": "" - } - ] - }, - { - "type": "function", - "name": "get_best_rate", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [ - { - "type": "address", - "name": "_from" - }, - { - "type": "address", - "name": "_to" - }, - { - "type": "uint256", - "name": "_amount" - }, - { - "type": "address[8]", - "name": "_exclude_pools" - } - ], - "outputs": [ - { - "type": "address", - "name": "" - }, - { - "type": "uint256", - "name": "" - } - ] - }, - { - "type": "function", - "name": "get_exchange_amount", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [ - { - "type": "address", - "name": "_pool" - }, - { - "type": "address", - "name": "_from" - }, - { - "type": "address", - "name": "_to" - }, - { - "type": "uint256", - "name": "_amount" - } - ], - "outputs": [ - { - "type": "uint256", - "name": "" - } - ] - }, - { - "type": "function", - "name": "get_input_amount", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [ - { - "type": "address", - "name": "_pool" - }, - { - "type": "address", - "name": "_from" - }, - { - "type": "address", - "name": "_to" - }, - { - "type": "uint256", - "name": "_amount" - } - ], - "outputs": [ - { - "type": "uint256", - "name": "" - } - ] - }, - { - "type": "function", - "name": "get_exchange_amounts", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [ - { - "type": "address", - "name": "_pool" - }, - { - "type": "address", - "name": "_from" - }, - { - "type": "address", - "name": "_to" - }, - { - "type": "uint256[100]", - "name": "_amounts" - } - ], - "outputs": [ - { - "type": "uint256[100]", - "name": "" - } - ] - }, - { - "type": "function", - "name": "get_exchange_multiple_amount", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [ - { - "type": "address[9]", - "name": "_route" - }, - { - "type": "uint256[3][4]", - "name": "_swap_params" - }, - { - "type": "uint256", - "name": "_amount" - } - ], - "outputs": [ - { - "type": "uint256", - "name": "" - } - ] - }, - { - "type": "function", - "name": "get_exchange_multiple_amount", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [ - { - "type": "address[9]", - "name": "_route" - }, - { - "type": "uint256[3][4]", - "name": "_swap_params" - }, - { - "type": "uint256", - "name": "_amount" - }, - { - "type": "address[4]", - "name": "_pools" - } - ], - "outputs": [ - { - "type": "uint256", - "name": "" - } - ] - }, - { - "type": "function", - "name": "get_calculator", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [ - { - "type": "address", - "name": "_pool" - } - ], - "outputs": [ - { - "type": "address", - "name": "" - } - ] - }, - { - "type": "function", - "name": "update_registry_address", - "constant": false, - "payable": false, - "inputs": [], - "outputs": [ - { - "type": "bool", - "name": "" - } - ] - }, - { - "type": "function", - "name": "set_calculator", - "constant": false, - "payable": false, - "inputs": [ - { - "type": "address", - "name": "_pool" - }, - { - "type": "address", - "name": "_calculator" - } - ], - "outputs": [ - { - "type": "bool", - "name": "" - } - ] - }, - { - "type": "function", - "name": "set_default_calculator", - "constant": false, - "payable": false, - "inputs": [ - { - "type": "address", - "name": "_calculator" - } - ], - "outputs": [ - { - "type": "bool", - "name": "" - } - ] - }, - { - "type": "function", - "name": "claim_balance", - "constant": false, - "payable": false, - "inputs": [ - { - "type": "address", - "name": "_token" - } - ], - "outputs": [ - { - "type": "bool", - "name": "" - } - ] - }, - { - "type": "function", - "name": "set_killed", - "constant": false, - "payable": false, - "inputs": [ - { - "type": "bool", - "name": "_is_killed" - } - ], - "outputs": [ - { - "type": "bool", - "name": "" - } - ] - }, - { - "type": "function", - "name": "registry", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [ - { - "type": "address", - "name": "" - } - ] - }, - { - "type": "function", - "name": "factory_registry", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [ - { - "type": "address", - "name": "" - } - ] - }, - { - "type": "function", - "name": "crypto_registry", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [ - { - "type": "address", - "name": "" - } - ] - }, - { - "type": "function", - "name": "default_calculator", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [ - { - "type": "address", - "name": "" - } - ] - }, - { - "type": "function", - "name": "is_killed", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [ - { - "type": "bool", - "name": "" - } - ] - } -] as const diff --git a/src/abi/curve-stable-swap-factory-ng.ts b/src/abi/curve-stable-swap-factory-ng.ts deleted file mode 100644 index 602dae0c..00000000 --- a/src/abi/curve-stable-swap-factory-ng.ts +++ /dev/null @@ -1,356 +0,0 @@ -import * as p from '@subsquid/evm-codec' -import { event, fun, viewFun, indexed, ContractBase } from '@subsquid/evm-abi' -import type { EventParams as EParams, FunctionArguments, FunctionReturn } from '@subsquid/evm-abi' - -export const events = { - BasePoolAdded: event("0xcc6afdfec79da6be08142ecee25cf14b665961e25d30d8eba45959be9547635f", "BasePoolAdded(address)", {"base_pool": p.address}), - PlainPoolDeployed: event("0xd1d60d4611e4091bb2e5f699eeb79136c21ac2305ad609f3de569afc3471eecc", "PlainPoolDeployed(address[],uint256,uint256,address)", {"coins": p.array(p.address), "A": p.uint256, "fee": p.uint256, "deployer": p.address}), - MetaPoolDeployed: event("0x01f31cd2abdeb4e5e10ba500f2db0f937d9e8c735ab04681925441b4ea37eda5", "MetaPoolDeployed(address,address,uint256,uint256,address)", {"coin": p.address, "base_pool": p.address, "A": p.uint256, "fee": p.uint256, "deployer": p.address}), - LiquidityGaugeDeployed: event("0x656bb34c20491970a8c163f3bd62ead82022b379c3924960ec60f6dbfc5aab3b", "LiquidityGaugeDeployed(address,address)", {"pool": p.address, "gauge": p.address}), -} - -export const functions = { - 'find_pool_for_coins(address,address)': viewFun("0xa87df06c", "find_pool_for_coins(address,address)", {"_from": p.address, "_to": p.address}, p.address), - 'find_pool_for_coins(address,address,uint256)': viewFun("0x6982eb0b", "find_pool_for_coins(address,address,uint256)", {"_from": p.address, "_to": p.address, "i": p.uint256}, p.address), - get_base_pool: viewFun("0x6f20d6dd", "get_base_pool(address)", {"_pool": p.address}, p.address), - get_n_coins: viewFun("0x940494f1", "get_n_coins(address)", {"_pool": p.address}, p.uint256), - get_meta_n_coins: viewFun("0xeb73f37d", "get_meta_n_coins(address)", {"_pool": p.address}, {"_0": p.uint256, "_1": p.uint256}), - get_coins: viewFun("0x9ac90d3d", "get_coins(address)", {"_pool": p.address}, p.array(p.address)), - get_underlying_coins: viewFun("0xa77576ef", "get_underlying_coins(address)", {"_pool": p.address}, p.array(p.address)), - get_decimals: viewFun("0x52b51555", "get_decimals(address)", {"_pool": p.address}, p.array(p.uint256)), - get_underlying_decimals: viewFun("0x4cb088f1", "get_underlying_decimals(address)", {"_pool": p.address}, p.array(p.uint256)), - get_metapool_rates: viewFun("0x06d8f160", "get_metapool_rates(address)", {"_pool": p.address}, p.array(p.uint256)), - get_balances: viewFun("0x92e3cc2d", "get_balances(address)", {"_pool": p.address}, p.array(p.uint256)), - get_underlying_balances: viewFun("0x59f4f351", "get_underlying_balances(address)", {"_pool": p.address}, p.array(p.uint256)), - get_A: viewFun("0x55b30b19", "get_A(address)", {"_pool": p.address}, p.uint256), - get_fees: viewFun("0x7cdb72b0", "get_fees(address)", {"_pool": p.address}, {"_0": p.uint256, "_1": p.uint256}), - get_admin_balances: viewFun("0xc11e45b8", "get_admin_balances(address)", {"_pool": p.address}, p.array(p.uint256)), - get_coin_indices: viewFun("0xeb85226d", "get_coin_indices(address,address,address)", {"_pool": p.address, "_from": p.address, "_to": p.address}, {"_0": p.int128, "_1": p.int128, "_2": p.bool}), - get_gauge: viewFun("0xdaf297b9", "get_gauge(address)", {"_pool": p.address}, p.address), - get_implementation_address: viewFun("0x510d98a4", "get_implementation_address(address)", {"_pool": p.address}, p.address), - is_meta: viewFun("0xe4d332a9", "is_meta(address)", {"_pool": p.address}, p.bool), - get_pool_asset_types: viewFun("0xa80f2464", "get_pool_asset_types(address)", {"_pool": p.address}, p.array(p.uint8)), - deploy_plain_pool: fun("0x5bcd3d83", "deploy_plain_pool(string,string,address[],uint256,uint256,uint256,uint256,uint256,uint8[],bytes4[],address[])", {"_name": p.string, "_symbol": p.string, "_coins": p.array(p.address), "_A": p.uint256, "_fee": p.uint256, "_offpeg_fee_multiplier": p.uint256, "_ma_exp_time": p.uint256, "_implementation_idx": p.uint256, "_asset_types": p.array(p.uint8), "_method_ids": p.array(p.bytes4), "_oracles": p.array(p.address)}, p.address), - deploy_metapool: fun("0xdf8c5d73", "deploy_metapool(address,string,string,address,uint256,uint256,uint256,uint256,uint256,uint8,bytes4,address)", {"_base_pool": p.address, "_name": p.string, "_symbol": p.string, "_coin": p.address, "_A": p.uint256, "_fee": p.uint256, "_offpeg_fee_multiplier": p.uint256, "_ma_exp_time": p.uint256, "_implementation_idx": p.uint256, "_asset_type": p.uint8, "_method_id": p.bytes4, "_oracle": p.address}, p.address), - deploy_gauge: fun("0x96bebb34", "deploy_gauge(address)", {"_pool": p.address}, p.address), - add_base_pool: fun("0xa9a8ef44", "add_base_pool(address,address,uint8[],uint256)", {"_base_pool": p.address, "_base_lp_token": p.address, "_asset_types": p.array(p.uint8), "_n_coins": p.uint256}, ), - set_pool_implementations: fun("0x4dc05cfb", "set_pool_implementations(uint256,address)", {"_implementation_index": p.uint256, "_implementation": p.address}, ), - set_metapool_implementations: fun("0x1cb30399", "set_metapool_implementations(uint256,address)", {"_implementation_index": p.uint256, "_implementation": p.address}, ), - set_math_implementation: fun("0xb07426f4", "set_math_implementation(address)", {"_math_implementation": p.address}, ), - set_gauge_implementation: fun("0x8f03182c", "set_gauge_implementation(address)", {"_gauge_implementation": p.address}, ), - set_views_implementation: fun("0xf6fa937f", "set_views_implementation(address)", {"_views_implementation": p.address}, ), - commit_transfer_ownership: fun("0x6b441a40", "commit_transfer_ownership(address)", {"_addr": p.address}, ), - accept_transfer_ownership: fun("0xe5ea47b8", "accept_transfer_ownership()", {}, ), - set_fee_receiver: fun("0x36d2b77a", "set_fee_receiver(address,address)", {"_pool": p.address, "_fee_receiver": p.address}, ), - add_asset_type: fun("0x4e988127", "add_asset_type(uint8,string)", {"_id": p.uint8, "_name": p.string}, ), - admin: viewFun("0xf851a440", "admin()", {}, p.address), - future_admin: viewFun("0x17f7182a", "future_admin()", {}, p.address), - asset_types: viewFun("0xf1f10172", "asset_types(uint8)", {"arg0": p.uint8}, p.string), - pool_list: viewFun("0x3a1d5d8e", "pool_list(uint256)", {"arg0": p.uint256}, p.address), - pool_count: viewFun("0x956aae3a", "pool_count()", {}, p.uint256), - base_pool_list: viewFun("0x22fe5671", "base_pool_list(uint256)", {"arg0": p.uint256}, p.address), - base_pool_count: viewFun("0xde5e4a3b", "base_pool_count()", {}, p.uint256), - base_pool_data: viewFun("0xed874940", "base_pool_data(address)", {"arg0": p.address}, p.struct({"lp_token": p.address, "coins": p.array(p.address), "decimals": p.uint256, "n_coins": p.uint256, "asset_types": p.array(p.uint8)})), - base_pool_assets: viewFun("0x10a002df", "base_pool_assets(address)", {"arg0": p.address}, p.bool), - pool_implementations: viewFun("0x3273ff47", "pool_implementations(uint256)", {"arg0": p.uint256}, p.address), - metapool_implementations: viewFun("0xcfef1d6b", "metapool_implementations(uint256)", {"arg0": p.uint256}, p.address), - math_implementation: viewFun("0xa13c8f81", "math_implementation()", {}, p.address), - gauge_implementation: viewFun("0x8df24207", "gauge_implementation()", {}, p.address), - views_implementation: viewFun("0xe31593d8", "views_implementation()", {}, p.address), - fee_receiver: viewFun("0xcab4d3db", "fee_receiver()", {}, p.address), -} - -export class Contract extends ContractBase { - - 'find_pool_for_coins(address,address)'(_from: Find_pool_for_coinsParams_0["_from"], _to: Find_pool_for_coinsParams_0["_to"]) { - return this.eth_call(functions['find_pool_for_coins(address,address)'], {_from, _to}) - } - - 'find_pool_for_coins(address,address,uint256)'(_from: Find_pool_for_coinsParams_1["_from"], _to: Find_pool_for_coinsParams_1["_to"], i: Find_pool_for_coinsParams_1["i"]) { - return this.eth_call(functions['find_pool_for_coins(address,address,uint256)'], {_from, _to, i}) - } - - get_base_pool(_pool: Get_base_poolParams["_pool"]) { - return this.eth_call(functions.get_base_pool, {_pool}) - } - - get_n_coins(_pool: Get_n_coinsParams["_pool"]) { - return this.eth_call(functions.get_n_coins, {_pool}) - } - - get_meta_n_coins(_pool: Get_meta_n_coinsParams["_pool"]) { - return this.eth_call(functions.get_meta_n_coins, {_pool}) - } - - get_coins(_pool: Get_coinsParams["_pool"]) { - return this.eth_call(functions.get_coins, {_pool}) - } - - get_underlying_coins(_pool: Get_underlying_coinsParams["_pool"]) { - return this.eth_call(functions.get_underlying_coins, {_pool}) - } - - get_decimals(_pool: Get_decimalsParams["_pool"]) { - return this.eth_call(functions.get_decimals, {_pool}) - } - - get_underlying_decimals(_pool: Get_underlying_decimalsParams["_pool"]) { - return this.eth_call(functions.get_underlying_decimals, {_pool}) - } - - get_metapool_rates(_pool: Get_metapool_ratesParams["_pool"]) { - return this.eth_call(functions.get_metapool_rates, {_pool}) - } - - get_balances(_pool: Get_balancesParams["_pool"]) { - return this.eth_call(functions.get_balances, {_pool}) - } - - get_underlying_balances(_pool: Get_underlying_balancesParams["_pool"]) { - return this.eth_call(functions.get_underlying_balances, {_pool}) - } - - get_A(_pool: Get_AParams["_pool"]) { - return this.eth_call(functions.get_A, {_pool}) - } - - get_fees(_pool: Get_feesParams["_pool"]) { - return this.eth_call(functions.get_fees, {_pool}) - } - - get_admin_balances(_pool: Get_admin_balancesParams["_pool"]) { - return this.eth_call(functions.get_admin_balances, {_pool}) - } - - get_coin_indices(_pool: Get_coin_indicesParams["_pool"], _from: Get_coin_indicesParams["_from"], _to: Get_coin_indicesParams["_to"]) { - return this.eth_call(functions.get_coin_indices, {_pool, _from, _to}) - } - - get_gauge(_pool: Get_gaugeParams["_pool"]) { - return this.eth_call(functions.get_gauge, {_pool}) - } - - get_implementation_address(_pool: Get_implementation_addressParams["_pool"]) { - return this.eth_call(functions.get_implementation_address, {_pool}) - } - - is_meta(_pool: Is_metaParams["_pool"]) { - return this.eth_call(functions.is_meta, {_pool}) - } - - get_pool_asset_types(_pool: Get_pool_asset_typesParams["_pool"]) { - return this.eth_call(functions.get_pool_asset_types, {_pool}) - } - - admin() { - return this.eth_call(functions.admin, {}) - } - - future_admin() { - return this.eth_call(functions.future_admin, {}) - } - - asset_types(arg0: Asset_typesParams["arg0"]) { - return this.eth_call(functions.asset_types, {arg0}) - } - - pool_list(arg0: Pool_listParams["arg0"]) { - return this.eth_call(functions.pool_list, {arg0}) - } - - pool_count() { - return this.eth_call(functions.pool_count, {}) - } - - base_pool_list(arg0: Base_pool_listParams["arg0"]) { - return this.eth_call(functions.base_pool_list, {arg0}) - } - - base_pool_count() { - return this.eth_call(functions.base_pool_count, {}) - } - - base_pool_data(arg0: Base_pool_dataParams["arg0"]) { - return this.eth_call(functions.base_pool_data, {arg0}) - } - - base_pool_assets(arg0: Base_pool_assetsParams["arg0"]) { - return this.eth_call(functions.base_pool_assets, {arg0}) - } - - pool_implementations(arg0: Pool_implementationsParams["arg0"]) { - return this.eth_call(functions.pool_implementations, {arg0}) - } - - metapool_implementations(arg0: Metapool_implementationsParams["arg0"]) { - return this.eth_call(functions.metapool_implementations, {arg0}) - } - - math_implementation() { - return this.eth_call(functions.math_implementation, {}) - } - - gauge_implementation() { - return this.eth_call(functions.gauge_implementation, {}) - } - - views_implementation() { - return this.eth_call(functions.views_implementation, {}) - } - - fee_receiver() { - return this.eth_call(functions.fee_receiver, {}) - } -} - -/// Event types -export type BasePoolAddedEventArgs = EParams -export type PlainPoolDeployedEventArgs = EParams -export type MetaPoolDeployedEventArgs = EParams -export type LiquidityGaugeDeployedEventArgs = EParams - -/// Function types -export type Find_pool_for_coinsParams_0 = FunctionArguments -export type Find_pool_for_coinsReturn_0 = FunctionReturn - -export type Find_pool_for_coinsParams_1 = FunctionArguments -export type Find_pool_for_coinsReturn_1 = FunctionReturn - -export type Get_base_poolParams = FunctionArguments -export type Get_base_poolReturn = FunctionReturn - -export type Get_n_coinsParams = FunctionArguments -export type Get_n_coinsReturn = FunctionReturn - -export type Get_meta_n_coinsParams = FunctionArguments -export type Get_meta_n_coinsReturn = FunctionReturn - -export type Get_coinsParams = FunctionArguments -export type Get_coinsReturn = FunctionReturn - -export type Get_underlying_coinsParams = FunctionArguments -export type Get_underlying_coinsReturn = FunctionReturn - -export type Get_decimalsParams = FunctionArguments -export type Get_decimalsReturn = FunctionReturn - -export type Get_underlying_decimalsParams = FunctionArguments -export type Get_underlying_decimalsReturn = FunctionReturn - -export type Get_metapool_ratesParams = FunctionArguments -export type Get_metapool_ratesReturn = FunctionReturn - -export type Get_balancesParams = FunctionArguments -export type Get_balancesReturn = FunctionReturn - -export type Get_underlying_balancesParams = FunctionArguments -export type Get_underlying_balancesReturn = FunctionReturn - -export type Get_AParams = FunctionArguments -export type Get_AReturn = FunctionReturn - -export type Get_feesParams = FunctionArguments -export type Get_feesReturn = FunctionReturn - -export type Get_admin_balancesParams = FunctionArguments -export type Get_admin_balancesReturn = FunctionReturn - -export type Get_coin_indicesParams = FunctionArguments -export type Get_coin_indicesReturn = FunctionReturn - -export type Get_gaugeParams = FunctionArguments -export type Get_gaugeReturn = FunctionReturn - -export type Get_implementation_addressParams = FunctionArguments -export type Get_implementation_addressReturn = FunctionReturn - -export type Is_metaParams = FunctionArguments -export type Is_metaReturn = FunctionReturn - -export type Get_pool_asset_typesParams = FunctionArguments -export type Get_pool_asset_typesReturn = FunctionReturn - -export type Deploy_plain_poolParams = FunctionArguments -export type Deploy_plain_poolReturn = FunctionReturn - -export type Deploy_metapoolParams = FunctionArguments -export type Deploy_metapoolReturn = FunctionReturn - -export type Deploy_gaugeParams = FunctionArguments -export type Deploy_gaugeReturn = FunctionReturn - -export type Add_base_poolParams = FunctionArguments -export type Add_base_poolReturn = FunctionReturn - -export type Set_pool_implementationsParams = FunctionArguments -export type Set_pool_implementationsReturn = FunctionReturn - -export type Set_metapool_implementationsParams = FunctionArguments -export type Set_metapool_implementationsReturn = FunctionReturn - -export type Set_math_implementationParams = FunctionArguments -export type Set_math_implementationReturn = FunctionReturn - -export type Set_gauge_implementationParams = FunctionArguments -export type Set_gauge_implementationReturn = FunctionReturn - -export type Set_views_implementationParams = FunctionArguments -export type Set_views_implementationReturn = FunctionReturn - -export type Commit_transfer_ownershipParams = FunctionArguments -export type Commit_transfer_ownershipReturn = FunctionReturn - -export type Accept_transfer_ownershipParams = FunctionArguments -export type Accept_transfer_ownershipReturn = FunctionReturn - -export type Set_fee_receiverParams = FunctionArguments -export type Set_fee_receiverReturn = FunctionReturn - -export type Add_asset_typeParams = FunctionArguments -export type Add_asset_typeReturn = FunctionReturn - -export type AdminParams = FunctionArguments -export type AdminReturn = FunctionReturn - -export type Future_adminParams = FunctionArguments -export type Future_adminReturn = FunctionReturn - -export type Asset_typesParams = FunctionArguments -export type Asset_typesReturn = FunctionReturn - -export type Pool_listParams = FunctionArguments -export type Pool_listReturn = FunctionReturn - -export type Pool_countParams = FunctionArguments -export type Pool_countReturn = FunctionReturn - -export type Base_pool_listParams = FunctionArguments -export type Base_pool_listReturn = FunctionReturn - -export type Base_pool_countParams = FunctionArguments -export type Base_pool_countReturn = FunctionReturn - -export type Base_pool_dataParams = FunctionArguments -export type Base_pool_dataReturn = FunctionReturn - -export type Base_pool_assetsParams = FunctionArguments -export type Base_pool_assetsReturn = FunctionReturn - -export type Pool_implementationsParams = FunctionArguments -export type Pool_implementationsReturn = FunctionReturn - -export type Metapool_implementationsParams = FunctionArguments -export type Metapool_implementationsReturn = FunctionReturn - -export type Math_implementationParams = FunctionArguments -export type Math_implementationReturn = FunctionReturn - -export type Gauge_implementationParams = FunctionArguments -export type Gauge_implementationReturn = FunctionReturn - -export type Views_implementationParams = FunctionArguments -export type Views_implementationReturn = FunctionReturn - -export type Fee_receiverParams = FunctionArguments -export type Fee_receiverReturn = FunctionReturn - diff --git a/src/abi/curve-stable-swap-factory-ng/contract.ts b/src/abi/curve-stable-swap-factory-ng/contract.ts new file mode 100644 index 00000000..da209fc6 --- /dev/null +++ b/src/abi/curve-stable-swap-factory-ng/contract.ts @@ -0,0 +1,157 @@ +import { ContractBase } from '../abi.support.js' +import { admin, asset_types, base_pool_assets, base_pool_count, base_pool_data, base_pool_list, deploy_gauge, deploy_metapool, deploy_plain_pool, fee_receiver, find_pool_for_coins, find_pool_for_coins_1, future_admin, gauge_implementation, get_A, get_admin_balances, get_balances, get_base_pool, get_coin_indices, get_coins, get_decimals, get_fees, get_gauge, get_implementation_address, get_meta_n_coins, get_metapool_rates, get_n_coins, get_pool_asset_types, get_underlying_balances, get_underlying_coins, get_underlying_decimals, is_meta, math_implementation, metapool_implementations, pool_count, pool_implementations, pool_list, views_implementation } from './functions.js' +import type { Asset_typesParams, Base_pool_assetsParams, Base_pool_dataParams, Base_pool_listParams, Deploy_gaugeParams, Deploy_metapoolParams, Deploy_plain_poolParams, Find_pool_for_coinsParams, Find_pool_for_coinsParams_1, Get_AParams, Get_admin_balancesParams, Get_balancesParams, Get_base_poolParams, Get_coin_indicesParams, Get_coinsParams, Get_decimalsParams, Get_feesParams, Get_gaugeParams, Get_implementation_addressParams, Get_meta_n_coinsParams, Get_metapool_ratesParams, Get_n_coinsParams, Get_pool_asset_typesParams, Get_underlying_balancesParams, Get_underlying_coinsParams, Get_underlying_decimalsParams, Is_metaParams, Metapool_implementationsParams, Pool_implementationsParams, Pool_listParams } from './functions.js' + +export class Contract extends ContractBase { + find_pool_for_coins(_from: Find_pool_for_coinsParams["_from"], _to: Find_pool_for_coinsParams["_to"]) { + return this.eth_call(find_pool_for_coins, {_from, _to}) + } + + find_pool_for_coins_1(_from: Find_pool_for_coinsParams_1["_from"], _to: Find_pool_for_coinsParams_1["_to"], i: Find_pool_for_coinsParams_1["i"]) { + return this.eth_call(find_pool_for_coins_1, {_from, _to, i}) + } + + get_base_pool(_pool: Get_base_poolParams["_pool"]) { + return this.eth_call(get_base_pool, {_pool}) + } + + get_n_coins(_pool: Get_n_coinsParams["_pool"]) { + return this.eth_call(get_n_coins, {_pool}) + } + + get_meta_n_coins(_pool: Get_meta_n_coinsParams["_pool"]) { + return this.eth_call(get_meta_n_coins, {_pool}) + } + + get_coins(_pool: Get_coinsParams["_pool"]) { + return this.eth_call(get_coins, {_pool}) + } + + get_underlying_coins(_pool: Get_underlying_coinsParams["_pool"]) { + return this.eth_call(get_underlying_coins, {_pool}) + } + + get_decimals(_pool: Get_decimalsParams["_pool"]) { + return this.eth_call(get_decimals, {_pool}) + } + + get_underlying_decimals(_pool: Get_underlying_decimalsParams["_pool"]) { + return this.eth_call(get_underlying_decimals, {_pool}) + } + + get_metapool_rates(_pool: Get_metapool_ratesParams["_pool"]) { + return this.eth_call(get_metapool_rates, {_pool}) + } + + get_balances(_pool: Get_balancesParams["_pool"]) { + return this.eth_call(get_balances, {_pool}) + } + + get_underlying_balances(_pool: Get_underlying_balancesParams["_pool"]) { + return this.eth_call(get_underlying_balances, {_pool}) + } + + get_A(_pool: Get_AParams["_pool"]) { + return this.eth_call(get_A, {_pool}) + } + + get_fees(_pool: Get_feesParams["_pool"]) { + return this.eth_call(get_fees, {_pool}) + } + + get_admin_balances(_pool: Get_admin_balancesParams["_pool"]) { + return this.eth_call(get_admin_balances, {_pool}) + } + + get_coin_indices(_pool: Get_coin_indicesParams["_pool"], _from: Get_coin_indicesParams["_from"], _to: Get_coin_indicesParams["_to"]) { + return this.eth_call(get_coin_indices, {_pool, _from, _to}) + } + + get_gauge(_pool: Get_gaugeParams["_pool"]) { + return this.eth_call(get_gauge, {_pool}) + } + + get_implementation_address(_pool: Get_implementation_addressParams["_pool"]) { + return this.eth_call(get_implementation_address, {_pool}) + } + + is_meta(_pool: Is_metaParams["_pool"]) { + return this.eth_call(is_meta, {_pool}) + } + + get_pool_asset_types(_pool: Get_pool_asset_typesParams["_pool"]) { + return this.eth_call(get_pool_asset_types, {_pool}) + } + + deploy_plain_pool(_name: Deploy_plain_poolParams["_name"], _symbol: Deploy_plain_poolParams["_symbol"], _coins: Deploy_plain_poolParams["_coins"], _A: Deploy_plain_poolParams["_A"], _fee: Deploy_plain_poolParams["_fee"], _offpeg_fee_multiplier: Deploy_plain_poolParams["_offpeg_fee_multiplier"], _ma_exp_time: Deploy_plain_poolParams["_ma_exp_time"], _implementation_idx: Deploy_plain_poolParams["_implementation_idx"], _asset_types: Deploy_plain_poolParams["_asset_types"], _method_ids: Deploy_plain_poolParams["_method_ids"], _oracles: Deploy_plain_poolParams["_oracles"]) { + return this.eth_call(deploy_plain_pool, {_name, _symbol, _coins, _A, _fee, _offpeg_fee_multiplier, _ma_exp_time, _implementation_idx, _asset_types, _method_ids, _oracles}) + } + + deploy_metapool(_base_pool: Deploy_metapoolParams["_base_pool"], _name: Deploy_metapoolParams["_name"], _symbol: Deploy_metapoolParams["_symbol"], _coin: Deploy_metapoolParams["_coin"], _A: Deploy_metapoolParams["_A"], _fee: Deploy_metapoolParams["_fee"], _offpeg_fee_multiplier: Deploy_metapoolParams["_offpeg_fee_multiplier"], _ma_exp_time: Deploy_metapoolParams["_ma_exp_time"], _implementation_idx: Deploy_metapoolParams["_implementation_idx"], _asset_type: Deploy_metapoolParams["_asset_type"], _method_id: Deploy_metapoolParams["_method_id"], _oracle: Deploy_metapoolParams["_oracle"]) { + return this.eth_call(deploy_metapool, {_base_pool, _name, _symbol, _coin, _A, _fee, _offpeg_fee_multiplier, _ma_exp_time, _implementation_idx, _asset_type, _method_id, _oracle}) + } + + deploy_gauge(_pool: Deploy_gaugeParams["_pool"]) { + return this.eth_call(deploy_gauge, {_pool}) + } + + admin() { + return this.eth_call(admin, {}) + } + + future_admin() { + return this.eth_call(future_admin, {}) + } + + asset_types(arg0: Asset_typesParams["arg0"]) { + return this.eth_call(asset_types, {arg0}) + } + + pool_list(arg0: Pool_listParams["arg0"]) { + return this.eth_call(pool_list, {arg0}) + } + + pool_count() { + return this.eth_call(pool_count, {}) + } + + base_pool_list(arg0: Base_pool_listParams["arg0"]) { + return this.eth_call(base_pool_list, {arg0}) + } + + base_pool_count() { + return this.eth_call(base_pool_count, {}) + } + + base_pool_data(arg0: Base_pool_dataParams["arg0"]) { + return this.eth_call(base_pool_data, {arg0}) + } + + base_pool_assets(arg0: Base_pool_assetsParams["arg0"]) { + return this.eth_call(base_pool_assets, {arg0}) + } + + pool_implementations(arg0: Pool_implementationsParams["arg0"]) { + return this.eth_call(pool_implementations, {arg0}) + } + + metapool_implementations(arg0: Metapool_implementationsParams["arg0"]) { + return this.eth_call(metapool_implementations, {arg0}) + } + + math_implementation() { + return this.eth_call(math_implementation, {}) + } + + gauge_implementation() { + return this.eth_call(gauge_implementation, {}) + } + + views_implementation() { + return this.eth_call(views_implementation, {}) + } + + fee_receiver() { + return this.eth_call(fee_receiver, {}) + } +} diff --git a/src/abi/curve-stable-swap-factory-ng/events.ts b/src/abi/curve-stable-swap-factory-ng/events.ts new file mode 100644 index 00000000..616bf767 --- /dev/null +++ b/src/abi/curve-stable-swap-factory-ng/events.ts @@ -0,0 +1,35 @@ +import { address, array, uint256 } from '@subsquid/evm-codec' +import { event } from '../abi.support.js' +import type { EventParams as EParams } from '../abi.support.js' + +/** BasePoolAdded(address) */ +export const BasePoolAdded = event('0xcc6afdfec79da6be08142ecee25cf14b665961e25d30d8eba45959be9547635f', { + base_pool: address, +}) +export type BasePoolAddedEventArgs = EParams + +/** PlainPoolDeployed(address[],uint256,uint256,address) */ +export const PlainPoolDeployed = event('0xd1d60d4611e4091bb2e5f699eeb79136c21ac2305ad609f3de569afc3471eecc', { + coins: array(address), + A: uint256, + fee: uint256, + deployer: address, +}) +export type PlainPoolDeployedEventArgs = EParams + +/** MetaPoolDeployed(address,address,uint256,uint256,address) */ +export const MetaPoolDeployed = event('0x01f31cd2abdeb4e5e10ba500f2db0f937d9e8c735ab04681925441b4ea37eda5', { + coin: address, + base_pool: address, + A: uint256, + fee: uint256, + deployer: address, +}) +export type MetaPoolDeployedEventArgs = EParams + +/** LiquidityGaugeDeployed(address,address) */ +export const LiquidityGaugeDeployed = event('0x656bb34c20491970a8c163f3bd62ead82022b379c3924960ec60f6dbfc5aab3b', { + pool: address, + gauge: address, +}) +export type LiquidityGaugeDeployedEventArgs = EParams diff --git a/src/abi/curve-stable-swap-factory-ng/functions.ts b/src/abi/curve-stable-swap-factory-ng/functions.ts new file mode 100644 index 00000000..7e2446a9 --- /dev/null +++ b/src/abi/curve-stable-swap-factory-ng/functions.ts @@ -0,0 +1,370 @@ +import { address, array, bool, bytes4, int128, string, struct, uint256, uint8 } from '@subsquid/evm-codec' +import { func } from '../abi.support.js' +import type { FunctionArguments, FunctionReturn } from '../abi.support.js' + +/** find_pool_for_coins(address,address) */ +export const find_pool_for_coins = func('0xa87df06c', { + _from: address, + _to: address, +}, address) +export type Find_pool_for_coinsParams = FunctionArguments +export type Find_pool_for_coinsReturn = FunctionReturn + +/** find_pool_for_coins(address,address,uint256) */ +export const find_pool_for_coins_1 = func('0x6982eb0b', { + _from: address, + _to: address, + i: uint256, +}, address) +export type Find_pool_for_coinsParams_1 = FunctionArguments +export type Find_pool_for_coinsReturn_1 = FunctionReturn + +/** get_base_pool(address) */ +export const get_base_pool = func('0x6f20d6dd', { + _pool: address, +}, address) +export type Get_base_poolParams = FunctionArguments +export type Get_base_poolReturn = FunctionReturn + +/** get_n_coins(address) */ +export const get_n_coins = func('0x940494f1', { + _pool: address, +}, uint256) +export type Get_n_coinsParams = FunctionArguments +export type Get_n_coinsReturn = FunctionReturn + +/** get_meta_n_coins(address) */ +export const get_meta_n_coins = func('0xeb73f37d', { + _pool: address, +}, struct({ + _0: uint256, + _1: uint256, +})) +export type Get_meta_n_coinsParams = FunctionArguments +export type Get_meta_n_coinsReturn = FunctionReturn + +/** get_coins(address) */ +export const get_coins = func('0x9ac90d3d', { + _pool: address, +}, array(address)) +export type Get_coinsParams = FunctionArguments +export type Get_coinsReturn = FunctionReturn + +/** get_underlying_coins(address) */ +export const get_underlying_coins = func('0xa77576ef', { + _pool: address, +}, array(address)) +export type Get_underlying_coinsParams = FunctionArguments +export type Get_underlying_coinsReturn = FunctionReturn + +/** get_decimals(address) */ +export const get_decimals = func('0x52b51555', { + _pool: address, +}, array(uint256)) +export type Get_decimalsParams = FunctionArguments +export type Get_decimalsReturn = FunctionReturn + +/** get_underlying_decimals(address) */ +export const get_underlying_decimals = func('0x4cb088f1', { + _pool: address, +}, array(uint256)) +export type Get_underlying_decimalsParams = FunctionArguments +export type Get_underlying_decimalsReturn = FunctionReturn + +/** get_metapool_rates(address) */ +export const get_metapool_rates = func('0x06d8f160', { + _pool: address, +}, array(uint256)) +export type Get_metapool_ratesParams = FunctionArguments +export type Get_metapool_ratesReturn = FunctionReturn + +/** get_balances(address) */ +export const get_balances = func('0x92e3cc2d', { + _pool: address, +}, array(uint256)) +export type Get_balancesParams = FunctionArguments +export type Get_balancesReturn = FunctionReturn + +/** get_underlying_balances(address) */ +export const get_underlying_balances = func('0x59f4f351', { + _pool: address, +}, array(uint256)) +export type Get_underlying_balancesParams = FunctionArguments +export type Get_underlying_balancesReturn = FunctionReturn + +/** get_A(address) */ +export const get_A = func('0x55b30b19', { + _pool: address, +}, uint256) +export type Get_AParams = FunctionArguments +export type Get_AReturn = FunctionReturn + +/** get_fees(address) */ +export const get_fees = func('0x7cdb72b0', { + _pool: address, +}, struct({ + _0: uint256, + _1: uint256, +})) +export type Get_feesParams = FunctionArguments +export type Get_feesReturn = FunctionReturn + +/** get_admin_balances(address) */ +export const get_admin_balances = func('0xc11e45b8', { + _pool: address, +}, array(uint256)) +export type Get_admin_balancesParams = FunctionArguments +export type Get_admin_balancesReturn = FunctionReturn + +/** get_coin_indices(address,address,address) */ +export const get_coin_indices = func('0xeb85226d', { + _pool: address, + _from: address, + _to: address, +}, struct({ + _0: int128, + _1: int128, + _2: bool, +})) +export type Get_coin_indicesParams = FunctionArguments +export type Get_coin_indicesReturn = FunctionReturn + +/** get_gauge(address) */ +export const get_gauge = func('0xdaf297b9', { + _pool: address, +}, address) +export type Get_gaugeParams = FunctionArguments +export type Get_gaugeReturn = FunctionReturn + +/** get_implementation_address(address) */ +export const get_implementation_address = func('0x510d98a4', { + _pool: address, +}, address) +export type Get_implementation_addressParams = FunctionArguments +export type Get_implementation_addressReturn = FunctionReturn + +/** is_meta(address) */ +export const is_meta = func('0xe4d332a9', { + _pool: address, +}, bool) +export type Is_metaParams = FunctionArguments +export type Is_metaReturn = FunctionReturn + +/** get_pool_asset_types(address) */ +export const get_pool_asset_types = func('0xa80f2464', { + _pool: address, +}, array(uint8)) +export type Get_pool_asset_typesParams = FunctionArguments +export type Get_pool_asset_typesReturn = FunctionReturn + +/** deploy_plain_pool(string,string,address[],uint256,uint256,uint256,uint256,uint256,uint8[],bytes4[],address[]) */ +export const deploy_plain_pool = func('0x5bcd3d83', { + _name: string, + _symbol: string, + _coins: array(address), + _A: uint256, + _fee: uint256, + _offpeg_fee_multiplier: uint256, + _ma_exp_time: uint256, + _implementation_idx: uint256, + _asset_types: array(uint8), + _method_ids: array(bytes4), + _oracles: array(address), +}, address) +export type Deploy_plain_poolParams = FunctionArguments +export type Deploy_plain_poolReturn = FunctionReturn + +/** deploy_metapool(address,string,string,address,uint256,uint256,uint256,uint256,uint256,uint8,bytes4,address) */ +export const deploy_metapool = func('0xdf8c5d73', { + _base_pool: address, + _name: string, + _symbol: string, + _coin: address, + _A: uint256, + _fee: uint256, + _offpeg_fee_multiplier: uint256, + _ma_exp_time: uint256, + _implementation_idx: uint256, + _asset_type: uint8, + _method_id: bytes4, + _oracle: address, +}, address) +export type Deploy_metapoolParams = FunctionArguments +export type Deploy_metapoolReturn = FunctionReturn + +/** deploy_gauge(address) */ +export const deploy_gauge = func('0x96bebb34', { + _pool: address, +}, address) +export type Deploy_gaugeParams = FunctionArguments +export type Deploy_gaugeReturn = FunctionReturn + +/** add_base_pool(address,address,uint8[],uint256) */ +export const add_base_pool = func('0xa9a8ef44', { + _base_pool: address, + _base_lp_token: address, + _asset_types: array(uint8), + _n_coins: uint256, +}) +export type Add_base_poolParams = FunctionArguments +export type Add_base_poolReturn = FunctionReturn + +/** set_pool_implementations(uint256,address) */ +export const set_pool_implementations = func('0x4dc05cfb', { + _implementation_index: uint256, + _implementation: address, +}) +export type Set_pool_implementationsParams = FunctionArguments +export type Set_pool_implementationsReturn = FunctionReturn + +/** set_metapool_implementations(uint256,address) */ +export const set_metapool_implementations = func('0x1cb30399', { + _implementation_index: uint256, + _implementation: address, +}) +export type Set_metapool_implementationsParams = FunctionArguments +export type Set_metapool_implementationsReturn = FunctionReturn + +/** set_math_implementation(address) */ +export const set_math_implementation = func('0xb07426f4', { + _math_implementation: address, +}) +export type Set_math_implementationParams = FunctionArguments +export type Set_math_implementationReturn = FunctionReturn + +/** set_gauge_implementation(address) */ +export const set_gauge_implementation = func('0x8f03182c', { + _gauge_implementation: address, +}) +export type Set_gauge_implementationParams = FunctionArguments +export type Set_gauge_implementationReturn = FunctionReturn + +/** set_views_implementation(address) */ +export const set_views_implementation = func('0xf6fa937f', { + _views_implementation: address, +}) +export type Set_views_implementationParams = FunctionArguments +export type Set_views_implementationReturn = FunctionReturn + +/** commit_transfer_ownership(address) */ +export const commit_transfer_ownership = func('0x6b441a40', { + _addr: address, +}) +export type Commit_transfer_ownershipParams = FunctionArguments +export type Commit_transfer_ownershipReturn = FunctionReturn + +/** accept_transfer_ownership() */ +export const accept_transfer_ownership = func('0xe5ea47b8', {}) +export type Accept_transfer_ownershipParams = FunctionArguments +export type Accept_transfer_ownershipReturn = FunctionReturn + +/** set_fee_receiver(address,address) */ +export const set_fee_receiver = func('0x36d2b77a', { + _pool: address, + _fee_receiver: address, +}) +export type Set_fee_receiverParams = FunctionArguments +export type Set_fee_receiverReturn = FunctionReturn + +/** add_asset_type(uint8,string) */ +export const add_asset_type = func('0x4e988127', { + _id: uint8, + _name: string, +}) +export type Add_asset_typeParams = FunctionArguments +export type Add_asset_typeReturn = FunctionReturn + +/** admin() */ +export const admin = func('0xf851a440', {}, address) +export type AdminParams = FunctionArguments +export type AdminReturn = FunctionReturn + +/** future_admin() */ +export const future_admin = func('0x17f7182a', {}, address) +export type Future_adminParams = FunctionArguments +export type Future_adminReturn = FunctionReturn + +/** asset_types(uint8) */ +export const asset_types = func('0xf1f10172', { + arg0: uint8, +}, string) +export type Asset_typesParams = FunctionArguments +export type Asset_typesReturn = FunctionReturn + +/** pool_list(uint256) */ +export const pool_list = func('0x3a1d5d8e', { + arg0: uint256, +}, address) +export type Pool_listParams = FunctionArguments +export type Pool_listReturn = FunctionReturn + +/** pool_count() */ +export const pool_count = func('0x956aae3a', {}, uint256) +export type Pool_countParams = FunctionArguments +export type Pool_countReturn = FunctionReturn + +/** base_pool_list(uint256) */ +export const base_pool_list = func('0x22fe5671', { + arg0: uint256, +}, address) +export type Base_pool_listParams = FunctionArguments +export type Base_pool_listReturn = FunctionReturn + +/** base_pool_count() */ +export const base_pool_count = func('0xde5e4a3b', {}, uint256) +export type Base_pool_countParams = FunctionArguments +export type Base_pool_countReturn = FunctionReturn + +/** base_pool_data(address) */ +export const base_pool_data = func('0xed874940', { + arg0: address, +}, struct({ + lp_token: address, + coins: array(address), + decimals: uint256, + n_coins: uint256, + asset_types: array(uint8), +})) +export type Base_pool_dataParams = FunctionArguments +export type Base_pool_dataReturn = FunctionReturn + +/** base_pool_assets(address) */ +export const base_pool_assets = func('0x10a002df', { + arg0: address, +}, bool) +export type Base_pool_assetsParams = FunctionArguments +export type Base_pool_assetsReturn = FunctionReturn + +/** pool_implementations(uint256) */ +export const pool_implementations = func('0x3273ff47', { + arg0: uint256, +}, address) +export type Pool_implementationsParams = FunctionArguments +export type Pool_implementationsReturn = FunctionReturn + +/** metapool_implementations(uint256) */ +export const metapool_implementations = func('0xcfef1d6b', { + arg0: uint256, +}, address) +export type Metapool_implementationsParams = FunctionArguments +export type Metapool_implementationsReturn = FunctionReturn + +/** math_implementation() */ +export const math_implementation = func('0xa13c8f81', {}, address) +export type Math_implementationParams = FunctionArguments +export type Math_implementationReturn = FunctionReturn + +/** gauge_implementation() */ +export const gauge_implementation = func('0x8df24207', {}, address) +export type Gauge_implementationParams = FunctionArguments +export type Gauge_implementationReturn = FunctionReturn + +/** views_implementation() */ +export const views_implementation = func('0xe31593d8', {}, address) +export type Views_implementationParams = FunctionArguments +export type Views_implementationReturn = FunctionReturn + +/** fee_receiver() */ +export const fee_receiver = func('0xcab4d3db', {}, address) +export type Fee_receiverParams = FunctionArguments +export type Fee_receiverReturn = FunctionReturn diff --git a/src/abi/curve-stable-swap-factory-ng/index.ts b/src/abi/curve-stable-swap-factory-ng/index.ts new file mode 100644 index 00000000..11829d6e --- /dev/null +++ b/src/abi/curve-stable-swap-factory-ng/index.ts @@ -0,0 +1,4 @@ +export * as events from './events.js' +export * as functions from './functions.js' + +export { Contract } from './contract.js' diff --git a/src/abi/curve-stable-swap-meta-ng.ts b/src/abi/curve-stable-swap-meta-ng.ts deleted file mode 100644 index 2f765e41..00000000 --- a/src/abi/curve-stable-swap-meta-ng.ts +++ /dev/null @@ -1,488 +0,0 @@ -import * as p from '@subsquid/evm-codec' -import { event, fun, viewFun, indexed, ContractBase } from '@subsquid/evm-abi' -import type { EventParams as EParams, FunctionArguments, FunctionReturn } from '@subsquid/evm-abi' - -export const events = { - Transfer: event("0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", "Transfer(address,address,uint256)", {"sender": indexed(p.address), "receiver": indexed(p.address), "value": p.uint256}), - Approval: event("0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925", "Approval(address,address,uint256)", {"owner": indexed(p.address), "spender": indexed(p.address), "value": p.uint256}), - TokenExchange: event("0x8b3e96f2b889fa771c53c981b40daf005f63f637f1869f707052d15a3dd97140", "TokenExchange(address,int128,uint256,int128,uint256)", {"buyer": indexed(p.address), "sold_id": p.int128, "tokens_sold": p.uint256, "bought_id": p.int128, "tokens_bought": p.uint256}), - TokenExchangeUnderlying: event("0xd013ca23e77a65003c2c659c5442c00c805371b7fc1ebd4c206c41d1536bd90b", "TokenExchangeUnderlying(address,int128,uint256,int128,uint256)", {"buyer": indexed(p.address), "sold_id": p.int128, "tokens_sold": p.uint256, "bought_id": p.int128, "tokens_bought": p.uint256}), - AddLiquidity: event("0x189c623b666b1b45b83d7178f39b8c087cb09774317ca2f53c2d3c3726f222a2", "AddLiquidity(address,uint256[],uint256[],uint256,uint256)", {"provider": indexed(p.address), "token_amounts": p.array(p.uint256), "fees": p.array(p.uint256), "invariant": p.uint256, "token_supply": p.uint256}), - RemoveLiquidity: event("0x347ad828e58cbe534d8f6b67985d791360756b18f0d95fd9f197a66cc46480ea", "RemoveLiquidity(address,uint256[],uint256[],uint256)", {"provider": indexed(p.address), "token_amounts": p.array(p.uint256), "fees": p.array(p.uint256), "token_supply": p.uint256}), - RemoveLiquidityOne: event("0x6f48129db1f37ccb9cc5dd7e119cb32750cabdf75b48375d730d26ce3659bbe1", "RemoveLiquidityOne(address,int128,uint256,uint256,uint256)", {"provider": indexed(p.address), "token_id": p.int128, "token_amount": p.uint256, "coin_amount": p.uint256, "token_supply": p.uint256}), - RemoveLiquidityImbalance: event("0x3631c28b1f9dd213e0319fb167b554d76b6c283a41143eb400a0d1adb1af1755", "RemoveLiquidityImbalance(address,uint256[],uint256[],uint256,uint256)", {"provider": indexed(p.address), "token_amounts": p.array(p.uint256), "fees": p.array(p.uint256), "invariant": p.uint256, "token_supply": p.uint256}), - RampA: event("0xa2b71ec6df949300b59aab36b55e189697b750119dd349fcfa8c0f779e83c254", "RampA(uint256,uint256,uint256,uint256)", {"old_A": p.uint256, "new_A": p.uint256, "initial_time": p.uint256, "future_time": p.uint256}), - StopRampA: event("0x46e22fb3709ad289f62ce63d469248536dbc78d82b84a3d7e74ad606dc201938", "StopRampA(uint256,uint256)", {"A": p.uint256, "t": p.uint256}), - ApplyNewFee: event("0x750d10a7f37466ce785ee6bcb604aac543358db42afbcc332a3c12a49c80bf6d", "ApplyNewFee(uint256,uint256)", {"fee": p.uint256, "offpeg_fee_multiplier": p.uint256}), - SetNewMATime: event("0x68dc4e067dff1862b896b7a0faf55f97df1a60d0aaa79481b69d675f2026a28c", "SetNewMATime(uint256,uint256)", {"ma_exp_time": p.uint256, "D_ma_time": p.uint256}), -} - -export const functions = { - 'exchange(int128,int128,uint256,uint256)': fun("0x3df02124", "exchange(int128,int128,uint256,uint256)", {"i": p.int128, "j": p.int128, "_dx": p.uint256, "_min_dy": p.uint256}, p.uint256), - 'exchange(int128,int128,uint256,uint256,address)': fun("0xddc1f59d", "exchange(int128,int128,uint256,uint256,address)", {"i": p.int128, "j": p.int128, "_dx": p.uint256, "_min_dy": p.uint256, "_receiver": p.address}, p.uint256), - 'exchange_received(int128,int128,uint256,uint256)': fun("0x7e3db030", "exchange_received(int128,int128,uint256,uint256)", {"i": p.int128, "j": p.int128, "_dx": p.uint256, "_min_dy": p.uint256}, p.uint256), - 'exchange_received(int128,int128,uint256,uint256,address)': fun("0xafb43012", "exchange_received(int128,int128,uint256,uint256,address)", {"i": p.int128, "j": p.int128, "_dx": p.uint256, "_min_dy": p.uint256, "_receiver": p.address}, p.uint256), - 'exchange_underlying(int128,int128,uint256,uint256)': fun("0xa6417ed6", "exchange_underlying(int128,int128,uint256,uint256)", {"i": p.int128, "j": p.int128, "_dx": p.uint256, "_min_dy": p.uint256}, p.uint256), - 'exchange_underlying(int128,int128,uint256,uint256,address)': fun("0x44ee1986", "exchange_underlying(int128,int128,uint256,uint256,address)", {"i": p.int128, "j": p.int128, "_dx": p.uint256, "_min_dy": p.uint256, "_receiver": p.address}, p.uint256), - 'add_liquidity(uint256[2],uint256)': fun("0x0b4c7e4d", "add_liquidity(uint256[2],uint256)", {"_amounts": p.fixedSizeArray(p.uint256, 2), "_min_mint_amount": p.uint256}, p.uint256), - 'add_liquidity(uint256[2],uint256,address)': fun("0x0c3e4b54", "add_liquidity(uint256[2],uint256,address)", {"_amounts": p.fixedSizeArray(p.uint256, 2), "_min_mint_amount": p.uint256, "_receiver": p.address}, p.uint256), - 'remove_liquidity_one_coin(uint256,int128,uint256)': fun("0x1a4d01d2", "remove_liquidity_one_coin(uint256,int128,uint256)", {"_burn_amount": p.uint256, "i": p.int128, "_min_received": p.uint256}, p.uint256), - 'remove_liquidity_one_coin(uint256,int128,uint256,address)': fun("0x081579a5", "remove_liquidity_one_coin(uint256,int128,uint256,address)", {"_burn_amount": p.uint256, "i": p.int128, "_min_received": p.uint256, "_receiver": p.address}, p.uint256), - 'remove_liquidity_imbalance(uint256[2],uint256)': fun("0xe3103273", "remove_liquidity_imbalance(uint256[2],uint256)", {"_amounts": p.fixedSizeArray(p.uint256, 2), "_max_burn_amount": p.uint256}, p.uint256), - 'remove_liquidity_imbalance(uint256[2],uint256,address)': fun("0x52d2cfdd", "remove_liquidity_imbalance(uint256[2],uint256,address)", {"_amounts": p.fixedSizeArray(p.uint256, 2), "_max_burn_amount": p.uint256, "_receiver": p.address}, p.uint256), - 'remove_liquidity(uint256,uint256[2])': fun("0x5b36389c", "remove_liquidity(uint256,uint256[2])", {"_burn_amount": p.uint256, "_min_amounts": p.fixedSizeArray(p.uint256, 2)}, p.fixedSizeArray(p.uint256, 2)), - 'remove_liquidity(uint256,uint256[2],address)': fun("0x3eb1719f", "remove_liquidity(uint256,uint256[2],address)", {"_burn_amount": p.uint256, "_min_amounts": p.fixedSizeArray(p.uint256, 2), "_receiver": p.address}, p.fixedSizeArray(p.uint256, 2)), - 'remove_liquidity(uint256,uint256[2],address,bool)': fun("0xdb1bb01b", "remove_liquidity(uint256,uint256[2],address,bool)", {"_burn_amount": p.uint256, "_min_amounts": p.fixedSizeArray(p.uint256, 2), "_receiver": p.address, "_claim_admin_fees": p.bool}, p.fixedSizeArray(p.uint256, 2)), - withdraw_admin_fees: fun("0x30c54085", "withdraw_admin_fees()", {}, ), - last_price: viewFun("0x3931ab52", "last_price(uint256)", {"i": p.uint256}, p.uint256), - ema_price: viewFun("0x90d20837", "ema_price(uint256)", {"i": p.uint256}, p.uint256), - get_p: viewFun("0xec023862", "get_p(uint256)", {"i": p.uint256}, p.uint256), - price_oracle: viewFun("0x68727653", "price_oracle(uint256)", {"i": p.uint256}, p.uint256), - D_oracle: viewFun("0x907a016b", "D_oracle()", {}, p.uint256), - transfer: fun("0xa9059cbb", "transfer(address,uint256)", {"_to": p.address, "_value": p.uint256}, p.bool), - transferFrom: fun("0x23b872dd", "transferFrom(address,address,uint256)", {"_from": p.address, "_to": p.address, "_value": p.uint256}, p.bool), - approve: fun("0x095ea7b3", "approve(address,uint256)", {"_spender": p.address, "_value": p.uint256}, p.bool), - permit: fun("0xd505accf", "permit(address,address,uint256,uint256,uint8,bytes32,bytes32)", {"_owner": p.address, "_spender": p.address, "_value": p.uint256, "_deadline": p.uint256, "_v": p.uint8, "_r": p.bytes32, "_s": p.bytes32}, p.bool), - DOMAIN_SEPARATOR: viewFun("0x3644e515", "DOMAIN_SEPARATOR()", {}, p.bytes32), - get_dx: viewFun("0x67df02ca", "get_dx(int128,int128,uint256)", {"i": p.int128, "j": p.int128, "dy": p.uint256}, p.uint256), - get_dx_underlying: viewFun("0x0e71d1b9", "get_dx_underlying(int128,int128,uint256)", {"i": p.int128, "j": p.int128, "dy": p.uint256}, p.uint256), - get_dy: viewFun("0x5e0d443f", "get_dy(int128,int128,uint256)", {"i": p.int128, "j": p.int128, "dx": p.uint256}, p.uint256), - get_dy_underlying: viewFun("0x07211ef7", "get_dy_underlying(int128,int128,uint256)", {"i": p.int128, "j": p.int128, "dx": p.uint256}, p.uint256), - calc_withdraw_one_coin: viewFun("0xcc2b27d7", "calc_withdraw_one_coin(uint256,int128)", {"_burn_amount": p.uint256, "i": p.int128}, p.uint256), - totalSupply: viewFun("0x18160ddd", "totalSupply()", {}, p.uint256), - get_virtual_price: viewFun("0xbb7b8b80", "get_virtual_price()", {}, p.uint256), - calc_token_amount: viewFun("0xed8e84f3", "calc_token_amount(uint256[2],bool)", {"_amounts": p.fixedSizeArray(p.uint256, 2), "_is_deposit": p.bool}, p.uint256), - A: viewFun("0xf446c1d0", "A()", {}, p.uint256), - A_precise: viewFun("0x76a2f0f0", "A_precise()", {}, p.uint256), - balances: viewFun("0x4903b0d1", "balances(uint256)", {"i": p.uint256}, p.uint256), - get_balances: viewFun("0x14f05979", "get_balances()", {}, p.array(p.uint256)), - stored_rates: viewFun("0xfd0684b1", "stored_rates()", {}, p.array(p.uint256)), - dynamic_fee: viewFun("0x76a9cd3e", "dynamic_fee(int128,int128)", {"i": p.int128, "j": p.int128}, p.uint256), - ramp_A: fun("0x3c157e64", "ramp_A(uint256,uint256)", {"_future_A": p.uint256, "_future_time": p.uint256}, ), - stop_ramp_A: fun("0x551a6588", "stop_ramp_A()", {}, ), - set_new_fee: fun("0x015c2838", "set_new_fee(uint256,uint256)", {"_new_fee": p.uint256, "_new_offpeg_fee_multiplier": p.uint256}, ), - set_ma_exp_time: fun("0x65bbea6b", "set_ma_exp_time(uint256,uint256)", {"_ma_exp_time": p.uint256, "_D_ma_time": p.uint256}, ), - N_COINS: viewFun("0x29357750", "N_COINS()", {}, p.uint256), - BASE_POOL: viewFun("0x71511a5e", "BASE_POOL()", {}, p.address), - BASE_N_COINS: viewFun("0x3da575a1", "BASE_N_COINS()", {}, p.uint256), - BASE_COINS: viewFun("0xd52d5b86", "BASE_COINS(uint256)", {"arg0": p.uint256}, p.address), - coins: viewFun("0xc6610657", "coins(uint256)", {"arg0": p.uint256}, p.address), - fee: viewFun("0xddca3f43", "fee()", {}, p.uint256), - offpeg_fee_multiplier: viewFun("0x8edfdd5f", "offpeg_fee_multiplier()", {}, p.uint256), - admin_fee: viewFun("0xfee3f7f9", "admin_fee()", {}, p.uint256), - initial_A: viewFun("0x5409491a", "initial_A()", {}, p.uint256), - future_A: viewFun("0xb4b577ad", "future_A()", {}, p.uint256), - initial_A_time: viewFun("0x2081066c", "initial_A_time()", {}, p.uint256), - future_A_time: viewFun("0x14052288", "future_A_time()", {}, p.uint256), - admin_balances: viewFun("0xe2e7d264", "admin_balances(uint256)", {"arg0": p.uint256}, p.uint256), - ma_exp_time: viewFun("0x1be913a5", "ma_exp_time()", {}, p.uint256), - D_ma_time: viewFun("0x9c4258c4", "D_ma_time()", {}, p.uint256), - ma_last_time: viewFun("0x1ddc3b01", "ma_last_time()", {}, p.uint256), - name: viewFun("0x06fdde03", "name()", {}, p.string), - symbol: viewFun("0x95d89b41", "symbol()", {}, p.string), - decimals: viewFun("0x313ce567", "decimals()", {}, p.uint8), - version: viewFun("0x54fd4d50", "version()", {}, p.string), - balanceOf: viewFun("0x70a08231", "balanceOf(address)", {"arg0": p.address}, p.uint256), - allowance: viewFun("0xdd62ed3e", "allowance(address,address)", {"arg0": p.address, "arg1": p.address}, p.uint256), - nonces: viewFun("0x7ecebe00", "nonces(address)", {"arg0": p.address}, p.uint256), - salt: viewFun("0xbfa0b133", "salt()", {}, p.bytes32), -} - -export class Contract extends ContractBase { - - last_price(i: Last_priceParams["i"]) { - return this.eth_call(functions.last_price, {i}) - } - - ema_price(i: Ema_priceParams["i"]) { - return this.eth_call(functions.ema_price, {i}) - } - - get_p(i: Get_pParams["i"]) { - return this.eth_call(functions.get_p, {i}) - } - - price_oracle(i: Price_oracleParams["i"]) { - return this.eth_call(functions.price_oracle, {i}) - } - - D_oracle() { - return this.eth_call(functions.D_oracle, {}) - } - - DOMAIN_SEPARATOR() { - return this.eth_call(functions.DOMAIN_SEPARATOR, {}) - } - - get_dx(i: Get_dxParams["i"], j: Get_dxParams["j"], dy: Get_dxParams["dy"]) { - return this.eth_call(functions.get_dx, {i, j, dy}) - } - - get_dx_underlying(i: Get_dx_underlyingParams["i"], j: Get_dx_underlyingParams["j"], dy: Get_dx_underlyingParams["dy"]) { - return this.eth_call(functions.get_dx_underlying, {i, j, dy}) - } - - get_dy(i: Get_dyParams["i"], j: Get_dyParams["j"], dx: Get_dyParams["dx"]) { - return this.eth_call(functions.get_dy, {i, j, dx}) - } - - get_dy_underlying(i: Get_dy_underlyingParams["i"], j: Get_dy_underlyingParams["j"], dx: Get_dy_underlyingParams["dx"]) { - return this.eth_call(functions.get_dy_underlying, {i, j, dx}) - } - - calc_withdraw_one_coin(_burn_amount: Calc_withdraw_one_coinParams["_burn_amount"], i: Calc_withdraw_one_coinParams["i"]) { - return this.eth_call(functions.calc_withdraw_one_coin, {_burn_amount, i}) - } - - totalSupply() { - return this.eth_call(functions.totalSupply, {}) - } - - get_virtual_price() { - return this.eth_call(functions.get_virtual_price, {}) - } - - calc_token_amount(_amounts: Calc_token_amountParams["_amounts"], _is_deposit: Calc_token_amountParams["_is_deposit"]) { - return this.eth_call(functions.calc_token_amount, {_amounts, _is_deposit}) - } - - A() { - return this.eth_call(functions.A, {}) - } - - A_precise() { - return this.eth_call(functions.A_precise, {}) - } - - balances(i: BalancesParams["i"]) { - return this.eth_call(functions.balances, {i}) - } - - get_balances() { - return this.eth_call(functions.get_balances, {}) - } - - stored_rates() { - return this.eth_call(functions.stored_rates, {}) - } - - dynamic_fee(i: Dynamic_feeParams["i"], j: Dynamic_feeParams["j"]) { - return this.eth_call(functions.dynamic_fee, {i, j}) - } - - N_COINS() { - return this.eth_call(functions.N_COINS, {}) - } - - BASE_POOL() { - return this.eth_call(functions.BASE_POOL, {}) - } - - BASE_N_COINS() { - return this.eth_call(functions.BASE_N_COINS, {}) - } - - BASE_COINS(arg0: BASE_COINSParams["arg0"]) { - return this.eth_call(functions.BASE_COINS, {arg0}) - } - - coins(arg0: CoinsParams["arg0"]) { - return this.eth_call(functions.coins, {arg0}) - } - - fee() { - return this.eth_call(functions.fee, {}) - } - - offpeg_fee_multiplier() { - return this.eth_call(functions.offpeg_fee_multiplier, {}) - } - - admin_fee() { - return this.eth_call(functions.admin_fee, {}) - } - - initial_A() { - return this.eth_call(functions.initial_A, {}) - } - - future_A() { - return this.eth_call(functions.future_A, {}) - } - - initial_A_time() { - return this.eth_call(functions.initial_A_time, {}) - } - - future_A_time() { - return this.eth_call(functions.future_A_time, {}) - } - - admin_balances(arg0: Admin_balancesParams["arg0"]) { - return this.eth_call(functions.admin_balances, {arg0}) - } - - ma_exp_time() { - return this.eth_call(functions.ma_exp_time, {}) - } - - D_ma_time() { - return this.eth_call(functions.D_ma_time, {}) - } - - ma_last_time() { - return this.eth_call(functions.ma_last_time, {}) - } - - name() { - return this.eth_call(functions.name, {}) - } - - symbol() { - return this.eth_call(functions.symbol, {}) - } - - decimals() { - return this.eth_call(functions.decimals, {}) - } - - version() { - return this.eth_call(functions.version, {}) - } - - balanceOf(arg0: BalanceOfParams["arg0"]) { - return this.eth_call(functions.balanceOf, {arg0}) - } - - allowance(arg0: AllowanceParams["arg0"], arg1: AllowanceParams["arg1"]) { - return this.eth_call(functions.allowance, {arg0, arg1}) - } - - nonces(arg0: NoncesParams["arg0"]) { - return this.eth_call(functions.nonces, {arg0}) - } - - salt() { - return this.eth_call(functions.salt, {}) - } -} - -/// Event types -export type TransferEventArgs = EParams -export type ApprovalEventArgs = EParams -export type TokenExchangeEventArgs = EParams -export type TokenExchangeUnderlyingEventArgs = EParams -export type AddLiquidityEventArgs = EParams -export type RemoveLiquidityEventArgs = EParams -export type RemoveLiquidityOneEventArgs = EParams -export type RemoveLiquidityImbalanceEventArgs = EParams -export type RampAEventArgs = EParams -export type StopRampAEventArgs = EParams -export type ApplyNewFeeEventArgs = EParams -export type SetNewMATimeEventArgs = EParams - -/// Function types -export type ExchangeParams_0 = FunctionArguments -export type ExchangeReturn_0 = FunctionReturn - -export type ExchangeParams_1 = FunctionArguments -export type ExchangeReturn_1 = FunctionReturn - -export type Exchange_receivedParams_0 = FunctionArguments -export type Exchange_receivedReturn_0 = FunctionReturn - -export type Exchange_receivedParams_1 = FunctionArguments -export type Exchange_receivedReturn_1 = FunctionReturn - -export type Exchange_underlyingParams_0 = FunctionArguments -export type Exchange_underlyingReturn_0 = FunctionReturn - -export type Exchange_underlyingParams_1 = FunctionArguments -export type Exchange_underlyingReturn_1 = FunctionReturn - -export type Add_liquidityParams_0 = FunctionArguments -export type Add_liquidityReturn_0 = FunctionReturn - -export type Add_liquidityParams_1 = FunctionArguments -export type Add_liquidityReturn_1 = FunctionReturn - -export type Remove_liquidity_one_coinParams_0 = FunctionArguments -export type Remove_liquidity_one_coinReturn_0 = FunctionReturn - -export type Remove_liquidity_one_coinParams_1 = FunctionArguments -export type Remove_liquidity_one_coinReturn_1 = FunctionReturn - -export type Remove_liquidity_imbalanceParams_0 = FunctionArguments -export type Remove_liquidity_imbalanceReturn_0 = FunctionReturn - -export type Remove_liquidity_imbalanceParams_1 = FunctionArguments -export type Remove_liquidity_imbalanceReturn_1 = FunctionReturn - -export type Remove_liquidityParams_0 = FunctionArguments -export type Remove_liquidityReturn_0 = FunctionReturn - -export type Remove_liquidityParams_1 = FunctionArguments -export type Remove_liquidityReturn_1 = FunctionReturn - -export type Remove_liquidityParams_2 = FunctionArguments -export type Remove_liquidityReturn_2 = FunctionReturn - -export type Withdraw_admin_feesParams = FunctionArguments -export type Withdraw_admin_feesReturn = FunctionReturn - -export type Last_priceParams = FunctionArguments -export type Last_priceReturn = FunctionReturn - -export type Ema_priceParams = FunctionArguments -export type Ema_priceReturn = FunctionReturn - -export type Get_pParams = FunctionArguments -export type Get_pReturn = FunctionReturn - -export type Price_oracleParams = FunctionArguments -export type Price_oracleReturn = FunctionReturn - -export type D_oracleParams = FunctionArguments -export type D_oracleReturn = FunctionReturn - -export type TransferParams = FunctionArguments -export type TransferReturn = FunctionReturn - -export type TransferFromParams = FunctionArguments -export type TransferFromReturn = FunctionReturn - -export type ApproveParams = FunctionArguments -export type ApproveReturn = FunctionReturn - -export type PermitParams = FunctionArguments -export type PermitReturn = FunctionReturn - -export type DOMAIN_SEPARATORParams = FunctionArguments -export type DOMAIN_SEPARATORReturn = FunctionReturn - -export type Get_dxParams = FunctionArguments -export type Get_dxReturn = FunctionReturn - -export type Get_dx_underlyingParams = FunctionArguments -export type Get_dx_underlyingReturn = FunctionReturn - -export type Get_dyParams = FunctionArguments -export type Get_dyReturn = FunctionReturn - -export type Get_dy_underlyingParams = FunctionArguments -export type Get_dy_underlyingReturn = FunctionReturn - -export type Calc_withdraw_one_coinParams = FunctionArguments -export type Calc_withdraw_one_coinReturn = FunctionReturn - -export type TotalSupplyParams = FunctionArguments -export type TotalSupplyReturn = FunctionReturn - -export type Get_virtual_priceParams = FunctionArguments -export type Get_virtual_priceReturn = FunctionReturn - -export type Calc_token_amountParams = FunctionArguments -export type Calc_token_amountReturn = FunctionReturn - -export type AParams = FunctionArguments -export type AReturn = FunctionReturn - -export type A_preciseParams = FunctionArguments -export type A_preciseReturn = FunctionReturn - -export type BalancesParams = FunctionArguments -export type BalancesReturn = FunctionReturn - -export type Get_balancesParams = FunctionArguments -export type Get_balancesReturn = FunctionReturn - -export type Stored_ratesParams = FunctionArguments -export type Stored_ratesReturn = FunctionReturn - -export type Dynamic_feeParams = FunctionArguments -export type Dynamic_feeReturn = FunctionReturn - -export type Ramp_AParams = FunctionArguments -export type Ramp_AReturn = FunctionReturn - -export type Stop_ramp_AParams = FunctionArguments -export type Stop_ramp_AReturn = FunctionReturn - -export type Set_new_feeParams = FunctionArguments -export type Set_new_feeReturn = FunctionReturn - -export type Set_ma_exp_timeParams = FunctionArguments -export type Set_ma_exp_timeReturn = FunctionReturn - -export type N_COINSParams = FunctionArguments -export type N_COINSReturn = FunctionReturn - -export type BASE_POOLParams = FunctionArguments -export type BASE_POOLReturn = FunctionReturn - -export type BASE_N_COINSParams = FunctionArguments -export type BASE_N_COINSReturn = FunctionReturn - -export type BASE_COINSParams = FunctionArguments -export type BASE_COINSReturn = FunctionReturn - -export type CoinsParams = FunctionArguments -export type CoinsReturn = FunctionReturn - -export type FeeParams = FunctionArguments -export type FeeReturn = FunctionReturn - -export type Offpeg_fee_multiplierParams = FunctionArguments -export type Offpeg_fee_multiplierReturn = FunctionReturn - -export type Admin_feeParams = FunctionArguments -export type Admin_feeReturn = FunctionReturn - -export type Initial_AParams = FunctionArguments -export type Initial_AReturn = FunctionReturn - -export type Future_AParams = FunctionArguments -export type Future_AReturn = FunctionReturn - -export type Initial_A_timeParams = FunctionArguments -export type Initial_A_timeReturn = FunctionReturn - -export type Future_A_timeParams = FunctionArguments -export type Future_A_timeReturn = FunctionReturn - -export type Admin_balancesParams = FunctionArguments -export type Admin_balancesReturn = FunctionReturn - -export type Ma_exp_timeParams = FunctionArguments -export type Ma_exp_timeReturn = FunctionReturn - -export type D_ma_timeParams = FunctionArguments -export type D_ma_timeReturn = FunctionReturn - -export type Ma_last_timeParams = FunctionArguments -export type Ma_last_timeReturn = FunctionReturn - -export type NameParams = FunctionArguments -export type NameReturn = FunctionReturn - -export type SymbolParams = FunctionArguments -export type SymbolReturn = FunctionReturn - -export type DecimalsParams = FunctionArguments -export type DecimalsReturn = FunctionReturn - -export type VersionParams = FunctionArguments -export type VersionReturn = FunctionReturn - -export type BalanceOfParams = FunctionArguments -export type BalanceOfReturn = FunctionReturn - -export type AllowanceParams = FunctionArguments -export type AllowanceReturn = FunctionReturn - -export type NoncesParams = FunctionArguments -export type NoncesReturn = FunctionReturn - -export type SaltParams = FunctionArguments -export type SaltReturn = FunctionReturn - diff --git a/src/abi/curve-stable-swap-meta-ng/contract.ts b/src/abi/curve-stable-swap-meta-ng/contract.ts new file mode 100644 index 00000000..22cda914 --- /dev/null +++ b/src/abi/curve-stable-swap-meta-ng/contract.ts @@ -0,0 +1,257 @@ +import { ContractBase } from '../abi.support.js' +import { A, A_precise, BASE_COINS, BASE_N_COINS, BASE_POOL, DOMAIN_SEPARATOR, D_ma_time, D_oracle, N_COINS, add_liquidity, add_liquidity_1, admin_balances, admin_fee, allowance, approve, balanceOf, balances, calc_token_amount, calc_withdraw_one_coin, coins, decimals, dynamic_fee, ema_price, exchange, exchange_1, exchange_received, exchange_received_1, exchange_underlying, exchange_underlying_1, fee, future_A, future_A_time, get_balances, get_dx, get_dx_underlying, get_dy, get_dy_underlying, get_p, get_virtual_price, initial_A, initial_A_time, last_price, ma_exp_time, ma_last_time, name, nonces, offpeg_fee_multiplier, permit, price_oracle, remove_liquidity, remove_liquidity_1, remove_liquidity_2, remove_liquidity_imbalance, remove_liquidity_imbalance_1, remove_liquidity_one_coin, remove_liquidity_one_coin_1, salt, stored_rates, symbol, totalSupply, transfer, transferFrom, version } from './functions.js' +import type { Add_liquidityParams, Add_liquidityParams_1, Admin_balancesParams, AllowanceParams, ApproveParams, BASE_COINSParams, BalanceOfParams, BalancesParams, Calc_token_amountParams, Calc_withdraw_one_coinParams, CoinsParams, Dynamic_feeParams, Ema_priceParams, ExchangeParams, ExchangeParams_1, Exchange_receivedParams, Exchange_receivedParams_1, Exchange_underlyingParams, Exchange_underlyingParams_1, Get_dxParams, Get_dx_underlyingParams, Get_dyParams, Get_dy_underlyingParams, Get_pParams, Last_priceParams, NoncesParams, PermitParams, Price_oracleParams, Remove_liquidityParams, Remove_liquidityParams_1, Remove_liquidityParams_2, Remove_liquidity_imbalanceParams, Remove_liquidity_imbalanceParams_1, Remove_liquidity_one_coinParams, Remove_liquidity_one_coinParams_1, TransferFromParams, TransferParams } from './functions.js' + +export class Contract extends ContractBase { + exchange(i: ExchangeParams["i"], j: ExchangeParams["j"], _dx: ExchangeParams["_dx"], _min_dy: ExchangeParams["_min_dy"]) { + return this.eth_call(exchange, {i, j, _dx, _min_dy}) + } + + exchange_1(i: ExchangeParams_1["i"], j: ExchangeParams_1["j"], _dx: ExchangeParams_1["_dx"], _min_dy: ExchangeParams_1["_min_dy"], _receiver: ExchangeParams_1["_receiver"]) { + return this.eth_call(exchange_1, {i, j, _dx, _min_dy, _receiver}) + } + + exchange_received(i: Exchange_receivedParams["i"], j: Exchange_receivedParams["j"], _dx: Exchange_receivedParams["_dx"], _min_dy: Exchange_receivedParams["_min_dy"]) { + return this.eth_call(exchange_received, {i, j, _dx, _min_dy}) + } + + exchange_received_1(i: Exchange_receivedParams_1["i"], j: Exchange_receivedParams_1["j"], _dx: Exchange_receivedParams_1["_dx"], _min_dy: Exchange_receivedParams_1["_min_dy"], _receiver: Exchange_receivedParams_1["_receiver"]) { + return this.eth_call(exchange_received_1, {i, j, _dx, _min_dy, _receiver}) + } + + exchange_underlying(i: Exchange_underlyingParams["i"], j: Exchange_underlyingParams["j"], _dx: Exchange_underlyingParams["_dx"], _min_dy: Exchange_underlyingParams["_min_dy"]) { + return this.eth_call(exchange_underlying, {i, j, _dx, _min_dy}) + } + + exchange_underlying_1(i: Exchange_underlyingParams_1["i"], j: Exchange_underlyingParams_1["j"], _dx: Exchange_underlyingParams_1["_dx"], _min_dy: Exchange_underlyingParams_1["_min_dy"], _receiver: Exchange_underlyingParams_1["_receiver"]) { + return this.eth_call(exchange_underlying_1, {i, j, _dx, _min_dy, _receiver}) + } + + add_liquidity(_amounts: Add_liquidityParams["_amounts"], _min_mint_amount: Add_liquidityParams["_min_mint_amount"]) { + return this.eth_call(add_liquidity, {_amounts, _min_mint_amount}) + } + + add_liquidity_1(_amounts: Add_liquidityParams_1["_amounts"], _min_mint_amount: Add_liquidityParams_1["_min_mint_amount"], _receiver: Add_liquidityParams_1["_receiver"]) { + return this.eth_call(add_liquidity_1, {_amounts, _min_mint_amount, _receiver}) + } + + remove_liquidity_one_coin(_burn_amount: Remove_liquidity_one_coinParams["_burn_amount"], i: Remove_liquidity_one_coinParams["i"], _min_received: Remove_liquidity_one_coinParams["_min_received"]) { + return this.eth_call(remove_liquidity_one_coin, {_burn_amount, i, _min_received}) + } + + remove_liquidity_one_coin_1(_burn_amount: Remove_liquidity_one_coinParams_1["_burn_amount"], i: Remove_liquidity_one_coinParams_1["i"], _min_received: Remove_liquidity_one_coinParams_1["_min_received"], _receiver: Remove_liquidity_one_coinParams_1["_receiver"]) { + return this.eth_call(remove_liquidity_one_coin_1, {_burn_amount, i, _min_received, _receiver}) + } + + remove_liquidity_imbalance(_amounts: Remove_liquidity_imbalanceParams["_amounts"], _max_burn_amount: Remove_liquidity_imbalanceParams["_max_burn_amount"]) { + return this.eth_call(remove_liquidity_imbalance, {_amounts, _max_burn_amount}) + } + + remove_liquidity_imbalance_1(_amounts: Remove_liquidity_imbalanceParams_1["_amounts"], _max_burn_amount: Remove_liquidity_imbalanceParams_1["_max_burn_amount"], _receiver: Remove_liquidity_imbalanceParams_1["_receiver"]) { + return this.eth_call(remove_liquidity_imbalance_1, {_amounts, _max_burn_amount, _receiver}) + } + + remove_liquidity(_burn_amount: Remove_liquidityParams["_burn_amount"], _min_amounts: Remove_liquidityParams["_min_amounts"]) { + return this.eth_call(remove_liquidity, {_burn_amount, _min_amounts}) + } + + remove_liquidity_1(_burn_amount: Remove_liquidityParams_1["_burn_amount"], _min_amounts: Remove_liquidityParams_1["_min_amounts"], _receiver: Remove_liquidityParams_1["_receiver"]) { + return this.eth_call(remove_liquidity_1, {_burn_amount, _min_amounts, _receiver}) + } + + remove_liquidity_2(_burn_amount: Remove_liquidityParams_2["_burn_amount"], _min_amounts: Remove_liquidityParams_2["_min_amounts"], _receiver: Remove_liquidityParams_2["_receiver"], _claim_admin_fees: Remove_liquidityParams_2["_claim_admin_fees"]) { + return this.eth_call(remove_liquidity_2, {_burn_amount, _min_amounts, _receiver, _claim_admin_fees}) + } + + last_price(i: Last_priceParams["i"]) { + return this.eth_call(last_price, {i}) + } + + ema_price(i: Ema_priceParams["i"]) { + return this.eth_call(ema_price, {i}) + } + + get_p(i: Get_pParams["i"]) { + return this.eth_call(get_p, {i}) + } + + price_oracle(i: Price_oracleParams["i"]) { + return this.eth_call(price_oracle, {i}) + } + + D_oracle() { + return this.eth_call(D_oracle, {}) + } + + transfer(_to: TransferParams["_to"], _value: TransferParams["_value"]) { + return this.eth_call(transfer, {_to, _value}) + } + + transferFrom(_from: TransferFromParams["_from"], _to: TransferFromParams["_to"], _value: TransferFromParams["_value"]) { + return this.eth_call(transferFrom, {_from, _to, _value}) + } + + approve(_spender: ApproveParams["_spender"], _value: ApproveParams["_value"]) { + return this.eth_call(approve, {_spender, _value}) + } + + permit(_owner: PermitParams["_owner"], _spender: PermitParams["_spender"], _value: PermitParams["_value"], _deadline: PermitParams["_deadline"], _v: PermitParams["_v"], _r: PermitParams["_r"], _s: PermitParams["_s"]) { + return this.eth_call(permit, {_owner, _spender, _value, _deadline, _v, _r, _s}) + } + + DOMAIN_SEPARATOR() { + return this.eth_call(DOMAIN_SEPARATOR, {}) + } + + get_dx(i: Get_dxParams["i"], j: Get_dxParams["j"], dy: Get_dxParams["dy"]) { + return this.eth_call(get_dx, {i, j, dy}) + } + + get_dx_underlying(i: Get_dx_underlyingParams["i"], j: Get_dx_underlyingParams["j"], dy: Get_dx_underlyingParams["dy"]) { + return this.eth_call(get_dx_underlying, {i, j, dy}) + } + + get_dy(i: Get_dyParams["i"], j: Get_dyParams["j"], dx: Get_dyParams["dx"]) { + return this.eth_call(get_dy, {i, j, dx}) + } + + get_dy_underlying(i: Get_dy_underlyingParams["i"], j: Get_dy_underlyingParams["j"], dx: Get_dy_underlyingParams["dx"]) { + return this.eth_call(get_dy_underlying, {i, j, dx}) + } + + calc_withdraw_one_coin(_burn_amount: Calc_withdraw_one_coinParams["_burn_amount"], i: Calc_withdraw_one_coinParams["i"]) { + return this.eth_call(calc_withdraw_one_coin, {_burn_amount, i}) + } + + totalSupply() { + return this.eth_call(totalSupply, {}) + } + + get_virtual_price() { + return this.eth_call(get_virtual_price, {}) + } + + calc_token_amount(_amounts: Calc_token_amountParams["_amounts"], _is_deposit: Calc_token_amountParams["_is_deposit"]) { + return this.eth_call(calc_token_amount, {_amounts, _is_deposit}) + } + + A() { + return this.eth_call(A, {}) + } + + A_precise() { + return this.eth_call(A_precise, {}) + } + + balances(i: BalancesParams["i"]) { + return this.eth_call(balances, {i}) + } + + get_balances() { + return this.eth_call(get_balances, {}) + } + + stored_rates() { + return this.eth_call(stored_rates, {}) + } + + dynamic_fee(i: Dynamic_feeParams["i"], j: Dynamic_feeParams["j"]) { + return this.eth_call(dynamic_fee, {i, j}) + } + + N_COINS() { + return this.eth_call(N_COINS, {}) + } + + BASE_POOL() { + return this.eth_call(BASE_POOL, {}) + } + + BASE_N_COINS() { + return this.eth_call(BASE_N_COINS, {}) + } + + BASE_COINS(arg0: BASE_COINSParams["arg0"]) { + return this.eth_call(BASE_COINS, {arg0}) + } + + coins(arg0: CoinsParams["arg0"]) { + return this.eth_call(coins, {arg0}) + } + + fee() { + return this.eth_call(fee, {}) + } + + offpeg_fee_multiplier() { + return this.eth_call(offpeg_fee_multiplier, {}) + } + + admin_fee() { + return this.eth_call(admin_fee, {}) + } + + initial_A() { + return this.eth_call(initial_A, {}) + } + + future_A() { + return this.eth_call(future_A, {}) + } + + initial_A_time() { + return this.eth_call(initial_A_time, {}) + } + + future_A_time() { + return this.eth_call(future_A_time, {}) + } + + admin_balances(arg0: Admin_balancesParams["arg0"]) { + return this.eth_call(admin_balances, {arg0}) + } + + ma_exp_time() { + return this.eth_call(ma_exp_time, {}) + } + + D_ma_time() { + return this.eth_call(D_ma_time, {}) + } + + ma_last_time() { + return this.eth_call(ma_last_time, {}) + } + + name() { + return this.eth_call(name, {}) + } + + symbol() { + return this.eth_call(symbol, {}) + } + + decimals() { + return this.eth_call(decimals, {}) + } + + version() { + return this.eth_call(version, {}) + } + + balanceOf(arg0: BalanceOfParams["arg0"]) { + return this.eth_call(balanceOf, {arg0}) + } + + allowance(arg0: AllowanceParams["arg0"], arg1: AllowanceParams["arg1"]) { + return this.eth_call(allowance, {arg0, arg1}) + } + + nonces(arg0: NoncesParams["arg0"]) { + return this.eth_call(nonces, {arg0}) + } + + salt() { + return this.eth_call(salt, {}) + } +} diff --git a/src/abi/curve-stable-swap-meta-ng/events.ts b/src/abi/curve-stable-swap-meta-ng/events.ts new file mode 100644 index 00000000..e7fef243 --- /dev/null +++ b/src/abi/curve-stable-swap-meta-ng/events.ts @@ -0,0 +1,108 @@ +import { address, array, int128, uint256 } from '@subsquid/evm-codec' +import { event, indexed } from '../abi.support.js' +import type { EventParams as EParams } from '../abi.support.js' + +/** Transfer(address,address,uint256) */ +export const Transfer = event('0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', { + sender: indexed(address), + receiver: indexed(address), + value: uint256, +}) +export type TransferEventArgs = EParams + +/** Approval(address,address,uint256) */ +export const Approval = event('0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925', { + owner: indexed(address), + spender: indexed(address), + value: uint256, +}) +export type ApprovalEventArgs = EParams + +/** TokenExchange(address,int128,uint256,int128,uint256) */ +export const TokenExchange = event('0x8b3e96f2b889fa771c53c981b40daf005f63f637f1869f707052d15a3dd97140', { + buyer: indexed(address), + sold_id: int128, + tokens_sold: uint256, + bought_id: int128, + tokens_bought: uint256, +}) +export type TokenExchangeEventArgs = EParams + +/** TokenExchangeUnderlying(address,int128,uint256,int128,uint256) */ +export const TokenExchangeUnderlying = event('0xd013ca23e77a65003c2c659c5442c00c805371b7fc1ebd4c206c41d1536bd90b', { + buyer: indexed(address), + sold_id: int128, + tokens_sold: uint256, + bought_id: int128, + tokens_bought: uint256, +}) +export type TokenExchangeUnderlyingEventArgs = EParams + +/** AddLiquidity(address,uint256[],uint256[],uint256,uint256) */ +export const AddLiquidity = event('0x189c623b666b1b45b83d7178f39b8c087cb09774317ca2f53c2d3c3726f222a2', { + provider: indexed(address), + token_amounts: array(uint256), + fees: array(uint256), + invariant: uint256, + token_supply: uint256, +}) +export type AddLiquidityEventArgs = EParams + +/** RemoveLiquidity(address,uint256[],uint256[],uint256) */ +export const RemoveLiquidity = event('0x347ad828e58cbe534d8f6b67985d791360756b18f0d95fd9f197a66cc46480ea', { + provider: indexed(address), + token_amounts: array(uint256), + fees: array(uint256), + token_supply: uint256, +}) +export type RemoveLiquidityEventArgs = EParams + +/** RemoveLiquidityOne(address,int128,uint256,uint256,uint256) */ +export const RemoveLiquidityOne = event('0x6f48129db1f37ccb9cc5dd7e119cb32750cabdf75b48375d730d26ce3659bbe1', { + provider: indexed(address), + token_id: int128, + token_amount: uint256, + coin_amount: uint256, + token_supply: uint256, +}) +export type RemoveLiquidityOneEventArgs = EParams + +/** RemoveLiquidityImbalance(address,uint256[],uint256[],uint256,uint256) */ +export const RemoveLiquidityImbalance = event('0x3631c28b1f9dd213e0319fb167b554d76b6c283a41143eb400a0d1adb1af1755', { + provider: indexed(address), + token_amounts: array(uint256), + fees: array(uint256), + invariant: uint256, + token_supply: uint256, +}) +export type RemoveLiquidityImbalanceEventArgs = EParams + +/** RampA(uint256,uint256,uint256,uint256) */ +export const RampA = event('0xa2b71ec6df949300b59aab36b55e189697b750119dd349fcfa8c0f779e83c254', { + old_A: uint256, + new_A: uint256, + initial_time: uint256, + future_time: uint256, +}) +export type RampAEventArgs = EParams + +/** StopRampA(uint256,uint256) */ +export const StopRampA = event('0x46e22fb3709ad289f62ce63d469248536dbc78d82b84a3d7e74ad606dc201938', { + A: uint256, + t: uint256, +}) +export type StopRampAEventArgs = EParams + +/** ApplyNewFee(uint256,uint256) */ +export const ApplyNewFee = event('0x750d10a7f37466ce785ee6bcb604aac543358db42afbcc332a3c12a49c80bf6d', { + fee: uint256, + offpeg_fee_multiplier: uint256, +}) +export type ApplyNewFeeEventArgs = EParams + +/** SetNewMATime(uint256,uint256) */ +export const SetNewMATime = event('0x68dc4e067dff1862b896b7a0faf55f97df1a60d0aaa79481b69d675f2026a28c', { + ma_exp_time: uint256, + D_ma_time: uint256, +}) +export type SetNewMATimeEventArgs = EParams diff --git a/src/abi/curve-stable-swap-meta-ng/functions.ts b/src/abi/curve-stable-swap-meta-ng/functions.ts new file mode 100644 index 00000000..37d99bb5 --- /dev/null +++ b/src/abi/curve-stable-swap-meta-ng/functions.ts @@ -0,0 +1,486 @@ +import { address, array, bool, bytes32, fixedSizeArray, int128, string, uint256, uint8 } from '@subsquid/evm-codec' +import { func } from '../abi.support.js' +import type { FunctionArguments, FunctionReturn } from '../abi.support.js' + +/** exchange(int128,int128,uint256,uint256) */ +export const exchange = func('0x3df02124', { + i: int128, + j: int128, + _dx: uint256, + _min_dy: uint256, +}, uint256) +export type ExchangeParams = FunctionArguments +export type ExchangeReturn = FunctionReturn + +/** exchange(int128,int128,uint256,uint256,address) */ +export const exchange_1 = func('0xddc1f59d', { + i: int128, + j: int128, + _dx: uint256, + _min_dy: uint256, + _receiver: address, +}, uint256) +export type ExchangeParams_1 = FunctionArguments +export type ExchangeReturn_1 = FunctionReturn + +/** exchange_received(int128,int128,uint256,uint256) */ +export const exchange_received = func('0x7e3db030', { + i: int128, + j: int128, + _dx: uint256, + _min_dy: uint256, +}, uint256) +export type Exchange_receivedParams = FunctionArguments +export type Exchange_receivedReturn = FunctionReturn + +/** exchange_received(int128,int128,uint256,uint256,address) */ +export const exchange_received_1 = func('0xafb43012', { + i: int128, + j: int128, + _dx: uint256, + _min_dy: uint256, + _receiver: address, +}, uint256) +export type Exchange_receivedParams_1 = FunctionArguments +export type Exchange_receivedReturn_1 = FunctionReturn + +/** exchange_underlying(int128,int128,uint256,uint256) */ +export const exchange_underlying = func('0xa6417ed6', { + i: int128, + j: int128, + _dx: uint256, + _min_dy: uint256, +}, uint256) +export type Exchange_underlyingParams = FunctionArguments +export type Exchange_underlyingReturn = FunctionReturn + +/** exchange_underlying(int128,int128,uint256,uint256,address) */ +export const exchange_underlying_1 = func('0x44ee1986', { + i: int128, + j: int128, + _dx: uint256, + _min_dy: uint256, + _receiver: address, +}, uint256) +export type Exchange_underlyingParams_1 = FunctionArguments +export type Exchange_underlyingReturn_1 = FunctionReturn + +/** add_liquidity(uint256[2],uint256) */ +export const add_liquidity = func('0x0b4c7e4d', { + _amounts: fixedSizeArray(uint256, 2), + _min_mint_amount: uint256, +}, uint256) +export type Add_liquidityParams = FunctionArguments +export type Add_liquidityReturn = FunctionReturn + +/** add_liquidity(uint256[2],uint256,address) */ +export const add_liquidity_1 = func('0x0c3e4b54', { + _amounts: fixedSizeArray(uint256, 2), + _min_mint_amount: uint256, + _receiver: address, +}, uint256) +export type Add_liquidityParams_1 = FunctionArguments +export type Add_liquidityReturn_1 = FunctionReturn + +/** remove_liquidity_one_coin(uint256,int128,uint256) */ +export const remove_liquidity_one_coin = func('0x1a4d01d2', { + _burn_amount: uint256, + i: int128, + _min_received: uint256, +}, uint256) +export type Remove_liquidity_one_coinParams = FunctionArguments +export type Remove_liquidity_one_coinReturn = FunctionReturn + +/** remove_liquidity_one_coin(uint256,int128,uint256,address) */ +export const remove_liquidity_one_coin_1 = func('0x081579a5', { + _burn_amount: uint256, + i: int128, + _min_received: uint256, + _receiver: address, +}, uint256) +export type Remove_liquidity_one_coinParams_1 = FunctionArguments +export type Remove_liquidity_one_coinReturn_1 = FunctionReturn + +/** remove_liquidity_imbalance(uint256[2],uint256) */ +export const remove_liquidity_imbalance = func('0xe3103273', { + _amounts: fixedSizeArray(uint256, 2), + _max_burn_amount: uint256, +}, uint256) +export type Remove_liquidity_imbalanceParams = FunctionArguments +export type Remove_liquidity_imbalanceReturn = FunctionReturn + +/** remove_liquidity_imbalance(uint256[2],uint256,address) */ +export const remove_liquidity_imbalance_1 = func('0x52d2cfdd', { + _amounts: fixedSizeArray(uint256, 2), + _max_burn_amount: uint256, + _receiver: address, +}, uint256) +export type Remove_liquidity_imbalanceParams_1 = FunctionArguments +export type Remove_liquidity_imbalanceReturn_1 = FunctionReturn + +/** remove_liquidity(uint256,uint256[2]) */ +export const remove_liquidity = func('0x5b36389c', { + _burn_amount: uint256, + _min_amounts: fixedSizeArray(uint256, 2), +}, fixedSizeArray(uint256, 2)) +export type Remove_liquidityParams = FunctionArguments +export type Remove_liquidityReturn = FunctionReturn + +/** remove_liquidity(uint256,uint256[2],address) */ +export const remove_liquidity_1 = func('0x3eb1719f', { + _burn_amount: uint256, + _min_amounts: fixedSizeArray(uint256, 2), + _receiver: address, +}, fixedSizeArray(uint256, 2)) +export type Remove_liquidityParams_1 = FunctionArguments +export type Remove_liquidityReturn_1 = FunctionReturn + +/** remove_liquidity(uint256,uint256[2],address,bool) */ +export const remove_liquidity_2 = func('0xdb1bb01b', { + _burn_amount: uint256, + _min_amounts: fixedSizeArray(uint256, 2), + _receiver: address, + _claim_admin_fees: bool, +}, fixedSizeArray(uint256, 2)) +export type Remove_liquidityParams_2 = FunctionArguments +export type Remove_liquidityReturn_2 = FunctionReturn + +/** withdraw_admin_fees() */ +export const withdraw_admin_fees = func('0x30c54085', {}) +export type Withdraw_admin_feesParams = FunctionArguments +export type Withdraw_admin_feesReturn = FunctionReturn + +/** last_price(uint256) */ +export const last_price = func('0x3931ab52', { + i: uint256, +}, uint256) +export type Last_priceParams = FunctionArguments +export type Last_priceReturn = FunctionReturn + +/** ema_price(uint256) */ +export const ema_price = func('0x90d20837', { + i: uint256, +}, uint256) +export type Ema_priceParams = FunctionArguments +export type Ema_priceReturn = FunctionReturn + +/** get_p(uint256) */ +export const get_p = func('0xec023862', { + i: uint256, +}, uint256) +export type Get_pParams = FunctionArguments +export type Get_pReturn = FunctionReturn + +/** price_oracle(uint256) */ +export const price_oracle = func('0x68727653', { + i: uint256, +}, uint256) +export type Price_oracleParams = FunctionArguments +export type Price_oracleReturn = FunctionReturn + +/** D_oracle() */ +export const D_oracle = func('0x907a016b', {}, uint256) +export type D_oracleParams = FunctionArguments +export type D_oracleReturn = FunctionReturn + +/** transfer(address,uint256) */ +export const transfer = func('0xa9059cbb', { + _to: address, + _value: uint256, +}, bool) +export type TransferParams = FunctionArguments +export type TransferReturn = FunctionReturn + +/** transferFrom(address,address,uint256) */ +export const transferFrom = func('0x23b872dd', { + _from: address, + _to: address, + _value: uint256, +}, bool) +export type TransferFromParams = FunctionArguments +export type TransferFromReturn = FunctionReturn + +/** approve(address,uint256) */ +export const approve = func('0x095ea7b3', { + _spender: address, + _value: uint256, +}, bool) +export type ApproveParams = FunctionArguments +export type ApproveReturn = FunctionReturn + +/** permit(address,address,uint256,uint256,uint8,bytes32,bytes32) */ +export const permit = func('0xd505accf', { + _owner: address, + _spender: address, + _value: uint256, + _deadline: uint256, + _v: uint8, + _r: bytes32, + _s: bytes32, +}, bool) +export type PermitParams = FunctionArguments +export type PermitReturn = FunctionReturn + +/** DOMAIN_SEPARATOR() */ +export const DOMAIN_SEPARATOR = func('0x3644e515', {}, bytes32) +export type DOMAIN_SEPARATORParams = FunctionArguments +export type DOMAIN_SEPARATORReturn = FunctionReturn + +/** get_dx(int128,int128,uint256) */ +export const get_dx = func('0x67df02ca', { + i: int128, + j: int128, + dy: uint256, +}, uint256) +export type Get_dxParams = FunctionArguments +export type Get_dxReturn = FunctionReturn + +/** get_dx_underlying(int128,int128,uint256) */ +export const get_dx_underlying = func('0x0e71d1b9', { + i: int128, + j: int128, + dy: uint256, +}, uint256) +export type Get_dx_underlyingParams = FunctionArguments +export type Get_dx_underlyingReturn = FunctionReturn + +/** get_dy(int128,int128,uint256) */ +export const get_dy = func('0x5e0d443f', { + i: int128, + j: int128, + dx: uint256, +}, uint256) +export type Get_dyParams = FunctionArguments +export type Get_dyReturn = FunctionReturn + +/** get_dy_underlying(int128,int128,uint256) */ +export const get_dy_underlying = func('0x07211ef7', { + i: int128, + j: int128, + dx: uint256, +}, uint256) +export type Get_dy_underlyingParams = FunctionArguments +export type Get_dy_underlyingReturn = FunctionReturn + +/** calc_withdraw_one_coin(uint256,int128) */ +export const calc_withdraw_one_coin = func('0xcc2b27d7', { + _burn_amount: uint256, + i: int128, +}, uint256) +export type Calc_withdraw_one_coinParams = FunctionArguments +export type Calc_withdraw_one_coinReturn = FunctionReturn + +/** totalSupply() */ +export const totalSupply = func('0x18160ddd', {}, uint256) +export type TotalSupplyParams = FunctionArguments +export type TotalSupplyReturn = FunctionReturn + +/** get_virtual_price() */ +export const get_virtual_price = func('0xbb7b8b80', {}, uint256) +export type Get_virtual_priceParams = FunctionArguments +export type Get_virtual_priceReturn = FunctionReturn + +/** calc_token_amount(uint256[2],bool) */ +export const calc_token_amount = func('0xed8e84f3', { + _amounts: fixedSizeArray(uint256, 2), + _is_deposit: bool, +}, uint256) +export type Calc_token_amountParams = FunctionArguments +export type Calc_token_amountReturn = FunctionReturn + +/** A() */ +export const A = func('0xf446c1d0', {}, uint256) +export type AParams = FunctionArguments +export type AReturn = FunctionReturn + +/** A_precise() */ +export const A_precise = func('0x76a2f0f0', {}, uint256) +export type A_preciseParams = FunctionArguments +export type A_preciseReturn = FunctionReturn + +/** balances(uint256) */ +export const balances = func('0x4903b0d1', { + i: uint256, +}, uint256) +export type BalancesParams = FunctionArguments +export type BalancesReturn = FunctionReturn + +/** get_balances() */ +export const get_balances = func('0x14f05979', {}, array(uint256)) +export type Get_balancesParams = FunctionArguments +export type Get_balancesReturn = FunctionReturn + +/** stored_rates() */ +export const stored_rates = func('0xfd0684b1', {}, array(uint256)) +export type Stored_ratesParams = FunctionArguments +export type Stored_ratesReturn = FunctionReturn + +/** dynamic_fee(int128,int128) */ +export const dynamic_fee = func('0x76a9cd3e', { + i: int128, + j: int128, +}, uint256) +export type Dynamic_feeParams = FunctionArguments +export type Dynamic_feeReturn = FunctionReturn + +/** ramp_A(uint256,uint256) */ +export const ramp_A = func('0x3c157e64', { + _future_A: uint256, + _future_time: uint256, +}) +export type Ramp_AParams = FunctionArguments +export type Ramp_AReturn = FunctionReturn + +/** stop_ramp_A() */ +export const stop_ramp_A = func('0x551a6588', {}) +export type Stop_ramp_AParams = FunctionArguments +export type Stop_ramp_AReturn = FunctionReturn + +/** set_new_fee(uint256,uint256) */ +export const set_new_fee = func('0x015c2838', { + _new_fee: uint256, + _new_offpeg_fee_multiplier: uint256, +}) +export type Set_new_feeParams = FunctionArguments +export type Set_new_feeReturn = FunctionReturn + +/** set_ma_exp_time(uint256,uint256) */ +export const set_ma_exp_time = func('0x65bbea6b', { + _ma_exp_time: uint256, + _D_ma_time: uint256, +}) +export type Set_ma_exp_timeParams = FunctionArguments +export type Set_ma_exp_timeReturn = FunctionReturn + +/** N_COINS() */ +export const N_COINS = func('0x29357750', {}, uint256) +export type N_COINSParams = FunctionArguments +export type N_COINSReturn = FunctionReturn + +/** BASE_POOL() */ +export const BASE_POOL = func('0x71511a5e', {}, address) +export type BASE_POOLParams = FunctionArguments +export type BASE_POOLReturn = FunctionReturn + +/** BASE_N_COINS() */ +export const BASE_N_COINS = func('0x3da575a1', {}, uint256) +export type BASE_N_COINSParams = FunctionArguments +export type BASE_N_COINSReturn = FunctionReturn + +/** BASE_COINS(uint256) */ +export const BASE_COINS = func('0xd52d5b86', { + arg0: uint256, +}, address) +export type BASE_COINSParams = FunctionArguments +export type BASE_COINSReturn = FunctionReturn + +/** coins(uint256) */ +export const coins = func('0xc6610657', { + arg0: uint256, +}, address) +export type CoinsParams = FunctionArguments +export type CoinsReturn = FunctionReturn + +/** fee() */ +export const fee = func('0xddca3f43', {}, uint256) +export type FeeParams = FunctionArguments +export type FeeReturn = FunctionReturn + +/** offpeg_fee_multiplier() */ +export const offpeg_fee_multiplier = func('0x8edfdd5f', {}, uint256) +export type Offpeg_fee_multiplierParams = FunctionArguments +export type Offpeg_fee_multiplierReturn = FunctionReturn + +/** admin_fee() */ +export const admin_fee = func('0xfee3f7f9', {}, uint256) +export type Admin_feeParams = FunctionArguments +export type Admin_feeReturn = FunctionReturn + +/** initial_A() */ +export const initial_A = func('0x5409491a', {}, uint256) +export type Initial_AParams = FunctionArguments +export type Initial_AReturn = FunctionReturn + +/** future_A() */ +export const future_A = func('0xb4b577ad', {}, uint256) +export type Future_AParams = FunctionArguments +export type Future_AReturn = FunctionReturn + +/** initial_A_time() */ +export const initial_A_time = func('0x2081066c', {}, uint256) +export type Initial_A_timeParams = FunctionArguments +export type Initial_A_timeReturn = FunctionReturn + +/** future_A_time() */ +export const future_A_time = func('0x14052288', {}, uint256) +export type Future_A_timeParams = FunctionArguments +export type Future_A_timeReturn = FunctionReturn + +/** admin_balances(uint256) */ +export const admin_balances = func('0xe2e7d264', { + arg0: uint256, +}, uint256) +export type Admin_balancesParams = FunctionArguments +export type Admin_balancesReturn = FunctionReturn + +/** ma_exp_time() */ +export const ma_exp_time = func('0x1be913a5', {}, uint256) +export type Ma_exp_timeParams = FunctionArguments +export type Ma_exp_timeReturn = FunctionReturn + +/** D_ma_time() */ +export const D_ma_time = func('0x9c4258c4', {}, uint256) +export type D_ma_timeParams = FunctionArguments +export type D_ma_timeReturn = FunctionReturn + +/** ma_last_time() */ +export const ma_last_time = func('0x1ddc3b01', {}, uint256) +export type Ma_last_timeParams = FunctionArguments +export type Ma_last_timeReturn = FunctionReturn + +/** name() */ +export const name = func('0x06fdde03', {}, string) +export type NameParams = FunctionArguments +export type NameReturn = FunctionReturn + +/** symbol() */ +export const symbol = func('0x95d89b41', {}, string) +export type SymbolParams = FunctionArguments +export type SymbolReturn = FunctionReturn + +/** decimals() */ +export const decimals = func('0x313ce567', {}, uint8) +export type DecimalsParams = FunctionArguments +export type DecimalsReturn = FunctionReturn + +/** version() */ +export const version = func('0x54fd4d50', {}, string) +export type VersionParams = FunctionArguments +export type VersionReturn = FunctionReturn + +/** balanceOf(address) */ +export const balanceOf = func('0x70a08231', { + arg0: address, +}, uint256) +export type BalanceOfParams = FunctionArguments +export type BalanceOfReturn = FunctionReturn + +/** allowance(address,address) */ +export const allowance = func('0xdd62ed3e', { + arg0: address, + arg1: address, +}, uint256) +export type AllowanceParams = FunctionArguments +export type AllowanceReturn = FunctionReturn + +/** nonces(address) */ +export const nonces = func('0x7ecebe00', { + arg0: address, +}, uint256) +export type NoncesParams = FunctionArguments +export type NoncesReturn = FunctionReturn + +/** salt() */ +export const salt = func('0xbfa0b133', {}, bytes32) +export type SaltParams = FunctionArguments +export type SaltReturn = FunctionReturn diff --git a/src/abi/curve-stable-swap-meta-ng/index.ts b/src/abi/curve-stable-swap-meta-ng/index.ts new file mode 100644 index 00000000..11829d6e --- /dev/null +++ b/src/abi/curve-stable-swap-meta-ng/index.ts @@ -0,0 +1,4 @@ +export * as events from './events.js' +export * as functions from './functions.js' + +export { Contract } from './contract.js' diff --git a/src/abi/curve-stable-swap-ng.ts b/src/abi/curve-stable-swap-ng.ts deleted file mode 100644 index 2b4bb3d1..00000000 --- a/src/abi/curve-stable-swap-ng.ts +++ /dev/null @@ -1,440 +0,0 @@ -import * as p from '@subsquid/evm-codec' -import { event, fun, viewFun, indexed, ContractBase } from '@subsquid/evm-abi' -import type { EventParams as EParams, FunctionArguments, FunctionReturn } from '@subsquid/evm-abi' - -export const events = { - Transfer: event("0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", "Transfer(address,address,uint256)", {"sender": indexed(p.address), "receiver": indexed(p.address), "value": p.uint256}), - Approval: event("0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925", "Approval(address,address,uint256)", {"owner": indexed(p.address), "spender": indexed(p.address), "value": p.uint256}), - TokenExchange: event("0x8b3e96f2b889fa771c53c981b40daf005f63f637f1869f707052d15a3dd97140", "TokenExchange(address,int128,uint256,int128,uint256)", {"buyer": indexed(p.address), "sold_id": p.int128, "tokens_sold": p.uint256, "bought_id": p.int128, "tokens_bought": p.uint256}), - TokenExchangeUnderlying: event("0xd013ca23e77a65003c2c659c5442c00c805371b7fc1ebd4c206c41d1536bd90b", "TokenExchangeUnderlying(address,int128,uint256,int128,uint256)", {"buyer": indexed(p.address), "sold_id": p.int128, "tokens_sold": p.uint256, "bought_id": p.int128, "tokens_bought": p.uint256}), - AddLiquidity: event("0x189c623b666b1b45b83d7178f39b8c087cb09774317ca2f53c2d3c3726f222a2", "AddLiquidity(address,uint256[],uint256[],uint256,uint256)", {"provider": indexed(p.address), "token_amounts": p.array(p.uint256), "fees": p.array(p.uint256), "invariant": p.uint256, "token_supply": p.uint256}), - RemoveLiquidity: event("0x347ad828e58cbe534d8f6b67985d791360756b18f0d95fd9f197a66cc46480ea", "RemoveLiquidity(address,uint256[],uint256[],uint256)", {"provider": indexed(p.address), "token_amounts": p.array(p.uint256), "fees": p.array(p.uint256), "token_supply": p.uint256}), - RemoveLiquidityOne: event("0x6f48129db1f37ccb9cc5dd7e119cb32750cabdf75b48375d730d26ce3659bbe1", "RemoveLiquidityOne(address,int128,uint256,uint256,uint256)", {"provider": indexed(p.address), "token_id": p.int128, "token_amount": p.uint256, "coin_amount": p.uint256, "token_supply": p.uint256}), - RemoveLiquidityImbalance: event("0x3631c28b1f9dd213e0319fb167b554d76b6c283a41143eb400a0d1adb1af1755", "RemoveLiquidityImbalance(address,uint256[],uint256[],uint256,uint256)", {"provider": indexed(p.address), "token_amounts": p.array(p.uint256), "fees": p.array(p.uint256), "invariant": p.uint256, "token_supply": p.uint256}), - RampA: event("0xa2b71ec6df949300b59aab36b55e189697b750119dd349fcfa8c0f779e83c254", "RampA(uint256,uint256,uint256,uint256)", {"old_A": p.uint256, "new_A": p.uint256, "initial_time": p.uint256, "future_time": p.uint256}), - StopRampA: event("0x46e22fb3709ad289f62ce63d469248536dbc78d82b84a3d7e74ad606dc201938", "StopRampA(uint256,uint256)", {"A": p.uint256, "t": p.uint256}), - ApplyNewFee: event("0x750d10a7f37466ce785ee6bcb604aac543358db42afbcc332a3c12a49c80bf6d", "ApplyNewFee(uint256,uint256)", {"fee": p.uint256, "offpeg_fee_multiplier": p.uint256}), - SetNewMATime: event("0x68dc4e067dff1862b896b7a0faf55f97df1a60d0aaa79481b69d675f2026a28c", "SetNewMATime(uint256,uint256)", {"ma_exp_time": p.uint256, "D_ma_time": p.uint256}), -} - -export const functions = { - 'exchange(int128,int128,uint256,uint256)': fun("0x3df02124", "exchange(int128,int128,uint256,uint256)", {"i": p.int128, "j": p.int128, "_dx": p.uint256, "_min_dy": p.uint256}, p.uint256), - 'exchange(int128,int128,uint256,uint256,address)': fun("0xddc1f59d", "exchange(int128,int128,uint256,uint256,address)", {"i": p.int128, "j": p.int128, "_dx": p.uint256, "_min_dy": p.uint256, "_receiver": p.address}, p.uint256), - 'exchange_received(int128,int128,uint256,uint256)': fun("0x7e3db030", "exchange_received(int128,int128,uint256,uint256)", {"i": p.int128, "j": p.int128, "_dx": p.uint256, "_min_dy": p.uint256}, p.uint256), - 'exchange_received(int128,int128,uint256,uint256,address)': fun("0xafb43012", "exchange_received(int128,int128,uint256,uint256,address)", {"i": p.int128, "j": p.int128, "_dx": p.uint256, "_min_dy": p.uint256, "_receiver": p.address}, p.uint256), - 'add_liquidity(uint256[],uint256)': fun("0xb72df5de", "add_liquidity(uint256[],uint256)", {"_amounts": p.array(p.uint256), "_min_mint_amount": p.uint256}, p.uint256), - 'add_liquidity(uint256[],uint256,address)': fun("0xa7256d09", "add_liquidity(uint256[],uint256,address)", {"_amounts": p.array(p.uint256), "_min_mint_amount": p.uint256, "_receiver": p.address}, p.uint256), - 'remove_liquidity_one_coin(uint256,int128,uint256)': fun("0x1a4d01d2", "remove_liquidity_one_coin(uint256,int128,uint256)", {"_burn_amount": p.uint256, "i": p.int128, "_min_received": p.uint256}, p.uint256), - 'remove_liquidity_one_coin(uint256,int128,uint256,address)': fun("0x081579a5", "remove_liquidity_one_coin(uint256,int128,uint256,address)", {"_burn_amount": p.uint256, "i": p.int128, "_min_received": p.uint256, "_receiver": p.address}, p.uint256), - 'remove_liquidity_imbalance(uint256[],uint256)': fun("0x7706db75", "remove_liquidity_imbalance(uint256[],uint256)", {"_amounts": p.array(p.uint256), "_max_burn_amount": p.uint256}, p.uint256), - 'remove_liquidity_imbalance(uint256[],uint256,address)': fun("0x4a6e32c6", "remove_liquidity_imbalance(uint256[],uint256,address)", {"_amounts": p.array(p.uint256), "_max_burn_amount": p.uint256, "_receiver": p.address}, p.uint256), - 'remove_liquidity(uint256,uint256[])': fun("0xd40ddb8c", "remove_liquidity(uint256,uint256[])", {"_burn_amount": p.uint256, "_min_amounts": p.array(p.uint256)}, p.array(p.uint256)), - 'remove_liquidity(uint256,uint256[],address)': fun("0x5e604cd2", "remove_liquidity(uint256,uint256[],address)", {"_burn_amount": p.uint256, "_min_amounts": p.array(p.uint256), "_receiver": p.address}, p.array(p.uint256)), - 'remove_liquidity(uint256,uint256[],address,bool)': fun("0x2969e04a", "remove_liquidity(uint256,uint256[],address,bool)", {"_burn_amount": p.uint256, "_min_amounts": p.array(p.uint256), "_receiver": p.address, "_claim_admin_fees": p.bool}, p.array(p.uint256)), - withdraw_admin_fees: fun("0x30c54085", "withdraw_admin_fees()", {}, ), - last_price: viewFun("0x3931ab52", "last_price(uint256)", {"i": p.uint256}, p.uint256), - ema_price: viewFun("0x90d20837", "ema_price(uint256)", {"i": p.uint256}, p.uint256), - get_p: viewFun("0xec023862", "get_p(uint256)", {"i": p.uint256}, p.uint256), - price_oracle: viewFun("0x68727653", "price_oracle(uint256)", {"i": p.uint256}, p.uint256), - D_oracle: viewFun("0x907a016b", "D_oracle()", {}, p.uint256), - transfer: fun("0xa9059cbb", "transfer(address,uint256)", {"_to": p.address, "_value": p.uint256}, p.bool), - transferFrom: fun("0x23b872dd", "transferFrom(address,address,uint256)", {"_from": p.address, "_to": p.address, "_value": p.uint256}, p.bool), - approve: fun("0x095ea7b3", "approve(address,uint256)", {"_spender": p.address, "_value": p.uint256}, p.bool), - permit: fun("0xd505accf", "permit(address,address,uint256,uint256,uint8,bytes32,bytes32)", {"_owner": p.address, "_spender": p.address, "_value": p.uint256, "_deadline": p.uint256, "_v": p.uint8, "_r": p.bytes32, "_s": p.bytes32}, p.bool), - DOMAIN_SEPARATOR: viewFun("0x3644e515", "DOMAIN_SEPARATOR()", {}, p.bytes32), - get_dx: viewFun("0x67df02ca", "get_dx(int128,int128,uint256)", {"i": p.int128, "j": p.int128, "dy": p.uint256}, p.uint256), - get_dy: viewFun("0x5e0d443f", "get_dy(int128,int128,uint256)", {"i": p.int128, "j": p.int128, "dx": p.uint256}, p.uint256), - calc_withdraw_one_coin: viewFun("0xcc2b27d7", "calc_withdraw_one_coin(uint256,int128)", {"_burn_amount": p.uint256, "i": p.int128}, p.uint256), - totalSupply: viewFun("0x18160ddd", "totalSupply()", {}, p.uint256), - get_virtual_price: viewFun("0xbb7b8b80", "get_virtual_price()", {}, p.uint256), - calc_token_amount: viewFun("0x3db06dd8", "calc_token_amount(uint256[],bool)", {"_amounts": p.array(p.uint256), "_is_deposit": p.bool}, p.uint256), - A: viewFun("0xf446c1d0", "A()", {}, p.uint256), - A_precise: viewFun("0x76a2f0f0", "A_precise()", {}, p.uint256), - balances: viewFun("0x4903b0d1", "balances(uint256)", {"i": p.uint256}, p.uint256), - get_balances: viewFun("0x14f05979", "get_balances()", {}, p.array(p.uint256)), - stored_rates: viewFun("0xfd0684b1", "stored_rates()", {}, p.array(p.uint256)), - dynamic_fee: viewFun("0x76a9cd3e", "dynamic_fee(int128,int128)", {"i": p.int128, "j": p.int128}, p.uint256), - ramp_A: fun("0x3c157e64", "ramp_A(uint256,uint256)", {"_future_A": p.uint256, "_future_time": p.uint256}, ), - stop_ramp_A: fun("0x551a6588", "stop_ramp_A()", {}, ), - set_new_fee: fun("0x015c2838", "set_new_fee(uint256,uint256)", {"_new_fee": p.uint256, "_new_offpeg_fee_multiplier": p.uint256}, ), - set_ma_exp_time: fun("0x65bbea6b", "set_ma_exp_time(uint256,uint256)", {"_ma_exp_time": p.uint256, "_D_ma_time": p.uint256}, ), - N_COINS: viewFun("0x29357750", "N_COINS()", {}, p.uint256), - coins: viewFun("0xc6610657", "coins(uint256)", {"arg0": p.uint256}, p.address), - fee: viewFun("0xddca3f43", "fee()", {}, p.uint256), - offpeg_fee_multiplier: viewFun("0x8edfdd5f", "offpeg_fee_multiplier()", {}, p.uint256), - admin_fee: viewFun("0xfee3f7f9", "admin_fee()", {}, p.uint256), - initial_A: viewFun("0x5409491a", "initial_A()", {}, p.uint256), - future_A: viewFun("0xb4b577ad", "future_A()", {}, p.uint256), - initial_A_time: viewFun("0x2081066c", "initial_A_time()", {}, p.uint256), - future_A_time: viewFun("0x14052288", "future_A_time()", {}, p.uint256), - admin_balances: viewFun("0xe2e7d264", "admin_balances(uint256)", {"arg0": p.uint256}, p.uint256), - ma_exp_time: viewFun("0x1be913a5", "ma_exp_time()", {}, p.uint256), - D_ma_time: viewFun("0x9c4258c4", "D_ma_time()", {}, p.uint256), - ma_last_time: viewFun("0x1ddc3b01", "ma_last_time()", {}, p.uint256), - name: viewFun("0x06fdde03", "name()", {}, p.string), - symbol: viewFun("0x95d89b41", "symbol()", {}, p.string), - decimals: viewFun("0x313ce567", "decimals()", {}, p.uint8), - version: viewFun("0x54fd4d50", "version()", {}, p.string), - balanceOf: viewFun("0x70a08231", "balanceOf(address)", {"arg0": p.address}, p.uint256), - allowance: viewFun("0xdd62ed3e", "allowance(address,address)", {"arg0": p.address, "arg1": p.address}, p.uint256), - nonces: viewFun("0x7ecebe00", "nonces(address)", {"arg0": p.address}, p.uint256), - salt: viewFun("0xbfa0b133", "salt()", {}, p.bytes32), -} - -export class Contract extends ContractBase { - - last_price(i: Last_priceParams["i"]) { - return this.eth_call(functions.last_price, {i}) - } - - ema_price(i: Ema_priceParams["i"]) { - return this.eth_call(functions.ema_price, {i}) - } - - get_p(i: Get_pParams["i"]) { - return this.eth_call(functions.get_p, {i}) - } - - price_oracle(i: Price_oracleParams["i"]) { - return this.eth_call(functions.price_oracle, {i}) - } - - D_oracle() { - return this.eth_call(functions.D_oracle, {}) - } - - DOMAIN_SEPARATOR() { - return this.eth_call(functions.DOMAIN_SEPARATOR, {}) - } - - get_dx(i: Get_dxParams["i"], j: Get_dxParams["j"], dy: Get_dxParams["dy"]) { - return this.eth_call(functions.get_dx, {i, j, dy}) - } - - get_dy(i: Get_dyParams["i"], j: Get_dyParams["j"], dx: Get_dyParams["dx"]) { - return this.eth_call(functions.get_dy, {i, j, dx}) - } - - calc_withdraw_one_coin(_burn_amount: Calc_withdraw_one_coinParams["_burn_amount"], i: Calc_withdraw_one_coinParams["i"]) { - return this.eth_call(functions.calc_withdraw_one_coin, {_burn_amount, i}) - } - - totalSupply() { - return this.eth_call(functions.totalSupply, {}) - } - - get_virtual_price() { - return this.eth_call(functions.get_virtual_price, {}) - } - - calc_token_amount(_amounts: Calc_token_amountParams["_amounts"], _is_deposit: Calc_token_amountParams["_is_deposit"]) { - return this.eth_call(functions.calc_token_amount, {_amounts, _is_deposit}) - } - - A() { - return this.eth_call(functions.A, {}) - } - - A_precise() { - return this.eth_call(functions.A_precise, {}) - } - - balances(i: BalancesParams["i"]) { - return this.eth_call(functions.balances, {i}) - } - - get_balances() { - return this.eth_call(functions.get_balances, {}) - } - - stored_rates() { - return this.eth_call(functions.stored_rates, {}) - } - - dynamic_fee(i: Dynamic_feeParams["i"], j: Dynamic_feeParams["j"]) { - return this.eth_call(functions.dynamic_fee, {i, j}) - } - - N_COINS() { - return this.eth_call(functions.N_COINS, {}) - } - - coins(arg0: CoinsParams["arg0"]) { - return this.eth_call(functions.coins, {arg0}) - } - - fee() { - return this.eth_call(functions.fee, {}) - } - - offpeg_fee_multiplier() { - return this.eth_call(functions.offpeg_fee_multiplier, {}) - } - - admin_fee() { - return this.eth_call(functions.admin_fee, {}) - } - - initial_A() { - return this.eth_call(functions.initial_A, {}) - } - - future_A() { - return this.eth_call(functions.future_A, {}) - } - - initial_A_time() { - return this.eth_call(functions.initial_A_time, {}) - } - - future_A_time() { - return this.eth_call(functions.future_A_time, {}) - } - - admin_balances(arg0: Admin_balancesParams["arg0"]) { - return this.eth_call(functions.admin_balances, {arg0}) - } - - ma_exp_time() { - return this.eth_call(functions.ma_exp_time, {}) - } - - D_ma_time() { - return this.eth_call(functions.D_ma_time, {}) - } - - ma_last_time() { - return this.eth_call(functions.ma_last_time, {}) - } - - name() { - return this.eth_call(functions.name, {}) - } - - symbol() { - return this.eth_call(functions.symbol, {}) - } - - decimals() { - return this.eth_call(functions.decimals, {}) - } - - version() { - return this.eth_call(functions.version, {}) - } - - balanceOf(arg0: BalanceOfParams["arg0"]) { - return this.eth_call(functions.balanceOf, {arg0}) - } - - allowance(arg0: AllowanceParams["arg0"], arg1: AllowanceParams["arg1"]) { - return this.eth_call(functions.allowance, {arg0, arg1}) - } - - nonces(arg0: NoncesParams["arg0"]) { - return this.eth_call(functions.nonces, {arg0}) - } - - salt() { - return this.eth_call(functions.salt, {}) - } -} - -/// Event types -export type TransferEventArgs = EParams -export type ApprovalEventArgs = EParams -export type TokenExchangeEventArgs = EParams -export type TokenExchangeUnderlyingEventArgs = EParams -export type AddLiquidityEventArgs = EParams -export type RemoveLiquidityEventArgs = EParams -export type RemoveLiquidityOneEventArgs = EParams -export type RemoveLiquidityImbalanceEventArgs = EParams -export type RampAEventArgs = EParams -export type StopRampAEventArgs = EParams -export type ApplyNewFeeEventArgs = EParams -export type SetNewMATimeEventArgs = EParams - -/// Function types -export type ExchangeParams_0 = FunctionArguments -export type ExchangeReturn_0 = FunctionReturn - -export type ExchangeParams_1 = FunctionArguments -export type ExchangeReturn_1 = FunctionReturn - -export type Exchange_receivedParams_0 = FunctionArguments -export type Exchange_receivedReturn_0 = FunctionReturn - -export type Exchange_receivedParams_1 = FunctionArguments -export type Exchange_receivedReturn_1 = FunctionReturn - -export type Add_liquidityParams_0 = FunctionArguments -export type Add_liquidityReturn_0 = FunctionReturn - -export type Add_liquidityParams_1 = FunctionArguments -export type Add_liquidityReturn_1 = FunctionReturn - -export type Remove_liquidity_one_coinParams_0 = FunctionArguments -export type Remove_liquidity_one_coinReturn_0 = FunctionReturn - -export type Remove_liquidity_one_coinParams_1 = FunctionArguments -export type Remove_liquidity_one_coinReturn_1 = FunctionReturn - -export type Remove_liquidity_imbalanceParams_0 = FunctionArguments -export type Remove_liquidity_imbalanceReturn_0 = FunctionReturn - -export type Remove_liquidity_imbalanceParams_1 = FunctionArguments -export type Remove_liquidity_imbalanceReturn_1 = FunctionReturn - -export type Remove_liquidityParams_0 = FunctionArguments -export type Remove_liquidityReturn_0 = FunctionReturn - -export type Remove_liquidityParams_1 = FunctionArguments -export type Remove_liquidityReturn_1 = FunctionReturn - -export type Remove_liquidityParams_2 = FunctionArguments -export type Remove_liquidityReturn_2 = FunctionReturn - -export type Withdraw_admin_feesParams = FunctionArguments -export type Withdraw_admin_feesReturn = FunctionReturn - -export type Last_priceParams = FunctionArguments -export type Last_priceReturn = FunctionReturn - -export type Ema_priceParams = FunctionArguments -export type Ema_priceReturn = FunctionReturn - -export type Get_pParams = FunctionArguments -export type Get_pReturn = FunctionReturn - -export type Price_oracleParams = FunctionArguments -export type Price_oracleReturn = FunctionReturn - -export type D_oracleParams = FunctionArguments -export type D_oracleReturn = FunctionReturn - -export type TransferParams = FunctionArguments -export type TransferReturn = FunctionReturn - -export type TransferFromParams = FunctionArguments -export type TransferFromReturn = FunctionReturn - -export type ApproveParams = FunctionArguments -export type ApproveReturn = FunctionReturn - -export type PermitParams = FunctionArguments -export type PermitReturn = FunctionReturn - -export type DOMAIN_SEPARATORParams = FunctionArguments -export type DOMAIN_SEPARATORReturn = FunctionReturn - -export type Get_dxParams = FunctionArguments -export type Get_dxReturn = FunctionReturn - -export type Get_dyParams = FunctionArguments -export type Get_dyReturn = FunctionReturn - -export type Calc_withdraw_one_coinParams = FunctionArguments -export type Calc_withdraw_one_coinReturn = FunctionReturn - -export type TotalSupplyParams = FunctionArguments -export type TotalSupplyReturn = FunctionReturn - -export type Get_virtual_priceParams = FunctionArguments -export type Get_virtual_priceReturn = FunctionReturn - -export type Calc_token_amountParams = FunctionArguments -export type Calc_token_amountReturn = FunctionReturn - -export type AParams = FunctionArguments -export type AReturn = FunctionReturn - -export type A_preciseParams = FunctionArguments -export type A_preciseReturn = FunctionReturn - -export type BalancesParams = FunctionArguments -export type BalancesReturn = FunctionReturn - -export type Get_balancesParams = FunctionArguments -export type Get_balancesReturn = FunctionReturn - -export type Stored_ratesParams = FunctionArguments -export type Stored_ratesReturn = FunctionReturn - -export type Dynamic_feeParams = FunctionArguments -export type Dynamic_feeReturn = FunctionReturn - -export type Ramp_AParams = FunctionArguments -export type Ramp_AReturn = FunctionReturn - -export type Stop_ramp_AParams = FunctionArguments -export type Stop_ramp_AReturn = FunctionReturn - -export type Set_new_feeParams = FunctionArguments -export type Set_new_feeReturn = FunctionReturn - -export type Set_ma_exp_timeParams = FunctionArguments -export type Set_ma_exp_timeReturn = FunctionReturn - -export type N_COINSParams = FunctionArguments -export type N_COINSReturn = FunctionReturn - -export type CoinsParams = FunctionArguments -export type CoinsReturn = FunctionReturn - -export type FeeParams = FunctionArguments -export type FeeReturn = FunctionReturn - -export type Offpeg_fee_multiplierParams = FunctionArguments -export type Offpeg_fee_multiplierReturn = FunctionReturn - -export type Admin_feeParams = FunctionArguments -export type Admin_feeReturn = FunctionReturn - -export type Initial_AParams = FunctionArguments -export type Initial_AReturn = FunctionReturn - -export type Future_AParams = FunctionArguments -export type Future_AReturn = FunctionReturn - -export type Initial_A_timeParams = FunctionArguments -export type Initial_A_timeReturn = FunctionReturn - -export type Future_A_timeParams = FunctionArguments -export type Future_A_timeReturn = FunctionReturn - -export type Admin_balancesParams = FunctionArguments -export type Admin_balancesReturn = FunctionReturn - -export type Ma_exp_timeParams = FunctionArguments -export type Ma_exp_timeReturn = FunctionReturn - -export type D_ma_timeParams = FunctionArguments -export type D_ma_timeReturn = FunctionReturn - -export type Ma_last_timeParams = FunctionArguments -export type Ma_last_timeReturn = FunctionReturn - -export type NameParams = FunctionArguments -export type NameReturn = FunctionReturn - -export type SymbolParams = FunctionArguments -export type SymbolReturn = FunctionReturn - -export type DecimalsParams = FunctionArguments -export type DecimalsReturn = FunctionReturn - -export type VersionParams = FunctionArguments -export type VersionReturn = FunctionReturn - -export type BalanceOfParams = FunctionArguments -export type BalanceOfReturn = FunctionReturn - -export type AllowanceParams = FunctionArguments -export type AllowanceReturn = FunctionReturn - -export type NoncesParams = FunctionArguments -export type NoncesReturn = FunctionReturn - -export type SaltParams = FunctionArguments -export type SaltReturn = FunctionReturn - diff --git a/src/abi/curve-stable-swap-ng/contract.ts b/src/abi/curve-stable-swap-ng/contract.ts new file mode 100644 index 00000000..5cbd81b4 --- /dev/null +++ b/src/abi/curve-stable-swap-ng/contract.ts @@ -0,0 +1,229 @@ +import { ContractBase } from '../abi.support.js' +import { A, A_precise, DOMAIN_SEPARATOR, D_ma_time, D_oracle, N_COINS, add_liquidity, add_liquidity_1, admin_balances, admin_fee, allowance, approve, balanceOf, balances, calc_token_amount, calc_withdraw_one_coin, coins, decimals, dynamic_fee, ema_price, exchange, exchange_1, exchange_received, exchange_received_1, fee, future_A, future_A_time, get_balances, get_dx, get_dy, get_p, get_virtual_price, initial_A, initial_A_time, last_price, ma_exp_time, ma_last_time, name, nonces, offpeg_fee_multiplier, permit, price_oracle, remove_liquidity, remove_liquidity_1, remove_liquidity_2, remove_liquidity_imbalance, remove_liquidity_imbalance_1, remove_liquidity_one_coin, remove_liquidity_one_coin_1, salt, stored_rates, symbol, totalSupply, transfer, transferFrom, version } from './functions.js' +import type { Add_liquidityParams, Add_liquidityParams_1, Admin_balancesParams, AllowanceParams, ApproveParams, BalanceOfParams, BalancesParams, Calc_token_amountParams, Calc_withdraw_one_coinParams, CoinsParams, Dynamic_feeParams, Ema_priceParams, ExchangeParams, ExchangeParams_1, Exchange_receivedParams, Exchange_receivedParams_1, Get_dxParams, Get_dyParams, Get_pParams, Last_priceParams, NoncesParams, PermitParams, Price_oracleParams, Remove_liquidityParams, Remove_liquidityParams_1, Remove_liquidityParams_2, Remove_liquidity_imbalanceParams, Remove_liquidity_imbalanceParams_1, Remove_liquidity_one_coinParams, Remove_liquidity_one_coinParams_1, TransferFromParams, TransferParams } from './functions.js' + +export class Contract extends ContractBase { + exchange(i: ExchangeParams["i"], j: ExchangeParams["j"], _dx: ExchangeParams["_dx"], _min_dy: ExchangeParams["_min_dy"]) { + return this.eth_call(exchange, {i, j, _dx, _min_dy}) + } + + exchange_1(i: ExchangeParams_1["i"], j: ExchangeParams_1["j"], _dx: ExchangeParams_1["_dx"], _min_dy: ExchangeParams_1["_min_dy"], _receiver: ExchangeParams_1["_receiver"]) { + return this.eth_call(exchange_1, {i, j, _dx, _min_dy, _receiver}) + } + + exchange_received(i: Exchange_receivedParams["i"], j: Exchange_receivedParams["j"], _dx: Exchange_receivedParams["_dx"], _min_dy: Exchange_receivedParams["_min_dy"]) { + return this.eth_call(exchange_received, {i, j, _dx, _min_dy}) + } + + exchange_received_1(i: Exchange_receivedParams_1["i"], j: Exchange_receivedParams_1["j"], _dx: Exchange_receivedParams_1["_dx"], _min_dy: Exchange_receivedParams_1["_min_dy"], _receiver: Exchange_receivedParams_1["_receiver"]) { + return this.eth_call(exchange_received_1, {i, j, _dx, _min_dy, _receiver}) + } + + add_liquidity(_amounts: Add_liquidityParams["_amounts"], _min_mint_amount: Add_liquidityParams["_min_mint_amount"]) { + return this.eth_call(add_liquidity, {_amounts, _min_mint_amount}) + } + + add_liquidity_1(_amounts: Add_liquidityParams_1["_amounts"], _min_mint_amount: Add_liquidityParams_1["_min_mint_amount"], _receiver: Add_liquidityParams_1["_receiver"]) { + return this.eth_call(add_liquidity_1, {_amounts, _min_mint_amount, _receiver}) + } + + remove_liquidity_one_coin(_burn_amount: Remove_liquidity_one_coinParams["_burn_amount"], i: Remove_liquidity_one_coinParams["i"], _min_received: Remove_liquidity_one_coinParams["_min_received"]) { + return this.eth_call(remove_liquidity_one_coin, {_burn_amount, i, _min_received}) + } + + remove_liquidity_one_coin_1(_burn_amount: Remove_liquidity_one_coinParams_1["_burn_amount"], i: Remove_liquidity_one_coinParams_1["i"], _min_received: Remove_liquidity_one_coinParams_1["_min_received"], _receiver: Remove_liquidity_one_coinParams_1["_receiver"]) { + return this.eth_call(remove_liquidity_one_coin_1, {_burn_amount, i, _min_received, _receiver}) + } + + remove_liquidity_imbalance(_amounts: Remove_liquidity_imbalanceParams["_amounts"], _max_burn_amount: Remove_liquidity_imbalanceParams["_max_burn_amount"]) { + return this.eth_call(remove_liquidity_imbalance, {_amounts, _max_burn_amount}) + } + + remove_liquidity_imbalance_1(_amounts: Remove_liquidity_imbalanceParams_1["_amounts"], _max_burn_amount: Remove_liquidity_imbalanceParams_1["_max_burn_amount"], _receiver: Remove_liquidity_imbalanceParams_1["_receiver"]) { + return this.eth_call(remove_liquidity_imbalance_1, {_amounts, _max_burn_amount, _receiver}) + } + + remove_liquidity(_burn_amount: Remove_liquidityParams["_burn_amount"], _min_amounts: Remove_liquidityParams["_min_amounts"]) { + return this.eth_call(remove_liquidity, {_burn_amount, _min_amounts}) + } + + remove_liquidity_1(_burn_amount: Remove_liquidityParams_1["_burn_amount"], _min_amounts: Remove_liquidityParams_1["_min_amounts"], _receiver: Remove_liquidityParams_1["_receiver"]) { + return this.eth_call(remove_liquidity_1, {_burn_amount, _min_amounts, _receiver}) + } + + remove_liquidity_2(_burn_amount: Remove_liquidityParams_2["_burn_amount"], _min_amounts: Remove_liquidityParams_2["_min_amounts"], _receiver: Remove_liquidityParams_2["_receiver"], _claim_admin_fees: Remove_liquidityParams_2["_claim_admin_fees"]) { + return this.eth_call(remove_liquidity_2, {_burn_amount, _min_amounts, _receiver, _claim_admin_fees}) + } + + last_price(i: Last_priceParams["i"]) { + return this.eth_call(last_price, {i}) + } + + ema_price(i: Ema_priceParams["i"]) { + return this.eth_call(ema_price, {i}) + } + + get_p(i: Get_pParams["i"]) { + return this.eth_call(get_p, {i}) + } + + price_oracle(i: Price_oracleParams["i"]) { + return this.eth_call(price_oracle, {i}) + } + + D_oracle() { + return this.eth_call(D_oracle, {}) + } + + transfer(_to: TransferParams["_to"], _value: TransferParams["_value"]) { + return this.eth_call(transfer, {_to, _value}) + } + + transferFrom(_from: TransferFromParams["_from"], _to: TransferFromParams["_to"], _value: TransferFromParams["_value"]) { + return this.eth_call(transferFrom, {_from, _to, _value}) + } + + approve(_spender: ApproveParams["_spender"], _value: ApproveParams["_value"]) { + return this.eth_call(approve, {_spender, _value}) + } + + permit(_owner: PermitParams["_owner"], _spender: PermitParams["_spender"], _value: PermitParams["_value"], _deadline: PermitParams["_deadline"], _v: PermitParams["_v"], _r: PermitParams["_r"], _s: PermitParams["_s"]) { + return this.eth_call(permit, {_owner, _spender, _value, _deadline, _v, _r, _s}) + } + + DOMAIN_SEPARATOR() { + return this.eth_call(DOMAIN_SEPARATOR, {}) + } + + get_dx(i: Get_dxParams["i"], j: Get_dxParams["j"], dy: Get_dxParams["dy"]) { + return this.eth_call(get_dx, {i, j, dy}) + } + + get_dy(i: Get_dyParams["i"], j: Get_dyParams["j"], dx: Get_dyParams["dx"]) { + return this.eth_call(get_dy, {i, j, dx}) + } + + calc_withdraw_one_coin(_burn_amount: Calc_withdraw_one_coinParams["_burn_amount"], i: Calc_withdraw_one_coinParams["i"]) { + return this.eth_call(calc_withdraw_one_coin, {_burn_amount, i}) + } + + totalSupply() { + return this.eth_call(totalSupply, {}) + } + + get_virtual_price() { + return this.eth_call(get_virtual_price, {}) + } + + calc_token_amount(_amounts: Calc_token_amountParams["_amounts"], _is_deposit: Calc_token_amountParams["_is_deposit"]) { + return this.eth_call(calc_token_amount, {_amounts, _is_deposit}) + } + + A() { + return this.eth_call(A, {}) + } + + A_precise() { + return this.eth_call(A_precise, {}) + } + + balances(i: BalancesParams["i"]) { + return this.eth_call(balances, {i}) + } + + get_balances() { + return this.eth_call(get_balances, {}) + } + + stored_rates() { + return this.eth_call(stored_rates, {}) + } + + dynamic_fee(i: Dynamic_feeParams["i"], j: Dynamic_feeParams["j"]) { + return this.eth_call(dynamic_fee, {i, j}) + } + + N_COINS() { + return this.eth_call(N_COINS, {}) + } + + coins(arg0: CoinsParams["arg0"]) { + return this.eth_call(coins, {arg0}) + } + + fee() { + return this.eth_call(fee, {}) + } + + offpeg_fee_multiplier() { + return this.eth_call(offpeg_fee_multiplier, {}) + } + + admin_fee() { + return this.eth_call(admin_fee, {}) + } + + initial_A() { + return this.eth_call(initial_A, {}) + } + + future_A() { + return this.eth_call(future_A, {}) + } + + initial_A_time() { + return this.eth_call(initial_A_time, {}) + } + + future_A_time() { + return this.eth_call(future_A_time, {}) + } + + admin_balances(arg0: Admin_balancesParams["arg0"]) { + return this.eth_call(admin_balances, {arg0}) + } + + ma_exp_time() { + return this.eth_call(ma_exp_time, {}) + } + + D_ma_time() { + return this.eth_call(D_ma_time, {}) + } + + ma_last_time() { + return this.eth_call(ma_last_time, {}) + } + + name() { + return this.eth_call(name, {}) + } + + symbol() { + return this.eth_call(symbol, {}) + } + + decimals() { + return this.eth_call(decimals, {}) + } + + version() { + return this.eth_call(version, {}) + } + + balanceOf(arg0: BalanceOfParams["arg0"]) { + return this.eth_call(balanceOf, {arg0}) + } + + allowance(arg0: AllowanceParams["arg0"], arg1: AllowanceParams["arg1"]) { + return this.eth_call(allowance, {arg0, arg1}) + } + + nonces(arg0: NoncesParams["arg0"]) { + return this.eth_call(nonces, {arg0}) + } + + salt() { + return this.eth_call(salt, {}) + } +} diff --git a/src/abi/curve-stable-swap-ng/events.ts b/src/abi/curve-stable-swap-ng/events.ts new file mode 100644 index 00000000..e7fef243 --- /dev/null +++ b/src/abi/curve-stable-swap-ng/events.ts @@ -0,0 +1,108 @@ +import { address, array, int128, uint256 } from '@subsquid/evm-codec' +import { event, indexed } from '../abi.support.js' +import type { EventParams as EParams } from '../abi.support.js' + +/** Transfer(address,address,uint256) */ +export const Transfer = event('0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', { + sender: indexed(address), + receiver: indexed(address), + value: uint256, +}) +export type TransferEventArgs = EParams + +/** Approval(address,address,uint256) */ +export const Approval = event('0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925', { + owner: indexed(address), + spender: indexed(address), + value: uint256, +}) +export type ApprovalEventArgs = EParams + +/** TokenExchange(address,int128,uint256,int128,uint256) */ +export const TokenExchange = event('0x8b3e96f2b889fa771c53c981b40daf005f63f637f1869f707052d15a3dd97140', { + buyer: indexed(address), + sold_id: int128, + tokens_sold: uint256, + bought_id: int128, + tokens_bought: uint256, +}) +export type TokenExchangeEventArgs = EParams + +/** TokenExchangeUnderlying(address,int128,uint256,int128,uint256) */ +export const TokenExchangeUnderlying = event('0xd013ca23e77a65003c2c659c5442c00c805371b7fc1ebd4c206c41d1536bd90b', { + buyer: indexed(address), + sold_id: int128, + tokens_sold: uint256, + bought_id: int128, + tokens_bought: uint256, +}) +export type TokenExchangeUnderlyingEventArgs = EParams + +/** AddLiquidity(address,uint256[],uint256[],uint256,uint256) */ +export const AddLiquidity = event('0x189c623b666b1b45b83d7178f39b8c087cb09774317ca2f53c2d3c3726f222a2', { + provider: indexed(address), + token_amounts: array(uint256), + fees: array(uint256), + invariant: uint256, + token_supply: uint256, +}) +export type AddLiquidityEventArgs = EParams + +/** RemoveLiquidity(address,uint256[],uint256[],uint256) */ +export const RemoveLiquidity = event('0x347ad828e58cbe534d8f6b67985d791360756b18f0d95fd9f197a66cc46480ea', { + provider: indexed(address), + token_amounts: array(uint256), + fees: array(uint256), + token_supply: uint256, +}) +export type RemoveLiquidityEventArgs = EParams + +/** RemoveLiquidityOne(address,int128,uint256,uint256,uint256) */ +export const RemoveLiquidityOne = event('0x6f48129db1f37ccb9cc5dd7e119cb32750cabdf75b48375d730d26ce3659bbe1', { + provider: indexed(address), + token_id: int128, + token_amount: uint256, + coin_amount: uint256, + token_supply: uint256, +}) +export type RemoveLiquidityOneEventArgs = EParams + +/** RemoveLiquidityImbalance(address,uint256[],uint256[],uint256,uint256) */ +export const RemoveLiquidityImbalance = event('0x3631c28b1f9dd213e0319fb167b554d76b6c283a41143eb400a0d1adb1af1755', { + provider: indexed(address), + token_amounts: array(uint256), + fees: array(uint256), + invariant: uint256, + token_supply: uint256, +}) +export type RemoveLiquidityImbalanceEventArgs = EParams + +/** RampA(uint256,uint256,uint256,uint256) */ +export const RampA = event('0xa2b71ec6df949300b59aab36b55e189697b750119dd349fcfa8c0f779e83c254', { + old_A: uint256, + new_A: uint256, + initial_time: uint256, + future_time: uint256, +}) +export type RampAEventArgs = EParams + +/** StopRampA(uint256,uint256) */ +export const StopRampA = event('0x46e22fb3709ad289f62ce63d469248536dbc78d82b84a3d7e74ad606dc201938', { + A: uint256, + t: uint256, +}) +export type StopRampAEventArgs = EParams + +/** ApplyNewFee(uint256,uint256) */ +export const ApplyNewFee = event('0x750d10a7f37466ce785ee6bcb604aac543358db42afbcc332a3c12a49c80bf6d', { + fee: uint256, + offpeg_fee_multiplier: uint256, +}) +export type ApplyNewFeeEventArgs = EParams + +/** SetNewMATime(uint256,uint256) */ +export const SetNewMATime = event('0x68dc4e067dff1862b896b7a0faf55f97df1a60d0aaa79481b69d675f2026a28c', { + ma_exp_time: uint256, + D_ma_time: uint256, +}) +export type SetNewMATimeEventArgs = EParams diff --git a/src/abi/curve-stable-swap-ng/functions.ts b/src/abi/curve-stable-swap-ng/functions.ts new file mode 100644 index 00000000..53ce4bc6 --- /dev/null +++ b/src/abi/curve-stable-swap-ng/functions.ts @@ -0,0 +1,430 @@ +import { address, array, bool, bytes32, int128, string, uint256, uint8 } from '@subsquid/evm-codec' +import { func } from '../abi.support.js' +import type { FunctionArguments, FunctionReturn } from '../abi.support.js' + +/** exchange(int128,int128,uint256,uint256) */ +export const exchange = func('0x3df02124', { + i: int128, + j: int128, + _dx: uint256, + _min_dy: uint256, +}, uint256) +export type ExchangeParams = FunctionArguments +export type ExchangeReturn = FunctionReturn + +/** exchange(int128,int128,uint256,uint256,address) */ +export const exchange_1 = func('0xddc1f59d', { + i: int128, + j: int128, + _dx: uint256, + _min_dy: uint256, + _receiver: address, +}, uint256) +export type ExchangeParams_1 = FunctionArguments +export type ExchangeReturn_1 = FunctionReturn + +/** exchange_received(int128,int128,uint256,uint256) */ +export const exchange_received = func('0x7e3db030', { + i: int128, + j: int128, + _dx: uint256, + _min_dy: uint256, +}, uint256) +export type Exchange_receivedParams = FunctionArguments +export type Exchange_receivedReturn = FunctionReturn + +/** exchange_received(int128,int128,uint256,uint256,address) */ +export const exchange_received_1 = func('0xafb43012', { + i: int128, + j: int128, + _dx: uint256, + _min_dy: uint256, + _receiver: address, +}, uint256) +export type Exchange_receivedParams_1 = FunctionArguments +export type Exchange_receivedReturn_1 = FunctionReturn + +/** add_liquidity(uint256[],uint256) */ +export const add_liquidity = func('0xb72df5de', { + _amounts: array(uint256), + _min_mint_amount: uint256, +}, uint256) +export type Add_liquidityParams = FunctionArguments +export type Add_liquidityReturn = FunctionReturn + +/** add_liquidity(uint256[],uint256,address) */ +export const add_liquidity_1 = func('0xa7256d09', { + _amounts: array(uint256), + _min_mint_amount: uint256, + _receiver: address, +}, uint256) +export type Add_liquidityParams_1 = FunctionArguments +export type Add_liquidityReturn_1 = FunctionReturn + +/** remove_liquidity_one_coin(uint256,int128,uint256) */ +export const remove_liquidity_one_coin = func('0x1a4d01d2', { + _burn_amount: uint256, + i: int128, + _min_received: uint256, +}, uint256) +export type Remove_liquidity_one_coinParams = FunctionArguments +export type Remove_liquidity_one_coinReturn = FunctionReturn + +/** remove_liquidity_one_coin(uint256,int128,uint256,address) */ +export const remove_liquidity_one_coin_1 = func('0x081579a5', { + _burn_amount: uint256, + i: int128, + _min_received: uint256, + _receiver: address, +}, uint256) +export type Remove_liquidity_one_coinParams_1 = FunctionArguments +export type Remove_liquidity_one_coinReturn_1 = FunctionReturn + +/** remove_liquidity_imbalance(uint256[],uint256) */ +export const remove_liquidity_imbalance = func('0x7706db75', { + _amounts: array(uint256), + _max_burn_amount: uint256, +}, uint256) +export type Remove_liquidity_imbalanceParams = FunctionArguments +export type Remove_liquidity_imbalanceReturn = FunctionReturn + +/** remove_liquidity_imbalance(uint256[],uint256,address) */ +export const remove_liquidity_imbalance_1 = func('0x4a6e32c6', { + _amounts: array(uint256), + _max_burn_amount: uint256, + _receiver: address, +}, uint256) +export type Remove_liquidity_imbalanceParams_1 = FunctionArguments +export type Remove_liquidity_imbalanceReturn_1 = FunctionReturn + +/** remove_liquidity(uint256,uint256[]) */ +export const remove_liquidity = func('0xd40ddb8c', { + _burn_amount: uint256, + _min_amounts: array(uint256), +}, array(uint256)) +export type Remove_liquidityParams = FunctionArguments +export type Remove_liquidityReturn = FunctionReturn + +/** remove_liquidity(uint256,uint256[],address) */ +export const remove_liquidity_1 = func('0x5e604cd2', { + _burn_amount: uint256, + _min_amounts: array(uint256), + _receiver: address, +}, array(uint256)) +export type Remove_liquidityParams_1 = FunctionArguments +export type Remove_liquidityReturn_1 = FunctionReturn + +/** remove_liquidity(uint256,uint256[],address,bool) */ +export const remove_liquidity_2 = func('0x2969e04a', { + _burn_amount: uint256, + _min_amounts: array(uint256), + _receiver: address, + _claim_admin_fees: bool, +}, array(uint256)) +export type Remove_liquidityParams_2 = FunctionArguments +export type Remove_liquidityReturn_2 = FunctionReturn + +/** withdraw_admin_fees() */ +export const withdraw_admin_fees = func('0x30c54085', {}) +export type Withdraw_admin_feesParams = FunctionArguments +export type Withdraw_admin_feesReturn = FunctionReturn + +/** last_price(uint256) */ +export const last_price = func('0x3931ab52', { + i: uint256, +}, uint256) +export type Last_priceParams = FunctionArguments +export type Last_priceReturn = FunctionReturn + +/** ema_price(uint256) */ +export const ema_price = func('0x90d20837', { + i: uint256, +}, uint256) +export type Ema_priceParams = FunctionArguments +export type Ema_priceReturn = FunctionReturn + +/** get_p(uint256) */ +export const get_p = func('0xec023862', { + i: uint256, +}, uint256) +export type Get_pParams = FunctionArguments +export type Get_pReturn = FunctionReturn + +/** price_oracle(uint256) */ +export const price_oracle = func('0x68727653', { + i: uint256, +}, uint256) +export type Price_oracleParams = FunctionArguments +export type Price_oracleReturn = FunctionReturn + +/** D_oracle() */ +export const D_oracle = func('0x907a016b', {}, uint256) +export type D_oracleParams = FunctionArguments +export type D_oracleReturn = FunctionReturn + +/** transfer(address,uint256) */ +export const transfer = func('0xa9059cbb', { + _to: address, + _value: uint256, +}, bool) +export type TransferParams = FunctionArguments +export type TransferReturn = FunctionReturn + +/** transferFrom(address,address,uint256) */ +export const transferFrom = func('0x23b872dd', { + _from: address, + _to: address, + _value: uint256, +}, bool) +export type TransferFromParams = FunctionArguments +export type TransferFromReturn = FunctionReturn + +/** approve(address,uint256) */ +export const approve = func('0x095ea7b3', { + _spender: address, + _value: uint256, +}, bool) +export type ApproveParams = FunctionArguments +export type ApproveReturn = FunctionReturn + +/** permit(address,address,uint256,uint256,uint8,bytes32,bytes32) */ +export const permit = func('0xd505accf', { + _owner: address, + _spender: address, + _value: uint256, + _deadline: uint256, + _v: uint8, + _r: bytes32, + _s: bytes32, +}, bool) +export type PermitParams = FunctionArguments +export type PermitReturn = FunctionReturn + +/** DOMAIN_SEPARATOR() */ +export const DOMAIN_SEPARATOR = func('0x3644e515', {}, bytes32) +export type DOMAIN_SEPARATORParams = FunctionArguments +export type DOMAIN_SEPARATORReturn = FunctionReturn + +/** get_dx(int128,int128,uint256) */ +export const get_dx = func('0x67df02ca', { + i: int128, + j: int128, + dy: uint256, +}, uint256) +export type Get_dxParams = FunctionArguments +export type Get_dxReturn = FunctionReturn + +/** get_dy(int128,int128,uint256) */ +export const get_dy = func('0x5e0d443f', { + i: int128, + j: int128, + dx: uint256, +}, uint256) +export type Get_dyParams = FunctionArguments +export type Get_dyReturn = FunctionReturn + +/** calc_withdraw_one_coin(uint256,int128) */ +export const calc_withdraw_one_coin = func('0xcc2b27d7', { + _burn_amount: uint256, + i: int128, +}, uint256) +export type Calc_withdraw_one_coinParams = FunctionArguments +export type Calc_withdraw_one_coinReturn = FunctionReturn + +/** totalSupply() */ +export const totalSupply = func('0x18160ddd', {}, uint256) +export type TotalSupplyParams = FunctionArguments +export type TotalSupplyReturn = FunctionReturn + +/** get_virtual_price() */ +export const get_virtual_price = func('0xbb7b8b80', {}, uint256) +export type Get_virtual_priceParams = FunctionArguments +export type Get_virtual_priceReturn = FunctionReturn + +/** calc_token_amount(uint256[],bool) */ +export const calc_token_amount = func('0x3db06dd8', { + _amounts: array(uint256), + _is_deposit: bool, +}, uint256) +export type Calc_token_amountParams = FunctionArguments +export type Calc_token_amountReturn = FunctionReturn + +/** A() */ +export const A = func('0xf446c1d0', {}, uint256) +export type AParams = FunctionArguments +export type AReturn = FunctionReturn + +/** A_precise() */ +export const A_precise = func('0x76a2f0f0', {}, uint256) +export type A_preciseParams = FunctionArguments +export type A_preciseReturn = FunctionReturn + +/** balances(uint256) */ +export const balances = func('0x4903b0d1', { + i: uint256, +}, uint256) +export type BalancesParams = FunctionArguments +export type BalancesReturn = FunctionReturn + +/** get_balances() */ +export const get_balances = func('0x14f05979', {}, array(uint256)) +export type Get_balancesParams = FunctionArguments +export type Get_balancesReturn = FunctionReturn + +/** stored_rates() */ +export const stored_rates = func('0xfd0684b1', {}, array(uint256)) +export type Stored_ratesParams = FunctionArguments +export type Stored_ratesReturn = FunctionReturn + +/** dynamic_fee(int128,int128) */ +export const dynamic_fee = func('0x76a9cd3e', { + i: int128, + j: int128, +}, uint256) +export type Dynamic_feeParams = FunctionArguments +export type Dynamic_feeReturn = FunctionReturn + +/** ramp_A(uint256,uint256) */ +export const ramp_A = func('0x3c157e64', { + _future_A: uint256, + _future_time: uint256, +}) +export type Ramp_AParams = FunctionArguments +export type Ramp_AReturn = FunctionReturn + +/** stop_ramp_A() */ +export const stop_ramp_A = func('0x551a6588', {}) +export type Stop_ramp_AParams = FunctionArguments +export type Stop_ramp_AReturn = FunctionReturn + +/** set_new_fee(uint256,uint256) */ +export const set_new_fee = func('0x015c2838', { + _new_fee: uint256, + _new_offpeg_fee_multiplier: uint256, +}) +export type Set_new_feeParams = FunctionArguments +export type Set_new_feeReturn = FunctionReturn + +/** set_ma_exp_time(uint256,uint256) */ +export const set_ma_exp_time = func('0x65bbea6b', { + _ma_exp_time: uint256, + _D_ma_time: uint256, +}) +export type Set_ma_exp_timeParams = FunctionArguments +export type Set_ma_exp_timeReturn = FunctionReturn + +/** N_COINS() */ +export const N_COINS = func('0x29357750', {}, uint256) +export type N_COINSParams = FunctionArguments +export type N_COINSReturn = FunctionReturn + +/** coins(uint256) */ +export const coins = func('0xc6610657', { + arg0: uint256, +}, address) +export type CoinsParams = FunctionArguments +export type CoinsReturn = FunctionReturn + +/** fee() */ +export const fee = func('0xddca3f43', {}, uint256) +export type FeeParams = FunctionArguments +export type FeeReturn = FunctionReturn + +/** offpeg_fee_multiplier() */ +export const offpeg_fee_multiplier = func('0x8edfdd5f', {}, uint256) +export type Offpeg_fee_multiplierParams = FunctionArguments +export type Offpeg_fee_multiplierReturn = FunctionReturn + +/** admin_fee() */ +export const admin_fee = func('0xfee3f7f9', {}, uint256) +export type Admin_feeParams = FunctionArguments +export type Admin_feeReturn = FunctionReturn + +/** initial_A() */ +export const initial_A = func('0x5409491a', {}, uint256) +export type Initial_AParams = FunctionArguments +export type Initial_AReturn = FunctionReturn + +/** future_A() */ +export const future_A = func('0xb4b577ad', {}, uint256) +export type Future_AParams = FunctionArguments +export type Future_AReturn = FunctionReturn + +/** initial_A_time() */ +export const initial_A_time = func('0x2081066c', {}, uint256) +export type Initial_A_timeParams = FunctionArguments +export type Initial_A_timeReturn = FunctionReturn + +/** future_A_time() */ +export const future_A_time = func('0x14052288', {}, uint256) +export type Future_A_timeParams = FunctionArguments +export type Future_A_timeReturn = FunctionReturn + +/** admin_balances(uint256) */ +export const admin_balances = func('0xe2e7d264', { + arg0: uint256, +}, uint256) +export type Admin_balancesParams = FunctionArguments +export type Admin_balancesReturn = FunctionReturn + +/** ma_exp_time() */ +export const ma_exp_time = func('0x1be913a5', {}, uint256) +export type Ma_exp_timeParams = FunctionArguments +export type Ma_exp_timeReturn = FunctionReturn + +/** D_ma_time() */ +export const D_ma_time = func('0x9c4258c4', {}, uint256) +export type D_ma_timeParams = FunctionArguments +export type D_ma_timeReturn = FunctionReturn + +/** ma_last_time() */ +export const ma_last_time = func('0x1ddc3b01', {}, uint256) +export type Ma_last_timeParams = FunctionArguments +export type Ma_last_timeReturn = FunctionReturn + +/** name() */ +export const name = func('0x06fdde03', {}, string) +export type NameParams = FunctionArguments +export type NameReturn = FunctionReturn + +/** symbol() */ +export const symbol = func('0x95d89b41', {}, string) +export type SymbolParams = FunctionArguments +export type SymbolReturn = FunctionReturn + +/** decimals() */ +export const decimals = func('0x313ce567', {}, uint8) +export type DecimalsParams = FunctionArguments +export type DecimalsReturn = FunctionReturn + +/** version() */ +export const version = func('0x54fd4d50', {}, string) +export type VersionParams = FunctionArguments +export type VersionReturn = FunctionReturn + +/** balanceOf(address) */ +export const balanceOf = func('0x70a08231', { + arg0: address, +}, uint256) +export type BalanceOfParams = FunctionArguments +export type BalanceOfReturn = FunctionReturn + +/** allowance(address,address) */ +export const allowance = func('0xdd62ed3e', { + arg0: address, + arg1: address, +}, uint256) +export type AllowanceParams = FunctionArguments +export type AllowanceReturn = FunctionReturn + +/** nonces(address) */ +export const nonces = func('0x7ecebe00', { + arg0: address, +}, uint256) +export type NoncesParams = FunctionArguments +export type NoncesReturn = FunctionReturn + +/** salt() */ +export const salt = func('0xbfa0b133', {}, bytes32) +export type SaltParams = FunctionArguments +export type SaltReturn = FunctionReturn diff --git a/src/abi/curve-stable-swap-ng/index.ts b/src/abi/curve-stable-swap-ng/index.ts new file mode 100644 index 00000000..11829d6e --- /dev/null +++ b/src/abi/curve-stable-swap-ng/index.ts @@ -0,0 +1,4 @@ +export * as events from './events.js' +export * as functions from './functions.js' + +export { Contract } from './contract.js' diff --git a/src/abi/curve-tricrypto-factory.ts b/src/abi/curve-tricrypto-factory.ts deleted file mode 100644 index baaae988..00000000 --- a/src/abi/curve-tricrypto-factory.ts +++ /dev/null @@ -1,204 +0,0 @@ -import * as p from '@subsquid/evm-codec' -import { event, fun, viewFun, indexed, ContractBase } from '@subsquid/evm-abi' -import type { EventParams as EParams, FunctionArguments, FunctionReturn } from '@subsquid/evm-abi' - -export const events = { - TricryptoPoolDeployed: event("0xa307f5d0802489baddec443058a63ce115756de9020e2b07d3e2cd2f21269e2a", "TricryptoPoolDeployed(address,string,string,address,address[3],address,bytes32,uint256,uint256,uint256,uint256,uint256,address)", {"pool": p.address, "name": p.string, "symbol": p.string, "weth": p.address, "coins": p.fixedSizeArray(p.address, 3), "math": p.address, "salt": p.bytes32, "packed_precisions": p.uint256, "packed_A_gamma": p.uint256, "packed_fee_params": p.uint256, "packed_rebalancing_params": p.uint256, "packed_prices": p.uint256, "deployer": p.address}), - LiquidityGaugeDeployed: event("0x656bb34c20491970a8c163f3bd62ead82022b379c3924960ec60f6dbfc5aab3b", "LiquidityGaugeDeployed(address,address)", {"pool": p.address, "gauge": p.address}), - UpdateFeeReceiver: event("0x2861448678f0be67f11bfb5481b3e3b4cfeb3acc6126ad60a05f95bfc6530666", "UpdateFeeReceiver(address,address)", {"_old_fee_receiver": p.address, "_new_fee_receiver": p.address}), - UpdatePoolImplementation: event("0x6a42ef9605e135afaf6ae4f3683b161a3b7369d07c9d52c701ab69553e04c3b6", "UpdatePoolImplementation(uint256,address,address)", {"_implemention_id": p.uint256, "_old_pool_implementation": p.address, "_new_pool_implementation": p.address}), - UpdateGaugeImplementation: event("0x1fd705f9c77053962a503f2f2f57f0862b4c3af687c25615c13817a86946c359", "UpdateGaugeImplementation(address,address)", {"_old_gauge_implementation": p.address, "_new_gauge_implementation": p.address}), - UpdateMathImplementation: event("0x68fe8fc3ac76ec17e21117df5e854c8c25b7b5f776aad2adc927fdd156bcd6de", "UpdateMathImplementation(address,address)", {"_old_math_implementation": p.address, "_new_math_implementation": p.address}), - UpdateViewsImplementation: event("0xd84eb1ea70cda40a6bfaa11f4f69efa10cbc5eb82760b3058f440512ec1d6d1f", "UpdateViewsImplementation(address,address)", {"_old_views_implementation": p.address, "_new_views_implementation": p.address}), - TransferOwnership: event("0x5c486528ec3e3f0ea91181cff8116f02bfa350e03b8b6f12e00765adbb5af85c", "TransferOwnership(address,address)", {"_old_owner": p.address, "_new_owner": p.address}), -} - -export const functions = { - deploy_pool: fun("0xaa38b385", "deploy_pool(string,string,address[3],address,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256[2])", {"_name": p.string, "_symbol": p.string, "_coins": p.fixedSizeArray(p.address, 3), "_weth": p.address, "implementation_id": p.uint256, "A": p.uint256, "gamma": p.uint256, "mid_fee": p.uint256, "out_fee": p.uint256, "fee_gamma": p.uint256, "allowed_extra_profit": p.uint256, "adjustment_step": p.uint256, "ma_exp_time": p.uint256, "initial_prices": p.fixedSizeArray(p.uint256, 2)}, p.address), - deploy_gauge: fun("0x96bebb34", "deploy_gauge(address)", {"_pool": p.address}, p.address), - set_fee_receiver: fun("0xe41ab771", "set_fee_receiver(address)", {"_fee_receiver": p.address}, ), - set_pool_implementation: fun("0x6f385ff6", "set_pool_implementation(address,uint256)", {"_pool_implementation": p.address, "_implementation_index": p.uint256}, ), - set_gauge_implementation: fun("0x8f03182c", "set_gauge_implementation(address)", {"_gauge_implementation": p.address}, ), - set_views_implementation: fun("0xf6fa937f", "set_views_implementation(address)", {"_views_implementation": p.address}, ), - set_math_implementation: fun("0xb07426f4", "set_math_implementation(address)", {"_math_implementation": p.address}, ), - commit_transfer_ownership: fun("0x6b441a40", "commit_transfer_ownership(address)", {"_addr": p.address}, ), - accept_transfer_ownership: fun("0xe5ea47b8", "accept_transfer_ownership()", {}, ), - 'find_pool_for_coins(address,address)': viewFun("0xa87df06c", "find_pool_for_coins(address,address)", {"_from": p.address, "_to": p.address}, p.address), - 'find_pool_for_coins(address,address,uint256)': viewFun("0x6982eb0b", "find_pool_for_coins(address,address,uint256)", {"_from": p.address, "_to": p.address, "i": p.uint256}, p.address), - get_coins: viewFun("0x9ac90d3d", "get_coins(address)", {"_pool": p.address}, p.fixedSizeArray(p.address, 3)), - get_decimals: viewFun("0x52b51555", "get_decimals(address)", {"_pool": p.address}, p.fixedSizeArray(p.uint256, 3)), - get_balances: viewFun("0x92e3cc2d", "get_balances(address)", {"_pool": p.address}, p.fixedSizeArray(p.uint256, 3)), - get_coin_indices: viewFun("0xeb85226d", "get_coin_indices(address,address,address)", {"_pool": p.address, "_from": p.address, "_to": p.address}, {"_0": p.uint256, "_1": p.uint256}), - get_gauge: viewFun("0xdaf297b9", "get_gauge(address)", {"_pool": p.address}, p.address), - get_market_counts: viewFun("0xc1856b52", "get_market_counts(address,address)", {"coin_a": p.address, "coin_b": p.address}, p.uint256), - admin: viewFun("0xf851a440", "admin()", {}, p.address), - future_admin: viewFun("0x17f7182a", "future_admin()", {}, p.address), - fee_receiver: viewFun("0xcab4d3db", "fee_receiver()", {}, p.address), - pool_implementations: viewFun("0x3273ff47", "pool_implementations(uint256)", {"arg0": p.uint256}, p.address), - gauge_implementation: viewFun("0x8df24207", "gauge_implementation()", {}, p.address), - views_implementation: viewFun("0xe31593d8", "views_implementation()", {}, p.address), - math_implementation: viewFun("0xa13c8f81", "math_implementation()", {}, p.address), - pool_count: viewFun("0x956aae3a", "pool_count()", {}, p.uint256), - pool_list: viewFun("0x3a1d5d8e", "pool_list(uint256)", {"arg0": p.uint256}, p.address), -} - -export class Contract extends ContractBase { - - 'find_pool_for_coins(address,address)'(_from: Find_pool_for_coinsParams_0["_from"], _to: Find_pool_for_coinsParams_0["_to"]) { - return this.eth_call(functions['find_pool_for_coins(address,address)'], {_from, _to}) - } - - 'find_pool_for_coins(address,address,uint256)'(_from: Find_pool_for_coinsParams_1["_from"], _to: Find_pool_for_coinsParams_1["_to"], i: Find_pool_for_coinsParams_1["i"]) { - return this.eth_call(functions['find_pool_for_coins(address,address,uint256)'], {_from, _to, i}) - } - - get_coins(_pool: Get_coinsParams["_pool"]) { - return this.eth_call(functions.get_coins, {_pool}) - } - - get_decimals(_pool: Get_decimalsParams["_pool"]) { - return this.eth_call(functions.get_decimals, {_pool}) - } - - get_balances(_pool: Get_balancesParams["_pool"]) { - return this.eth_call(functions.get_balances, {_pool}) - } - - get_coin_indices(_pool: Get_coin_indicesParams["_pool"], _from: Get_coin_indicesParams["_from"], _to: Get_coin_indicesParams["_to"]) { - return this.eth_call(functions.get_coin_indices, {_pool, _from, _to}) - } - - get_gauge(_pool: Get_gaugeParams["_pool"]) { - return this.eth_call(functions.get_gauge, {_pool}) - } - - get_market_counts(coin_a: Get_market_countsParams["coin_a"], coin_b: Get_market_countsParams["coin_b"]) { - return this.eth_call(functions.get_market_counts, {coin_a, coin_b}) - } - - admin() { - return this.eth_call(functions.admin, {}) - } - - future_admin() { - return this.eth_call(functions.future_admin, {}) - } - - fee_receiver() { - return this.eth_call(functions.fee_receiver, {}) - } - - pool_implementations(arg0: Pool_implementationsParams["arg0"]) { - return this.eth_call(functions.pool_implementations, {arg0}) - } - - gauge_implementation() { - return this.eth_call(functions.gauge_implementation, {}) - } - - views_implementation() { - return this.eth_call(functions.views_implementation, {}) - } - - math_implementation() { - return this.eth_call(functions.math_implementation, {}) - } - - pool_count() { - return this.eth_call(functions.pool_count, {}) - } - - pool_list(arg0: Pool_listParams["arg0"]) { - return this.eth_call(functions.pool_list, {arg0}) - } -} - -/// Event types -export type TricryptoPoolDeployedEventArgs = EParams -export type LiquidityGaugeDeployedEventArgs = EParams -export type UpdateFeeReceiverEventArgs = EParams -export type UpdatePoolImplementationEventArgs = EParams -export type UpdateGaugeImplementationEventArgs = EParams -export type UpdateMathImplementationEventArgs = EParams -export type UpdateViewsImplementationEventArgs = EParams -export type TransferOwnershipEventArgs = EParams - -/// Function types -export type Deploy_poolParams = FunctionArguments -export type Deploy_poolReturn = FunctionReturn - -export type Deploy_gaugeParams = FunctionArguments -export type Deploy_gaugeReturn = FunctionReturn - -export type Set_fee_receiverParams = FunctionArguments -export type Set_fee_receiverReturn = FunctionReturn - -export type Set_pool_implementationParams = FunctionArguments -export type Set_pool_implementationReturn = FunctionReturn - -export type Set_gauge_implementationParams = FunctionArguments -export type Set_gauge_implementationReturn = FunctionReturn - -export type Set_views_implementationParams = FunctionArguments -export type Set_views_implementationReturn = FunctionReturn - -export type Set_math_implementationParams = FunctionArguments -export type Set_math_implementationReturn = FunctionReturn - -export type Commit_transfer_ownershipParams = FunctionArguments -export type Commit_transfer_ownershipReturn = FunctionReturn - -export type Accept_transfer_ownershipParams = FunctionArguments -export type Accept_transfer_ownershipReturn = FunctionReturn - -export type Find_pool_for_coinsParams_0 = FunctionArguments -export type Find_pool_for_coinsReturn_0 = FunctionReturn - -export type Find_pool_for_coinsParams_1 = FunctionArguments -export type Find_pool_for_coinsReturn_1 = FunctionReturn - -export type Get_coinsParams = FunctionArguments -export type Get_coinsReturn = FunctionReturn - -export type Get_decimalsParams = FunctionArguments -export type Get_decimalsReturn = FunctionReturn - -export type Get_balancesParams = FunctionArguments -export type Get_balancesReturn = FunctionReturn - -export type Get_coin_indicesParams = FunctionArguments -export type Get_coin_indicesReturn = FunctionReturn - -export type Get_gaugeParams = FunctionArguments -export type Get_gaugeReturn = FunctionReturn - -export type Get_market_countsParams = FunctionArguments -export type Get_market_countsReturn = FunctionReturn - -export type AdminParams = FunctionArguments -export type AdminReturn = FunctionReturn - -export type Future_adminParams = FunctionArguments -export type Future_adminReturn = FunctionReturn - -export type Fee_receiverParams = FunctionArguments -export type Fee_receiverReturn = FunctionReturn - -export type Pool_implementationsParams = FunctionArguments -export type Pool_implementationsReturn = FunctionReturn - -export type Gauge_implementationParams = FunctionArguments -export type Gauge_implementationReturn = FunctionReturn - -export type Views_implementationParams = FunctionArguments -export type Views_implementationReturn = FunctionReturn - -export type Math_implementationParams = FunctionArguments -export type Math_implementationReturn = FunctionReturn - -export type Pool_countParams = FunctionArguments -export type Pool_countReturn = FunctionReturn - -export type Pool_listParams = FunctionArguments -export type Pool_listReturn = FunctionReturn - diff --git a/src/abi/curve-tricrypto-factory/contract.ts b/src/abi/curve-tricrypto-factory/contract.ts new file mode 100644 index 00000000..296d0cd1 --- /dev/null +++ b/src/abi/curve-tricrypto-factory/contract.ts @@ -0,0 +1,81 @@ +import { ContractBase } from '../abi.support.js' +import { admin, deploy_gauge, deploy_pool, fee_receiver, find_pool_for_coins, find_pool_for_coins_1, future_admin, gauge_implementation, get_balances, get_coin_indices, get_coins, get_decimals, get_gauge, get_market_counts, math_implementation, pool_count, pool_implementations, pool_list, views_implementation } from './functions.js' +import type { Deploy_gaugeParams, Deploy_poolParams, Find_pool_for_coinsParams, Find_pool_for_coinsParams_1, Get_balancesParams, Get_coin_indicesParams, Get_coinsParams, Get_decimalsParams, Get_gaugeParams, Get_market_countsParams, Pool_implementationsParams, Pool_listParams } from './functions.js' + +export class Contract extends ContractBase { + deploy_pool(_name: Deploy_poolParams["_name"], _symbol: Deploy_poolParams["_symbol"], _coins: Deploy_poolParams["_coins"], _weth: Deploy_poolParams["_weth"], implementation_id: Deploy_poolParams["implementation_id"], A: Deploy_poolParams["A"], gamma: Deploy_poolParams["gamma"], mid_fee: Deploy_poolParams["mid_fee"], out_fee: Deploy_poolParams["out_fee"], fee_gamma: Deploy_poolParams["fee_gamma"], allowed_extra_profit: Deploy_poolParams["allowed_extra_profit"], adjustment_step: Deploy_poolParams["adjustment_step"], ma_exp_time: Deploy_poolParams["ma_exp_time"], initial_prices: Deploy_poolParams["initial_prices"]) { + return this.eth_call(deploy_pool, {_name, _symbol, _coins, _weth, implementation_id, A, gamma, mid_fee, out_fee, fee_gamma, allowed_extra_profit, adjustment_step, ma_exp_time, initial_prices}) + } + + deploy_gauge(_pool: Deploy_gaugeParams["_pool"]) { + return this.eth_call(deploy_gauge, {_pool}) + } + + find_pool_for_coins(_from: Find_pool_for_coinsParams["_from"], _to: Find_pool_for_coinsParams["_to"]) { + return this.eth_call(find_pool_for_coins, {_from, _to}) + } + + find_pool_for_coins_1(_from: Find_pool_for_coinsParams_1["_from"], _to: Find_pool_for_coinsParams_1["_to"], i: Find_pool_for_coinsParams_1["i"]) { + return this.eth_call(find_pool_for_coins_1, {_from, _to, i}) + } + + get_coins(_pool: Get_coinsParams["_pool"]) { + return this.eth_call(get_coins, {_pool}) + } + + get_decimals(_pool: Get_decimalsParams["_pool"]) { + return this.eth_call(get_decimals, {_pool}) + } + + get_balances(_pool: Get_balancesParams["_pool"]) { + return this.eth_call(get_balances, {_pool}) + } + + get_coin_indices(_pool: Get_coin_indicesParams["_pool"], _from: Get_coin_indicesParams["_from"], _to: Get_coin_indicesParams["_to"]) { + return this.eth_call(get_coin_indices, {_pool, _from, _to}) + } + + get_gauge(_pool: Get_gaugeParams["_pool"]) { + return this.eth_call(get_gauge, {_pool}) + } + + get_market_counts(coin_a: Get_market_countsParams["coin_a"], coin_b: Get_market_countsParams["coin_b"]) { + return this.eth_call(get_market_counts, {coin_a, coin_b}) + } + + admin() { + return this.eth_call(admin, {}) + } + + future_admin() { + return this.eth_call(future_admin, {}) + } + + fee_receiver() { + return this.eth_call(fee_receiver, {}) + } + + pool_implementations(arg0: Pool_implementationsParams["arg0"]) { + return this.eth_call(pool_implementations, {arg0}) + } + + gauge_implementation() { + return this.eth_call(gauge_implementation, {}) + } + + views_implementation() { + return this.eth_call(views_implementation, {}) + } + + math_implementation() { + return this.eth_call(math_implementation, {}) + } + + pool_count() { + return this.eth_call(pool_count, {}) + } + + pool_list(arg0: Pool_listParams["arg0"]) { + return this.eth_call(pool_list, {arg0}) + } +} diff --git a/src/abi/curve-tricrypto-factory/events.ts b/src/abi/curve-tricrypto-factory/events.ts new file mode 100644 index 00000000..0f3dd1b5 --- /dev/null +++ b/src/abi/curve-tricrypto-factory/events.ts @@ -0,0 +1,71 @@ +import { address, bytes32, fixedSizeArray, string, uint256 } from '@subsquid/evm-codec' +import { event } from '../abi.support.js' +import type { EventParams as EParams } from '../abi.support.js' + +/** TricryptoPoolDeployed(address,string,string,address,address[3],address,bytes32,uint256,uint256,uint256,uint256,uint256,address) */ +export const TricryptoPoolDeployed = event('0xa307f5d0802489baddec443058a63ce115756de9020e2b07d3e2cd2f21269e2a', { + pool: address, + name: string, + symbol: string, + weth: address, + coins: fixedSizeArray(address, 3), + math: address, + salt: bytes32, + packed_precisions: uint256, + packed_A_gamma: uint256, + packed_fee_params: uint256, + packed_rebalancing_params: uint256, + packed_prices: uint256, + deployer: address, +}) +export type TricryptoPoolDeployedEventArgs = EParams + +/** LiquidityGaugeDeployed(address,address) */ +export const LiquidityGaugeDeployed = event('0x656bb34c20491970a8c163f3bd62ead82022b379c3924960ec60f6dbfc5aab3b', { + pool: address, + gauge: address, +}) +export type LiquidityGaugeDeployedEventArgs = EParams + +/** UpdateFeeReceiver(address,address) */ +export const UpdateFeeReceiver = event('0x2861448678f0be67f11bfb5481b3e3b4cfeb3acc6126ad60a05f95bfc6530666', { + _old_fee_receiver: address, + _new_fee_receiver: address, +}) +export type UpdateFeeReceiverEventArgs = EParams + +/** UpdatePoolImplementation(uint256,address,address) */ +export const UpdatePoolImplementation = event('0x6a42ef9605e135afaf6ae4f3683b161a3b7369d07c9d52c701ab69553e04c3b6', { + _implemention_id: uint256, + _old_pool_implementation: address, + _new_pool_implementation: address, +}) +export type UpdatePoolImplementationEventArgs = EParams + +/** UpdateGaugeImplementation(address,address) */ +export const UpdateGaugeImplementation = event('0x1fd705f9c77053962a503f2f2f57f0862b4c3af687c25615c13817a86946c359', { + _old_gauge_implementation: address, + _new_gauge_implementation: address, +}) +export type UpdateGaugeImplementationEventArgs = EParams + +/** UpdateMathImplementation(address,address) */ +export const UpdateMathImplementation = event('0x68fe8fc3ac76ec17e21117df5e854c8c25b7b5f776aad2adc927fdd156bcd6de', { + _old_math_implementation: address, + _new_math_implementation: address, +}) +export type UpdateMathImplementationEventArgs = EParams + +/** UpdateViewsImplementation(address,address) */ +export const UpdateViewsImplementation = event('0xd84eb1ea70cda40a6bfaa11f4f69efa10cbc5eb82760b3058f440512ec1d6d1f', { + _old_views_implementation: address, + _new_views_implementation: address, +}) +export type UpdateViewsImplementationEventArgs = EParams + +/** TransferOwnership(address,address) */ +export const TransferOwnership = event('0x5c486528ec3e3f0ea91181cff8116f02bfa350e03b8b6f12e00765adbb5af85c', { + _old_owner: address, + _new_owner: address, +}) +export type TransferOwnershipEventArgs = EParams diff --git a/src/abi/curve-tricrypto-factory/functions.ts b/src/abi/curve-tricrypto-factory/functions.ts new file mode 100644 index 00000000..28da7115 --- /dev/null +++ b/src/abi/curve-tricrypto-factory/functions.ts @@ -0,0 +1,192 @@ +import { address, fixedSizeArray, string, struct, uint256 } from '@subsquid/evm-codec' +import { func } from '../abi.support.js' +import type { FunctionArguments, FunctionReturn } from '../abi.support.js' + +/** deploy_pool(string,string,address[3],address,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256[2]) */ +export const deploy_pool = func('0xaa38b385', { + _name: string, + _symbol: string, + _coins: fixedSizeArray(address, 3), + _weth: address, + implementation_id: uint256, + A: uint256, + gamma: uint256, + mid_fee: uint256, + out_fee: uint256, + fee_gamma: uint256, + allowed_extra_profit: uint256, + adjustment_step: uint256, + ma_exp_time: uint256, + initial_prices: fixedSizeArray(uint256, 2), +}, address) +export type Deploy_poolParams = FunctionArguments +export type Deploy_poolReturn = FunctionReturn + +/** deploy_gauge(address) */ +export const deploy_gauge = func('0x96bebb34', { + _pool: address, +}, address) +export type Deploy_gaugeParams = FunctionArguments +export type Deploy_gaugeReturn = FunctionReturn + +/** set_fee_receiver(address) */ +export const set_fee_receiver = func('0xe41ab771', { + _fee_receiver: address, +}) +export type Set_fee_receiverParams = FunctionArguments +export type Set_fee_receiverReturn = FunctionReturn + +/** set_pool_implementation(address,uint256) */ +export const set_pool_implementation = func('0x6f385ff6', { + _pool_implementation: address, + _implementation_index: uint256, +}) +export type Set_pool_implementationParams = FunctionArguments +export type Set_pool_implementationReturn = FunctionReturn + +/** set_gauge_implementation(address) */ +export const set_gauge_implementation = func('0x8f03182c', { + _gauge_implementation: address, +}) +export type Set_gauge_implementationParams = FunctionArguments +export type Set_gauge_implementationReturn = FunctionReturn + +/** set_views_implementation(address) */ +export const set_views_implementation = func('0xf6fa937f', { + _views_implementation: address, +}) +export type Set_views_implementationParams = FunctionArguments +export type Set_views_implementationReturn = FunctionReturn + +/** set_math_implementation(address) */ +export const set_math_implementation = func('0xb07426f4', { + _math_implementation: address, +}) +export type Set_math_implementationParams = FunctionArguments +export type Set_math_implementationReturn = FunctionReturn + +/** commit_transfer_ownership(address) */ +export const commit_transfer_ownership = func('0x6b441a40', { + _addr: address, +}) +export type Commit_transfer_ownershipParams = FunctionArguments +export type Commit_transfer_ownershipReturn = FunctionReturn + +/** accept_transfer_ownership() */ +export const accept_transfer_ownership = func('0xe5ea47b8', {}) +export type Accept_transfer_ownershipParams = FunctionArguments +export type Accept_transfer_ownershipReturn = FunctionReturn + +/** find_pool_for_coins(address,address) */ +export const find_pool_for_coins = func('0xa87df06c', { + _from: address, + _to: address, +}, address) +export type Find_pool_for_coinsParams = FunctionArguments +export type Find_pool_for_coinsReturn = FunctionReturn + +/** find_pool_for_coins(address,address,uint256) */ +export const find_pool_for_coins_1 = func('0x6982eb0b', { + _from: address, + _to: address, + i: uint256, +}, address) +export type Find_pool_for_coinsParams_1 = FunctionArguments +export type Find_pool_for_coinsReturn_1 = FunctionReturn + +/** get_coins(address) */ +export const get_coins = func('0x9ac90d3d', { + _pool: address, +}, fixedSizeArray(address, 3)) +export type Get_coinsParams = FunctionArguments +export type Get_coinsReturn = FunctionReturn + +/** get_decimals(address) */ +export const get_decimals = func('0x52b51555', { + _pool: address, +}, fixedSizeArray(uint256, 3)) +export type Get_decimalsParams = FunctionArguments +export type Get_decimalsReturn = FunctionReturn + +/** get_balances(address) */ +export const get_balances = func('0x92e3cc2d', { + _pool: address, +}, fixedSizeArray(uint256, 3)) +export type Get_balancesParams = FunctionArguments +export type Get_balancesReturn = FunctionReturn + +/** get_coin_indices(address,address,address) */ +export const get_coin_indices = func('0xeb85226d', { + _pool: address, + _from: address, + _to: address, +}, struct({ + _0: uint256, + _1: uint256, +})) +export type Get_coin_indicesParams = FunctionArguments +export type Get_coin_indicesReturn = FunctionReturn + +/** get_gauge(address) */ +export const get_gauge = func('0xdaf297b9', { + _pool: address, +}, address) +export type Get_gaugeParams = FunctionArguments +export type Get_gaugeReturn = FunctionReturn + +/** get_market_counts(address,address) */ +export const get_market_counts = func('0xc1856b52', { + coin_a: address, + coin_b: address, +}, uint256) +export type Get_market_countsParams = FunctionArguments +export type Get_market_countsReturn = FunctionReturn + +/** admin() */ +export const admin = func('0xf851a440', {}, address) +export type AdminParams = FunctionArguments +export type AdminReturn = FunctionReturn + +/** future_admin() */ +export const future_admin = func('0x17f7182a', {}, address) +export type Future_adminParams = FunctionArguments +export type Future_adminReturn = FunctionReturn + +/** fee_receiver() */ +export const fee_receiver = func('0xcab4d3db', {}, address) +export type Fee_receiverParams = FunctionArguments +export type Fee_receiverReturn = FunctionReturn + +/** pool_implementations(uint256) */ +export const pool_implementations = func('0x3273ff47', { + arg0: uint256, +}, address) +export type Pool_implementationsParams = FunctionArguments +export type Pool_implementationsReturn = FunctionReturn + +/** gauge_implementation() */ +export const gauge_implementation = func('0x8df24207', {}, address) +export type Gauge_implementationParams = FunctionArguments +export type Gauge_implementationReturn = FunctionReturn + +/** views_implementation() */ +export const views_implementation = func('0xe31593d8', {}, address) +export type Views_implementationParams = FunctionArguments +export type Views_implementationReturn = FunctionReturn + +/** math_implementation() */ +export const math_implementation = func('0xa13c8f81', {}, address) +export type Math_implementationParams = FunctionArguments +export type Math_implementationReturn = FunctionReturn + +/** pool_count() */ +export const pool_count = func('0x956aae3a', {}, uint256) +export type Pool_countParams = FunctionArguments +export type Pool_countReturn = FunctionReturn + +/** pool_list(uint256) */ +export const pool_list = func('0x3a1d5d8e', { + arg0: uint256, +}, address) +export type Pool_listParams = FunctionArguments +export type Pool_listReturn = FunctionReturn diff --git a/src/abi/curve-tricrypto-factory/index.ts b/src/abi/curve-tricrypto-factory/index.ts new file mode 100644 index 00000000..11829d6e --- /dev/null +++ b/src/abi/curve-tricrypto-factory/index.ts @@ -0,0 +1,4 @@ +export * as events from './events.js' +export * as functions from './functions.js' + +export { Contract } from './contract.js' diff --git a/src/abi/curve-twocrypto-factory.ts b/src/abi/curve-twocrypto-factory.ts deleted file mode 100644 index 9d60c742..00000000 --- a/src/abi/curve-twocrypto-factory.ts +++ /dev/null @@ -1,208 +0,0 @@ -import * as p from '@subsquid/evm-codec' -import { event, fun, viewFun, indexed, ContractBase } from '@subsquid/evm-abi' -import type { EventParams as EParams, FunctionArguments, FunctionReturn } from '@subsquid/evm-abi' - -export const events = { - TwocryptoPoolDeployed: event("0x8152a3037e3dc54154ad0d2cadb1cf7e1d1b9e2b625faa3dfb4fe03d609102ca", "TwocryptoPoolDeployed(address,string,string,address[2],address,bytes32,uint256[2],uint256,uint256,uint256,uint256,address)", {"pool": p.address, "name": p.string, "symbol": p.string, "coins": p.fixedSizeArray(p.address, 2), "math": p.address, "salt": p.bytes32, "precisions": p.fixedSizeArray(p.uint256, 2), "packed_A_gamma": p.uint256, "packed_fee_params": p.uint256, "packed_rebalancing_params": p.uint256, "packed_prices": p.uint256, "deployer": p.address}), - LiquidityGaugeDeployed: event("0x656bb34c20491970a8c163f3bd62ead82022b379c3924960ec60f6dbfc5aab3b", "LiquidityGaugeDeployed(address,address)", {"pool": p.address, "gauge": p.address}), - UpdateFeeReceiver: event("0x2861448678f0be67f11bfb5481b3e3b4cfeb3acc6126ad60a05f95bfc6530666", "UpdateFeeReceiver(address,address)", {"_old_fee_receiver": p.address, "_new_fee_receiver": p.address}), - UpdatePoolImplementation: event("0x6a42ef9605e135afaf6ae4f3683b161a3b7369d07c9d52c701ab69553e04c3b6", "UpdatePoolImplementation(uint256,address,address)", {"_implemention_id": p.uint256, "_old_pool_implementation": p.address, "_new_pool_implementation": p.address}), - UpdateGaugeImplementation: event("0x1fd705f9c77053962a503f2f2f57f0862b4c3af687c25615c13817a86946c359", "UpdateGaugeImplementation(address,address)", {"_old_gauge_implementation": p.address, "_new_gauge_implementation": p.address}), - UpdateMathImplementation: event("0x68fe8fc3ac76ec17e21117df5e854c8c25b7b5f776aad2adc927fdd156bcd6de", "UpdateMathImplementation(address,address)", {"_old_math_implementation": p.address, "_new_math_implementation": p.address}), - UpdateViewsImplementation: event("0xd84eb1ea70cda40a6bfaa11f4f69efa10cbc5eb82760b3058f440512ec1d6d1f", "UpdateViewsImplementation(address,address)", {"_old_views_implementation": p.address, "_new_views_implementation": p.address}), - TransferOwnership: event("0x5c486528ec3e3f0ea91181cff8116f02bfa350e03b8b6f12e00765adbb5af85c", "TransferOwnership(address,address)", {"_old_owner": p.address, "_new_owner": p.address}), -} - -export const functions = { - initialise_ownership: fun("0x45e62f85", "initialise_ownership(address,address)", {"_fee_receiver": p.address, "_admin": p.address}, ), - deploy_pool: fun("0xc955fa04", "deploy_pool(string,string,address[2],uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256)", {"_name": p.string, "_symbol": p.string, "_coins": p.fixedSizeArray(p.address, 2), "implementation_id": p.uint256, "A": p.uint256, "gamma": p.uint256, "mid_fee": p.uint256, "out_fee": p.uint256, "fee_gamma": p.uint256, "allowed_extra_profit": p.uint256, "adjustment_step": p.uint256, "ma_exp_time": p.uint256, "initial_price": p.uint256}, p.address), - deploy_gauge: fun("0x96bebb34", "deploy_gauge(address)", {"_pool": p.address}, p.address), - set_fee_receiver: fun("0xe41ab771", "set_fee_receiver(address)", {"_fee_receiver": p.address}, ), - set_pool_implementation: fun("0x6f385ff6", "set_pool_implementation(address,uint256)", {"_pool_implementation": p.address, "_implementation_index": p.uint256}, ), - set_gauge_implementation: fun("0x8f03182c", "set_gauge_implementation(address)", {"_gauge_implementation": p.address}, ), - set_views_implementation: fun("0xf6fa937f", "set_views_implementation(address)", {"_views_implementation": p.address}, ), - set_math_implementation: fun("0xb07426f4", "set_math_implementation(address)", {"_math_implementation": p.address}, ), - commit_transfer_ownership: fun("0x6b441a40", "commit_transfer_ownership(address)", {"_addr": p.address}, ), - accept_transfer_ownership: fun("0xe5ea47b8", "accept_transfer_ownership()", {}, ), - 'find_pool_for_coins(address,address)': viewFun("0xa87df06c", "find_pool_for_coins(address,address)", {"_from": p.address, "_to": p.address}, p.address), - 'find_pool_for_coins(address,address,uint256)': viewFun("0x6982eb0b", "find_pool_for_coins(address,address,uint256)", {"_from": p.address, "_to": p.address, "i": p.uint256}, p.address), - pool_count: viewFun("0x956aae3a", "pool_count()", {}, p.uint256), - get_coins: viewFun("0x9ac90d3d", "get_coins(address)", {"_pool": p.address}, p.fixedSizeArray(p.address, 2)), - get_decimals: viewFun("0x52b51555", "get_decimals(address)", {"_pool": p.address}, p.fixedSizeArray(p.uint256, 2)), - get_balances: viewFun("0x92e3cc2d", "get_balances(address)", {"_pool": p.address}, p.fixedSizeArray(p.uint256, 2)), - get_coin_indices: viewFun("0xeb85226d", "get_coin_indices(address,address,address)", {"_pool": p.address, "_from": p.address, "_to": p.address}, {"_0": p.uint256, "_1": p.uint256}), - get_gauge: viewFun("0xdaf297b9", "get_gauge(address)", {"_pool": p.address}, p.address), - get_market_counts: viewFun("0xc1856b52", "get_market_counts(address,address)", {"coin_a": p.address, "coin_b": p.address}, p.uint256), - admin: viewFun("0xf851a440", "admin()", {}, p.address), - future_admin: viewFun("0x17f7182a", "future_admin()", {}, p.address), - fee_receiver: viewFun("0xcab4d3db", "fee_receiver()", {}, p.address), - pool_implementations: viewFun("0x3273ff47", "pool_implementations(uint256)", {"arg0": p.uint256}, p.address), - gauge_implementation: viewFun("0x8df24207", "gauge_implementation()", {}, p.address), - views_implementation: viewFun("0xe31593d8", "views_implementation()", {}, p.address), - math_implementation: viewFun("0xa13c8f81", "math_implementation()", {}, p.address), - pool_list: viewFun("0x3a1d5d8e", "pool_list(uint256)", {"arg0": p.uint256}, p.address), -} - -export class Contract extends ContractBase { - - 'find_pool_for_coins(address,address)'(_from: Find_pool_for_coinsParams_0["_from"], _to: Find_pool_for_coinsParams_0["_to"]) { - return this.eth_call(functions['find_pool_for_coins(address,address)'], {_from, _to}) - } - - 'find_pool_for_coins(address,address,uint256)'(_from: Find_pool_for_coinsParams_1["_from"], _to: Find_pool_for_coinsParams_1["_to"], i: Find_pool_for_coinsParams_1["i"]) { - return this.eth_call(functions['find_pool_for_coins(address,address,uint256)'], {_from, _to, i}) - } - - pool_count() { - return this.eth_call(functions.pool_count, {}) - } - - get_coins(_pool: Get_coinsParams["_pool"]) { - return this.eth_call(functions.get_coins, {_pool}) - } - - get_decimals(_pool: Get_decimalsParams["_pool"]) { - return this.eth_call(functions.get_decimals, {_pool}) - } - - get_balances(_pool: Get_balancesParams["_pool"]) { - return this.eth_call(functions.get_balances, {_pool}) - } - - get_coin_indices(_pool: Get_coin_indicesParams["_pool"], _from: Get_coin_indicesParams["_from"], _to: Get_coin_indicesParams["_to"]) { - return this.eth_call(functions.get_coin_indices, {_pool, _from, _to}) - } - - get_gauge(_pool: Get_gaugeParams["_pool"]) { - return this.eth_call(functions.get_gauge, {_pool}) - } - - get_market_counts(coin_a: Get_market_countsParams["coin_a"], coin_b: Get_market_countsParams["coin_b"]) { - return this.eth_call(functions.get_market_counts, {coin_a, coin_b}) - } - - admin() { - return this.eth_call(functions.admin, {}) - } - - future_admin() { - return this.eth_call(functions.future_admin, {}) - } - - fee_receiver() { - return this.eth_call(functions.fee_receiver, {}) - } - - pool_implementations(arg0: Pool_implementationsParams["arg0"]) { - return this.eth_call(functions.pool_implementations, {arg0}) - } - - gauge_implementation() { - return this.eth_call(functions.gauge_implementation, {}) - } - - views_implementation() { - return this.eth_call(functions.views_implementation, {}) - } - - math_implementation() { - return this.eth_call(functions.math_implementation, {}) - } - - pool_list(arg0: Pool_listParams["arg0"]) { - return this.eth_call(functions.pool_list, {arg0}) - } -} - -/// Event types -export type TwocryptoPoolDeployedEventArgs = EParams -export type LiquidityGaugeDeployedEventArgs = EParams -export type UpdateFeeReceiverEventArgs = EParams -export type UpdatePoolImplementationEventArgs = EParams -export type UpdateGaugeImplementationEventArgs = EParams -export type UpdateMathImplementationEventArgs = EParams -export type UpdateViewsImplementationEventArgs = EParams -export type TransferOwnershipEventArgs = EParams - -/// Function types -export type Initialise_ownershipParams = FunctionArguments -export type Initialise_ownershipReturn = FunctionReturn - -export type Deploy_poolParams = FunctionArguments -export type Deploy_poolReturn = FunctionReturn - -export type Deploy_gaugeParams = FunctionArguments -export type Deploy_gaugeReturn = FunctionReturn - -export type Set_fee_receiverParams = FunctionArguments -export type Set_fee_receiverReturn = FunctionReturn - -export type Set_pool_implementationParams = FunctionArguments -export type Set_pool_implementationReturn = FunctionReturn - -export type Set_gauge_implementationParams = FunctionArguments -export type Set_gauge_implementationReturn = FunctionReturn - -export type Set_views_implementationParams = FunctionArguments -export type Set_views_implementationReturn = FunctionReturn - -export type Set_math_implementationParams = FunctionArguments -export type Set_math_implementationReturn = FunctionReturn - -export type Commit_transfer_ownershipParams = FunctionArguments -export type Commit_transfer_ownershipReturn = FunctionReturn - -export type Accept_transfer_ownershipParams = FunctionArguments -export type Accept_transfer_ownershipReturn = FunctionReturn - -export type Find_pool_for_coinsParams_0 = FunctionArguments -export type Find_pool_for_coinsReturn_0 = FunctionReturn - -export type Find_pool_for_coinsParams_1 = FunctionArguments -export type Find_pool_for_coinsReturn_1 = FunctionReturn - -export type Pool_countParams = FunctionArguments -export type Pool_countReturn = FunctionReturn - -export type Get_coinsParams = FunctionArguments -export type Get_coinsReturn = FunctionReturn - -export type Get_decimalsParams = FunctionArguments -export type Get_decimalsReturn = FunctionReturn - -export type Get_balancesParams = FunctionArguments -export type Get_balancesReturn = FunctionReturn - -export type Get_coin_indicesParams = FunctionArguments -export type Get_coin_indicesReturn = FunctionReturn - -export type Get_gaugeParams = FunctionArguments -export type Get_gaugeReturn = FunctionReturn - -export type Get_market_countsParams = FunctionArguments -export type Get_market_countsReturn = FunctionReturn - -export type AdminParams = FunctionArguments -export type AdminReturn = FunctionReturn - -export type Future_adminParams = FunctionArguments -export type Future_adminReturn = FunctionReturn - -export type Fee_receiverParams = FunctionArguments -export type Fee_receiverReturn = FunctionReturn - -export type Pool_implementationsParams = FunctionArguments -export type Pool_implementationsReturn = FunctionReturn - -export type Gauge_implementationParams = FunctionArguments -export type Gauge_implementationReturn = FunctionReturn - -export type Views_implementationParams = FunctionArguments -export type Views_implementationReturn = FunctionReturn - -export type Math_implementationParams = FunctionArguments -export type Math_implementationReturn = FunctionReturn - -export type Pool_listParams = FunctionArguments -export type Pool_listReturn = FunctionReturn - diff --git a/src/abi/curve-twocrypto-factory/contract.ts b/src/abi/curve-twocrypto-factory/contract.ts new file mode 100644 index 00000000..b2540317 --- /dev/null +++ b/src/abi/curve-twocrypto-factory/contract.ts @@ -0,0 +1,81 @@ +import { ContractBase } from '../abi.support.js' +import { admin, deploy_gauge, deploy_pool, fee_receiver, find_pool_for_coins, find_pool_for_coins_1, future_admin, gauge_implementation, get_balances, get_coin_indices, get_coins, get_decimals, get_gauge, get_market_counts, math_implementation, pool_count, pool_implementations, pool_list, views_implementation } from './functions.js' +import type { Deploy_gaugeParams, Deploy_poolParams, Find_pool_for_coinsParams, Find_pool_for_coinsParams_1, Get_balancesParams, Get_coin_indicesParams, Get_coinsParams, Get_decimalsParams, Get_gaugeParams, Get_market_countsParams, Pool_implementationsParams, Pool_listParams } from './functions.js' + +export class Contract extends ContractBase { + deploy_pool(_name: Deploy_poolParams["_name"], _symbol: Deploy_poolParams["_symbol"], _coins: Deploy_poolParams["_coins"], implementation_id: Deploy_poolParams["implementation_id"], A: Deploy_poolParams["A"], gamma: Deploy_poolParams["gamma"], mid_fee: Deploy_poolParams["mid_fee"], out_fee: Deploy_poolParams["out_fee"], fee_gamma: Deploy_poolParams["fee_gamma"], allowed_extra_profit: Deploy_poolParams["allowed_extra_profit"], adjustment_step: Deploy_poolParams["adjustment_step"], ma_exp_time: Deploy_poolParams["ma_exp_time"], initial_price: Deploy_poolParams["initial_price"]) { + return this.eth_call(deploy_pool, {_name, _symbol, _coins, implementation_id, A, gamma, mid_fee, out_fee, fee_gamma, allowed_extra_profit, adjustment_step, ma_exp_time, initial_price}) + } + + deploy_gauge(_pool: Deploy_gaugeParams["_pool"]) { + return this.eth_call(deploy_gauge, {_pool}) + } + + find_pool_for_coins(_from: Find_pool_for_coinsParams["_from"], _to: Find_pool_for_coinsParams["_to"]) { + return this.eth_call(find_pool_for_coins, {_from, _to}) + } + + find_pool_for_coins_1(_from: Find_pool_for_coinsParams_1["_from"], _to: Find_pool_for_coinsParams_1["_to"], i: Find_pool_for_coinsParams_1["i"]) { + return this.eth_call(find_pool_for_coins_1, {_from, _to, i}) + } + + pool_count() { + return this.eth_call(pool_count, {}) + } + + get_coins(_pool: Get_coinsParams["_pool"]) { + return this.eth_call(get_coins, {_pool}) + } + + get_decimals(_pool: Get_decimalsParams["_pool"]) { + return this.eth_call(get_decimals, {_pool}) + } + + get_balances(_pool: Get_balancesParams["_pool"]) { + return this.eth_call(get_balances, {_pool}) + } + + get_coin_indices(_pool: Get_coin_indicesParams["_pool"], _from: Get_coin_indicesParams["_from"], _to: Get_coin_indicesParams["_to"]) { + return this.eth_call(get_coin_indices, {_pool, _from, _to}) + } + + get_gauge(_pool: Get_gaugeParams["_pool"]) { + return this.eth_call(get_gauge, {_pool}) + } + + get_market_counts(coin_a: Get_market_countsParams["coin_a"], coin_b: Get_market_countsParams["coin_b"]) { + return this.eth_call(get_market_counts, {coin_a, coin_b}) + } + + admin() { + return this.eth_call(admin, {}) + } + + future_admin() { + return this.eth_call(future_admin, {}) + } + + fee_receiver() { + return this.eth_call(fee_receiver, {}) + } + + pool_implementations(arg0: Pool_implementationsParams["arg0"]) { + return this.eth_call(pool_implementations, {arg0}) + } + + gauge_implementation() { + return this.eth_call(gauge_implementation, {}) + } + + views_implementation() { + return this.eth_call(views_implementation, {}) + } + + math_implementation() { + return this.eth_call(math_implementation, {}) + } + + pool_list(arg0: Pool_listParams["arg0"]) { + return this.eth_call(pool_list, {arg0}) + } +} diff --git a/src/abi/curve-twocrypto-factory/events.ts b/src/abi/curve-twocrypto-factory/events.ts new file mode 100644 index 00000000..71b6f2c2 --- /dev/null +++ b/src/abi/curve-twocrypto-factory/events.ts @@ -0,0 +1,70 @@ +import { address, bytes32, fixedSizeArray, string, uint256 } from '@subsquid/evm-codec' +import { event } from '../abi.support.js' +import type { EventParams as EParams } from '../abi.support.js' + +/** TwocryptoPoolDeployed(address,string,string,address[2],address,bytes32,uint256[2],uint256,uint256,uint256,uint256,address) */ +export const TwocryptoPoolDeployed = event('0x8152a3037e3dc54154ad0d2cadb1cf7e1d1b9e2b625faa3dfb4fe03d609102ca', { + pool: address, + name: string, + symbol: string, + coins: fixedSizeArray(address, 2), + math: address, + salt: bytes32, + precisions: fixedSizeArray(uint256, 2), + packed_A_gamma: uint256, + packed_fee_params: uint256, + packed_rebalancing_params: uint256, + packed_prices: uint256, + deployer: address, +}) +export type TwocryptoPoolDeployedEventArgs = EParams + +/** LiquidityGaugeDeployed(address,address) */ +export const LiquidityGaugeDeployed = event('0x656bb34c20491970a8c163f3bd62ead82022b379c3924960ec60f6dbfc5aab3b', { + pool: address, + gauge: address, +}) +export type LiquidityGaugeDeployedEventArgs = EParams + +/** UpdateFeeReceiver(address,address) */ +export const UpdateFeeReceiver = event('0x2861448678f0be67f11bfb5481b3e3b4cfeb3acc6126ad60a05f95bfc6530666', { + _old_fee_receiver: address, + _new_fee_receiver: address, +}) +export type UpdateFeeReceiverEventArgs = EParams + +/** UpdatePoolImplementation(uint256,address,address) */ +export const UpdatePoolImplementation = event('0x6a42ef9605e135afaf6ae4f3683b161a3b7369d07c9d52c701ab69553e04c3b6', { + _implemention_id: uint256, + _old_pool_implementation: address, + _new_pool_implementation: address, +}) +export type UpdatePoolImplementationEventArgs = EParams + +/** UpdateGaugeImplementation(address,address) */ +export const UpdateGaugeImplementation = event('0x1fd705f9c77053962a503f2f2f57f0862b4c3af687c25615c13817a86946c359', { + _old_gauge_implementation: address, + _new_gauge_implementation: address, +}) +export type UpdateGaugeImplementationEventArgs = EParams + +/** UpdateMathImplementation(address,address) */ +export const UpdateMathImplementation = event('0x68fe8fc3ac76ec17e21117df5e854c8c25b7b5f776aad2adc927fdd156bcd6de', { + _old_math_implementation: address, + _new_math_implementation: address, +}) +export type UpdateMathImplementationEventArgs = EParams + +/** UpdateViewsImplementation(address,address) */ +export const UpdateViewsImplementation = event('0xd84eb1ea70cda40a6bfaa11f4f69efa10cbc5eb82760b3058f440512ec1d6d1f', { + _old_views_implementation: address, + _new_views_implementation: address, +}) +export type UpdateViewsImplementationEventArgs = EParams + +/** TransferOwnership(address,address) */ +export const TransferOwnership = event('0x5c486528ec3e3f0ea91181cff8116f02bfa350e03b8b6f12e00765adbb5af85c', { + _old_owner: address, + _new_owner: address, +}) +export type TransferOwnershipEventArgs = EParams diff --git a/src/abi/curve-twocrypto-factory/functions.ts b/src/abi/curve-twocrypto-factory/functions.ts new file mode 100644 index 00000000..0d14c499 --- /dev/null +++ b/src/abi/curve-twocrypto-factory/functions.ts @@ -0,0 +1,199 @@ +import { address, fixedSizeArray, string, struct, uint256 } from '@subsquid/evm-codec' +import { func } from '../abi.support.js' +import type { FunctionArguments, FunctionReturn } from '../abi.support.js' + +/** initialise_ownership(address,address) */ +export const initialise_ownership = func('0x45e62f85', { + _fee_receiver: address, + _admin: address, +}) +export type Initialise_ownershipParams = FunctionArguments +export type Initialise_ownershipReturn = FunctionReturn + +/** deploy_pool(string,string,address[2],uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256) */ +export const deploy_pool = func('0xc955fa04', { + _name: string, + _symbol: string, + _coins: fixedSizeArray(address, 2), + implementation_id: uint256, + A: uint256, + gamma: uint256, + mid_fee: uint256, + out_fee: uint256, + fee_gamma: uint256, + allowed_extra_profit: uint256, + adjustment_step: uint256, + ma_exp_time: uint256, + initial_price: uint256, +}, address) +export type Deploy_poolParams = FunctionArguments +export type Deploy_poolReturn = FunctionReturn + +/** deploy_gauge(address) */ +export const deploy_gauge = func('0x96bebb34', { + _pool: address, +}, address) +export type Deploy_gaugeParams = FunctionArguments +export type Deploy_gaugeReturn = FunctionReturn + +/** set_fee_receiver(address) */ +export const set_fee_receiver = func('0xe41ab771', { + _fee_receiver: address, +}) +export type Set_fee_receiverParams = FunctionArguments +export type Set_fee_receiverReturn = FunctionReturn + +/** set_pool_implementation(address,uint256) */ +export const set_pool_implementation = func('0x6f385ff6', { + _pool_implementation: address, + _implementation_index: uint256, +}) +export type Set_pool_implementationParams = FunctionArguments +export type Set_pool_implementationReturn = FunctionReturn + +/** set_gauge_implementation(address) */ +export const set_gauge_implementation = func('0x8f03182c', { + _gauge_implementation: address, +}) +export type Set_gauge_implementationParams = FunctionArguments +export type Set_gauge_implementationReturn = FunctionReturn + +/** set_views_implementation(address) */ +export const set_views_implementation = func('0xf6fa937f', { + _views_implementation: address, +}) +export type Set_views_implementationParams = FunctionArguments +export type Set_views_implementationReturn = FunctionReturn + +/** set_math_implementation(address) */ +export const set_math_implementation = func('0xb07426f4', { + _math_implementation: address, +}) +export type Set_math_implementationParams = FunctionArguments +export type Set_math_implementationReturn = FunctionReturn + +/** commit_transfer_ownership(address) */ +export const commit_transfer_ownership = func('0x6b441a40', { + _addr: address, +}) +export type Commit_transfer_ownershipParams = FunctionArguments +export type Commit_transfer_ownershipReturn = FunctionReturn + +/** accept_transfer_ownership() */ +export const accept_transfer_ownership = func('0xe5ea47b8', {}) +export type Accept_transfer_ownershipParams = FunctionArguments +export type Accept_transfer_ownershipReturn = FunctionReturn + +/** find_pool_for_coins(address,address) */ +export const find_pool_for_coins = func('0xa87df06c', { + _from: address, + _to: address, +}, address) +export type Find_pool_for_coinsParams = FunctionArguments +export type Find_pool_for_coinsReturn = FunctionReturn + +/** find_pool_for_coins(address,address,uint256) */ +export const find_pool_for_coins_1 = func('0x6982eb0b', { + _from: address, + _to: address, + i: uint256, +}, address) +export type Find_pool_for_coinsParams_1 = FunctionArguments +export type Find_pool_for_coinsReturn_1 = FunctionReturn + +/** pool_count() */ +export const pool_count = func('0x956aae3a', {}, uint256) +export type Pool_countParams = FunctionArguments +export type Pool_countReturn = FunctionReturn + +/** get_coins(address) */ +export const get_coins = func('0x9ac90d3d', { + _pool: address, +}, fixedSizeArray(address, 2)) +export type Get_coinsParams = FunctionArguments +export type Get_coinsReturn = FunctionReturn + +/** get_decimals(address) */ +export const get_decimals = func('0x52b51555', { + _pool: address, +}, fixedSizeArray(uint256, 2)) +export type Get_decimalsParams = FunctionArguments +export type Get_decimalsReturn = FunctionReturn + +/** get_balances(address) */ +export const get_balances = func('0x92e3cc2d', { + _pool: address, +}, fixedSizeArray(uint256, 2)) +export type Get_balancesParams = FunctionArguments +export type Get_balancesReturn = FunctionReturn + +/** get_coin_indices(address,address,address) */ +export const get_coin_indices = func('0xeb85226d', { + _pool: address, + _from: address, + _to: address, +}, struct({ + _0: uint256, + _1: uint256, +})) +export type Get_coin_indicesParams = FunctionArguments +export type Get_coin_indicesReturn = FunctionReturn + +/** get_gauge(address) */ +export const get_gauge = func('0xdaf297b9', { + _pool: address, +}, address) +export type Get_gaugeParams = FunctionArguments +export type Get_gaugeReturn = FunctionReturn + +/** get_market_counts(address,address) */ +export const get_market_counts = func('0xc1856b52', { + coin_a: address, + coin_b: address, +}, uint256) +export type Get_market_countsParams = FunctionArguments +export type Get_market_countsReturn = FunctionReturn + +/** admin() */ +export const admin = func('0xf851a440', {}, address) +export type AdminParams = FunctionArguments +export type AdminReturn = FunctionReturn + +/** future_admin() */ +export const future_admin = func('0x17f7182a', {}, address) +export type Future_adminParams = FunctionArguments +export type Future_adminReturn = FunctionReturn + +/** fee_receiver() */ +export const fee_receiver = func('0xcab4d3db', {}, address) +export type Fee_receiverParams = FunctionArguments +export type Fee_receiverReturn = FunctionReturn + +/** pool_implementations(uint256) */ +export const pool_implementations = func('0x3273ff47', { + arg0: uint256, +}, address) +export type Pool_implementationsParams = FunctionArguments +export type Pool_implementationsReturn = FunctionReturn + +/** gauge_implementation() */ +export const gauge_implementation = func('0x8df24207', {}, address) +export type Gauge_implementationParams = FunctionArguments +export type Gauge_implementationReturn = FunctionReturn + +/** views_implementation() */ +export const views_implementation = func('0xe31593d8', {}, address) +export type Views_implementationParams = FunctionArguments +export type Views_implementationReturn = FunctionReturn + +/** math_implementation() */ +export const math_implementation = func('0xa13c8f81', {}, address) +export type Math_implementationParams = FunctionArguments +export type Math_implementationReturn = FunctionReturn + +/** pool_list(uint256) */ +export const pool_list = func('0x3a1d5d8e', { + arg0: uint256, +}, address) +export type Pool_listParams = FunctionArguments +export type Pool_listReturn = FunctionReturn diff --git a/src/abi/curve-twocrypto-factory/index.ts b/src/abi/curve-twocrypto-factory/index.ts new file mode 100644 index 00000000..11829d6e --- /dev/null +++ b/src/abi/curve-twocrypto-factory/index.ts @@ -0,0 +1,4 @@ +export * as events from './events.js' +export * as functions from './functions.js' + +export { Contract } from './contract.js' diff --git a/src/abi/dia-oracle.ts b/src/abi/dia-oracle.ts deleted file mode 100644 index b10b3499..00000000 --- a/src/abi/dia-oracle.ts +++ /dev/null @@ -1,48 +0,0 @@ -import * as p from '@subsquid/evm-codec' -import { event, fun, viewFun, indexed, ContractBase } from '@subsquid/evm-abi' -import type { EventParams as EParams, FunctionArguments, FunctionReturn } from '@subsquid/evm-abi' - -export const events = { - OracleUpdate: event("0xa7fc99ed7617309ee23f63ae90196a1e490d362e6f6a547a59bc809ee2291782", "OracleUpdate(string,uint128,uint128)", {"key": p.string, "value": p.uint128, "timestamp": p.uint128}), - UpdaterAddressChange: event("0x121e958a4cadf7f8dadefa22cc019700365240223668418faebed197da07089f", "UpdaterAddressChange(address)", {"newUpdater": p.address}), -} - -export const functions = { - getValue: viewFun("0x960384a0", "getValue(string)", {"key": p.string}, {"_0": p.uint128, "_1": p.uint128}), - setMultipleValues: fun("0x8d241526", "setMultipleValues(string[],uint256[])", {"keys": p.array(p.string), "compressedValues": p.array(p.uint256)}, ), - setValue: fun("0x7898e0c2", "setValue(string,uint128,uint128)", {"key": p.string, "value": p.uint128, "timestamp": p.uint128}, ), - updateOracleUpdaterAddress: fun("0x6aa45efc", "updateOracleUpdaterAddress(address)", {"newOracleUpdaterAddress": p.address}, ), - values: viewFun("0x5a9ade8b", "values(string)", {"_0": p.string}, p.uint256), -} - -export class Contract extends ContractBase { - - getValue(key: GetValueParams["key"]) { - return this.eth_call(functions.getValue, {key}) - } - - values(_0: ValuesParams["_0"]) { - return this.eth_call(functions.values, {_0}) - } -} - -/// Event types -export type OracleUpdateEventArgs = EParams -export type UpdaterAddressChangeEventArgs = EParams - -/// Function types -export type GetValueParams = FunctionArguments -export type GetValueReturn = FunctionReturn - -export type SetMultipleValuesParams = FunctionArguments -export type SetMultipleValuesReturn = FunctionReturn - -export type SetValueParams = FunctionArguments -export type SetValueReturn = FunctionReturn - -export type UpdateOracleUpdaterAddressParams = FunctionArguments -export type UpdateOracleUpdaterAddressReturn = FunctionReturn - -export type ValuesParams = FunctionArguments -export type ValuesReturn = FunctionReturn - diff --git a/src/abi/dia-oracle/contract.ts b/src/abi/dia-oracle/contract.ts new file mode 100644 index 00000000..aaa03c5b --- /dev/null +++ b/src/abi/dia-oracle/contract.ts @@ -0,0 +1,13 @@ +import { ContractBase } from '../abi.support.js' +import { getValue, values } from './functions.js' +import type { GetValueParams, ValuesParams } from './functions.js' + +export class Contract extends ContractBase { + getValue(key: GetValueParams["key"]) { + return this.eth_call(getValue, {key}) + } + + values(_0: ValuesParams["_0"]) { + return this.eth_call(values, {_0}) + } +} diff --git a/src/abi/dia-oracle/events.ts b/src/abi/dia-oracle/events.ts new file mode 100644 index 00000000..c879775e --- /dev/null +++ b/src/abi/dia-oracle/events.ts @@ -0,0 +1,17 @@ +import { address, string, uint128 } from '@subsquid/evm-codec' +import { event } from '../abi.support.js' +import type { EventParams as EParams } from '../abi.support.js' + +/** OracleUpdate(string,uint128,uint128) */ +export const OracleUpdate = event('0xa7fc99ed7617309ee23f63ae90196a1e490d362e6f6a547a59bc809ee2291782', { + key: string, + value: uint128, + timestamp: uint128, +}) +export type OracleUpdateEventArgs = EParams + +/** UpdaterAddressChange(address) */ +export const UpdaterAddressChange = event('0x121e958a4cadf7f8dadefa22cc019700365240223668418faebed197da07089f', { + newUpdater: address, +}) +export type UpdaterAddressChangeEventArgs = EParams diff --git a/src/abi/dia-oracle/functions.ts b/src/abi/dia-oracle/functions.ts new file mode 100644 index 00000000..d98d9751 --- /dev/null +++ b/src/abi/dia-oracle/functions.ts @@ -0,0 +1,44 @@ +import { address, array, string, struct, uint128, uint256 } from '@subsquid/evm-codec' +import { func } from '../abi.support.js' +import type { FunctionArguments, FunctionReturn } from '../abi.support.js' + +/** getValue(string) */ +export const getValue = func('0x960384a0', { + key: string, +}, struct({ + _0: uint128, + _1: uint128, +})) +export type GetValueParams = FunctionArguments +export type GetValueReturn = FunctionReturn + +/** setMultipleValues(string[],uint256[]) */ +export const setMultipleValues = func('0x8d241526', { + keys: array(string), + compressedValues: array(uint256), +}) +export type SetMultipleValuesParams = FunctionArguments +export type SetMultipleValuesReturn = FunctionReturn + +/** setValue(string,uint128,uint128) */ +export const setValue = func('0x7898e0c2', { + key: string, + value: uint128, + timestamp: uint128, +}) +export type SetValueParams = FunctionArguments +export type SetValueReturn = FunctionReturn + +/** updateOracleUpdaterAddress(address) */ +export const updateOracleUpdaterAddress = func('0x6aa45efc', { + newOracleUpdaterAddress: address, +}) +export type UpdateOracleUpdaterAddressParams = FunctionArguments +export type UpdateOracleUpdaterAddressReturn = FunctionReturn + +/** values(string) */ +export const values = func('0x5a9ade8b', { + _0: string, +}, uint256) +export type ValuesParams = FunctionArguments +export type ValuesReturn = FunctionReturn diff --git a/src/abi/dia-oracle/index.ts b/src/abi/dia-oracle/index.ts new file mode 100644 index 00000000..11829d6e --- /dev/null +++ b/src/abi/dia-oracle/index.ts @@ -0,0 +1,4 @@ +export * as events from './events.js' +export * as functions from './functions.js' + +export { Contract } from './contract.js' diff --git a/src/abi/eac-aggregator-proxy.ts b/src/abi/eac-aggregator-proxy.ts deleted file mode 100644 index f3c6f2e4..00000000 --- a/src/abi/eac-aggregator-proxy.ts +++ /dev/null @@ -1,188 +0,0 @@ -import * as p from '@subsquid/evm-codec' -import { event, fun, viewFun, indexed, ContractBase } from '@subsquid/evm-abi' -import type { EventParams as EParams, FunctionArguments, FunctionReturn } from '@subsquid/evm-abi' - -export const events = { - AnswerUpdated: event("0x0559884fd3a460db3073b7fc896cc77986f16e378210ded43186175bf646fc5f", "AnswerUpdated(int256,uint256,uint256)", {"current": indexed(p.int256), "roundId": indexed(p.uint256), "updatedAt": p.uint256}), - NewRound: event("0x0109fc6f55cf40689f02fbaad7af7fe7bbac8a3d2186600afc7d3e10cac60271", "NewRound(uint256,address,uint256)", {"roundId": indexed(p.uint256), "startedBy": indexed(p.address), "startedAt": p.uint256}), - OwnershipTransferRequested: event("0xed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae1278", "OwnershipTransferRequested(address,address)", {"from": indexed(p.address), "to": indexed(p.address)}), - OwnershipTransferred: event("0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", "OwnershipTransferred(address,address)", {"from": indexed(p.address), "to": indexed(p.address)}), -} - -export const functions = { - acceptOwnership: fun("0x79ba5097", "acceptOwnership()", {}, ), - accessController: viewFun("0xbc43cbaf", "accessController()", {}, p.address), - aggregator: viewFun("0x245a7bfc", "aggregator()", {}, p.address), - confirmAggregator: fun("0xa928c096", "confirmAggregator(address)", {"_aggregator": p.address}, ), - decimals: viewFun("0x313ce567", "decimals()", {}, p.uint8), - description: viewFun("0x7284e416", "description()", {}, p.string), - getAnswer: viewFun("0xb5ab58dc", "getAnswer(uint256)", {"_roundId": p.uint256}, p.int256), - getRoundData: viewFun("0x9a6fc8f5", "getRoundData(uint80)", {"_roundId": p.uint80}, {"roundId": p.uint80, "answer": p.int256, "startedAt": p.uint256, "updatedAt": p.uint256, "answeredInRound": p.uint80}), - getTimestamp: viewFun("0xb633620c", "getTimestamp(uint256)", {"_roundId": p.uint256}, p.uint256), - latestAnswer: viewFun("0x50d25bcd", "latestAnswer()", {}, p.int256), - latestRound: viewFun("0x668a0f02", "latestRound()", {}, p.uint256), - latestRoundData: viewFun("0xfeaf968c", "latestRoundData()", {}, {"roundId": p.uint80, "answer": p.int256, "startedAt": p.uint256, "updatedAt": p.uint256, "answeredInRound": p.uint80}), - latestTimestamp: viewFun("0x8205bf6a", "latestTimestamp()", {}, p.uint256), - owner: viewFun("0x8da5cb5b", "owner()", {}, p.address), - phaseAggregators: viewFun("0xc1597304", "phaseAggregators(uint16)", {"_0": p.uint16}, p.address), - phaseId: viewFun("0x58303b10", "phaseId()", {}, p.uint16), - proposeAggregator: fun("0xf8a2abd3", "proposeAggregator(address)", {"_aggregator": p.address}, ), - proposedAggregator: viewFun("0xe8c4be30", "proposedAggregator()", {}, p.address), - proposedGetRoundData: viewFun("0x6001ac53", "proposedGetRoundData(uint80)", {"_roundId": p.uint80}, {"roundId": p.uint80, "answer": p.int256, "startedAt": p.uint256, "updatedAt": p.uint256, "answeredInRound": p.uint80}), - proposedLatestRoundData: viewFun("0x8f6b4d91", "proposedLatestRoundData()", {}, {"roundId": p.uint80, "answer": p.int256, "startedAt": p.uint256, "updatedAt": p.uint256, "answeredInRound": p.uint80}), - setController: fun("0x92eefe9b", "setController(address)", {"_accessController": p.address}, ), - transferOwnership: fun("0xf2fde38b", "transferOwnership(address)", {"_to": p.address}, ), - version: viewFun("0x54fd4d50", "version()", {}, p.uint256), -} - -export class Contract extends ContractBase { - - accessController() { - return this.eth_call(functions.accessController, {}) - } - - aggregator() { - return this.eth_call(functions.aggregator, {}) - } - - decimals() { - return this.eth_call(functions.decimals, {}) - } - - description() { - return this.eth_call(functions.description, {}) - } - - getAnswer(_roundId: GetAnswerParams["_roundId"]) { - return this.eth_call(functions.getAnswer, {_roundId}) - } - - getRoundData(_roundId: GetRoundDataParams["_roundId"]) { - return this.eth_call(functions.getRoundData, {_roundId}) - } - - getTimestamp(_roundId: GetTimestampParams["_roundId"]) { - return this.eth_call(functions.getTimestamp, {_roundId}) - } - - latestAnswer() { - return this.eth_call(functions.latestAnswer, {}) - } - - latestRound() { - return this.eth_call(functions.latestRound, {}) - } - - latestRoundData() { - return this.eth_call(functions.latestRoundData, {}) - } - - latestTimestamp() { - return this.eth_call(functions.latestTimestamp, {}) - } - - owner() { - return this.eth_call(functions.owner, {}) - } - - phaseAggregators(_0: PhaseAggregatorsParams["_0"]) { - return this.eth_call(functions.phaseAggregators, {_0}) - } - - phaseId() { - return this.eth_call(functions.phaseId, {}) - } - - proposedAggregator() { - return this.eth_call(functions.proposedAggregator, {}) - } - - proposedGetRoundData(_roundId: ProposedGetRoundDataParams["_roundId"]) { - return this.eth_call(functions.proposedGetRoundData, {_roundId}) - } - - proposedLatestRoundData() { - return this.eth_call(functions.proposedLatestRoundData, {}) - } - - version() { - return this.eth_call(functions.version, {}) - } -} - -/// Event types -export type AnswerUpdatedEventArgs = EParams -export type NewRoundEventArgs = EParams -export type OwnershipTransferRequestedEventArgs = EParams -export type OwnershipTransferredEventArgs = EParams - -/// Function types -export type AcceptOwnershipParams = FunctionArguments -export type AcceptOwnershipReturn = FunctionReturn - -export type AccessControllerParams = FunctionArguments -export type AccessControllerReturn = FunctionReturn - -export type AggregatorParams = FunctionArguments -export type AggregatorReturn = FunctionReturn - -export type ConfirmAggregatorParams = FunctionArguments -export type ConfirmAggregatorReturn = FunctionReturn - -export type DecimalsParams = FunctionArguments -export type DecimalsReturn = FunctionReturn - -export type DescriptionParams = FunctionArguments -export type DescriptionReturn = FunctionReturn - -export type GetAnswerParams = FunctionArguments -export type GetAnswerReturn = FunctionReturn - -export type GetRoundDataParams = FunctionArguments -export type GetRoundDataReturn = FunctionReturn - -export type GetTimestampParams = FunctionArguments -export type GetTimestampReturn = FunctionReturn - -export type LatestAnswerParams = FunctionArguments -export type LatestAnswerReturn = FunctionReturn - -export type LatestRoundParams = FunctionArguments -export type LatestRoundReturn = FunctionReturn - -export type LatestRoundDataParams = FunctionArguments -export type LatestRoundDataReturn = FunctionReturn - -export type LatestTimestampParams = FunctionArguments -export type LatestTimestampReturn = FunctionReturn - -export type OwnerParams = FunctionArguments -export type OwnerReturn = FunctionReturn - -export type PhaseAggregatorsParams = FunctionArguments -export type PhaseAggregatorsReturn = FunctionReturn - -export type PhaseIdParams = FunctionArguments -export type PhaseIdReturn = FunctionReturn - -export type ProposeAggregatorParams = FunctionArguments -export type ProposeAggregatorReturn = FunctionReturn - -export type ProposedAggregatorParams = FunctionArguments -export type ProposedAggregatorReturn = FunctionReturn - -export type ProposedGetRoundDataParams = FunctionArguments -export type ProposedGetRoundDataReturn = FunctionReturn - -export type ProposedLatestRoundDataParams = FunctionArguments -export type ProposedLatestRoundDataReturn = FunctionReturn - -export type SetControllerParams = FunctionArguments -export type SetControllerReturn = FunctionReturn - -export type TransferOwnershipParams = FunctionArguments -export type TransferOwnershipReturn = FunctionReturn - -export type VersionParams = FunctionArguments -export type VersionReturn = FunctionReturn - diff --git a/src/abi/eac-aggregator-proxy/contract.ts b/src/abi/eac-aggregator-proxy/contract.ts new file mode 100644 index 00000000..55a0ca07 --- /dev/null +++ b/src/abi/eac-aggregator-proxy/contract.ts @@ -0,0 +1,77 @@ +import { ContractBase } from '../abi.support.js' +import { accessController, aggregator, decimals, description, getAnswer, getRoundData, getTimestamp, latestAnswer, latestRound, latestRoundData, latestTimestamp, owner, phaseAggregators, phaseId, proposedAggregator, proposedGetRoundData, proposedLatestRoundData, version } from './functions.js' +import type { GetAnswerParams, GetRoundDataParams, GetTimestampParams, PhaseAggregatorsParams, ProposedGetRoundDataParams } from './functions.js' + +export class Contract extends ContractBase { + accessController() { + return this.eth_call(accessController, {}) + } + + aggregator() { + return this.eth_call(aggregator, {}) + } + + decimals() { + return this.eth_call(decimals, {}) + } + + description() { + return this.eth_call(description, {}) + } + + getAnswer(_roundId: GetAnswerParams["_roundId"]) { + return this.eth_call(getAnswer, {_roundId}) + } + + getRoundData(_roundId: GetRoundDataParams["_roundId"]) { + return this.eth_call(getRoundData, {_roundId}) + } + + getTimestamp(_roundId: GetTimestampParams["_roundId"]) { + return this.eth_call(getTimestamp, {_roundId}) + } + + latestAnswer() { + return this.eth_call(latestAnswer, {}) + } + + latestRound() { + return this.eth_call(latestRound, {}) + } + + latestRoundData() { + return this.eth_call(latestRoundData, {}) + } + + latestTimestamp() { + return this.eth_call(latestTimestamp, {}) + } + + owner() { + return this.eth_call(owner, {}) + } + + phaseAggregators(_0: PhaseAggregatorsParams["_0"]) { + return this.eth_call(phaseAggregators, {_0}) + } + + phaseId() { + return this.eth_call(phaseId, {}) + } + + proposedAggregator() { + return this.eth_call(proposedAggregator, {}) + } + + proposedGetRoundData(_roundId: ProposedGetRoundDataParams["_roundId"]) { + return this.eth_call(proposedGetRoundData, {_roundId}) + } + + proposedLatestRoundData() { + return this.eth_call(proposedLatestRoundData, {}) + } + + version() { + return this.eth_call(version, {}) + } +} diff --git a/src/abi/eac-aggregator-proxy/events.ts b/src/abi/eac-aggregator-proxy/events.ts new file mode 100644 index 00000000..123c0b83 --- /dev/null +++ b/src/abi/eac-aggregator-proxy/events.ts @@ -0,0 +1,33 @@ +import { address, int256, uint256 } from '@subsquid/evm-codec' +import { event, indexed } from '../abi.support.js' +import type { EventParams as EParams } from '../abi.support.js' + +/** AnswerUpdated(int256,uint256,uint256) */ +export const AnswerUpdated = event('0x0559884fd3a460db3073b7fc896cc77986f16e378210ded43186175bf646fc5f', { + current: indexed(int256), + roundId: indexed(uint256), + updatedAt: uint256, +}) +export type AnswerUpdatedEventArgs = EParams + +/** NewRound(uint256,address,uint256) */ +export const NewRound = event('0x0109fc6f55cf40689f02fbaad7af7fe7bbac8a3d2186600afc7d3e10cac60271', { + roundId: indexed(uint256), + startedBy: indexed(address), + startedAt: uint256, +}) +export type NewRoundEventArgs = EParams + +/** OwnershipTransferRequested(address,address) */ +export const OwnershipTransferRequested = event('0xed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae1278', { + from: indexed(address), + to: indexed(address), +}) +export type OwnershipTransferRequestedEventArgs = EParams + +/** OwnershipTransferred(address,address) */ +export const OwnershipTransferred = event('0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0', { + from: indexed(address), + to: indexed(address), +}) +export type OwnershipTransferredEventArgs = EParams diff --git a/src/abi/eac-aggregator-proxy/functions.ts b/src/abi/eac-aggregator-proxy/functions.ts new file mode 100644 index 00000000..08fb8b4b --- /dev/null +++ b/src/abi/eac-aggregator-proxy/functions.ts @@ -0,0 +1,160 @@ +import { address, int256, string, struct, uint16, uint256, uint8, uint80 } from '@subsquid/evm-codec' +import { func } from '../abi.support.js' +import type { FunctionArguments, FunctionReturn } from '../abi.support.js' + +/** acceptOwnership() */ +export const acceptOwnership = func('0x79ba5097', {}) +export type AcceptOwnershipParams = FunctionArguments +export type AcceptOwnershipReturn = FunctionReturn + +/** accessController() */ +export const accessController = func('0xbc43cbaf', {}, address) +export type AccessControllerParams = FunctionArguments +export type AccessControllerReturn = FunctionReturn + +/** aggregator() */ +export const aggregator = func('0x245a7bfc', {}, address) +export type AggregatorParams = FunctionArguments +export type AggregatorReturn = FunctionReturn + +/** confirmAggregator(address) */ +export const confirmAggregator = func('0xa928c096', { + _aggregator: address, +}) +export type ConfirmAggregatorParams = FunctionArguments +export type ConfirmAggregatorReturn = FunctionReturn + +/** decimals() */ +export const decimals = func('0x313ce567', {}, uint8) +export type DecimalsParams = FunctionArguments +export type DecimalsReturn = FunctionReturn + +/** description() */ +export const description = func('0x7284e416', {}, string) +export type DescriptionParams = FunctionArguments +export type DescriptionReturn = FunctionReturn + +/** getAnswer(uint256) */ +export const getAnswer = func('0xb5ab58dc', { + _roundId: uint256, +}, int256) +export type GetAnswerParams = FunctionArguments +export type GetAnswerReturn = FunctionReturn + +/** getRoundData(uint80) */ +export const getRoundData = func('0x9a6fc8f5', { + _roundId: uint80, +}, struct({ + roundId: uint80, + answer: int256, + startedAt: uint256, + updatedAt: uint256, + answeredInRound: uint80, +})) +export type GetRoundDataParams = FunctionArguments +export type GetRoundDataReturn = FunctionReturn + +/** getTimestamp(uint256) */ +export const getTimestamp = func('0xb633620c', { + _roundId: uint256, +}, uint256) +export type GetTimestampParams = FunctionArguments +export type GetTimestampReturn = FunctionReturn + +/** latestAnswer() */ +export const latestAnswer = func('0x50d25bcd', {}, int256) +export type LatestAnswerParams = FunctionArguments +export type LatestAnswerReturn = FunctionReturn + +/** latestRound() */ +export const latestRound = func('0x668a0f02', {}, uint256) +export type LatestRoundParams = FunctionArguments +export type LatestRoundReturn = FunctionReturn + +/** latestRoundData() */ +export const latestRoundData = func('0xfeaf968c', {}, struct({ + roundId: uint80, + answer: int256, + startedAt: uint256, + updatedAt: uint256, + answeredInRound: uint80, +})) +export type LatestRoundDataParams = FunctionArguments +export type LatestRoundDataReturn = FunctionReturn + +/** latestTimestamp() */ +export const latestTimestamp = func('0x8205bf6a', {}, uint256) +export type LatestTimestampParams = FunctionArguments +export type LatestTimestampReturn = FunctionReturn + +/** owner() */ +export const owner = func('0x8da5cb5b', {}, address) +export type OwnerParams = FunctionArguments +export type OwnerReturn = FunctionReturn + +/** phaseAggregators(uint16) */ +export const phaseAggregators = func('0xc1597304', { + _0: uint16, +}, address) +export type PhaseAggregatorsParams = FunctionArguments +export type PhaseAggregatorsReturn = FunctionReturn + +/** phaseId() */ +export const phaseId = func('0x58303b10', {}, uint16) +export type PhaseIdParams = FunctionArguments +export type PhaseIdReturn = FunctionReturn + +/** proposeAggregator(address) */ +export const proposeAggregator = func('0xf8a2abd3', { + _aggregator: address, +}) +export type ProposeAggregatorParams = FunctionArguments +export type ProposeAggregatorReturn = FunctionReturn + +/** proposedAggregator() */ +export const proposedAggregator = func('0xe8c4be30', {}, address) +export type ProposedAggregatorParams = FunctionArguments +export type ProposedAggregatorReturn = FunctionReturn + +/** proposedGetRoundData(uint80) */ +export const proposedGetRoundData = func('0x6001ac53', { + _roundId: uint80, +}, struct({ + roundId: uint80, + answer: int256, + startedAt: uint256, + updatedAt: uint256, + answeredInRound: uint80, +})) +export type ProposedGetRoundDataParams = FunctionArguments +export type ProposedGetRoundDataReturn = FunctionReturn + +/** proposedLatestRoundData() */ +export const proposedLatestRoundData = func('0x8f6b4d91', {}, struct({ + roundId: uint80, + answer: int256, + startedAt: uint256, + updatedAt: uint256, + answeredInRound: uint80, +})) +export type ProposedLatestRoundDataParams = FunctionArguments +export type ProposedLatestRoundDataReturn = FunctionReturn + +/** setController(address) */ +export const setController = func('0x92eefe9b', { + _accessController: address, +}) +export type SetControllerParams = FunctionArguments +export type SetControllerReturn = FunctionReturn + +/** transferOwnership(address) */ +export const transferOwnership = func('0xf2fde38b', { + _to: address, +}) +export type TransferOwnershipParams = FunctionArguments +export type TransferOwnershipReturn = FunctionReturn + +/** version() */ +export const version = func('0x54fd4d50', {}, uint256) +export type VersionParams = FunctionArguments +export type VersionReturn = FunctionReturn diff --git a/src/abi/eac-aggregator-proxy/index.ts b/src/abi/eac-aggregator-proxy/index.ts new file mode 100644 index 00000000..11829d6e --- /dev/null +++ b/src/abi/eac-aggregator-proxy/index.ts @@ -0,0 +1,4 @@ +export * as events from './events.js' +export * as functions from './functions.js' + +export { Contract } from './contract.js' diff --git a/src/abi/erc20.ts b/src/abi/erc20.ts deleted file mode 100644 index bb7f0016..00000000 --- a/src/abi/erc20.ts +++ /dev/null @@ -1,80 +0,0 @@ -import * as p from '@subsquid/evm-codec' -import { event, fun, viewFun, indexed, ContractBase } from '@subsquid/evm-abi' -import type { EventParams as EParams, FunctionArguments, FunctionReturn } from '@subsquid/evm-abi' - -export const events = { - Approval: event("0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925", "Approval(address,address,uint256)", {"owner": indexed(p.address), "spender": indexed(p.address), "value": p.uint256}), - Transfer: event("0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", "Transfer(address,address,uint256)", {"from": indexed(p.address), "to": indexed(p.address), "value": p.uint256}), -} - -export const functions = { - name: viewFun("0x06fdde03", "name()", {}, p.string), - approve: fun("0x095ea7b3", "approve(address,uint256)", {"_spender": p.address, "_value": p.uint256}, p.bool), - totalSupply: viewFun("0x18160ddd", "totalSupply()", {}, p.uint256), - transferFrom: fun("0x23b872dd", "transferFrom(address,address,uint256)", {"_from": p.address, "_to": p.address, "_value": p.uint256}, p.bool), - decimals: viewFun("0x313ce567", "decimals()", {}, p.uint8), - balanceOf: viewFun("0x70a08231", "balanceOf(address)", {"_owner": p.address}, p.uint256), - symbol: viewFun("0x95d89b41", "symbol()", {}, p.string), - transfer: fun("0xa9059cbb", "transfer(address,uint256)", {"_to": p.address, "_value": p.uint256}, p.bool), - allowance: viewFun("0xdd62ed3e", "allowance(address,address)", {"_owner": p.address, "_spender": p.address}, p.uint256), -} - -export class Contract extends ContractBase { - - name() { - return this.eth_call(functions.name, {}) - } - - totalSupply() { - return this.eth_call(functions.totalSupply, {}) - } - - decimals() { - return this.eth_call(functions.decimals, {}) - } - - balanceOf(_owner: BalanceOfParams["_owner"]) { - return this.eth_call(functions.balanceOf, {_owner}) - } - - symbol() { - return this.eth_call(functions.symbol, {}) - } - - allowance(_owner: AllowanceParams["_owner"], _spender: AllowanceParams["_spender"]) { - return this.eth_call(functions.allowance, {_owner, _spender}) - } -} - -/// Event types -export type ApprovalEventArgs = EParams -export type TransferEventArgs = EParams - -/// Function types -export type NameParams = FunctionArguments -export type NameReturn = FunctionReturn - -export type ApproveParams = FunctionArguments -export type ApproveReturn = FunctionReturn - -export type TotalSupplyParams = FunctionArguments -export type TotalSupplyReturn = FunctionReturn - -export type TransferFromParams = FunctionArguments -export type TransferFromReturn = FunctionReturn - -export type DecimalsParams = FunctionArguments -export type DecimalsReturn = FunctionReturn - -export type BalanceOfParams = FunctionArguments -export type BalanceOfReturn = FunctionReturn - -export type SymbolParams = FunctionArguments -export type SymbolReturn = FunctionReturn - -export type TransferParams = FunctionArguments -export type TransferReturn = FunctionReturn - -export type AllowanceParams = FunctionArguments -export type AllowanceReturn = FunctionReturn - diff --git a/src/abi/erc20/contract.ts b/src/abi/erc20/contract.ts new file mode 100644 index 00000000..41e08cc0 --- /dev/null +++ b/src/abi/erc20/contract.ts @@ -0,0 +1,41 @@ +import { ContractBase } from '../abi.support.js' +import { allowance, approve, balanceOf, decimals, name, symbol, totalSupply, transfer, transferFrom } from './functions.js' +import type { AllowanceParams, ApproveParams, BalanceOfParams, TransferFromParams, TransferParams } from './functions.js' + +export class Contract extends ContractBase { + name() { + return this.eth_call(name, {}) + } + + approve(_spender: ApproveParams["_spender"], _value: ApproveParams["_value"]) { + return this.eth_call(approve, {_spender, _value}) + } + + totalSupply() { + return this.eth_call(totalSupply, {}) + } + + transferFrom(_from: TransferFromParams["_from"], _to: TransferFromParams["_to"], _value: TransferFromParams["_value"]) { + return this.eth_call(transferFrom, {_from, _to, _value}) + } + + decimals() { + return this.eth_call(decimals, {}) + } + + balanceOf(_owner: BalanceOfParams["_owner"]) { + return this.eth_call(balanceOf, {_owner}) + } + + symbol() { + return this.eth_call(symbol, {}) + } + + transfer(_to: TransferParams["_to"], _value: TransferParams["_value"]) { + return this.eth_call(transfer, {_to, _value}) + } + + allowance(_owner: AllowanceParams["_owner"], _spender: AllowanceParams["_spender"]) { + return this.eth_call(allowance, {_owner, _spender}) + } +} diff --git a/src/abi/erc20/events.ts b/src/abi/erc20/events.ts new file mode 100644 index 00000000..2a5cb470 --- /dev/null +++ b/src/abi/erc20/events.ts @@ -0,0 +1,19 @@ +import { address, uint256 } from '@subsquid/evm-codec' +import { event, indexed } from '../abi.support.js' +import type { EventParams as EParams } from '../abi.support.js' + +/** Approval(address,address,uint256) */ +export const Approval = event('0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925', { + owner: indexed(address), + spender: indexed(address), + value: uint256, +}) +export type ApprovalEventArgs = EParams + +/** Transfer(address,address,uint256) */ +export const Transfer = event('0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', { + from: indexed(address), + to: indexed(address), + value: uint256, +}) +export type TransferEventArgs = EParams diff --git a/src/abi/erc20/functions.ts b/src/abi/erc20/functions.ts new file mode 100644 index 00000000..96cfe821 --- /dev/null +++ b/src/abi/erc20/functions.ts @@ -0,0 +1,63 @@ +import { address, bool, string, uint256, uint8 } from '@subsquid/evm-codec' +import { func } from '../abi.support.js' +import type { FunctionArguments, FunctionReturn } from '../abi.support.js' + +/** name() */ +export const name = func('0x06fdde03', {}, string) +export type NameParams = FunctionArguments +export type NameReturn = FunctionReturn + +/** approve(address,uint256) */ +export const approve = func('0x095ea7b3', { + _spender: address, + _value: uint256, +}, bool) +export type ApproveParams = FunctionArguments +export type ApproveReturn = FunctionReturn + +/** totalSupply() */ +export const totalSupply = func('0x18160ddd', {}, uint256) +export type TotalSupplyParams = FunctionArguments +export type TotalSupplyReturn = FunctionReturn + +/** transferFrom(address,address,uint256) */ +export const transferFrom = func('0x23b872dd', { + _from: address, + _to: address, + _value: uint256, +}, bool) +export type TransferFromParams = FunctionArguments +export type TransferFromReturn = FunctionReturn + +/** decimals() */ +export const decimals = func('0x313ce567', {}, uint8) +export type DecimalsParams = FunctionArguments +export type DecimalsReturn = FunctionReturn + +/** balanceOf(address) */ +export const balanceOf = func('0x70a08231', { + _owner: address, +}, uint256) +export type BalanceOfParams = FunctionArguments +export type BalanceOfReturn = FunctionReturn + +/** symbol() */ +export const symbol = func('0x95d89b41', {}, string) +export type SymbolParams = FunctionArguments +export type SymbolReturn = FunctionReturn + +/** transfer(address,uint256) */ +export const transfer = func('0xa9059cbb', { + _to: address, + _value: uint256, +}, bool) +export type TransferParams = FunctionArguments +export type TransferReturn = FunctionReturn + +/** allowance(address,address) */ +export const allowance = func('0xdd62ed3e', { + _owner: address, + _spender: address, +}, uint256) +export type AllowanceParams = FunctionArguments +export type AllowanceReturn = FunctionReturn diff --git a/src/abi/erc20/index.ts b/src/abi/erc20/index.ts new file mode 100644 index 00000000..11829d6e --- /dev/null +++ b/src/abi/erc20/index.ts @@ -0,0 +1,4 @@ +export * as events from './events.js' +export * as functions from './functions.js' + +export { Contract } from './contract.js' diff --git a/src/abi/exponential-staking.ts b/src/abi/exponential-staking.ts deleted file mode 100644 index 8aeb4b94..00000000 --- a/src/abi/exponential-staking.ts +++ /dev/null @@ -1,284 +0,0 @@ -import * as p from '@subsquid/evm-codec' -import { event, fun, viewFun, indexed, ContractBase } from '@subsquid/evm-abi' -import type { EventParams as EParams, FunctionArguments, FunctionReturn } from '@subsquid/evm-abi' - -export const events = { - Approval: event("0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925", "Approval(address,address,uint256)", {"owner": indexed(p.address), "spender": indexed(p.address), "value": p.uint256}), - DelegateChanged: event("0x3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f", "DelegateChanged(address,address,address)", {"delegator": indexed(p.address), "fromDelegate": indexed(p.address), "toDelegate": indexed(p.address)}), - DelegateVotesChanged: event("0xdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a724", "DelegateVotesChanged(address,uint256,uint256)", {"delegate": indexed(p.address), "previousBalance": p.uint256, "newBalance": p.uint256}), - Penalty: event("0x322e5021ddf51920f7602154a6c845b34ef1b32704a1fa2c66927b56be280762", "Penalty(address,uint256)", {"user": indexed(p.address), "amount": p.uint256}), - Reward: event("0x619caafabdd75649b302ba8419e48cccf64f37f1983ac4727cfb38b57703ffc9", "Reward(address,uint256)", {"user": indexed(p.address), "amount": p.uint256}), - Stake: event("0x2720efa4b2dd4f3f8a347da3cbd290a522e9432da9072c5b8e6300496fdde282", "Stake(address,uint256,uint256,uint256,uint256)", {"user": indexed(p.address), "lockupId": p.uint256, "amount": p.uint256, "end": p.uint256, "points": p.uint256}), - Transfer: event("0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", "Transfer(address,address,uint256)", {"from": indexed(p.address), "to": indexed(p.address), "value": p.uint256}), - Unstake: event("0x05b744e3e9358bc00ba3cc0c6606a4d6536134dba00b2d2ee4b5de169acd6427", "Unstake(address,uint256,uint256,uint256,uint256)", {"user": indexed(p.address), "lockupId": p.uint256, "amount": p.uint256, "end": p.uint256, "points": p.uint256}), -} - -export const functions = { - DOMAIN_SEPARATOR: viewFun("0x3644e515", "DOMAIN_SEPARATOR()", {}, p.bytes32), - accRewardPerShare: viewFun("0x939d6237", "accRewardPerShare()", {}, p.uint256), - allowance: viewFun("0xdd62ed3e", "allowance(address,address)", {"owner": p.address, "spender": p.address}, p.uint256), - approve: fun("0x095ea7b3", "approve(address,uint256)", {"spender": p.address, "amount": p.uint256}, p.bool), - asset: viewFun("0x38d52e0f", "asset()", {}, p.address), - balanceOf: viewFun("0x70a08231", "balanceOf(address)", {"account": p.address}, p.uint256), - checkpoints: viewFun("0xf1127ed8", "checkpoints(address,uint32)", {"account": p.address, "pos": p.uint32}, p.struct({"fromBlock": p.uint32, "votes": p.uint224})), - collectRewards: fun("0x70bb45b3", "collectRewards()", {}, ), - decimals: viewFun("0x313ce567", "decimals()", {}, p.uint8), - decreaseAllowance: fun("0xa457c2d7", "decreaseAllowance(address,uint256)", {"spender": p.address, "subtractedValue": p.uint256}, p.bool), - delegate: fun("0x5c19a95c", "delegate(address)", {"delegatee": p.address}, ), - delegateBySig: fun("0xc3cda520", "delegateBySig(address,uint256,uint256,uint8,bytes32,bytes32)", {"delegatee": p.address, "nonce": p.uint256, "expiry": p.uint256, "v": p.uint8, "r": p.bytes32, "s": p.bytes32}, ), - delegates: viewFun("0x587cde1e", "delegates(address)", {"account": p.address}, p.address), - epoch: viewFun("0x900cf0cf", "epoch()", {}, p.uint256), - getPastTotalSupply: viewFun("0x8e539e8c", "getPastTotalSupply(uint256)", {"blockNumber": p.uint256}, p.uint256), - getPastVotes: viewFun("0x3a46b1a8", "getPastVotes(address,uint256)", {"account": p.address, "blockNumber": p.uint256}, p.uint256), - getVotes: viewFun("0x9ab24eb0", "getVotes(address)", {"account": p.address}, p.uint256), - increaseAllowance: fun("0x39509351", "increaseAllowance(address,uint256)", {"spender": p.address, "addedValue": p.uint256}, p.bool), - lockups: viewFun("0xc93d0b1e", "lockups(address,uint256)", {"_0": p.address, "_1": p.uint256}, {"amount": p.uint128, "end": p.uint128, "points": p.uint256}), - lockupsCount: viewFun("0xd1a1ad81", "lockupsCount(address)", {"user": p.address}, p.uint256), - maxStakeDuration: viewFun("0x76f70003", "maxStakeDuration()", {}, p.uint256), - minStakeDuration: viewFun("0x5fec5c64", "minStakeDuration()", {}, p.uint256), - name: viewFun("0x06fdde03", "name()", {}, p.string), - nonces: viewFun("0x7ecebe00", "nonces(address)", {"owner": p.address}, p.uint256), - numCheckpoints: viewFun("0x6fcfff45", "numCheckpoints(address)", {"account": p.address}, p.uint32), - permit: fun("0xd505accf", "permit(address,address,uint256,uint256,uint8,bytes32,bytes32)", {"owner": p.address, "spender": p.address, "value": p.uint256, "deadline": p.uint256, "v": p.uint8, "r": p.bytes32, "s": p.bytes32}, ), - previewPoints: viewFun("0x4fd0e648", "previewPoints(uint256,uint256)", {"amount": p.uint256, "duration": p.uint256}, {"_0": p.uint256, "_1": p.uint256}), - previewRewards: viewFun("0xf166e920", "previewRewards(address)", {"user": p.address}, p.uint256), - previewWithdraw: viewFun("0x488bd7b0", "previewWithdraw(uint256,uint256)", {"amount": p.uint256, "end": p.uint256}, p.uint256), - rewardDebtPerShare: viewFun("0x4423bf57", "rewardDebtPerShare(address)", {"_0": p.address}, p.uint256), - rewardsSource: viewFun("0xf7240d2f", "rewardsSource()", {}, p.address), - stake: fun("0x5cd42a92", "stake(uint256,uint256,address,bool,int256)", {"amountIn": p.uint256, "duration": p.uint256, "to": p.address, "stakeRewards": p.bool, "lockupId": p.int256}, ), - symbol: viewFun("0x95d89b41", "symbol()", {}, p.string), - totalSupply: viewFun("0x18160ddd", "totalSupply()", {}, p.uint256), - transfer: fun("0xa9059cbb", "transfer(address,uint256)", {"_0": p.address, "_1": p.uint256}, p.bool), - transferFrom: fun("0x23b872dd", "transferFrom(address,address,uint256)", {"_0": p.address, "_1": p.address, "_2": p.uint256}, p.bool), - unstake: fun("0x2e17de78", "unstake(uint256)", {"lockupId": p.uint256}, ), -} - -export class Contract extends ContractBase { - - DOMAIN_SEPARATOR() { - return this.eth_call(functions.DOMAIN_SEPARATOR, {}) - } - - accRewardPerShare() { - return this.eth_call(functions.accRewardPerShare, {}) - } - - allowance(owner: AllowanceParams["owner"], spender: AllowanceParams["spender"]) { - return this.eth_call(functions.allowance, {owner, spender}) - } - - asset() { - return this.eth_call(functions.asset, {}) - } - - balanceOf(account: BalanceOfParams["account"]) { - return this.eth_call(functions.balanceOf, {account}) - } - - checkpoints(account: CheckpointsParams["account"], pos: CheckpointsParams["pos"]) { - return this.eth_call(functions.checkpoints, {account, pos}) - } - - decimals() { - return this.eth_call(functions.decimals, {}) - } - - delegates(account: DelegatesParams["account"]) { - return this.eth_call(functions.delegates, {account}) - } - - epoch() { - return this.eth_call(functions.epoch, {}) - } - - getPastTotalSupply(blockNumber: GetPastTotalSupplyParams["blockNumber"]) { - return this.eth_call(functions.getPastTotalSupply, {blockNumber}) - } - - getPastVotes(account: GetPastVotesParams["account"], blockNumber: GetPastVotesParams["blockNumber"]) { - return this.eth_call(functions.getPastVotes, {account, blockNumber}) - } - - getVotes(account: GetVotesParams["account"]) { - return this.eth_call(functions.getVotes, {account}) - } - - lockups(_0: LockupsParams["_0"], _1: LockupsParams["_1"]) { - return this.eth_call(functions.lockups, {_0, _1}) - } - - lockupsCount(user: LockupsCountParams["user"]) { - return this.eth_call(functions.lockupsCount, {user}) - } - - maxStakeDuration() { - return this.eth_call(functions.maxStakeDuration, {}) - } - - minStakeDuration() { - return this.eth_call(functions.minStakeDuration, {}) - } - - name() { - return this.eth_call(functions.name, {}) - } - - nonces(owner: NoncesParams["owner"]) { - return this.eth_call(functions.nonces, {owner}) - } - - numCheckpoints(account: NumCheckpointsParams["account"]) { - return this.eth_call(functions.numCheckpoints, {account}) - } - - previewPoints(amount: PreviewPointsParams["amount"], duration: PreviewPointsParams["duration"]) { - return this.eth_call(functions.previewPoints, {amount, duration}) - } - - previewRewards(user: PreviewRewardsParams["user"]) { - return this.eth_call(functions.previewRewards, {user}) - } - - previewWithdraw(amount: PreviewWithdrawParams["amount"], end: PreviewWithdrawParams["end"]) { - return this.eth_call(functions.previewWithdraw, {amount, end}) - } - - rewardDebtPerShare(_0: RewardDebtPerShareParams["_0"]) { - return this.eth_call(functions.rewardDebtPerShare, {_0}) - } - - rewardsSource() { - return this.eth_call(functions.rewardsSource, {}) - } - - symbol() { - return this.eth_call(functions.symbol, {}) - } - - totalSupply() { - return this.eth_call(functions.totalSupply, {}) - } -} - -/// Event types -export type ApprovalEventArgs = EParams -export type DelegateChangedEventArgs = EParams -export type DelegateVotesChangedEventArgs = EParams -export type PenaltyEventArgs = EParams -export type RewardEventArgs = EParams -export type StakeEventArgs = EParams -export type TransferEventArgs = EParams -export type UnstakeEventArgs = EParams - -/// Function types -export type DOMAIN_SEPARATORParams = FunctionArguments -export type DOMAIN_SEPARATORReturn = FunctionReturn - -export type AccRewardPerShareParams = FunctionArguments -export type AccRewardPerShareReturn = FunctionReturn - -export type AllowanceParams = FunctionArguments -export type AllowanceReturn = FunctionReturn - -export type ApproveParams = FunctionArguments -export type ApproveReturn = FunctionReturn - -export type AssetParams = FunctionArguments -export type AssetReturn = FunctionReturn - -export type BalanceOfParams = FunctionArguments -export type BalanceOfReturn = FunctionReturn - -export type CheckpointsParams = FunctionArguments -export type CheckpointsReturn = FunctionReturn - -export type CollectRewardsParams = FunctionArguments -export type CollectRewardsReturn = FunctionReturn - -export type DecimalsParams = FunctionArguments -export type DecimalsReturn = FunctionReturn - -export type DecreaseAllowanceParams = FunctionArguments -export type DecreaseAllowanceReturn = FunctionReturn - -export type DelegateParams = FunctionArguments -export type DelegateReturn = FunctionReturn - -export type DelegateBySigParams = FunctionArguments -export type DelegateBySigReturn = FunctionReturn - -export type DelegatesParams = FunctionArguments -export type DelegatesReturn = FunctionReturn - -export type EpochParams = FunctionArguments -export type EpochReturn = FunctionReturn - -export type GetPastTotalSupplyParams = FunctionArguments -export type GetPastTotalSupplyReturn = FunctionReturn - -export type GetPastVotesParams = FunctionArguments -export type GetPastVotesReturn = FunctionReturn - -export type GetVotesParams = FunctionArguments -export type GetVotesReturn = FunctionReturn - -export type IncreaseAllowanceParams = FunctionArguments -export type IncreaseAllowanceReturn = FunctionReturn - -export type LockupsParams = FunctionArguments -export type LockupsReturn = FunctionReturn - -export type LockupsCountParams = FunctionArguments -export type LockupsCountReturn = FunctionReturn - -export type MaxStakeDurationParams = FunctionArguments -export type MaxStakeDurationReturn = FunctionReturn - -export type MinStakeDurationParams = FunctionArguments -export type MinStakeDurationReturn = FunctionReturn - -export type NameParams = FunctionArguments -export type NameReturn = FunctionReturn - -export type NoncesParams = FunctionArguments -export type NoncesReturn = FunctionReturn - -export type NumCheckpointsParams = FunctionArguments -export type NumCheckpointsReturn = FunctionReturn - -export type PermitParams = FunctionArguments -export type PermitReturn = FunctionReturn - -export type PreviewPointsParams = FunctionArguments -export type PreviewPointsReturn = FunctionReturn - -export type PreviewRewardsParams = FunctionArguments -export type PreviewRewardsReturn = FunctionReturn - -export type PreviewWithdrawParams = FunctionArguments -export type PreviewWithdrawReturn = FunctionReturn - -export type RewardDebtPerShareParams = FunctionArguments -export type RewardDebtPerShareReturn = FunctionReturn - -export type RewardsSourceParams = FunctionArguments -export type RewardsSourceReturn = FunctionReturn - -export type StakeParams = FunctionArguments -export type StakeReturn = FunctionReturn - -export type SymbolParams = FunctionArguments -export type SymbolReturn = FunctionReturn - -export type TotalSupplyParams = FunctionArguments -export type TotalSupplyReturn = FunctionReturn - -export type TransferParams = FunctionArguments -export type TransferReturn = FunctionReturn - -export type TransferFromParams = FunctionArguments -export type TransferFromReturn = FunctionReturn - -export type UnstakeParams = FunctionArguments -export type UnstakeReturn = FunctionReturn - diff --git a/src/abi/exponential-staking/contract.ts b/src/abi/exponential-staking/contract.ts new file mode 100644 index 00000000..40323d9f --- /dev/null +++ b/src/abi/exponential-staking/contract.ts @@ -0,0 +1,129 @@ +import { ContractBase } from '../abi.support.js' +import { DOMAIN_SEPARATOR, accRewardPerShare, allowance, approve, asset, balanceOf, checkpoints, decimals, decreaseAllowance, delegates, epoch, getPastTotalSupply, getPastVotes, getVotes, increaseAllowance, lockups, lockupsCount, maxStakeDuration, minStakeDuration, name, nonces, numCheckpoints, previewPoints, previewRewards, previewWithdraw, rewardDebtPerShare, rewardsSource, symbol, totalSupply, transfer, transferFrom } from './functions.js' +import type { AllowanceParams, ApproveParams, BalanceOfParams, CheckpointsParams, DecreaseAllowanceParams, DelegatesParams, GetPastTotalSupplyParams, GetPastVotesParams, GetVotesParams, IncreaseAllowanceParams, LockupsCountParams, LockupsParams, NoncesParams, NumCheckpointsParams, PreviewPointsParams, PreviewRewardsParams, PreviewWithdrawParams, RewardDebtPerShareParams, TransferFromParams, TransferParams } from './functions.js' + +export class Contract extends ContractBase { + DOMAIN_SEPARATOR() { + return this.eth_call(DOMAIN_SEPARATOR, {}) + } + + accRewardPerShare() { + return this.eth_call(accRewardPerShare, {}) + } + + allowance(owner: AllowanceParams["owner"], spender: AllowanceParams["spender"]) { + return this.eth_call(allowance, {owner, spender}) + } + + approve(spender: ApproveParams["spender"], amount: ApproveParams["amount"]) { + return this.eth_call(approve, {spender, amount}) + } + + asset() { + return this.eth_call(asset, {}) + } + + balanceOf(account: BalanceOfParams["account"]) { + return this.eth_call(balanceOf, {account}) + } + + checkpoints(account: CheckpointsParams["account"], pos: CheckpointsParams["pos"]) { + return this.eth_call(checkpoints, {account, pos}) + } + + decimals() { + return this.eth_call(decimals, {}) + } + + decreaseAllowance(spender: DecreaseAllowanceParams["spender"], subtractedValue: DecreaseAllowanceParams["subtractedValue"]) { + return this.eth_call(decreaseAllowance, {spender, subtractedValue}) + } + + delegates(account: DelegatesParams["account"]) { + return this.eth_call(delegates, {account}) + } + + epoch() { + return this.eth_call(epoch, {}) + } + + getPastTotalSupply(blockNumber: GetPastTotalSupplyParams["blockNumber"]) { + return this.eth_call(getPastTotalSupply, {blockNumber}) + } + + getPastVotes(account: GetPastVotesParams["account"], blockNumber: GetPastVotesParams["blockNumber"]) { + return this.eth_call(getPastVotes, {account, blockNumber}) + } + + getVotes(account: GetVotesParams["account"]) { + return this.eth_call(getVotes, {account}) + } + + increaseAllowance(spender: IncreaseAllowanceParams["spender"], addedValue: IncreaseAllowanceParams["addedValue"]) { + return this.eth_call(increaseAllowance, {spender, addedValue}) + } + + lockups(_0: LockupsParams["_0"], _1: LockupsParams["_1"]) { + return this.eth_call(lockups, {_0, _1}) + } + + lockupsCount(user: LockupsCountParams["user"]) { + return this.eth_call(lockupsCount, {user}) + } + + maxStakeDuration() { + return this.eth_call(maxStakeDuration, {}) + } + + minStakeDuration() { + return this.eth_call(minStakeDuration, {}) + } + + name() { + return this.eth_call(name, {}) + } + + nonces(owner: NoncesParams["owner"]) { + return this.eth_call(nonces, {owner}) + } + + numCheckpoints(account: NumCheckpointsParams["account"]) { + return this.eth_call(numCheckpoints, {account}) + } + + previewPoints(amount: PreviewPointsParams["amount"], duration: PreviewPointsParams["duration"]) { + return this.eth_call(previewPoints, {amount, duration}) + } + + previewRewards(user: PreviewRewardsParams["user"]) { + return this.eth_call(previewRewards, {user}) + } + + previewWithdraw(amount: PreviewWithdrawParams["amount"], end: PreviewWithdrawParams["end"]) { + return this.eth_call(previewWithdraw, {amount, end}) + } + + rewardDebtPerShare(_0: RewardDebtPerShareParams["_0"]) { + return this.eth_call(rewardDebtPerShare, {_0}) + } + + rewardsSource() { + return this.eth_call(rewardsSource, {}) + } + + symbol() { + return this.eth_call(symbol, {}) + } + + totalSupply() { + return this.eth_call(totalSupply, {}) + } + + transfer(_0: TransferParams["_0"], _1: TransferParams["_1"]) { + return this.eth_call(transfer, {_0, _1}) + } + + transferFrom(_0: TransferFromParams["_0"], _1: TransferFromParams["_1"], _2: TransferFromParams["_2"]) { + return this.eth_call(transferFrom, {_0, _1, _2}) + } +} diff --git a/src/abi/exponential-staking/events.ts b/src/abi/exponential-staking/events.ts new file mode 100644 index 00000000..33040145 --- /dev/null +++ b/src/abi/exponential-staking/events.ts @@ -0,0 +1,69 @@ +import { address, uint256 } from '@subsquid/evm-codec' +import { event, indexed } from '../abi.support.js' +import type { EventParams as EParams } from '../abi.support.js' + +/** Approval(address,address,uint256) */ +export const Approval = event('0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925', { + owner: indexed(address), + spender: indexed(address), + value: uint256, +}) +export type ApprovalEventArgs = EParams + +/** DelegateChanged(address,address,address) */ +export const DelegateChanged = event('0x3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f', { + delegator: indexed(address), + fromDelegate: indexed(address), + toDelegate: indexed(address), +}) +export type DelegateChangedEventArgs = EParams + +/** DelegateVotesChanged(address,uint256,uint256) */ +export const DelegateVotesChanged = event('0xdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a724', { + delegate: indexed(address), + previousBalance: uint256, + newBalance: uint256, +}) +export type DelegateVotesChangedEventArgs = EParams + +/** Penalty(address,uint256) */ +export const Penalty = event('0x322e5021ddf51920f7602154a6c845b34ef1b32704a1fa2c66927b56be280762', { + user: indexed(address), + amount: uint256, +}) +export type PenaltyEventArgs = EParams + +/** Reward(address,uint256) */ +export const Reward = event('0x619caafabdd75649b302ba8419e48cccf64f37f1983ac4727cfb38b57703ffc9', { + user: indexed(address), + amount: uint256, +}) +export type RewardEventArgs = EParams + +/** Stake(address,uint256,uint256,uint256,uint256) */ +export const Stake = event('0x2720efa4b2dd4f3f8a347da3cbd290a522e9432da9072c5b8e6300496fdde282', { + user: indexed(address), + lockupId: uint256, + amount: uint256, + end: uint256, + points: uint256, +}) +export type StakeEventArgs = EParams + +/** Transfer(address,address,uint256) */ +export const Transfer = event('0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', { + from: indexed(address), + to: indexed(address), + value: uint256, +}) +export type TransferEventArgs = EParams + +/** Unstake(address,uint256,uint256,uint256,uint256) */ +export const Unstake = event('0x05b744e3e9358bc00ba3cc0c6606a4d6536134dba00b2d2ee4b5de169acd6427', { + user: indexed(address), + lockupId: uint256, + amount: uint256, + end: uint256, + points: uint256, +}) +export type UnstakeEventArgs = EParams diff --git a/src/abi/exponential-staking/functions.ts b/src/abi/exponential-staking/functions.ts new file mode 100644 index 00000000..6eb3a423 --- /dev/null +++ b/src/abi/exponential-staking/functions.ts @@ -0,0 +1,275 @@ +import { address, bool, bytes32, int256, string, struct, uint128, uint224, uint256, uint32, uint8 } from '@subsquid/evm-codec' +import { func } from '../abi.support.js' +import type { FunctionArguments, FunctionReturn } from '../abi.support.js' + +/** DOMAIN_SEPARATOR() */ +export const DOMAIN_SEPARATOR = func('0x3644e515', {}, bytes32) +export type DOMAIN_SEPARATORParams = FunctionArguments +export type DOMAIN_SEPARATORReturn = FunctionReturn + +/** accRewardPerShare() */ +export const accRewardPerShare = func('0x939d6237', {}, uint256) +export type AccRewardPerShareParams = FunctionArguments +export type AccRewardPerShareReturn = FunctionReturn + +/** allowance(address,address) */ +export const allowance = func('0xdd62ed3e', { + owner: address, + spender: address, +}, uint256) +export type AllowanceParams = FunctionArguments +export type AllowanceReturn = FunctionReturn + +/** approve(address,uint256) */ +export const approve = func('0x095ea7b3', { + spender: address, + amount: uint256, +}, bool) +export type ApproveParams = FunctionArguments +export type ApproveReturn = FunctionReturn + +/** asset() */ +export const asset = func('0x38d52e0f', {}, address) +export type AssetParams = FunctionArguments +export type AssetReturn = FunctionReturn + +/** balanceOf(address) */ +export const balanceOf = func('0x70a08231', { + account: address, +}, uint256) +export type BalanceOfParams = FunctionArguments +export type BalanceOfReturn = FunctionReturn + +/** checkpoints(address,uint32) */ +export const checkpoints = func('0xf1127ed8', { + account: address, + pos: uint32, +}, struct({ + fromBlock: uint32, + votes: uint224, +})) +export type CheckpointsParams = FunctionArguments +export type CheckpointsReturn = FunctionReturn + +/** collectRewards() */ +export const collectRewards = func('0x70bb45b3', {}) +export type CollectRewardsParams = FunctionArguments +export type CollectRewardsReturn = FunctionReturn + +/** decimals() */ +export const decimals = func('0x313ce567', {}, uint8) +export type DecimalsParams = FunctionArguments +export type DecimalsReturn = FunctionReturn + +/** decreaseAllowance(address,uint256) */ +export const decreaseAllowance = func('0xa457c2d7', { + spender: address, + subtractedValue: uint256, +}, bool) +export type DecreaseAllowanceParams = FunctionArguments +export type DecreaseAllowanceReturn = FunctionReturn + +/** delegate(address) */ +export const delegate = func('0x5c19a95c', { + delegatee: address, +}) +export type DelegateParams = FunctionArguments +export type DelegateReturn = FunctionReturn + +/** delegateBySig(address,uint256,uint256,uint8,bytes32,bytes32) */ +export const delegateBySig = func('0xc3cda520', { + delegatee: address, + nonce: uint256, + expiry: uint256, + v: uint8, + r: bytes32, + s: bytes32, +}) +export type DelegateBySigParams = FunctionArguments +export type DelegateBySigReturn = FunctionReturn + +/** delegates(address) */ +export const delegates = func('0x587cde1e', { + account: address, +}, address) +export type DelegatesParams = FunctionArguments +export type DelegatesReturn = FunctionReturn + +/** epoch() */ +export const epoch = func('0x900cf0cf', {}, uint256) +export type EpochParams = FunctionArguments +export type EpochReturn = FunctionReturn + +/** getPastTotalSupply(uint256) */ +export const getPastTotalSupply = func('0x8e539e8c', { + blockNumber: uint256, +}, uint256) +export type GetPastTotalSupplyParams = FunctionArguments +export type GetPastTotalSupplyReturn = FunctionReturn + +/** getPastVotes(address,uint256) */ +export const getPastVotes = func('0x3a46b1a8', { + account: address, + blockNumber: uint256, +}, uint256) +export type GetPastVotesParams = FunctionArguments +export type GetPastVotesReturn = FunctionReturn + +/** getVotes(address) */ +export const getVotes = func('0x9ab24eb0', { + account: address, +}, uint256) +export type GetVotesParams = FunctionArguments +export type GetVotesReturn = FunctionReturn + +/** increaseAllowance(address,uint256) */ +export const increaseAllowance = func('0x39509351', { + spender: address, + addedValue: uint256, +}, bool) +export type IncreaseAllowanceParams = FunctionArguments +export type IncreaseAllowanceReturn = FunctionReturn + +/** lockups(address,uint256) */ +export const lockups = func('0xc93d0b1e', { + _0: address, + _1: uint256, +}, struct({ + amount: uint128, + end: uint128, + points: uint256, +})) +export type LockupsParams = FunctionArguments +export type LockupsReturn = FunctionReturn + +/** lockupsCount(address) */ +export const lockupsCount = func('0xd1a1ad81', { + user: address, +}, uint256) +export type LockupsCountParams = FunctionArguments +export type LockupsCountReturn = FunctionReturn + +/** maxStakeDuration() */ +export const maxStakeDuration = func('0x76f70003', {}, uint256) +export type MaxStakeDurationParams = FunctionArguments +export type MaxStakeDurationReturn = FunctionReturn + +/** minStakeDuration() */ +export const minStakeDuration = func('0x5fec5c64', {}, uint256) +export type MinStakeDurationParams = FunctionArguments +export type MinStakeDurationReturn = FunctionReturn + +/** name() */ +export const name = func('0x06fdde03', {}, string) +export type NameParams = FunctionArguments +export type NameReturn = FunctionReturn + +/** nonces(address) */ +export const nonces = func('0x7ecebe00', { + owner: address, +}, uint256) +export type NoncesParams = FunctionArguments +export type NoncesReturn = FunctionReturn + +/** numCheckpoints(address) */ +export const numCheckpoints = func('0x6fcfff45', { + account: address, +}, uint32) +export type NumCheckpointsParams = FunctionArguments +export type NumCheckpointsReturn = FunctionReturn + +/** permit(address,address,uint256,uint256,uint8,bytes32,bytes32) */ +export const permit = func('0xd505accf', { + owner: address, + spender: address, + value: uint256, + deadline: uint256, + v: uint8, + r: bytes32, + s: bytes32, +}) +export type PermitParams = FunctionArguments +export type PermitReturn = FunctionReturn + +/** previewPoints(uint256,uint256) */ +export const previewPoints = func('0x4fd0e648', { + amount: uint256, + duration: uint256, +}, struct({ + _0: uint256, + _1: uint256, +})) +export type PreviewPointsParams = FunctionArguments +export type PreviewPointsReturn = FunctionReturn + +/** previewRewards(address) */ +export const previewRewards = func('0xf166e920', { + user: address, +}, uint256) +export type PreviewRewardsParams = FunctionArguments +export type PreviewRewardsReturn = FunctionReturn + +/** previewWithdraw(uint256,uint256) */ +export const previewWithdraw = func('0x488bd7b0', { + amount: uint256, + end: uint256, +}, uint256) +export type PreviewWithdrawParams = FunctionArguments +export type PreviewWithdrawReturn = FunctionReturn + +/** rewardDebtPerShare(address) */ +export const rewardDebtPerShare = func('0x4423bf57', { + _0: address, +}, uint256) +export type RewardDebtPerShareParams = FunctionArguments +export type RewardDebtPerShareReturn = FunctionReturn + +/** rewardsSource() */ +export const rewardsSource = func('0xf7240d2f', {}, address) +export type RewardsSourceParams = FunctionArguments +export type RewardsSourceReturn = FunctionReturn + +/** stake(uint256,uint256,address,bool,int256) */ +export const stake = func('0x5cd42a92', { + amountIn: uint256, + duration: uint256, + to: address, + stakeRewards: bool, + lockupId: int256, +}) +export type StakeParams = FunctionArguments +export type StakeReturn = FunctionReturn + +/** symbol() */ +export const symbol = func('0x95d89b41', {}, string) +export type SymbolParams = FunctionArguments +export type SymbolReturn = FunctionReturn + +/** totalSupply() */ +export const totalSupply = func('0x18160ddd', {}, uint256) +export type TotalSupplyParams = FunctionArguments +export type TotalSupplyReturn = FunctionReturn + +/** transfer(address,uint256) */ +export const transfer = func('0xa9059cbb', { + _0: address, + _1: uint256, +}, bool) +export type TransferParams = FunctionArguments +export type TransferReturn = FunctionReturn + +/** transferFrom(address,address,uint256) */ +export const transferFrom = func('0x23b872dd', { + _0: address, + _1: address, + _2: uint256, +}, bool) +export type TransferFromParams = FunctionArguments +export type TransferFromReturn = FunctionReturn + +/** unstake(uint256) */ +export const unstake = func('0x2e17de78', { + lockupId: uint256, +}) +export type UnstakeParams = FunctionArguments +export type UnstakeReturn = FunctionReturn diff --git a/src/abi/exponential-staking/index.ts b/src/abi/exponential-staking/index.ts new file mode 100644 index 00000000..11829d6e --- /dev/null +++ b/src/abi/exponential-staking/index.ts @@ -0,0 +1,4 @@ +export * as events from './events.js' +export * as functions from './functions.js' + +export { Contract } from './contract.js' diff --git a/src/abi/fee-accumulator.ts b/src/abi/fee-accumulator.ts deleted file mode 100644 index e92523b9..00000000 --- a/src/abi/fee-accumulator.ts +++ /dev/null @@ -1,30 +0,0 @@ -import * as p from '@subsquid/evm-codec' -import { event, fun, viewFun, indexed, ContractBase } from '@subsquid/evm-abi' -import type { EventParams as EParams, FunctionArguments, FunctionReturn } from '@subsquid/evm-abi' - -export const events = { - ExecutionRewardsCollected: event("0xc2acb502a0dc166a61cd83b914b480d76050e91a6797d7a833be84c4eace1dfe", "ExecutionRewardsCollected(address,uint256)", {"strategy": indexed(p.address), "amount": p.uint256}), -} - -export const functions = { - STRATEGY: viewFun("0x185025ef", "STRATEGY()", {}, p.address), - collect: fun("0xe5225381", "collect()", {}, p.uint256), -} - -export class Contract extends ContractBase { - - STRATEGY() { - return this.eth_call(functions.STRATEGY, {}) - } -} - -/// Event types -export type ExecutionRewardsCollectedEventArgs = EParams - -/// Function types -export type STRATEGYParams = FunctionArguments -export type STRATEGYReturn = FunctionReturn - -export type CollectParams = FunctionArguments -export type CollectReturn = FunctionReturn - diff --git a/src/abi/fee-accumulator/contract.ts b/src/abi/fee-accumulator/contract.ts new file mode 100644 index 00000000..9c503501 --- /dev/null +++ b/src/abi/fee-accumulator/contract.ts @@ -0,0 +1,12 @@ +import { ContractBase } from '../abi.support.js' +import { STRATEGY, collect } from './functions.js' + +export class Contract extends ContractBase { + STRATEGY() { + return this.eth_call(STRATEGY, {}) + } + + collect() { + return this.eth_call(collect, {}) + } +} diff --git a/src/abi/fee-accumulator/events.ts b/src/abi/fee-accumulator/events.ts new file mode 100644 index 00000000..7cd7ca79 --- /dev/null +++ b/src/abi/fee-accumulator/events.ts @@ -0,0 +1,10 @@ +import { address, uint256 } from '@subsquid/evm-codec' +import { event, indexed } from '../abi.support.js' +import type { EventParams as EParams } from '../abi.support.js' + +/** ExecutionRewardsCollected(address,uint256) */ +export const ExecutionRewardsCollected = event('0xc2acb502a0dc166a61cd83b914b480d76050e91a6797d7a833be84c4eace1dfe', { + strategy: indexed(address), + amount: uint256, +}) +export type ExecutionRewardsCollectedEventArgs = EParams diff --git a/src/abi/fee-accumulator/functions.ts b/src/abi/fee-accumulator/functions.ts new file mode 100644 index 00000000..d84874cb --- /dev/null +++ b/src/abi/fee-accumulator/functions.ts @@ -0,0 +1,13 @@ +import { address, uint256 } from '@subsquid/evm-codec' +import { func } from '../abi.support.js' +import type { FunctionArguments, FunctionReturn } from '../abi.support.js' + +/** STRATEGY() */ +export const STRATEGY = func('0x185025ef', {}, address) +export type STRATEGYParams = FunctionArguments +export type STRATEGYReturn = FunctionReturn + +/** collect() */ +export const collect = func('0xe5225381', {}, uint256) +export type CollectParams = FunctionArguments +export type CollectReturn = FunctionReturn diff --git a/src/abi/fee-accumulator/index.ts b/src/abi/fee-accumulator/index.ts new file mode 100644 index 00000000..11829d6e --- /dev/null +++ b/src/abi/fee-accumulator/index.ts @@ -0,0 +1,4 @@ +export * as events from './events.js' +export * as functions from './functions.js' + +export { Contract } from './contract.js' diff --git a/src/abi/fixed-rate-rewards-source.ts b/src/abi/fixed-rate-rewards-source.ts deleted file mode 100644 index e49af3de..00000000 --- a/src/abi/fixed-rate-rewards-source.ts +++ /dev/null @@ -1,112 +0,0 @@ -import * as p from '@subsquid/evm-codec' -import { event, fun, viewFun, indexed, ContractBase } from '@subsquid/evm-abi' -import type { EventParams as EParams, FunctionArguments, FunctionReturn } from '@subsquid/evm-abi' - -export const events = { - GovernorshipTransferred: event("0xc7c0c772add429241571afb3805861fb3cfa2af374534088b76cdb4325a87e9a", "GovernorshipTransferred(address,address)", {"previousGovernor": indexed(p.address), "newGovernor": indexed(p.address)}), - PendingGovernorshipTransfer: event("0xa39cc5eb22d0f34d8beaefee8a3f17cc229c1a1d1ef87a5ad47313487b1c4f0d", "PendingGovernorshipTransfer(address,address)", {"previousGovernor": indexed(p.address), "newGovernor": indexed(p.address)}), - RewardCollected: event("0x9026b1dc1bd4688af8f4998f8cacc713a53fba753294da0efe4849a25c26023e", "RewardCollected(uint256)", {"amountCollected": p.uint256}), - RewardsPerSecondChanged: event("0xe261f91b5c3d9f16ed2268171bcd375f4aa1fe4b244cfe2e54a7d21be4735d46", "RewardsPerSecondChanged(uint256,uint256)", {"newRPS": p.uint256, "oldRPS": p.uint256}), - RewardsTargetChange: event("0x41ad0a33748dcbf4495041d0518e1204c1d5f0d65e7dccb51877235361e75f4a", "RewardsTargetChange(address,address)", {"target": p.address, "previousTarget": p.address}), - StrategistUpdated: event("0x869e0abd13cc3a975de7b93be3df1cb2255c802b1cead85963cc79d99f131bee", "StrategistUpdated(address)", {"_address": p.address}), -} - -export const functions = { - claimGovernance: fun("0x5d36b190", "claimGovernance()", {}, ), - collectRewards: fun("0x70bb45b3", "collectRewards()", {}, p.uint256), - governor: viewFun("0x0c340a24", "governor()", {}, p.address), - initialize: fun("0x485cc955", "initialize(address,address)", {"_strategistAddr": p.address, "_rewardsTarget": p.address}, ), - isGovernor: viewFun("0xc7af3352", "isGovernor()", {}, p.bool), - previewRewards: viewFun("0xe0d801dd", "previewRewards()", {}, p.uint256), - rewardConfig: viewFun("0x4e94c285", "rewardConfig()", {}, {"lastCollect": p.uint64, "rewardsPerSecond": p.uint192}), - rewardToken: viewFun("0xf7c618c1", "rewardToken()", {}, p.address), - rewardsTarget: viewFun("0x82487844", "rewardsTarget()", {}, p.address), - setRewardsPerSecond: fun("0xdc9ec152", "setRewardsPerSecond(uint192)", {"_rewardsPerSecond": p.uint192}, ), - setRewardsTarget: fun("0x6411466f", "setRewardsTarget(address)", {"_rewardsTarget": p.address}, ), - setStrategistAddr: fun("0x773540b3", "setStrategistAddr(address)", {"_address": p.address}, ), - strategistAddr: viewFun("0x570d8e1d", "strategistAddr()", {}, p.address), - transferGovernance: fun("0xd38bfff4", "transferGovernance(address)", {"_newGovernor": p.address}, ), -} - -export class Contract extends ContractBase { - - governor() { - return this.eth_call(functions.governor, {}) - } - - isGovernor() { - return this.eth_call(functions.isGovernor, {}) - } - - previewRewards() { - return this.eth_call(functions.previewRewards, {}) - } - - rewardConfig() { - return this.eth_call(functions.rewardConfig, {}) - } - - rewardToken() { - return this.eth_call(functions.rewardToken, {}) - } - - rewardsTarget() { - return this.eth_call(functions.rewardsTarget, {}) - } - - strategistAddr() { - return this.eth_call(functions.strategistAddr, {}) - } -} - -/// Event types -export type GovernorshipTransferredEventArgs = EParams -export type PendingGovernorshipTransferEventArgs = EParams -export type RewardCollectedEventArgs = EParams -export type RewardsPerSecondChangedEventArgs = EParams -export type RewardsTargetChangeEventArgs = EParams -export type StrategistUpdatedEventArgs = EParams - -/// Function types -export type ClaimGovernanceParams = FunctionArguments -export type ClaimGovernanceReturn = FunctionReturn - -export type CollectRewardsParams = FunctionArguments -export type CollectRewardsReturn = FunctionReturn - -export type GovernorParams = FunctionArguments -export type GovernorReturn = FunctionReturn - -export type InitializeParams = FunctionArguments -export type InitializeReturn = FunctionReturn - -export type IsGovernorParams = FunctionArguments -export type IsGovernorReturn = FunctionReturn - -export type PreviewRewardsParams = FunctionArguments -export type PreviewRewardsReturn = FunctionReturn - -export type RewardConfigParams = FunctionArguments -export type RewardConfigReturn = FunctionReturn - -export type RewardTokenParams = FunctionArguments -export type RewardTokenReturn = FunctionReturn - -export type RewardsTargetParams = FunctionArguments -export type RewardsTargetReturn = FunctionReturn - -export type SetRewardsPerSecondParams = FunctionArguments -export type SetRewardsPerSecondReturn = FunctionReturn - -export type SetRewardsTargetParams = FunctionArguments -export type SetRewardsTargetReturn = FunctionReturn - -export type SetStrategistAddrParams = FunctionArguments -export type SetStrategistAddrReturn = FunctionReturn - -export type StrategistAddrParams = FunctionArguments -export type StrategistAddrReturn = FunctionReturn - -export type TransferGovernanceParams = FunctionArguments -export type TransferGovernanceReturn = FunctionReturn - diff --git a/src/abi/fixed-rate-rewards-source/contract.ts b/src/abi/fixed-rate-rewards-source/contract.ts new file mode 100644 index 00000000..6ac75c42 --- /dev/null +++ b/src/abi/fixed-rate-rewards-source/contract.ts @@ -0,0 +1,36 @@ +import { ContractBase } from '../abi.support.js' +import { collectRewards, governor, isGovernor, previewRewards, rewardConfig, rewardToken, rewardsTarget, strategistAddr } from './functions.js' + +export class Contract extends ContractBase { + collectRewards() { + return this.eth_call(collectRewards, {}) + } + + governor() { + return this.eth_call(governor, {}) + } + + isGovernor() { + return this.eth_call(isGovernor, {}) + } + + previewRewards() { + return this.eth_call(previewRewards, {}) + } + + rewardConfig() { + return this.eth_call(rewardConfig, {}) + } + + rewardToken() { + return this.eth_call(rewardToken, {}) + } + + rewardsTarget() { + return this.eth_call(rewardsTarget, {}) + } + + strategistAddr() { + return this.eth_call(strategistAddr, {}) + } +} diff --git a/src/abi/fixed-rate-rewards-source/events.ts b/src/abi/fixed-rate-rewards-source/events.ts new file mode 100644 index 00000000..cd44fbfc --- /dev/null +++ b/src/abi/fixed-rate-rewards-source/events.ts @@ -0,0 +1,43 @@ +import { address, uint256 } from '@subsquid/evm-codec' +import { event, indexed } from '../abi.support.js' +import type { EventParams as EParams } from '../abi.support.js' + +/** GovernorshipTransferred(address,address) */ +export const GovernorshipTransferred = event('0xc7c0c772add429241571afb3805861fb3cfa2af374534088b76cdb4325a87e9a', { + previousGovernor: indexed(address), + newGovernor: indexed(address), +}) +export type GovernorshipTransferredEventArgs = EParams + +/** PendingGovernorshipTransfer(address,address) */ +export const PendingGovernorshipTransfer = event('0xa39cc5eb22d0f34d8beaefee8a3f17cc229c1a1d1ef87a5ad47313487b1c4f0d', { + previousGovernor: indexed(address), + newGovernor: indexed(address), +}) +export type PendingGovernorshipTransferEventArgs = EParams + +/** RewardCollected(uint256) */ +export const RewardCollected = event('0x9026b1dc1bd4688af8f4998f8cacc713a53fba753294da0efe4849a25c26023e', { + amountCollected: uint256, +}) +export type RewardCollectedEventArgs = EParams + +/** RewardsPerSecondChanged(uint256,uint256) */ +export const RewardsPerSecondChanged = event('0xe261f91b5c3d9f16ed2268171bcd375f4aa1fe4b244cfe2e54a7d21be4735d46', { + newRPS: uint256, + oldRPS: uint256, +}) +export type RewardsPerSecondChangedEventArgs = EParams + +/** RewardsTargetChange(address,address) */ +export const RewardsTargetChange = event('0x41ad0a33748dcbf4495041d0518e1204c1d5f0d65e7dccb51877235361e75f4a', { + target: address, + previousTarget: address, +}) +export type RewardsTargetChangeEventArgs = EParams + +/** StrategistUpdated(address) */ +export const StrategistUpdated = event('0x869e0abd13cc3a975de7b93be3df1cb2255c802b1cead85963cc79d99f131bee', { + _address: address, +}) +export type StrategistUpdatedEventArgs = EParams diff --git a/src/abi/fixed-rate-rewards-source/functions.ts b/src/abi/fixed-rate-rewards-source/functions.ts new file mode 100644 index 00000000..b419ea5e --- /dev/null +++ b/src/abi/fixed-rate-rewards-source/functions.ts @@ -0,0 +1,87 @@ +import { address, bool, struct, uint192, uint256, uint64 } from '@subsquid/evm-codec' +import { func } from '../abi.support.js' +import type { FunctionArguments, FunctionReturn } from '../abi.support.js' + +/** claimGovernance() */ +export const claimGovernance = func('0x5d36b190', {}) +export type ClaimGovernanceParams = FunctionArguments +export type ClaimGovernanceReturn = FunctionReturn + +/** collectRewards() */ +export const collectRewards = func('0x70bb45b3', {}, uint256) +export type CollectRewardsParams = FunctionArguments +export type CollectRewardsReturn = FunctionReturn + +/** governor() */ +export const governor = func('0x0c340a24', {}, address) +export type GovernorParams = FunctionArguments +export type GovernorReturn = FunctionReturn + +/** initialize(address,address) */ +export const initialize = func('0x485cc955', { + _strategistAddr: address, + _rewardsTarget: address, +}) +export type InitializeParams = FunctionArguments +export type InitializeReturn = FunctionReturn + +/** isGovernor() */ +export const isGovernor = func('0xc7af3352', {}, bool) +export type IsGovernorParams = FunctionArguments +export type IsGovernorReturn = FunctionReturn + +/** previewRewards() */ +export const previewRewards = func('0xe0d801dd', {}, uint256) +export type PreviewRewardsParams = FunctionArguments +export type PreviewRewardsReturn = FunctionReturn + +/** rewardConfig() */ +export const rewardConfig = func('0x4e94c285', {}, struct({ + lastCollect: uint64, + rewardsPerSecond: uint192, +})) +export type RewardConfigParams = FunctionArguments +export type RewardConfigReturn = FunctionReturn + +/** rewardToken() */ +export const rewardToken = func('0xf7c618c1', {}, address) +export type RewardTokenParams = FunctionArguments +export type RewardTokenReturn = FunctionReturn + +/** rewardsTarget() */ +export const rewardsTarget = func('0x82487844', {}, address) +export type RewardsTargetParams = FunctionArguments +export type RewardsTargetReturn = FunctionReturn + +/** setRewardsPerSecond(uint192) */ +export const setRewardsPerSecond = func('0xdc9ec152', { + _rewardsPerSecond: uint192, +}) +export type SetRewardsPerSecondParams = FunctionArguments +export type SetRewardsPerSecondReturn = FunctionReturn + +/** setRewardsTarget(address) */ +export const setRewardsTarget = func('0x6411466f', { + _rewardsTarget: address, +}) +export type SetRewardsTargetParams = FunctionArguments +export type SetRewardsTargetReturn = FunctionReturn + +/** setStrategistAddr(address) */ +export const setStrategistAddr = func('0x773540b3', { + _address: address, +}) +export type SetStrategistAddrParams = FunctionArguments +export type SetStrategistAddrReturn = FunctionReturn + +/** strategistAddr() */ +export const strategistAddr = func('0x570d8e1d', {}, address) +export type StrategistAddrParams = FunctionArguments +export type StrategistAddrReturn = FunctionReturn + +/** transferGovernance(address) */ +export const transferGovernance = func('0xd38bfff4', { + _newGovernor: address, +}) +export type TransferGovernanceParams = FunctionArguments +export type TransferGovernanceReturn = FunctionReturn diff --git a/src/abi/fixed-rate-rewards-source/index.ts b/src/abi/fixed-rate-rewards-source/index.ts new file mode 100644 index 00000000..11829d6e --- /dev/null +++ b/src/abi/fixed-rate-rewards-source/index.ts @@ -0,0 +1,4 @@ +export * as events from './events.js' +export * as functions from './functions.js' + +export { Contract } from './contract.js' diff --git a/src/abi/frx-eth-frax-oracle.ts b/src/abi/frx-eth-frax-oracle.ts deleted file mode 100644 index b76c3468..00000000 --- a/src/abi/frx-eth-frax-oracle.ts +++ /dev/null @@ -1,182 +0,0 @@ -import * as p from '@subsquid/evm-codec' -import { event, fun, viewFun, indexed, ContractBase } from '@subsquid/evm-abi' -import type { EventParams as EParams, FunctionArguments, FunctionReturn } from '@subsquid/evm-abi' - -export const events = { - SetMaximumDeviation: event("0x7e2a21727a662d0def125b3d1237f41a099a760d472095091724cd8e56c25bf0", "SetMaximumDeviation(uint256,uint256)", {"oldMaxDeviation": p.uint256, "newMaxDeviation": p.uint256}), - SetMaximumOracleDelay: event("0xd72ef688fa430b6a285b84371ba35e8a8e0762b32c1deb7be9d9c111ca79f5ea", "SetMaximumOracleDelay(uint256,uint256)", {"oldMaxOracleDelay": p.uint256, "newMaxOracleDelay": p.uint256}), - SetPriceSource: event("0x964298b435edfc268e11aa89b342ef1ddac566da6759b6dd15d7aad58a1dc935", "SetPriceSource(address,address)", {"oldPriceSource": p.address, "newPriceSource": p.address}), - TimelockTransferStarted: event("0x162998b90abc2507f3953aa797827b03a14c42dbd9a35f09feaf02e0d592773a", "TimelockTransferStarted(address,address)", {"previousTimelock": indexed(p.address), "newTimelock": indexed(p.address)}), - TimelockTransferred: event("0x31b6c5a04b069b6ec1b3cef44c4e7c1eadd721349cda9823d0b1877b3551cdc6", "TimelockTransferred(address,address)", {"previousTimelock": indexed(p.address), "newTimelock": indexed(p.address)}), -} - -export const functions = { - BASE_TOKEN: viewFun("0x210663e4", "BASE_TOKEN()", {}, p.address), - QUOTE_TOKEN: viewFun("0x78892cea", "QUOTE_TOKEN()", {}, p.address), - acceptTransferTimelock: fun("0xf6ccaad4", "acceptTransferTimelock()", {}, ), - addRoundData: fun("0x45d9f582", "addRoundData(bool,uint104,uint104,uint40)", {"_isBadData": p.bool, "_priceLow": p.uint104, "_priceHigh": p.uint104, "_timestamp": p.uint40}, ), - decimals: viewFun("0x313ce567", "decimals()", {}, p.uint8), - description: viewFun("0x7284e416", "description()", {}, p.string), - getPrices: viewFun("0xbd9a548b", "getPrices()", {}, {"_isBadData": p.bool, "_priceLow": p.uint256, "_priceHigh": p.uint256}), - getRoundData: viewFun("0x9a6fc8f5", "getRoundData(uint80)", {"_roundId": p.uint80}, {"roundId": p.uint80, "answer": p.int256, "startedAt": p.uint256, "updatedAt": p.uint256, "answeredInRound": p.uint80}), - lastCorrectRoundId: viewFun("0x0f4a05fb", "lastCorrectRoundId()", {}, p.uint80), - latestRoundData: viewFun("0xfeaf968c", "latestRoundData()", {}, {"roundId": p.uint80, "answer": p.int256, "startedAt": p.uint256, "updatedAt": p.uint256, "answeredInRound": p.uint80}), - maximumDeviation: viewFun("0x9152c29d", "maximumDeviation()", {}, p.uint256), - maximumOracleDelay: viewFun("0xcede91a4", "maximumOracleDelay()", {}, p.uint256), - pendingTimelockAddress: viewFun("0x090f3f50", "pendingTimelockAddress()", {}, p.address), - priceSource: viewFun("0x20531bc9", "priceSource()", {}, p.address), - renounceTimelock: fun("0x4f8b4ae7", "renounceTimelock()", {}, ), - rounds: viewFun("0x8c65c81f", "rounds(uint256)", {"_0": p.uint256}, {"priceLow": p.uint104, "priceHigh": p.uint104, "timestamp": p.uint40, "isBadData": p.bool}), - setMaximumDeviation: fun("0x2dfa4267", "setMaximumDeviation(uint256)", {"_newMaxDeviation": p.uint256}, ), - setMaximumOracleDelay: fun("0xd2333be7", "setMaximumOracleDelay(uint256)", {"_newMaxOracleDelay": p.uint256}, ), - setPriceSource: fun("0xbda53107", "setPriceSource(address)", {"_newPriceSource": p.address}, ), - supportsInterface: viewFun("0x01ffc9a7", "supportsInterface(bytes4)", {"interfaceId": p.bytes4}, p.bool), - timelockAddress: viewFun("0x4bc66f32", "timelockAddress()", {}, p.address), - transferTimelock: fun("0x45014095", "transferTimelock(address)", {"_newTimelock": p.address}, ), - version: viewFun("0x54fd4d50", "version()", {}, p.uint256), -} - -export class Contract extends ContractBase { - - BASE_TOKEN() { - return this.eth_call(functions.BASE_TOKEN, {}) - } - - QUOTE_TOKEN() { - return this.eth_call(functions.QUOTE_TOKEN, {}) - } - - decimals() { - return this.eth_call(functions.decimals, {}) - } - - description() { - return this.eth_call(functions.description, {}) - } - - getPrices() { - return this.eth_call(functions.getPrices, {}) - } - - getRoundData(_roundId: GetRoundDataParams["_roundId"]) { - return this.eth_call(functions.getRoundData, {_roundId}) - } - - lastCorrectRoundId() { - return this.eth_call(functions.lastCorrectRoundId, {}) - } - - latestRoundData() { - return this.eth_call(functions.latestRoundData, {}) - } - - maximumDeviation() { - return this.eth_call(functions.maximumDeviation, {}) - } - - maximumOracleDelay() { - return this.eth_call(functions.maximumOracleDelay, {}) - } - - pendingTimelockAddress() { - return this.eth_call(functions.pendingTimelockAddress, {}) - } - - priceSource() { - return this.eth_call(functions.priceSource, {}) - } - - rounds(_0: RoundsParams["_0"]) { - return this.eth_call(functions.rounds, {_0}) - } - - supportsInterface(interfaceId: SupportsInterfaceParams["interfaceId"]) { - return this.eth_call(functions.supportsInterface, {interfaceId}) - } - - timelockAddress() { - return this.eth_call(functions.timelockAddress, {}) - } - - version() { - return this.eth_call(functions.version, {}) - } -} - -/// Event types -export type SetMaximumDeviationEventArgs = EParams -export type SetMaximumOracleDelayEventArgs = EParams -export type SetPriceSourceEventArgs = EParams -export type TimelockTransferStartedEventArgs = EParams -export type TimelockTransferredEventArgs = EParams - -/// Function types -export type BASE_TOKENParams = FunctionArguments -export type BASE_TOKENReturn = FunctionReturn - -export type QUOTE_TOKENParams = FunctionArguments -export type QUOTE_TOKENReturn = FunctionReturn - -export type AcceptTransferTimelockParams = FunctionArguments -export type AcceptTransferTimelockReturn = FunctionReturn - -export type AddRoundDataParams = FunctionArguments -export type AddRoundDataReturn = FunctionReturn - -export type DecimalsParams = FunctionArguments -export type DecimalsReturn = FunctionReturn - -export type DescriptionParams = FunctionArguments -export type DescriptionReturn = FunctionReturn - -export type GetPricesParams = FunctionArguments -export type GetPricesReturn = FunctionReturn - -export type GetRoundDataParams = FunctionArguments -export type GetRoundDataReturn = FunctionReturn - -export type LastCorrectRoundIdParams = FunctionArguments -export type LastCorrectRoundIdReturn = FunctionReturn - -export type LatestRoundDataParams = FunctionArguments -export type LatestRoundDataReturn = FunctionReturn - -export type MaximumDeviationParams = FunctionArguments -export type MaximumDeviationReturn = FunctionReturn - -export type MaximumOracleDelayParams = FunctionArguments -export type MaximumOracleDelayReturn = FunctionReturn - -export type PendingTimelockAddressParams = FunctionArguments -export type PendingTimelockAddressReturn = FunctionReturn - -export type PriceSourceParams = FunctionArguments -export type PriceSourceReturn = FunctionReturn - -export type RenounceTimelockParams = FunctionArguments -export type RenounceTimelockReturn = FunctionReturn - -export type RoundsParams = FunctionArguments -export type RoundsReturn = FunctionReturn - -export type SetMaximumDeviationParams = FunctionArguments -export type SetMaximumDeviationReturn = FunctionReturn - -export type SetMaximumOracleDelayParams = FunctionArguments -export type SetMaximumOracleDelayReturn = FunctionReturn - -export type SetPriceSourceParams = FunctionArguments -export type SetPriceSourceReturn = FunctionReturn - -export type SupportsInterfaceParams = FunctionArguments -export type SupportsInterfaceReturn = FunctionReturn - -export type TimelockAddressParams = FunctionArguments -export type TimelockAddressReturn = FunctionReturn - -export type TransferTimelockParams = FunctionArguments -export type TransferTimelockReturn = FunctionReturn - -export type VersionParams = FunctionArguments -export type VersionReturn = FunctionReturn - diff --git a/src/abi/frx-eth-frax-oracle/contract.ts b/src/abi/frx-eth-frax-oracle/contract.ts new file mode 100644 index 00000000..58f08aa9 --- /dev/null +++ b/src/abi/frx-eth-frax-oracle/contract.ts @@ -0,0 +1,69 @@ +import { ContractBase } from '../abi.support.js' +import { BASE_TOKEN, QUOTE_TOKEN, decimals, description, getPrices, getRoundData, lastCorrectRoundId, latestRoundData, maximumDeviation, maximumOracleDelay, pendingTimelockAddress, priceSource, rounds, supportsInterface, timelockAddress, version } from './functions.js' +import type { GetRoundDataParams, RoundsParams, SupportsInterfaceParams } from './functions.js' + +export class Contract extends ContractBase { + BASE_TOKEN() { + return this.eth_call(BASE_TOKEN, {}) + } + + QUOTE_TOKEN() { + return this.eth_call(QUOTE_TOKEN, {}) + } + + decimals() { + return this.eth_call(decimals, {}) + } + + description() { + return this.eth_call(description, {}) + } + + getPrices() { + return this.eth_call(getPrices, {}) + } + + getRoundData(_roundId: GetRoundDataParams["_roundId"]) { + return this.eth_call(getRoundData, {_roundId}) + } + + lastCorrectRoundId() { + return this.eth_call(lastCorrectRoundId, {}) + } + + latestRoundData() { + return this.eth_call(latestRoundData, {}) + } + + maximumDeviation() { + return this.eth_call(maximumDeviation, {}) + } + + maximumOracleDelay() { + return this.eth_call(maximumOracleDelay, {}) + } + + pendingTimelockAddress() { + return this.eth_call(pendingTimelockAddress, {}) + } + + priceSource() { + return this.eth_call(priceSource, {}) + } + + rounds(_0: RoundsParams["_0"]) { + return this.eth_call(rounds, {_0}) + } + + supportsInterface(interfaceId: SupportsInterfaceParams["interfaceId"]) { + return this.eth_call(supportsInterface, {interfaceId}) + } + + timelockAddress() { + return this.eth_call(timelockAddress, {}) + } + + version() { + return this.eth_call(version, {}) + } +} diff --git a/src/abi/frx-eth-frax-oracle/events.ts b/src/abi/frx-eth-frax-oracle/events.ts new file mode 100644 index 00000000..ed66ccbe --- /dev/null +++ b/src/abi/frx-eth-frax-oracle/events.ts @@ -0,0 +1,38 @@ +import { address, uint256 } from '@subsquid/evm-codec' +import { event, indexed } from '../abi.support.js' +import type { EventParams as EParams } from '../abi.support.js' + +/** SetMaximumDeviation(uint256,uint256) */ +export const SetMaximumDeviation = event('0x7e2a21727a662d0def125b3d1237f41a099a760d472095091724cd8e56c25bf0', { + oldMaxDeviation: uint256, + newMaxDeviation: uint256, +}) +export type SetMaximumDeviationEventArgs = EParams + +/** SetMaximumOracleDelay(uint256,uint256) */ +export const SetMaximumOracleDelay = event('0xd72ef688fa430b6a285b84371ba35e8a8e0762b32c1deb7be9d9c111ca79f5ea', { + oldMaxOracleDelay: uint256, + newMaxOracleDelay: uint256, +}) +export type SetMaximumOracleDelayEventArgs = EParams + +/** SetPriceSource(address,address) */ +export const SetPriceSource = event('0x964298b435edfc268e11aa89b342ef1ddac566da6759b6dd15d7aad58a1dc935', { + oldPriceSource: address, + newPriceSource: address, +}) +export type SetPriceSourceEventArgs = EParams + +/** TimelockTransferStarted(address,address) */ +export const TimelockTransferStarted = event('0x162998b90abc2507f3953aa797827b03a14c42dbd9a35f09feaf02e0d592773a', { + previousTimelock: indexed(address), + newTimelock: indexed(address), +}) +export type TimelockTransferStartedEventArgs = EParams + +/** TimelockTransferred(address,address) */ +export const TimelockTransferred = event('0x31b6c5a04b069b6ec1b3cef44c4e7c1eadd721349cda9823d0b1877b3551cdc6', { + previousTimelock: indexed(address), + newTimelock: indexed(address), +}) +export type TimelockTransferredEventArgs = EParams diff --git a/src/abi/frx-eth-frax-oracle/functions.ts b/src/abi/frx-eth-frax-oracle/functions.ts new file mode 100644 index 00000000..cec4046f --- /dev/null +++ b/src/abi/frx-eth-frax-oracle/functions.ts @@ -0,0 +1,158 @@ +import { address, bool, bytes4, int256, string, struct, uint104, uint256, uint40, uint8, uint80 } from '@subsquid/evm-codec' +import { func } from '../abi.support.js' +import type { FunctionArguments, FunctionReturn } from '../abi.support.js' + +/** BASE_TOKEN() */ +export const BASE_TOKEN = func('0x210663e4', {}, address) +export type BASE_TOKENParams = FunctionArguments +export type BASE_TOKENReturn = FunctionReturn + +/** QUOTE_TOKEN() */ +export const QUOTE_TOKEN = func('0x78892cea', {}, address) +export type QUOTE_TOKENParams = FunctionArguments +export type QUOTE_TOKENReturn = FunctionReturn + +/** acceptTransferTimelock() */ +export const acceptTransferTimelock = func('0xf6ccaad4', {}) +export type AcceptTransferTimelockParams = FunctionArguments +export type AcceptTransferTimelockReturn = FunctionReturn + +/** addRoundData(bool,uint104,uint104,uint40) */ +export const addRoundData = func('0x45d9f582', { + _isBadData: bool, + _priceLow: uint104, + _priceHigh: uint104, + _timestamp: uint40, +}) +export type AddRoundDataParams = FunctionArguments +export type AddRoundDataReturn = FunctionReturn + +/** decimals() */ +export const decimals = func('0x313ce567', {}, uint8) +export type DecimalsParams = FunctionArguments +export type DecimalsReturn = FunctionReturn + +/** description() */ +export const description = func('0x7284e416', {}, string) +export type DescriptionParams = FunctionArguments +export type DescriptionReturn = FunctionReturn + +/** getPrices() */ +export const getPrices = func('0xbd9a548b', {}, struct({ + _isBadData: bool, + _priceLow: uint256, + _priceHigh: uint256, +})) +export type GetPricesParams = FunctionArguments +export type GetPricesReturn = FunctionReturn + +/** getRoundData(uint80) */ +export const getRoundData = func('0x9a6fc8f5', { + _roundId: uint80, +}, struct({ + roundId: uint80, + answer: int256, + startedAt: uint256, + updatedAt: uint256, + answeredInRound: uint80, +})) +export type GetRoundDataParams = FunctionArguments +export type GetRoundDataReturn = FunctionReturn + +/** lastCorrectRoundId() */ +export const lastCorrectRoundId = func('0x0f4a05fb', {}, uint80) +export type LastCorrectRoundIdParams = FunctionArguments +export type LastCorrectRoundIdReturn = FunctionReturn + +/** latestRoundData() */ +export const latestRoundData = func('0xfeaf968c', {}, struct({ + roundId: uint80, + answer: int256, + startedAt: uint256, + updatedAt: uint256, + answeredInRound: uint80, +})) +export type LatestRoundDataParams = FunctionArguments +export type LatestRoundDataReturn = FunctionReturn + +/** maximumDeviation() */ +export const maximumDeviation = func('0x9152c29d', {}, uint256) +export type MaximumDeviationParams = FunctionArguments +export type MaximumDeviationReturn = FunctionReturn + +/** maximumOracleDelay() */ +export const maximumOracleDelay = func('0xcede91a4', {}, uint256) +export type MaximumOracleDelayParams = FunctionArguments +export type MaximumOracleDelayReturn = FunctionReturn + +/** pendingTimelockAddress() */ +export const pendingTimelockAddress = func('0x090f3f50', {}, address) +export type PendingTimelockAddressParams = FunctionArguments +export type PendingTimelockAddressReturn = FunctionReturn + +/** priceSource() */ +export const priceSource = func('0x20531bc9', {}, address) +export type PriceSourceParams = FunctionArguments +export type PriceSourceReturn = FunctionReturn + +/** renounceTimelock() */ +export const renounceTimelock = func('0x4f8b4ae7', {}) +export type RenounceTimelockParams = FunctionArguments +export type RenounceTimelockReturn = FunctionReturn + +/** rounds(uint256) */ +export const rounds = func('0x8c65c81f', { + _0: uint256, +}, struct({ + priceLow: uint104, + priceHigh: uint104, + timestamp: uint40, + isBadData: bool, +})) +export type RoundsParams = FunctionArguments +export type RoundsReturn = FunctionReturn + +/** setMaximumDeviation(uint256) */ +export const setMaximumDeviation = func('0x2dfa4267', { + _newMaxDeviation: uint256, +}) +export type SetMaximumDeviationParams = FunctionArguments +export type SetMaximumDeviationReturn = FunctionReturn + +/** setMaximumOracleDelay(uint256) */ +export const setMaximumOracleDelay = func('0xd2333be7', { + _newMaxOracleDelay: uint256, +}) +export type SetMaximumOracleDelayParams = FunctionArguments +export type SetMaximumOracleDelayReturn = FunctionReturn + +/** setPriceSource(address) */ +export const setPriceSource = func('0xbda53107', { + _newPriceSource: address, +}) +export type SetPriceSourceParams = FunctionArguments +export type SetPriceSourceReturn = FunctionReturn + +/** supportsInterface(bytes4) */ +export const supportsInterface = func('0x01ffc9a7', { + interfaceId: bytes4, +}, bool) +export type SupportsInterfaceParams = FunctionArguments +export type SupportsInterfaceReturn = FunctionReturn + +/** timelockAddress() */ +export const timelockAddress = func('0x4bc66f32', {}, address) +export type TimelockAddressParams = FunctionArguments +export type TimelockAddressReturn = FunctionReturn + +/** transferTimelock(address) */ +export const transferTimelock = func('0x45014095', { + _newTimelock: address, +}) +export type TransferTimelockParams = FunctionArguments +export type TransferTimelockReturn = FunctionReturn + +/** version() */ +export const version = func('0x54fd4d50', {}, uint256) +export type VersionParams = FunctionArguments +export type VersionReturn = FunctionReturn diff --git a/src/abi/frx-eth-frax-oracle/index.ts b/src/abi/frx-eth-frax-oracle/index.ts new file mode 100644 index 00000000..11829d6e --- /dev/null +++ b/src/abi/frx-eth-frax-oracle/index.ts @@ -0,0 +1,4 @@ +export * as events from './events.js' +export * as functions from './functions.js' + +export { Contract } from './contract.js' diff --git a/src/abi/governance.ts b/src/abi/governance.ts deleted file mode 100644 index 73011e92..00000000 --- a/src/abi/governance.ts +++ /dev/null @@ -1,346 +0,0 @@ -import * as p from '@subsquid/evm-codec' -import { event, fun, viewFun, indexed, ContractBase } from '@subsquid/evm-abi' -import type { EventParams as EParams, FunctionArguments, FunctionReturn } from '@subsquid/evm-abi' - -export const events = { - LateQuorumVoteExtensionSet: event("0x7ca4ac117ed3cdce75c1161d8207c440389b1a15d69d096831664657c07dafc2", "LateQuorumVoteExtensionSet(uint64,uint64)", {"oldVoteExtension": p.uint64, "newVoteExtension": p.uint64}), - ProposalCanceled: event("0x789cf55be980739dad1d0699b93b58e806b51c9d96619bfa8fe0a28abaa7b30c", "ProposalCanceled(uint256)", {"proposalId": p.uint256}), - ProposalCreated: event("0x7d84a6263ae0d98d3329bd7b46bb4e8d6f98cd35a7adb45c274c8b7fd5ebd5e0", "ProposalCreated(uint256,address,address[],uint256[],string[],bytes[],uint256,uint256,string)", {"proposalId": p.uint256, "proposer": p.address, "targets": p.array(p.address), "values": p.array(p.uint256), "signatures": p.array(p.string), "calldatas": p.array(p.bytes), "startBlock": p.uint256, "endBlock": p.uint256, "description": p.string}), - ProposalExecuted: event("0x712ae1383f79ac853f8d882153778e0260ef8f03b504e2866e0593e04d2b291f", "ProposalExecuted(uint256)", {"proposalId": p.uint256}), - ProposalExtended: event("0x541f725fb9f7c98a30cc9c0ff32fbb14358cd7159c847a3aa20a2bdc442ba511", "ProposalExtended(uint256,uint64)", {"proposalId": indexed(p.uint256), "extendedDeadline": p.uint64}), - ProposalQueued: event("0x9a2e42fd6722813d69113e7d0079d3d940171428df7373df9c7f7617cfda2892", "ProposalQueued(uint256,uint256)", {"proposalId": p.uint256, "eta": p.uint256}), - ProposalThresholdSet: event("0xccb45da8d5717e6c4544694297c4ba5cf151d455c9bb0ed4fc7a38411bc05461", "ProposalThresholdSet(uint256,uint256)", {"oldProposalThreshold": p.uint256, "newProposalThreshold": p.uint256}), - QuorumNumeratorUpdated: event("0x0553476bf02ef2726e8ce5ced78d63e26e602e4a2257b1f559418e24b4633997", "QuorumNumeratorUpdated(uint256,uint256)", {"oldQuorumNumerator": p.uint256, "newQuorumNumerator": p.uint256}), - TimelockChange: event("0x08f74ea46ef7894f65eabfb5e6e695de773a000b47c529ab559178069b226401", "TimelockChange(address,address)", {"oldTimelock": p.address, "newTimelock": p.address}), - VoteCast: event("0xb8e138887d0aa13bab447e82de9d5c1777041ecd21ca36ba824ff1e6c07ddda4", "VoteCast(address,uint256,uint8,uint256,string)", {"voter": indexed(p.address), "proposalId": p.uint256, "support": p.uint8, "weight": p.uint256, "reason": p.string}), - VoteCastWithParams: event("0xe2babfbac5889a709b63bb7f598b324e08bc5a4fb9ec647fb3cbc9ec07eb8712", "VoteCastWithParams(address,uint256,uint8,uint256,string,bytes)", {"voter": indexed(p.address), "proposalId": p.uint256, "support": p.uint8, "weight": p.uint256, "reason": p.string, "params": p.bytes}), - VotingDelaySet: event("0xc565b045403dc03c2eea82b81a0465edad9e2e7fc4d97e11421c209da93d7a93", "VotingDelaySet(uint256,uint256)", {"oldVotingDelay": p.uint256, "newVotingDelay": p.uint256}), - VotingPeriodSet: event("0x7e3f7f0708a84de9203036abaa450dccc85ad5ff52f78c170f3edb55cf5e8828", "VotingPeriodSet(uint256,uint256)", {"oldVotingPeriod": p.uint256, "newVotingPeriod": p.uint256}), -} - -export const functions = { - BALLOT_TYPEHASH: viewFun("0xdeaaa7cc", "BALLOT_TYPEHASH()", {}, p.bytes32), - COUNTING_MODE: viewFun("0xdd4e2ba5", "COUNTING_MODE()", {}, p.string), - EXTENDED_BALLOT_TYPEHASH: viewFun("0x2fe3e261", "EXTENDED_BALLOT_TYPEHASH()", {}, p.bytes32), - cancel: fun("0x40e58ee5", "cancel(uint256)", {"proposalId": p.uint256}, ), - castVote: fun("0x56781388", "castVote(uint256,uint8)", {"proposalId": p.uint256, "support": p.uint8}, p.uint256), - castVoteBySig: fun("0x3bccf4fd", "castVoteBySig(uint256,uint8,uint8,bytes32,bytes32)", {"proposalId": p.uint256, "support": p.uint8, "v": p.uint8, "r": p.bytes32, "s": p.bytes32}, p.uint256), - castVoteWithReason: fun("0x7b3c71d3", "castVoteWithReason(uint256,uint8,string)", {"proposalId": p.uint256, "support": p.uint8, "reason": p.string}, p.uint256), - castVoteWithReasonAndParams: fun("0x5f398a14", "castVoteWithReasonAndParams(uint256,uint8,string,bytes)", {"proposalId": p.uint256, "support": p.uint8, "reason": p.string, "params": p.bytes}, p.uint256), - castVoteWithReasonAndParamsBySig: fun("0x03420181", "castVoteWithReasonAndParamsBySig(uint256,uint8,string,bytes,uint8,bytes32,bytes32)", {"proposalId": p.uint256, "support": p.uint8, "reason": p.string, "params": p.bytes, "v": p.uint8, "r": p.bytes32, "s": p.bytes32}, p.uint256), - 'execute(address[],uint256[],bytes[],bytes32)': fun("0x2656227d", "execute(address[],uint256[],bytes[],bytes32)", {"targets": p.array(p.address), "values": p.array(p.uint256), "calldatas": p.array(p.bytes), "descriptionHash": p.bytes32}, p.uint256), - 'execute(uint256)': fun("0xfe0d94c1", "execute(uint256)", {"proposalId": p.uint256}, ), - getActions: viewFun("0x328dd982", "getActions(uint256)", {"proposalId": p.uint256}, {"targets": p.array(p.address), "values": p.array(p.uint256), "signatures": p.array(p.string), "calldatas": p.array(p.bytes)}), - getReceipt: viewFun("0xe23a9a52", "getReceipt(uint256,address)", {"proposalId": p.uint256, "voter": p.address}, p.struct({"hasVoted": p.bool, "support": p.uint8, "votes": p.uint256})), - getVotes: viewFun("0xeb9019d4", "getVotes(address,uint256)", {"account": p.address, "blockNumber": p.uint256}, p.uint256), - getVotesWithParams: viewFun("0x9a802a6d", "getVotesWithParams(address,uint256,bytes)", {"account": p.address, "blockNumber": p.uint256, "params": p.bytes}, p.uint256), - hasVoted: viewFun("0x43859632", "hasVoted(uint256,address)", {"proposalId": p.uint256, "account": p.address}, p.bool), - hashProposal: viewFun("0xc59057e4", "hashProposal(address[],uint256[],bytes[],bytes32)", {"targets": p.array(p.address), "values": p.array(p.uint256), "calldatas": p.array(p.bytes), "descriptionHash": p.bytes32}, p.uint256), - lateQuorumVoteExtension: viewFun("0x32b8113e", "lateQuorumVoteExtension()", {}, p.uint64), - name: viewFun("0x06fdde03", "name()", {}, p.string), - onERC1155BatchReceived: fun("0xbc197c81", "onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)", {"_0": p.address, "_1": p.address, "_2": p.array(p.uint256), "_3": p.array(p.uint256), "_4": p.bytes}, p.bytes4), - onERC1155Received: fun("0xf23a6e61", "onERC1155Received(address,address,uint256,uint256,bytes)", {"_0": p.address, "_1": p.address, "_2": p.uint256, "_3": p.uint256, "_4": p.bytes}, p.bytes4), - onERC721Received: fun("0x150b7a02", "onERC721Received(address,address,uint256,bytes)", {"_0": p.address, "_1": p.address, "_2": p.uint256, "_3": p.bytes}, p.bytes4), - proposalDeadline: viewFun("0xc01f9e37", "proposalDeadline(uint256)", {"proposalId": p.uint256}, p.uint256), - proposalEta: viewFun("0xab58fb8e", "proposalEta(uint256)", {"proposalId": p.uint256}, p.uint256), - proposalSnapshot: viewFun("0x2d63f693", "proposalSnapshot(uint256)", {"proposalId": p.uint256}, p.uint256), - proposalThreshold: viewFun("0xb58131b0", "proposalThreshold()", {}, p.uint256), - proposals: viewFun("0x013cf08b", "proposals(uint256)", {"proposalId": p.uint256}, {"id": p.uint256, "proposer": p.address, "eta": p.uint256, "startBlock": p.uint256, "endBlock": p.uint256, "forVotes": p.uint256, "againstVotes": p.uint256, "abstainVotes": p.uint256, "canceled": p.bool, "executed": p.bool}), - 'propose(address[],uint256[],bytes[],string)': fun("0x7d5e81e2", "propose(address[],uint256[],bytes[],string)", {"targets": p.array(p.address), "values": p.array(p.uint256), "calldatas": p.array(p.bytes), "description": p.string}, p.uint256), - 'propose(address[],uint256[],string[],bytes[],string)': fun("0xda95691a", "propose(address[],uint256[],string[],bytes[],string)", {"targets": p.array(p.address), "values": p.array(p.uint256), "signatures": p.array(p.string), "calldatas": p.array(p.bytes), "description": p.string}, p.uint256), - 'queue(address[],uint256[],bytes[],bytes32)': fun("0x160cbed7", "queue(address[],uint256[],bytes[],bytes32)", {"targets": p.array(p.address), "values": p.array(p.uint256), "calldatas": p.array(p.bytes), "descriptionHash": p.bytes32}, p.uint256), - 'queue(uint256)': fun("0xddf0b009", "queue(uint256)", {"proposalId": p.uint256}, ), - quorum: viewFun("0xf8ce560a", "quorum(uint256)", {"blockNumber": p.uint256}, p.uint256), - quorumDenominator: viewFun("0x97c3d334", "quorumDenominator()", {}, p.uint256), - quorumNumerator: viewFun("0xa7713a70", "quorumNumerator()", {}, p.uint256), - quorumVotes: viewFun("0x24bc1a64", "quorumVotes()", {}, p.uint256), - relay: fun("0xc28bc2fa", "relay(address,uint256,bytes)", {"target": p.address, "value": p.uint256, "data": p.bytes}, ), - setLateQuorumVoteExtension: fun("0xd07f91e9", "setLateQuorumVoteExtension(uint64)", {"newVoteExtension": p.uint64}, ), - setProposalThreshold: fun("0xece40cc1", "setProposalThreshold(uint256)", {"newProposalThreshold": p.uint256}, ), - setVotingDelay: fun("0x70b0f660", "setVotingDelay(uint256)", {"newVotingDelay": p.uint256}, ), - setVotingPeriod: fun("0xea0217cf", "setVotingPeriod(uint256)", {"newVotingPeriod": p.uint256}, ), - state: viewFun("0x3e4f49e6", "state(uint256)", {"proposalId": p.uint256}, p.uint8), - supportsInterface: viewFun("0x01ffc9a7", "supportsInterface(bytes4)", {"interfaceId": p.bytes4}, p.bool), - timelock: viewFun("0xd33219b4", "timelock()", {}, p.address), - token: viewFun("0xfc0c546a", "token()", {}, p.address), - updateQuorumNumerator: fun("0x06f3f9e6", "updateQuorumNumerator(uint256)", {"newQuorumNumerator": p.uint256}, ), - updateTimelock: fun("0xa890c910", "updateTimelock(address)", {"newTimelock": p.address}, ), - version: viewFun("0x54fd4d50", "version()", {}, p.string), - votingDelay: viewFun("0x3932abb1", "votingDelay()", {}, p.uint256), - votingPeriod: viewFun("0x02a251a3", "votingPeriod()", {}, p.uint256), -} - -export class Contract extends ContractBase { - - BALLOT_TYPEHASH() { - return this.eth_call(functions.BALLOT_TYPEHASH, {}) - } - - COUNTING_MODE() { - return this.eth_call(functions.COUNTING_MODE, {}) - } - - EXTENDED_BALLOT_TYPEHASH() { - return this.eth_call(functions.EXTENDED_BALLOT_TYPEHASH, {}) - } - - getActions(proposalId: GetActionsParams["proposalId"]) { - return this.eth_call(functions.getActions, {proposalId}) - } - - getReceipt(proposalId: GetReceiptParams["proposalId"], voter: GetReceiptParams["voter"]) { - return this.eth_call(functions.getReceipt, {proposalId, voter}) - } - - getVotes(account: GetVotesParams["account"], blockNumber: GetVotesParams["blockNumber"]) { - return this.eth_call(functions.getVotes, {account, blockNumber}) - } - - getVotesWithParams(account: GetVotesWithParamsParams["account"], blockNumber: GetVotesWithParamsParams["blockNumber"], params: GetVotesWithParamsParams["params"]) { - return this.eth_call(functions.getVotesWithParams, {account, blockNumber, params}) - } - - hasVoted(proposalId: HasVotedParams["proposalId"], account: HasVotedParams["account"]) { - return this.eth_call(functions.hasVoted, {proposalId, account}) - } - - hashProposal(targets: HashProposalParams["targets"], values: HashProposalParams["values"], calldatas: HashProposalParams["calldatas"], descriptionHash: HashProposalParams["descriptionHash"]) { - return this.eth_call(functions.hashProposal, {targets, values, calldatas, descriptionHash}) - } - - lateQuorumVoteExtension() { - return this.eth_call(functions.lateQuorumVoteExtension, {}) - } - - name() { - return this.eth_call(functions.name, {}) - } - - proposalDeadline(proposalId: ProposalDeadlineParams["proposalId"]) { - return this.eth_call(functions.proposalDeadline, {proposalId}) - } - - proposalEta(proposalId: ProposalEtaParams["proposalId"]) { - return this.eth_call(functions.proposalEta, {proposalId}) - } - - proposalSnapshot(proposalId: ProposalSnapshotParams["proposalId"]) { - return this.eth_call(functions.proposalSnapshot, {proposalId}) - } - - proposalThreshold() { - return this.eth_call(functions.proposalThreshold, {}) - } - - proposals(proposalId: ProposalsParams["proposalId"]) { - return this.eth_call(functions.proposals, {proposalId}) - } - - quorum(blockNumber: QuorumParams["blockNumber"]) { - return this.eth_call(functions.quorum, {blockNumber}) - } - - quorumDenominator() { - return this.eth_call(functions.quorumDenominator, {}) - } - - quorumNumerator() { - return this.eth_call(functions.quorumNumerator, {}) - } - - quorumVotes() { - return this.eth_call(functions.quorumVotes, {}) - } - - state(proposalId: StateParams["proposalId"]) { - return this.eth_call(functions.state, {proposalId}) - } - - supportsInterface(interfaceId: SupportsInterfaceParams["interfaceId"]) { - return this.eth_call(functions.supportsInterface, {interfaceId}) - } - - timelock() { - return this.eth_call(functions.timelock, {}) - } - - token() { - return this.eth_call(functions.token, {}) - } - - version() { - return this.eth_call(functions.version, {}) - } - - votingDelay() { - return this.eth_call(functions.votingDelay, {}) - } - - votingPeriod() { - return this.eth_call(functions.votingPeriod, {}) - } -} - -/// Event types -export type LateQuorumVoteExtensionSetEventArgs = EParams -export type ProposalCanceledEventArgs = EParams -export type ProposalCreatedEventArgs = EParams -export type ProposalExecutedEventArgs = EParams -export type ProposalExtendedEventArgs = EParams -export type ProposalQueuedEventArgs = EParams -export type ProposalThresholdSetEventArgs = EParams -export type QuorumNumeratorUpdatedEventArgs = EParams -export type TimelockChangeEventArgs = EParams -export type VoteCastEventArgs = EParams -export type VoteCastWithParamsEventArgs = EParams -export type VotingDelaySetEventArgs = EParams -export type VotingPeriodSetEventArgs = EParams - -/// Function types -export type BALLOT_TYPEHASHParams = FunctionArguments -export type BALLOT_TYPEHASHReturn = FunctionReturn - -export type COUNTING_MODEParams = FunctionArguments -export type COUNTING_MODEReturn = FunctionReturn - -export type EXTENDED_BALLOT_TYPEHASHParams = FunctionArguments -export type EXTENDED_BALLOT_TYPEHASHReturn = FunctionReturn - -export type CancelParams = FunctionArguments -export type CancelReturn = FunctionReturn - -export type CastVoteParams = FunctionArguments -export type CastVoteReturn = FunctionReturn - -export type CastVoteBySigParams = FunctionArguments -export type CastVoteBySigReturn = FunctionReturn - -export type CastVoteWithReasonParams = FunctionArguments -export type CastVoteWithReasonReturn = FunctionReturn - -export type CastVoteWithReasonAndParamsParams = FunctionArguments -export type CastVoteWithReasonAndParamsReturn = FunctionReturn - -export type CastVoteWithReasonAndParamsBySigParams = FunctionArguments -export type CastVoteWithReasonAndParamsBySigReturn = FunctionReturn - -export type ExecuteParams_0 = FunctionArguments -export type ExecuteReturn_0 = FunctionReturn - -export type ExecuteParams_1 = FunctionArguments -export type ExecuteReturn_1 = FunctionReturn - -export type GetActionsParams = FunctionArguments -export type GetActionsReturn = FunctionReturn - -export type GetReceiptParams = FunctionArguments -export type GetReceiptReturn = FunctionReturn - -export type GetVotesParams = FunctionArguments -export type GetVotesReturn = FunctionReturn - -export type GetVotesWithParamsParams = FunctionArguments -export type GetVotesWithParamsReturn = FunctionReturn - -export type HasVotedParams = FunctionArguments -export type HasVotedReturn = FunctionReturn - -export type HashProposalParams = FunctionArguments -export type HashProposalReturn = FunctionReturn - -export type LateQuorumVoteExtensionParams = FunctionArguments -export type LateQuorumVoteExtensionReturn = FunctionReturn - -export type NameParams = FunctionArguments -export type NameReturn = FunctionReturn - -export type OnERC1155BatchReceivedParams = FunctionArguments -export type OnERC1155BatchReceivedReturn = FunctionReturn - -export type OnERC1155ReceivedParams = FunctionArguments -export type OnERC1155ReceivedReturn = FunctionReturn - -export type OnERC721ReceivedParams = FunctionArguments -export type OnERC721ReceivedReturn = FunctionReturn - -export type ProposalDeadlineParams = FunctionArguments -export type ProposalDeadlineReturn = FunctionReturn - -export type ProposalEtaParams = FunctionArguments -export type ProposalEtaReturn = FunctionReturn - -export type ProposalSnapshotParams = FunctionArguments -export type ProposalSnapshotReturn = FunctionReturn - -export type ProposalThresholdParams = FunctionArguments -export type ProposalThresholdReturn = FunctionReturn - -export type ProposalsParams = FunctionArguments -export type ProposalsReturn = FunctionReturn - -export type ProposeParams_0 = FunctionArguments -export type ProposeReturn_0 = FunctionReturn - -export type ProposeParams_1 = FunctionArguments -export type ProposeReturn_1 = FunctionReturn - -export type QueueParams_0 = FunctionArguments -export type QueueReturn_0 = FunctionReturn - -export type QueueParams_1 = FunctionArguments -export type QueueReturn_1 = FunctionReturn - -export type QuorumParams = FunctionArguments -export type QuorumReturn = FunctionReturn - -export type QuorumDenominatorParams = FunctionArguments -export type QuorumDenominatorReturn = FunctionReturn - -export type QuorumNumeratorParams = FunctionArguments -export type QuorumNumeratorReturn = FunctionReturn - -export type QuorumVotesParams = FunctionArguments -export type QuorumVotesReturn = FunctionReturn - -export type RelayParams = FunctionArguments -export type RelayReturn = FunctionReturn - -export type SetLateQuorumVoteExtensionParams = FunctionArguments -export type SetLateQuorumVoteExtensionReturn = FunctionReturn - -export type SetProposalThresholdParams = FunctionArguments -export type SetProposalThresholdReturn = FunctionReturn - -export type SetVotingDelayParams = FunctionArguments -export type SetVotingDelayReturn = FunctionReturn - -export type SetVotingPeriodParams = FunctionArguments -export type SetVotingPeriodReturn = FunctionReturn - -export type StateParams = FunctionArguments -export type StateReturn = FunctionReturn - -export type SupportsInterfaceParams = FunctionArguments -export type SupportsInterfaceReturn = FunctionReturn - -export type TimelockParams = FunctionArguments -export type TimelockReturn = FunctionReturn - -export type TokenParams = FunctionArguments -export type TokenReturn = FunctionReturn - -export type UpdateQuorumNumeratorParams = FunctionArguments -export type UpdateQuorumNumeratorReturn = FunctionReturn - -export type UpdateTimelockParams = FunctionArguments -export type UpdateTimelockReturn = FunctionReturn - -export type VersionParams = FunctionArguments -export type VersionReturn = FunctionReturn - -export type VotingDelayParams = FunctionArguments -export type VotingDelayReturn = FunctionReturn - -export type VotingPeriodParams = FunctionArguments -export type VotingPeriodReturn = FunctionReturn - diff --git a/src/abi/governance/contract.ts b/src/abi/governance/contract.ts new file mode 100644 index 00000000..d4439d6f --- /dev/null +++ b/src/abi/governance/contract.ts @@ -0,0 +1,161 @@ +import { ContractBase } from '../abi.support.js' +import { BALLOT_TYPEHASH, COUNTING_MODE, EXTENDED_BALLOT_TYPEHASH, castVote, castVoteBySig, castVoteWithReason, castVoteWithReasonAndParams, castVoteWithReasonAndParamsBySig, execute, getActions, getReceipt, getVotes, getVotesWithParams, hasVoted, hashProposal, lateQuorumVoteExtension, name, onERC1155BatchReceived, onERC1155Received, onERC721Received, proposalDeadline, proposalEta, proposalSnapshot, proposalThreshold, proposals, propose, propose_1, queue, quorum, quorumDenominator, quorumNumerator, quorumVotes, state, supportsInterface, timelock, token, version, votingDelay, votingPeriod } from './functions.js' +import type { CastVoteBySigParams, CastVoteParams, CastVoteWithReasonAndParamsBySigParams, CastVoteWithReasonAndParamsParams, CastVoteWithReasonParams, ExecuteParams, GetActionsParams, GetReceiptParams, GetVotesParams, GetVotesWithParamsParams, HasVotedParams, HashProposalParams, OnERC1155BatchReceivedParams, OnERC1155ReceivedParams, OnERC721ReceivedParams, ProposalDeadlineParams, ProposalEtaParams, ProposalSnapshotParams, ProposalsParams, ProposeParams, ProposeParams_1, QueueParams, QuorumParams, StateParams, SupportsInterfaceParams } from './functions.js' + +export class Contract extends ContractBase { + BALLOT_TYPEHASH() { + return this.eth_call(BALLOT_TYPEHASH, {}) + } + + COUNTING_MODE() { + return this.eth_call(COUNTING_MODE, {}) + } + + EXTENDED_BALLOT_TYPEHASH() { + return this.eth_call(EXTENDED_BALLOT_TYPEHASH, {}) + } + + castVote(proposalId: CastVoteParams["proposalId"], support: CastVoteParams["support"]) { + return this.eth_call(castVote, {proposalId, support}) + } + + castVoteBySig(proposalId: CastVoteBySigParams["proposalId"], support: CastVoteBySigParams["support"], v: CastVoteBySigParams["v"], r: CastVoteBySigParams["r"], s: CastVoteBySigParams["s"]) { + return this.eth_call(castVoteBySig, {proposalId, support, v, r, s}) + } + + castVoteWithReason(proposalId: CastVoteWithReasonParams["proposalId"], support: CastVoteWithReasonParams["support"], reason: CastVoteWithReasonParams["reason"]) { + return this.eth_call(castVoteWithReason, {proposalId, support, reason}) + } + + castVoteWithReasonAndParams(proposalId: CastVoteWithReasonAndParamsParams["proposalId"], support: CastVoteWithReasonAndParamsParams["support"], reason: CastVoteWithReasonAndParamsParams["reason"], params: CastVoteWithReasonAndParamsParams["params"]) { + return this.eth_call(castVoteWithReasonAndParams, {proposalId, support, reason, params}) + } + + castVoteWithReasonAndParamsBySig(proposalId: CastVoteWithReasonAndParamsBySigParams["proposalId"], support: CastVoteWithReasonAndParamsBySigParams["support"], reason: CastVoteWithReasonAndParamsBySigParams["reason"], params: CastVoteWithReasonAndParamsBySigParams["params"], v: CastVoteWithReasonAndParamsBySigParams["v"], r: CastVoteWithReasonAndParamsBySigParams["r"], s: CastVoteWithReasonAndParamsBySigParams["s"]) { + return this.eth_call(castVoteWithReasonAndParamsBySig, {proposalId, support, reason, params, v, r, s}) + } + + execute(targets: ExecuteParams["targets"], values: ExecuteParams["values"], calldatas: ExecuteParams["calldatas"], descriptionHash: ExecuteParams["descriptionHash"]) { + return this.eth_call(execute, {targets, values, calldatas, descriptionHash}) + } + + getActions(proposalId: GetActionsParams["proposalId"]) { + return this.eth_call(getActions, {proposalId}) + } + + getReceipt(proposalId: GetReceiptParams["proposalId"], voter: GetReceiptParams["voter"]) { + return this.eth_call(getReceipt, {proposalId, voter}) + } + + getVotes(account: GetVotesParams["account"], blockNumber: GetVotesParams["blockNumber"]) { + return this.eth_call(getVotes, {account, blockNumber}) + } + + getVotesWithParams(account: GetVotesWithParamsParams["account"], blockNumber: GetVotesWithParamsParams["blockNumber"], params: GetVotesWithParamsParams["params"]) { + return this.eth_call(getVotesWithParams, {account, blockNumber, params}) + } + + hasVoted(proposalId: HasVotedParams["proposalId"], account: HasVotedParams["account"]) { + return this.eth_call(hasVoted, {proposalId, account}) + } + + hashProposal(targets: HashProposalParams["targets"], values: HashProposalParams["values"], calldatas: HashProposalParams["calldatas"], descriptionHash: HashProposalParams["descriptionHash"]) { + return this.eth_call(hashProposal, {targets, values, calldatas, descriptionHash}) + } + + lateQuorumVoteExtension() { + return this.eth_call(lateQuorumVoteExtension, {}) + } + + name() { + return this.eth_call(name, {}) + } + + onERC1155BatchReceived(_0: OnERC1155BatchReceivedParams["_0"], _1: OnERC1155BatchReceivedParams["_1"], _2: OnERC1155BatchReceivedParams["_2"], _3: OnERC1155BatchReceivedParams["_3"], _4: OnERC1155BatchReceivedParams["_4"]) { + return this.eth_call(onERC1155BatchReceived, {_0, _1, _2, _3, _4}) + } + + onERC1155Received(_0: OnERC1155ReceivedParams["_0"], _1: OnERC1155ReceivedParams["_1"], _2: OnERC1155ReceivedParams["_2"], _3: OnERC1155ReceivedParams["_3"], _4: OnERC1155ReceivedParams["_4"]) { + return this.eth_call(onERC1155Received, {_0, _1, _2, _3, _4}) + } + + onERC721Received(_0: OnERC721ReceivedParams["_0"], _1: OnERC721ReceivedParams["_1"], _2: OnERC721ReceivedParams["_2"], _3: OnERC721ReceivedParams["_3"]) { + return this.eth_call(onERC721Received, {_0, _1, _2, _3}) + } + + proposalDeadline(proposalId: ProposalDeadlineParams["proposalId"]) { + return this.eth_call(proposalDeadline, {proposalId}) + } + + proposalEta(proposalId: ProposalEtaParams["proposalId"]) { + return this.eth_call(proposalEta, {proposalId}) + } + + proposalSnapshot(proposalId: ProposalSnapshotParams["proposalId"]) { + return this.eth_call(proposalSnapshot, {proposalId}) + } + + proposalThreshold() { + return this.eth_call(proposalThreshold, {}) + } + + proposals(proposalId: ProposalsParams["proposalId"]) { + return this.eth_call(proposals, {proposalId}) + } + + propose(targets: ProposeParams["targets"], values: ProposeParams["values"], calldatas: ProposeParams["calldatas"], description: ProposeParams["description"]) { + return this.eth_call(propose, {targets, values, calldatas, description}) + } + + propose_1(targets: ProposeParams_1["targets"], values: ProposeParams_1["values"], signatures: ProposeParams_1["signatures"], calldatas: ProposeParams_1["calldatas"], description: ProposeParams_1["description"]) { + return this.eth_call(propose_1, {targets, values, signatures, calldatas, description}) + } + + queue(targets: QueueParams["targets"], values: QueueParams["values"], calldatas: QueueParams["calldatas"], descriptionHash: QueueParams["descriptionHash"]) { + return this.eth_call(queue, {targets, values, calldatas, descriptionHash}) + } + + quorum(blockNumber: QuorumParams["blockNumber"]) { + return this.eth_call(quorum, {blockNumber}) + } + + quorumDenominator() { + return this.eth_call(quorumDenominator, {}) + } + + quorumNumerator() { + return this.eth_call(quorumNumerator, {}) + } + + quorumVotes() { + return this.eth_call(quorumVotes, {}) + } + + state(proposalId: StateParams["proposalId"]) { + return this.eth_call(state, {proposalId}) + } + + supportsInterface(interfaceId: SupportsInterfaceParams["interfaceId"]) { + return this.eth_call(supportsInterface, {interfaceId}) + } + + timelock() { + return this.eth_call(timelock, {}) + } + + token() { + return this.eth_call(token, {}) + } + + version() { + return this.eth_call(version, {}) + } + + votingDelay() { + return this.eth_call(votingDelay, {}) + } + + votingPeriod() { + return this.eth_call(votingPeriod, {}) + } +} diff --git a/src/abi/governance/events.ts b/src/abi/governance/events.ts new file mode 100644 index 00000000..07c216fd --- /dev/null +++ b/src/abi/governance/events.ts @@ -0,0 +1,106 @@ +import { address, array, bytes, string, uint256, uint64, uint8 } from '@subsquid/evm-codec' +import { event, indexed } from '../abi.support.js' +import type { EventParams as EParams } from '../abi.support.js' + +/** LateQuorumVoteExtensionSet(uint64,uint64) */ +export const LateQuorumVoteExtensionSet = event('0x7ca4ac117ed3cdce75c1161d8207c440389b1a15d69d096831664657c07dafc2', { + oldVoteExtension: uint64, + newVoteExtension: uint64, +}) +export type LateQuorumVoteExtensionSetEventArgs = EParams + +/** ProposalCanceled(uint256) */ +export const ProposalCanceled = event('0x789cf55be980739dad1d0699b93b58e806b51c9d96619bfa8fe0a28abaa7b30c', { + proposalId: uint256, +}) +export type ProposalCanceledEventArgs = EParams + +/** ProposalCreated(uint256,address,address[],uint256[],string[],bytes[],uint256,uint256,string) */ +export const ProposalCreated = event('0x7d84a6263ae0d98d3329bd7b46bb4e8d6f98cd35a7adb45c274c8b7fd5ebd5e0', { + proposalId: uint256, + proposer: address, + targets: array(address), + values: array(uint256), + signatures: array(string), + calldatas: array(bytes), + startBlock: uint256, + endBlock: uint256, + description: string, +}) +export type ProposalCreatedEventArgs = EParams + +/** ProposalExecuted(uint256) */ +export const ProposalExecuted = event('0x712ae1383f79ac853f8d882153778e0260ef8f03b504e2866e0593e04d2b291f', { + proposalId: uint256, +}) +export type ProposalExecutedEventArgs = EParams + +/** ProposalExtended(uint256,uint64) */ +export const ProposalExtended = event('0x541f725fb9f7c98a30cc9c0ff32fbb14358cd7159c847a3aa20a2bdc442ba511', { + proposalId: indexed(uint256), + extendedDeadline: uint64, +}) +export type ProposalExtendedEventArgs = EParams + +/** ProposalQueued(uint256,uint256) */ +export const ProposalQueued = event('0x9a2e42fd6722813d69113e7d0079d3d940171428df7373df9c7f7617cfda2892', { + proposalId: uint256, + eta: uint256, +}) +export type ProposalQueuedEventArgs = EParams + +/** ProposalThresholdSet(uint256,uint256) */ +export const ProposalThresholdSet = event('0xccb45da8d5717e6c4544694297c4ba5cf151d455c9bb0ed4fc7a38411bc05461', { + oldProposalThreshold: uint256, + newProposalThreshold: uint256, +}) +export type ProposalThresholdSetEventArgs = EParams + +/** QuorumNumeratorUpdated(uint256,uint256) */ +export const QuorumNumeratorUpdated = event('0x0553476bf02ef2726e8ce5ced78d63e26e602e4a2257b1f559418e24b4633997', { + oldQuorumNumerator: uint256, + newQuorumNumerator: uint256, +}) +export type QuorumNumeratorUpdatedEventArgs = EParams + +/** TimelockChange(address,address) */ +export const TimelockChange = event('0x08f74ea46ef7894f65eabfb5e6e695de773a000b47c529ab559178069b226401', { + oldTimelock: address, + newTimelock: address, +}) +export type TimelockChangeEventArgs = EParams + +/** VoteCast(address,uint256,uint8,uint256,string) */ +export const VoteCast = event('0xb8e138887d0aa13bab447e82de9d5c1777041ecd21ca36ba824ff1e6c07ddda4', { + voter: indexed(address), + proposalId: uint256, + support: uint8, + weight: uint256, + reason: string, +}) +export type VoteCastEventArgs = EParams + +/** VoteCastWithParams(address,uint256,uint8,uint256,string,bytes) */ +export const VoteCastWithParams = event('0xe2babfbac5889a709b63bb7f598b324e08bc5a4fb9ec647fb3cbc9ec07eb8712', { + voter: indexed(address), + proposalId: uint256, + support: uint8, + weight: uint256, + reason: string, + params: bytes, +}) +export type VoteCastWithParamsEventArgs = EParams + +/** VotingDelaySet(uint256,uint256) */ +export const VotingDelaySet = event('0xc565b045403dc03c2eea82b81a0465edad9e2e7fc4d97e11421c209da93d7a93', { + oldVotingDelay: uint256, + newVotingDelay: uint256, +}) +export type VotingDelaySetEventArgs = EParams + +/** VotingPeriodSet(uint256,uint256) */ +export const VotingPeriodSet = event('0x7e3f7f0708a84de9203036abaa450dccc85ad5ff52f78c170f3edb55cf5e8828', { + oldVotingPeriod: uint256, + newVotingPeriod: uint256, +}) +export type VotingPeriodSetEventArgs = EParams diff --git a/src/abi/governance/functions.ts b/src/abi/governance/functions.ts new file mode 100644 index 00000000..0f11f612 --- /dev/null +++ b/src/abi/governance/functions.ts @@ -0,0 +1,388 @@ +import { address, array, bool, bytes, bytes32, bytes4, string, struct, uint256, uint64, uint8 } from '@subsquid/evm-codec' +import { func } from '../abi.support.js' +import type { FunctionArguments, FunctionReturn } from '../abi.support.js' + +/** BALLOT_TYPEHASH() */ +export const BALLOT_TYPEHASH = func('0xdeaaa7cc', {}, bytes32) +export type BALLOT_TYPEHASHParams = FunctionArguments +export type BALLOT_TYPEHASHReturn = FunctionReturn + +/** COUNTING_MODE() */ +export const COUNTING_MODE = func('0xdd4e2ba5', {}, string) +export type COUNTING_MODEParams = FunctionArguments +export type COUNTING_MODEReturn = FunctionReturn + +/** EXTENDED_BALLOT_TYPEHASH() */ +export const EXTENDED_BALLOT_TYPEHASH = func('0x2fe3e261', {}, bytes32) +export type EXTENDED_BALLOT_TYPEHASHParams = FunctionArguments +export type EXTENDED_BALLOT_TYPEHASHReturn = FunctionReturn + +/** cancel(uint256) */ +export const cancel = func('0x40e58ee5', { + proposalId: uint256, +}) +export type CancelParams = FunctionArguments +export type CancelReturn = FunctionReturn + +/** castVote(uint256,uint8) */ +export const castVote = func('0x56781388', { + proposalId: uint256, + support: uint8, +}, uint256) +export type CastVoteParams = FunctionArguments +export type CastVoteReturn = FunctionReturn + +/** castVoteBySig(uint256,uint8,uint8,bytes32,bytes32) */ +export const castVoteBySig = func('0x3bccf4fd', { + proposalId: uint256, + support: uint8, + v: uint8, + r: bytes32, + s: bytes32, +}, uint256) +export type CastVoteBySigParams = FunctionArguments +export type CastVoteBySigReturn = FunctionReturn + +/** castVoteWithReason(uint256,uint8,string) */ +export const castVoteWithReason = func('0x7b3c71d3', { + proposalId: uint256, + support: uint8, + reason: string, +}, uint256) +export type CastVoteWithReasonParams = FunctionArguments +export type CastVoteWithReasonReturn = FunctionReturn + +/** castVoteWithReasonAndParams(uint256,uint8,string,bytes) */ +export const castVoteWithReasonAndParams = func('0x5f398a14', { + proposalId: uint256, + support: uint8, + reason: string, + params: bytes, +}, uint256) +export type CastVoteWithReasonAndParamsParams = FunctionArguments +export type CastVoteWithReasonAndParamsReturn = FunctionReturn + +/** castVoteWithReasonAndParamsBySig(uint256,uint8,string,bytes,uint8,bytes32,bytes32) */ +export const castVoteWithReasonAndParamsBySig = func('0x03420181', { + proposalId: uint256, + support: uint8, + reason: string, + params: bytes, + v: uint8, + r: bytes32, + s: bytes32, +}, uint256) +export type CastVoteWithReasonAndParamsBySigParams = FunctionArguments +export type CastVoteWithReasonAndParamsBySigReturn = FunctionReturn + +/** execute(address[],uint256[],bytes[],bytes32) */ +export const execute = func('0x2656227d', { + targets: array(address), + values: array(uint256), + calldatas: array(bytes), + descriptionHash: bytes32, +}, uint256) +export type ExecuteParams = FunctionArguments +export type ExecuteReturn = FunctionReturn + +/** execute(uint256) */ +export const execute_1 = func('0xfe0d94c1', { + proposalId: uint256, +}) +export type ExecuteParams_1 = FunctionArguments +export type ExecuteReturn_1 = FunctionReturn + +/** getActions(uint256) */ +export const getActions = func('0x328dd982', { + proposalId: uint256, +}, struct({ + targets: array(address), + values: array(uint256), + signatures: array(string), + calldatas: array(bytes), +})) +export type GetActionsParams = FunctionArguments +export type GetActionsReturn = FunctionReturn + +/** getReceipt(uint256,address) */ +export const getReceipt = func('0xe23a9a52', { + proposalId: uint256, + voter: address, +}, struct({ + hasVoted: bool, + support: uint8, + votes: uint256, +})) +export type GetReceiptParams = FunctionArguments +export type GetReceiptReturn = FunctionReturn + +/** getVotes(address,uint256) */ +export const getVotes = func('0xeb9019d4', { + account: address, + blockNumber: uint256, +}, uint256) +export type GetVotesParams = FunctionArguments +export type GetVotesReturn = FunctionReturn + +/** getVotesWithParams(address,uint256,bytes) */ +export const getVotesWithParams = func('0x9a802a6d', { + account: address, + blockNumber: uint256, + params: bytes, +}, uint256) +export type GetVotesWithParamsParams = FunctionArguments +export type GetVotesWithParamsReturn = FunctionReturn + +/** hasVoted(uint256,address) */ +export const hasVoted = func('0x43859632', { + proposalId: uint256, + account: address, +}, bool) +export type HasVotedParams = FunctionArguments +export type HasVotedReturn = FunctionReturn + +/** hashProposal(address[],uint256[],bytes[],bytes32) */ +export const hashProposal = func('0xc59057e4', { + targets: array(address), + values: array(uint256), + calldatas: array(bytes), + descriptionHash: bytes32, +}, uint256) +export type HashProposalParams = FunctionArguments +export type HashProposalReturn = FunctionReturn + +/** lateQuorumVoteExtension() */ +export const lateQuorumVoteExtension = func('0x32b8113e', {}, uint64) +export type LateQuorumVoteExtensionParams = FunctionArguments +export type LateQuorumVoteExtensionReturn = FunctionReturn + +/** name() */ +export const name = func('0x06fdde03', {}, string) +export type NameParams = FunctionArguments +export type NameReturn = FunctionReturn + +/** onERC1155BatchReceived(address,address,uint256[],uint256[],bytes) */ +export const onERC1155BatchReceived = func('0xbc197c81', { + _0: address, + _1: address, + _2: array(uint256), + _3: array(uint256), + _4: bytes, +}, bytes4) +export type OnERC1155BatchReceivedParams = FunctionArguments +export type OnERC1155BatchReceivedReturn = FunctionReturn + +/** onERC1155Received(address,address,uint256,uint256,bytes) */ +export const onERC1155Received = func('0xf23a6e61', { + _0: address, + _1: address, + _2: uint256, + _3: uint256, + _4: bytes, +}, bytes4) +export type OnERC1155ReceivedParams = FunctionArguments +export type OnERC1155ReceivedReturn = FunctionReturn + +/** onERC721Received(address,address,uint256,bytes) */ +export const onERC721Received = func('0x150b7a02', { + _0: address, + _1: address, + _2: uint256, + _3: bytes, +}, bytes4) +export type OnERC721ReceivedParams = FunctionArguments +export type OnERC721ReceivedReturn = FunctionReturn + +/** proposalDeadline(uint256) */ +export const proposalDeadline = func('0xc01f9e37', { + proposalId: uint256, +}, uint256) +export type ProposalDeadlineParams = FunctionArguments +export type ProposalDeadlineReturn = FunctionReturn + +/** proposalEta(uint256) */ +export const proposalEta = func('0xab58fb8e', { + proposalId: uint256, +}, uint256) +export type ProposalEtaParams = FunctionArguments +export type ProposalEtaReturn = FunctionReturn + +/** proposalSnapshot(uint256) */ +export const proposalSnapshot = func('0x2d63f693', { + proposalId: uint256, +}, uint256) +export type ProposalSnapshotParams = FunctionArguments +export type ProposalSnapshotReturn = FunctionReturn + +/** proposalThreshold() */ +export const proposalThreshold = func('0xb58131b0', {}, uint256) +export type ProposalThresholdParams = FunctionArguments +export type ProposalThresholdReturn = FunctionReturn + +/** proposals(uint256) */ +export const proposals = func('0x013cf08b', { + proposalId: uint256, +}, struct({ + id: uint256, + proposer: address, + eta: uint256, + startBlock: uint256, + endBlock: uint256, + forVotes: uint256, + againstVotes: uint256, + abstainVotes: uint256, + canceled: bool, + executed: bool, +})) +export type ProposalsParams = FunctionArguments +export type ProposalsReturn = FunctionReturn + +/** propose(address[],uint256[],bytes[],string) */ +export const propose = func('0x7d5e81e2', { + targets: array(address), + values: array(uint256), + calldatas: array(bytes), + description: string, +}, uint256) +export type ProposeParams = FunctionArguments +export type ProposeReturn = FunctionReturn + +/** propose(address[],uint256[],string[],bytes[],string) */ +export const propose_1 = func('0xda95691a', { + targets: array(address), + values: array(uint256), + signatures: array(string), + calldatas: array(bytes), + description: string, +}, uint256) +export type ProposeParams_1 = FunctionArguments +export type ProposeReturn_1 = FunctionReturn + +/** queue(address[],uint256[],bytes[],bytes32) */ +export const queue = func('0x160cbed7', { + targets: array(address), + values: array(uint256), + calldatas: array(bytes), + descriptionHash: bytes32, +}, uint256) +export type QueueParams = FunctionArguments +export type QueueReturn = FunctionReturn + +/** queue(uint256) */ +export const queue_1 = func('0xddf0b009', { + proposalId: uint256, +}) +export type QueueParams_1 = FunctionArguments +export type QueueReturn_1 = FunctionReturn + +/** quorum(uint256) */ +export const quorum = func('0xf8ce560a', { + blockNumber: uint256, +}, uint256) +export type QuorumParams = FunctionArguments +export type QuorumReturn = FunctionReturn + +/** quorumDenominator() */ +export const quorumDenominator = func('0x97c3d334', {}, uint256) +export type QuorumDenominatorParams = FunctionArguments +export type QuorumDenominatorReturn = FunctionReturn + +/** quorumNumerator() */ +export const quorumNumerator = func('0xa7713a70', {}, uint256) +export type QuorumNumeratorParams = FunctionArguments +export type QuorumNumeratorReturn = FunctionReturn + +/** quorumVotes() */ +export const quorumVotes = func('0x24bc1a64', {}, uint256) +export type QuorumVotesParams = FunctionArguments +export type QuorumVotesReturn = FunctionReturn + +/** relay(address,uint256,bytes) */ +export const relay = func('0xc28bc2fa', { + target: address, + value: uint256, + data: bytes, +}) +export type RelayParams = FunctionArguments +export type RelayReturn = FunctionReturn + +/** setLateQuorumVoteExtension(uint64) */ +export const setLateQuorumVoteExtension = func('0xd07f91e9', { + newVoteExtension: uint64, +}) +export type SetLateQuorumVoteExtensionParams = FunctionArguments +export type SetLateQuorumVoteExtensionReturn = FunctionReturn + +/** setProposalThreshold(uint256) */ +export const setProposalThreshold = func('0xece40cc1', { + newProposalThreshold: uint256, +}) +export type SetProposalThresholdParams = FunctionArguments +export type SetProposalThresholdReturn = FunctionReturn + +/** setVotingDelay(uint256) */ +export const setVotingDelay = func('0x70b0f660', { + newVotingDelay: uint256, +}) +export type SetVotingDelayParams = FunctionArguments +export type SetVotingDelayReturn = FunctionReturn + +/** setVotingPeriod(uint256) */ +export const setVotingPeriod = func('0xea0217cf', { + newVotingPeriod: uint256, +}) +export type SetVotingPeriodParams = FunctionArguments +export type SetVotingPeriodReturn = FunctionReturn + +/** state(uint256) */ +export const state = func('0x3e4f49e6', { + proposalId: uint256, +}, uint8) +export type StateParams = FunctionArguments +export type StateReturn = FunctionReturn + +/** supportsInterface(bytes4) */ +export const supportsInterface = func('0x01ffc9a7', { + interfaceId: bytes4, +}, bool) +export type SupportsInterfaceParams = FunctionArguments +export type SupportsInterfaceReturn = FunctionReturn + +/** timelock() */ +export const timelock = func('0xd33219b4', {}, address) +export type TimelockParams = FunctionArguments +export type TimelockReturn = FunctionReturn + +/** token() */ +export const token = func('0xfc0c546a', {}, address) +export type TokenParams = FunctionArguments +export type TokenReturn = FunctionReturn + +/** updateQuorumNumerator(uint256) */ +export const updateQuorumNumerator = func('0x06f3f9e6', { + newQuorumNumerator: uint256, +}) +export type UpdateQuorumNumeratorParams = FunctionArguments +export type UpdateQuorumNumeratorReturn = FunctionReturn + +/** updateTimelock(address) */ +export const updateTimelock = func('0xa890c910', { + newTimelock: address, +}) +export type UpdateTimelockParams = FunctionArguments +export type UpdateTimelockReturn = FunctionReturn + +/** version() */ +export const version = func('0x54fd4d50', {}, string) +export type VersionParams = FunctionArguments +export type VersionReturn = FunctionReturn + +/** votingDelay() */ +export const votingDelay = func('0x3932abb1', {}, uint256) +export type VotingDelayParams = FunctionArguments +export type VotingDelayReturn = FunctionReturn + +/** votingPeriod() */ +export const votingPeriod = func('0x02a251a3', {}, uint256) +export type VotingPeriodParams = FunctionArguments +export type VotingPeriodReturn = FunctionReturn diff --git a/src/abi/governance/index.ts b/src/abi/governance/index.ts new file mode 100644 index 00000000..11829d6e --- /dev/null +++ b/src/abi/governance/index.ts @@ -0,0 +1,4 @@ +export * as events from './events.js' +export * as functions from './functions.js' + +export { Contract } from './contract.js' diff --git a/src/abi/governed-upgradeability-proxy.ts b/src/abi/governed-upgradeability-proxy.ts deleted file mode 100644 index d91b4fe6..00000000 --- a/src/abi/governed-upgradeability-proxy.ts +++ /dev/null @@ -1,74 +0,0 @@ -import * as p from '@subsquid/evm-codec' -import { event, fun, viewFun, indexed, ContractBase } from '@subsquid/evm-abi' -import type { EventParams as EParams, FunctionArguments, FunctionReturn } from '@subsquid/evm-abi' - -export const events = { - GovernorshipTransferred: event("0xc7c0c772add429241571afb3805861fb3cfa2af374534088b76cdb4325a87e9a", "GovernorshipTransferred(address,address)", {"previousGovernor": indexed(p.address), "newGovernor": indexed(p.address)}), - PendingGovernorshipTransfer: event("0xa39cc5eb22d0f34d8beaefee8a3f17cc229c1a1d1ef87a5ad47313487b1c4f0d", "PendingGovernorshipTransfer(address,address)", {"previousGovernor": indexed(p.address), "newGovernor": indexed(p.address)}), - Upgraded: event("0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", "Upgraded(address)", {"implementation": indexed(p.address)}), -} - -export const functions = { - admin: viewFun("0xf851a440", "admin()", {}, p.address), - claimGovernance: fun("0x5d36b190", "claimGovernance()", {}, ), - governor: viewFun("0x0c340a24", "governor()", {}, p.address), - implementation: viewFun("0x5c60da1b", "implementation()", {}, p.address), - initialize: fun("0xcf7a1d77", "initialize(address,address,bytes)", {"_logic": p.address, "_initGovernor": p.address, "_data": p.bytes}, ), - isGovernor: viewFun("0xc7af3352", "isGovernor()", {}, p.bool), - transferGovernance: fun("0xd38bfff4", "transferGovernance(address)", {"_newGovernor": p.address}, ), - upgradeTo: fun("0x3659cfe6", "upgradeTo(address)", {"newImplementation": p.address}, ), - upgradeToAndCall: fun("0x4f1ef286", "upgradeToAndCall(address,bytes)", {"newImplementation": p.address, "data": p.bytes}, ), -} - -export class Contract extends ContractBase { - - admin() { - return this.eth_call(functions.admin, {}) - } - - governor() { - return this.eth_call(functions.governor, {}) - } - - implementation() { - return this.eth_call(functions.implementation, {}) - } - - isGovernor() { - return this.eth_call(functions.isGovernor, {}) - } -} - -/// Event types -export type GovernorshipTransferredEventArgs = EParams -export type PendingGovernorshipTransferEventArgs = EParams -export type UpgradedEventArgs = EParams - -/// Function types -export type AdminParams = FunctionArguments -export type AdminReturn = FunctionReturn - -export type ClaimGovernanceParams = FunctionArguments -export type ClaimGovernanceReturn = FunctionReturn - -export type GovernorParams = FunctionArguments -export type GovernorReturn = FunctionReturn - -export type ImplementationParams = FunctionArguments -export type ImplementationReturn = FunctionReturn - -export type InitializeParams = FunctionArguments -export type InitializeReturn = FunctionReturn - -export type IsGovernorParams = FunctionArguments -export type IsGovernorReturn = FunctionReturn - -export type TransferGovernanceParams = FunctionArguments -export type TransferGovernanceReturn = FunctionReturn - -export type UpgradeToParams = FunctionArguments -export type UpgradeToReturn = FunctionReturn - -export type UpgradeToAndCallParams = FunctionArguments -export type UpgradeToAndCallReturn = FunctionReturn - diff --git a/src/abi/governed-upgradeability-proxy/contract.ts b/src/abi/governed-upgradeability-proxy/contract.ts new file mode 100644 index 00000000..93f5f793 --- /dev/null +++ b/src/abi/governed-upgradeability-proxy/contract.ts @@ -0,0 +1,20 @@ +import { ContractBase } from '../abi.support.js' +import { admin, governor, implementation, isGovernor } from './functions.js' + +export class Contract extends ContractBase { + admin() { + return this.eth_call(admin, {}) + } + + governor() { + return this.eth_call(governor, {}) + } + + implementation() { + return this.eth_call(implementation, {}) + } + + isGovernor() { + return this.eth_call(isGovernor, {}) + } +} diff --git a/src/abi/governed-upgradeability-proxy/events.ts b/src/abi/governed-upgradeability-proxy/events.ts new file mode 100644 index 00000000..5483aea5 --- /dev/null +++ b/src/abi/governed-upgradeability-proxy/events.ts @@ -0,0 +1,23 @@ +import { address } from '@subsquid/evm-codec' +import { event, indexed } from '../abi.support.js' +import type { EventParams as EParams } from '../abi.support.js' + +/** GovernorshipTransferred(address,address) */ +export const GovernorshipTransferred = event('0xc7c0c772add429241571afb3805861fb3cfa2af374534088b76cdb4325a87e9a', { + previousGovernor: indexed(address), + newGovernor: indexed(address), +}) +export type GovernorshipTransferredEventArgs = EParams + +/** PendingGovernorshipTransfer(address,address) */ +export const PendingGovernorshipTransfer = event('0xa39cc5eb22d0f34d8beaefee8a3f17cc229c1a1d1ef87a5ad47313487b1c4f0d', { + previousGovernor: indexed(address), + newGovernor: indexed(address), +}) +export type PendingGovernorshipTransferEventArgs = EParams + +/** Upgraded(address) */ +export const Upgraded = event('0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b', { + implementation: indexed(address), +}) +export type UpgradedEventArgs = EParams diff --git a/src/abi/governed-upgradeability-proxy/functions.ts b/src/abi/governed-upgradeability-proxy/functions.ts new file mode 100644 index 00000000..bea6d04c --- /dev/null +++ b/src/abi/governed-upgradeability-proxy/functions.ts @@ -0,0 +1,59 @@ +import { address, bool, bytes } from '@subsquid/evm-codec' +import { func } from '../abi.support.js' +import type { FunctionArguments, FunctionReturn } from '../abi.support.js' + +/** admin() */ +export const admin = func('0xf851a440', {}, address) +export type AdminParams = FunctionArguments +export type AdminReturn = FunctionReturn + +/** claimGovernance() */ +export const claimGovernance = func('0x5d36b190', {}) +export type ClaimGovernanceParams = FunctionArguments +export type ClaimGovernanceReturn = FunctionReturn + +/** governor() */ +export const governor = func('0x0c340a24', {}, address) +export type GovernorParams = FunctionArguments +export type GovernorReturn = FunctionReturn + +/** implementation() */ +export const implementation = func('0x5c60da1b', {}, address) +export type ImplementationParams = FunctionArguments +export type ImplementationReturn = FunctionReturn + +/** initialize(address,address,bytes) */ +export const initialize = func('0xcf7a1d77', { + _logic: address, + _initGovernor: address, + _data: bytes, +}) +export type InitializeParams = FunctionArguments +export type InitializeReturn = FunctionReturn + +/** isGovernor() */ +export const isGovernor = func('0xc7af3352', {}, bool) +export type IsGovernorParams = FunctionArguments +export type IsGovernorReturn = FunctionReturn + +/** transferGovernance(address) */ +export const transferGovernance = func('0xd38bfff4', { + _newGovernor: address, +}) +export type TransferGovernanceParams = FunctionArguments +export type TransferGovernanceReturn = FunctionReturn + +/** upgradeTo(address) */ +export const upgradeTo = func('0x3659cfe6', { + newImplementation: address, +}) +export type UpgradeToParams = FunctionArguments +export type UpgradeToReturn = FunctionReturn + +/** upgradeToAndCall(address,bytes) */ +export const upgradeToAndCall = func('0x4f1ef286', { + newImplementation: address, + data: bytes, +}) +export type UpgradeToAndCallParams = FunctionArguments +export type UpgradeToAndCallReturn = FunctionReturn diff --git a/src/abi/governed-upgradeability-proxy/index.ts b/src/abi/governed-upgradeability-proxy/index.ts new file mode 100644 index 00000000..11829d6e --- /dev/null +++ b/src/abi/governed-upgradeability-proxy/index.ts @@ -0,0 +1,4 @@ +export * as events from './events.js' +export * as functions from './functions.js' + +export { Contract } from './contract.js' diff --git a/src/abi/initializable-abstract-strategy.ts b/src/abi/initializable-abstract-strategy.ts deleted file mode 100644 index 1d127c58..00000000 --- a/src/abi/initializable-abstract-strategy.ts +++ /dev/null @@ -1,170 +0,0 @@ -import * as p from '@subsquid/evm-codec' -import { event, fun, viewFun, indexed, ContractBase } from '@subsquid/evm-abi' -import type { EventParams as EParams, FunctionArguments, FunctionReturn } from '@subsquid/evm-abi' - -export const events = { - Deposit: event("0x5548c837ab068cf56a2c2479df0882a4922fd203edb7517321831d95078c5f62", "Deposit(address,address,uint256)", {"_asset": indexed(p.address), "_pToken": p.address, "_amount": p.uint256}), - GovernorshipTransferred: event("0xc7c0c772add429241571afb3805861fb3cfa2af374534088b76cdb4325a87e9a", "GovernorshipTransferred(address,address)", {"previousGovernor": indexed(p.address), "newGovernor": indexed(p.address)}), - HarvesterAddressesUpdated: event("0xe48386b84419f4d36e0f96c10cc3510b6fb1a33795620c5098b22472bbe90796", "HarvesterAddressesUpdated(address,address)", {"_oldHarvesterAddress": p.address, "_newHarvesterAddress": p.address}), - PTokenAdded: event("0xef6485b84315f9b1483beffa32aae9a0596890395e3d7521f1c5fbb51790e765", "PTokenAdded(address,address)", {"_asset": indexed(p.address), "_pToken": p.address}), - PTokenRemoved: event("0x16b7600acff27e39a8a96056b3d533045298de927507f5c1d97e4accde60488c", "PTokenRemoved(address,address)", {"_asset": indexed(p.address), "_pToken": p.address}), - PendingGovernorshipTransfer: event("0xa39cc5eb22d0f34d8beaefee8a3f17cc229c1a1d1ef87a5ad47313487b1c4f0d", "PendingGovernorshipTransfer(address,address)", {"previousGovernor": indexed(p.address), "newGovernor": indexed(p.address)}), - RewardTokenAddressesUpdated: event("0x04c0b9649497d316554306e53678d5f5f5dbc3a06f97dec13ff4cfe98b986bbc", "RewardTokenAddressesUpdated(address[],address[])", {"_oldAddresses": p.array(p.address), "_newAddresses": p.array(p.address)}), - RewardTokenCollected: event("0xf6c07a063ed4e63808eb8da7112d46dbcd38de2b40a73dbcc9353c5a94c72353", "RewardTokenCollected(address,address,uint256)", {"recipient": p.address, "rewardToken": p.address, "amount": p.uint256}), - Withdrawal: event("0x2717ead6b9200dd235aad468c9809ea400fe33ac69b5bfaa6d3e90fc922b6398", "Withdrawal(address,address,uint256)", {"_asset": indexed(p.address), "_pToken": p.address, "_amount": p.uint256}), -} - -export const functions = { - assetToPToken: viewFun("0x0fc3b4c4", "assetToPToken(address)", {"_0": p.address}, p.address), - checkBalance: viewFun("0x5f515226", "checkBalance(address)", {"_asset": p.address}, p.uint256), - claimGovernance: fun("0x5d36b190", "claimGovernance()", {}, ), - collectRewardTokens: fun("0x5a063f63", "collectRewardTokens()", {}, ), - deposit: fun("0x47e7ef24", "deposit(address,uint256)", {"_asset": p.address, "_amount": p.uint256}, ), - depositAll: fun("0xde5f6268", "depositAll()", {}, ), - getRewardTokenAddresses: viewFun("0xf6ca71b0", "getRewardTokenAddresses()", {}, p.array(p.address)), - governor: viewFun("0x0c340a24", "governor()", {}, p.address), - harvesterAddress: viewFun("0x67c7066c", "harvesterAddress()", {}, p.address), - initialize: fun("0x435356d1", "initialize(address[],address[],address[])", {"_rewardTokenAddresses": p.array(p.address), "_assets": p.array(p.address), "_pTokens": p.array(p.address)}, ), - isGovernor: viewFun("0xc7af3352", "isGovernor()", {}, p.bool), - platformAddress: viewFun("0xdbe55e56", "platformAddress()", {}, p.address), - removePToken: fun("0x9136616a", "removePToken(uint256)", {"_assetIndex": p.uint256}, ), - rewardTokenAddresses: viewFun("0x7b2d9b2c", "rewardTokenAddresses(uint256)", {"_0": p.uint256}, p.address), - safeApproveAllTokens: fun("0xad1728cb", "safeApproveAllTokens()", {}, ), - setHarvesterAddress: fun("0xc2e1e3f4", "setHarvesterAddress(address)", {"_harvesterAddress": p.address}, ), - setPTokenAddress: fun("0x0ed57b3a", "setPTokenAddress(address,address)", {"_asset": p.address, "_pToken": p.address}, ), - setRewardTokenAddresses: fun("0x96d538bb", "setRewardTokenAddresses(address[])", {"_rewardTokenAddresses": p.array(p.address)}, ), - supportsAsset: viewFun("0xaa388af6", "supportsAsset(address)", {"_asset": p.address}, p.bool), - transferGovernance: fun("0xd38bfff4", "transferGovernance(address)", {"_newGovernor": p.address}, ), - transferToken: fun("0x1072cbea", "transferToken(address,uint256)", {"_asset": p.address, "_amount": p.uint256}, ), - vaultAddress: viewFun("0x430bf08a", "vaultAddress()", {}, p.address), - withdraw: fun("0xd9caed12", "withdraw(address,address,uint256)", {"_recipient": p.address, "_asset": p.address, "_amount": p.uint256}, ), - withdrawAll: fun("0x853828b6", "withdrawAll()", {}, ), -} - -export class Contract extends ContractBase { - - assetToPToken(_0: AssetToPTokenParams["_0"]) { - return this.eth_call(functions.assetToPToken, {_0}) - } - - checkBalance(_asset: CheckBalanceParams["_asset"]) { - return this.eth_call(functions.checkBalance, {_asset}) - } - - getRewardTokenAddresses() { - return this.eth_call(functions.getRewardTokenAddresses, {}) - } - - governor() { - return this.eth_call(functions.governor, {}) - } - - harvesterAddress() { - return this.eth_call(functions.harvesterAddress, {}) - } - - isGovernor() { - return this.eth_call(functions.isGovernor, {}) - } - - platformAddress() { - return this.eth_call(functions.platformAddress, {}) - } - - rewardTokenAddresses(_0: RewardTokenAddressesParams["_0"]) { - return this.eth_call(functions.rewardTokenAddresses, {_0}) - } - - supportsAsset(_asset: SupportsAssetParams["_asset"]) { - return this.eth_call(functions.supportsAsset, {_asset}) - } - - vaultAddress() { - return this.eth_call(functions.vaultAddress, {}) - } -} - -/// Event types -export type DepositEventArgs = EParams -export type GovernorshipTransferredEventArgs = EParams -export type HarvesterAddressesUpdatedEventArgs = EParams -export type PTokenAddedEventArgs = EParams -export type PTokenRemovedEventArgs = EParams -export type PendingGovernorshipTransferEventArgs = EParams -export type RewardTokenAddressesUpdatedEventArgs = EParams -export type RewardTokenCollectedEventArgs = EParams -export type WithdrawalEventArgs = EParams - -/// Function types -export type AssetToPTokenParams = FunctionArguments -export type AssetToPTokenReturn = FunctionReturn - -export type CheckBalanceParams = FunctionArguments -export type CheckBalanceReturn = FunctionReturn - -export type ClaimGovernanceParams = FunctionArguments -export type ClaimGovernanceReturn = FunctionReturn - -export type CollectRewardTokensParams = FunctionArguments -export type CollectRewardTokensReturn = FunctionReturn - -export type DepositParams = FunctionArguments -export type DepositReturn = FunctionReturn - -export type DepositAllParams = FunctionArguments -export type DepositAllReturn = FunctionReturn - -export type GetRewardTokenAddressesParams = FunctionArguments -export type GetRewardTokenAddressesReturn = FunctionReturn - -export type GovernorParams = FunctionArguments -export type GovernorReturn = FunctionReturn - -export type HarvesterAddressParams = FunctionArguments -export type HarvesterAddressReturn = FunctionReturn - -export type InitializeParams = FunctionArguments -export type InitializeReturn = FunctionReturn - -export type IsGovernorParams = FunctionArguments -export type IsGovernorReturn = FunctionReturn - -export type PlatformAddressParams = FunctionArguments -export type PlatformAddressReturn = FunctionReturn - -export type RemovePTokenParams = FunctionArguments -export type RemovePTokenReturn = FunctionReturn - -export type RewardTokenAddressesParams = FunctionArguments -export type RewardTokenAddressesReturn = FunctionReturn - -export type SafeApproveAllTokensParams = FunctionArguments -export type SafeApproveAllTokensReturn = FunctionReturn - -export type SetHarvesterAddressParams = FunctionArguments -export type SetHarvesterAddressReturn = FunctionReturn - -export type SetPTokenAddressParams = FunctionArguments -export type SetPTokenAddressReturn = FunctionReturn - -export type SetRewardTokenAddressesParams = FunctionArguments -export type SetRewardTokenAddressesReturn = FunctionReturn - -export type SupportsAssetParams = FunctionArguments -export type SupportsAssetReturn = FunctionReturn - -export type TransferGovernanceParams = FunctionArguments -export type TransferGovernanceReturn = FunctionReturn - -export type TransferTokenParams = FunctionArguments -export type TransferTokenReturn = FunctionReturn - -export type VaultAddressParams = FunctionArguments -export type VaultAddressReturn = FunctionReturn - -export type WithdrawParams = FunctionArguments -export type WithdrawReturn = FunctionReturn - -export type WithdrawAllParams = FunctionArguments -export type WithdrawAllReturn = FunctionReturn - diff --git a/src/abi/initializable-abstract-strategy/contract.ts b/src/abi/initializable-abstract-strategy/contract.ts new file mode 100644 index 00000000..26346bbf --- /dev/null +++ b/src/abi/initializable-abstract-strategy/contract.ts @@ -0,0 +1,45 @@ +import { ContractBase } from '../abi.support.js' +import { assetToPToken, checkBalance, getRewardTokenAddresses, governor, harvesterAddress, isGovernor, platformAddress, rewardTokenAddresses, supportsAsset, vaultAddress } from './functions.js' +import type { AssetToPTokenParams, CheckBalanceParams, RewardTokenAddressesParams, SupportsAssetParams } from './functions.js' + +export class Contract extends ContractBase { + assetToPToken(_0: AssetToPTokenParams["_0"]) { + return this.eth_call(assetToPToken, {_0}) + } + + checkBalance(_asset: CheckBalanceParams["_asset"]) { + return this.eth_call(checkBalance, {_asset}) + } + + getRewardTokenAddresses() { + return this.eth_call(getRewardTokenAddresses, {}) + } + + governor() { + return this.eth_call(governor, {}) + } + + harvesterAddress() { + return this.eth_call(harvesterAddress, {}) + } + + isGovernor() { + return this.eth_call(isGovernor, {}) + } + + platformAddress() { + return this.eth_call(platformAddress, {}) + } + + rewardTokenAddresses(_0: RewardTokenAddressesParams["_0"]) { + return this.eth_call(rewardTokenAddresses, {_0}) + } + + supportsAsset(_asset: SupportsAssetParams["_asset"]) { + return this.eth_call(supportsAsset, {_asset}) + } + + vaultAddress() { + return this.eth_call(vaultAddress, {}) + } +} diff --git a/src/abi/initializable-abstract-strategy/events.ts b/src/abi/initializable-abstract-strategy/events.ts new file mode 100644 index 00000000..1554a5bd --- /dev/null +++ b/src/abi/initializable-abstract-strategy/events.ts @@ -0,0 +1,69 @@ +import { address, array, uint256 } from '@subsquid/evm-codec' +import { event, indexed } from '../abi.support.js' +import type { EventParams as EParams } from '../abi.support.js' + +/** Deposit(address,address,uint256) */ +export const Deposit = event('0x5548c837ab068cf56a2c2479df0882a4922fd203edb7517321831d95078c5f62', { + _asset: indexed(address), + _pToken: address, + _amount: uint256, +}) +export type DepositEventArgs = EParams + +/** GovernorshipTransferred(address,address) */ +export const GovernorshipTransferred = event('0xc7c0c772add429241571afb3805861fb3cfa2af374534088b76cdb4325a87e9a', { + previousGovernor: indexed(address), + newGovernor: indexed(address), +}) +export type GovernorshipTransferredEventArgs = EParams + +/** HarvesterAddressesUpdated(address,address) */ +export const HarvesterAddressesUpdated = event('0xe48386b84419f4d36e0f96c10cc3510b6fb1a33795620c5098b22472bbe90796', { + _oldHarvesterAddress: address, + _newHarvesterAddress: address, +}) +export type HarvesterAddressesUpdatedEventArgs = EParams + +/** PTokenAdded(address,address) */ +export const PTokenAdded = event('0xef6485b84315f9b1483beffa32aae9a0596890395e3d7521f1c5fbb51790e765', { + _asset: indexed(address), + _pToken: address, +}) +export type PTokenAddedEventArgs = EParams + +/** PTokenRemoved(address,address) */ +export const PTokenRemoved = event('0x16b7600acff27e39a8a96056b3d533045298de927507f5c1d97e4accde60488c', { + _asset: indexed(address), + _pToken: address, +}) +export type PTokenRemovedEventArgs = EParams + +/** PendingGovernorshipTransfer(address,address) */ +export const PendingGovernorshipTransfer = event('0xa39cc5eb22d0f34d8beaefee8a3f17cc229c1a1d1ef87a5ad47313487b1c4f0d', { + previousGovernor: indexed(address), + newGovernor: indexed(address), +}) +export type PendingGovernorshipTransferEventArgs = EParams + +/** RewardTokenAddressesUpdated(address[],address[]) */ +export const RewardTokenAddressesUpdated = event('0x04c0b9649497d316554306e53678d5f5f5dbc3a06f97dec13ff4cfe98b986bbc', { + _oldAddresses: array(address), + _newAddresses: array(address), +}) +export type RewardTokenAddressesUpdatedEventArgs = EParams + +/** RewardTokenCollected(address,address,uint256) */ +export const RewardTokenCollected = event('0xf6c07a063ed4e63808eb8da7112d46dbcd38de2b40a73dbcc9353c5a94c72353', { + recipient: address, + rewardToken: address, + amount: uint256, +}) +export type RewardTokenCollectedEventArgs = EParams + +/** Withdrawal(address,address,uint256) */ +export const Withdrawal = event('0x2717ead6b9200dd235aad468c9809ea400fe33ac69b5bfaa6d3e90fc922b6398', { + _asset: indexed(address), + _pToken: address, + _amount: uint256, +}) +export type WithdrawalEventArgs = EParams diff --git a/src/abi/initializable-abstract-strategy/functions.ts b/src/abi/initializable-abstract-strategy/functions.ts new file mode 100644 index 00000000..788c9ce4 --- /dev/null +++ b/src/abi/initializable-abstract-strategy/functions.ts @@ -0,0 +1,156 @@ +import { address, array, bool, uint256 } from '@subsquid/evm-codec' +import { func } from '../abi.support.js' +import type { FunctionArguments, FunctionReturn } from '../abi.support.js' + +/** assetToPToken(address) */ +export const assetToPToken = func('0x0fc3b4c4', { + _0: address, +}, address) +export type AssetToPTokenParams = FunctionArguments +export type AssetToPTokenReturn = FunctionReturn + +/** checkBalance(address) */ +export const checkBalance = func('0x5f515226', { + _asset: address, +}, uint256) +export type CheckBalanceParams = FunctionArguments +export type CheckBalanceReturn = FunctionReturn + +/** claimGovernance() */ +export const claimGovernance = func('0x5d36b190', {}) +export type ClaimGovernanceParams = FunctionArguments +export type ClaimGovernanceReturn = FunctionReturn + +/** collectRewardTokens() */ +export const collectRewardTokens = func('0x5a063f63', {}) +export type CollectRewardTokensParams = FunctionArguments +export type CollectRewardTokensReturn = FunctionReturn + +/** deposit(address,uint256) */ +export const deposit = func('0x47e7ef24', { + _asset: address, + _amount: uint256, +}) +export type DepositParams = FunctionArguments +export type DepositReturn = FunctionReturn + +/** depositAll() */ +export const depositAll = func('0xde5f6268', {}) +export type DepositAllParams = FunctionArguments +export type DepositAllReturn = FunctionReturn + +/** getRewardTokenAddresses() */ +export const getRewardTokenAddresses = func('0xf6ca71b0', {}, array(address)) +export type GetRewardTokenAddressesParams = FunctionArguments +export type GetRewardTokenAddressesReturn = FunctionReturn + +/** governor() */ +export const governor = func('0x0c340a24', {}, address) +export type GovernorParams = FunctionArguments +export type GovernorReturn = FunctionReturn + +/** harvesterAddress() */ +export const harvesterAddress = func('0x67c7066c', {}, address) +export type HarvesterAddressParams = FunctionArguments +export type HarvesterAddressReturn = FunctionReturn + +/** initialize(address[],address[],address[]) */ +export const initialize = func('0x435356d1', { + _rewardTokenAddresses: array(address), + _assets: array(address), + _pTokens: array(address), +}) +export type InitializeParams = FunctionArguments +export type InitializeReturn = FunctionReturn + +/** isGovernor() */ +export const isGovernor = func('0xc7af3352', {}, bool) +export type IsGovernorParams = FunctionArguments +export type IsGovernorReturn = FunctionReturn + +/** platformAddress() */ +export const platformAddress = func('0xdbe55e56', {}, address) +export type PlatformAddressParams = FunctionArguments +export type PlatformAddressReturn = FunctionReturn + +/** removePToken(uint256) */ +export const removePToken = func('0x9136616a', { + _assetIndex: uint256, +}) +export type RemovePTokenParams = FunctionArguments +export type RemovePTokenReturn = FunctionReturn + +/** rewardTokenAddresses(uint256) */ +export const rewardTokenAddresses = func('0x7b2d9b2c', { + _0: uint256, +}, address) +export type RewardTokenAddressesParams = FunctionArguments +export type RewardTokenAddressesReturn = FunctionReturn + +/** safeApproveAllTokens() */ +export const safeApproveAllTokens = func('0xad1728cb', {}) +export type SafeApproveAllTokensParams = FunctionArguments +export type SafeApproveAllTokensReturn = FunctionReturn + +/** setHarvesterAddress(address) */ +export const setHarvesterAddress = func('0xc2e1e3f4', { + _harvesterAddress: address, +}) +export type SetHarvesterAddressParams = FunctionArguments +export type SetHarvesterAddressReturn = FunctionReturn + +/** setPTokenAddress(address,address) */ +export const setPTokenAddress = func('0x0ed57b3a', { + _asset: address, + _pToken: address, +}) +export type SetPTokenAddressParams = FunctionArguments +export type SetPTokenAddressReturn = FunctionReturn + +/** setRewardTokenAddresses(address[]) */ +export const setRewardTokenAddresses = func('0x96d538bb', { + _rewardTokenAddresses: array(address), +}) +export type SetRewardTokenAddressesParams = FunctionArguments +export type SetRewardTokenAddressesReturn = FunctionReturn + +/** supportsAsset(address) */ +export const supportsAsset = func('0xaa388af6', { + _asset: address, +}, bool) +export type SupportsAssetParams = FunctionArguments +export type SupportsAssetReturn = FunctionReturn + +/** transferGovernance(address) */ +export const transferGovernance = func('0xd38bfff4', { + _newGovernor: address, +}) +export type TransferGovernanceParams = FunctionArguments +export type TransferGovernanceReturn = FunctionReturn + +/** transferToken(address,uint256) */ +export const transferToken = func('0x1072cbea', { + _asset: address, + _amount: uint256, +}) +export type TransferTokenParams = FunctionArguments +export type TransferTokenReturn = FunctionReturn + +/** vaultAddress() */ +export const vaultAddress = func('0x430bf08a', {}, address) +export type VaultAddressParams = FunctionArguments +export type VaultAddressReturn = FunctionReturn + +/** withdraw(address,address,uint256) */ +export const withdraw = func('0xd9caed12', { + _recipient: address, + _asset: address, + _amount: uint256, +}) +export type WithdrawParams = FunctionArguments +export type WithdrawReturn = FunctionReturn + +/** withdrawAll() */ +export const withdrawAll = func('0x853828b6', {}) +export type WithdrawAllParams = FunctionArguments +export type WithdrawAllReturn = FunctionReturn diff --git a/src/abi/initializable-abstract-strategy/index.ts b/src/abi/initializable-abstract-strategy/index.ts new file mode 100644 index 00000000..11829d6e --- /dev/null +++ b/src/abi/initializable-abstract-strategy/index.ts @@ -0,0 +1,4 @@ +export * as events from './events.js' +export * as functions from './functions.js' + +export { Contract } from './contract.js' diff --git a/src/abi/irm-adaptive-curve.ts b/src/abi/irm-adaptive-curve.ts deleted file mode 100644 index f8e6ddac..00000000 --- a/src/abi/irm-adaptive-curve.ts +++ /dev/null @@ -1,19 +0,0 @@ -import * as p from '@subsquid/evm-codec' -import { event, fun, viewFun, indexed, ContractBase } from '@subsquid/evm-abi' -import type { EventParams as EParams, FunctionArguments, FunctionReturn } from '@subsquid/evm-abi' - -export const functions = { - rateAtTarget: viewFun("0x01977b57", "rateAtTarget(bytes32)", {"id": p.bytes32}, p.int256), -} - -export class Contract extends ContractBase { - - rateAtTarget(id: RateAtTargetParams["id"]) { - return this.eth_call(functions.rateAtTarget, {id}) - } -} - -/// Function types -export type RateAtTargetParams = FunctionArguments -export type RateAtTargetReturn = FunctionReturn - diff --git a/src/abi/irm-adaptive-curve/contract.ts b/src/abi/irm-adaptive-curve/contract.ts new file mode 100644 index 00000000..969b2098 --- /dev/null +++ b/src/abi/irm-adaptive-curve/contract.ts @@ -0,0 +1,9 @@ +import { ContractBase } from '../abi.support.js' +import { rateAtTarget } from './functions.js' +import type { RateAtTargetParams } from './functions.js' + +export class Contract extends ContractBase { + rateAtTarget(id: RateAtTargetParams["id"]) { + return this.eth_call(rateAtTarget, {id}) + } +} diff --git a/src/abi/irm-adaptive-curve/functions.ts b/src/abi/irm-adaptive-curve/functions.ts new file mode 100644 index 00000000..91ecd2c1 --- /dev/null +++ b/src/abi/irm-adaptive-curve/functions.ts @@ -0,0 +1,10 @@ +import { bytes32, int256 } from '@subsquid/evm-codec' +import { func } from '../abi.support.js' +import type { FunctionArguments, FunctionReturn } from '../abi.support.js' + +/** rateAtTarget(bytes32) */ +export const rateAtTarget = func('0x01977b57', { + id: bytes32, +}, int256) +export type RateAtTargetParams = FunctionArguments +export type RateAtTargetReturn = FunctionReturn diff --git a/src/abi/irm-adaptive-curve/index.ts b/src/abi/irm-adaptive-curve/index.ts new file mode 100644 index 00000000..ed5306bd --- /dev/null +++ b/src/abi/irm-adaptive-curve/index.ts @@ -0,0 +1,3 @@ +export * as functions from './functions.js' + +export { Contract } from './contract.js' diff --git a/src/abi/legacy-staking.ts b/src/abi/legacy-staking.ts deleted file mode 100644 index f828db98..00000000 --- a/src/abi/legacy-staking.ts +++ /dev/null @@ -1,35 +0,0 @@ -import * as p from '@subsquid/evm-codec' -import { event, fun, viewFun, indexed, ContractBase } from '@subsquid/evm-abi' -import type { EventParams as EParams, FunctionArguments, FunctionReturn } from '@subsquid/evm-abi' - -export const events = { - GovernorshipTransferred: event("0xc7c0c772add429241571afb3805861fb3cfa2af374534088b76cdb4325a87e9a", "GovernorshipTransferred(address,address)", {"previousGovernor": indexed(p.address), "newGovernor": indexed(p.address)}), - NewAirDropRootHash: event("0x1ac9c006454d2d601a481473a37c95bf489c5923bd7c2a701757d4016a0f022d", "NewAirDropRootHash(uint8,bytes32,uint256)", {"stakeType": p.uint8, "rootHash": p.bytes32, "proofDepth": p.uint256}), - NewDurations: event("0x180120279c2eb356244609197b5b64c0fbabd60f8d073b75aba771a296bb63d4", "NewDurations(address,uint256[])", {"user": indexed(p.address), "durations": p.array(p.uint256)}), - NewRates: event("0xa804368c7f1a6216d92d17d9753b923dfc3da14ae33d231e8d79e39202e249c3", "NewRates(address,uint256[])", {"user": indexed(p.address), "rates": p.array(p.uint256)}), - Paused: event("0xe8699cf681560fd07de85543bd994263f4557bdc5179dd702f256d15fd083e1d", "Paused(address,bool)", {"user": indexed(p.address), "yes": p.bool}), - PendingGovernorshipTransfer: event("0xa39cc5eb22d0f34d8beaefee8a3f17cc229c1a1d1ef87a5ad47313487b1c4f0d", "PendingGovernorshipTransfer(address,address)", {"previousGovernor": indexed(p.address), "newGovernor": indexed(p.address)}), - 'Staked(address indexed,uint256,uint256,uint256)': event("0xb4caaf29adda3eefee3ad552a8e85058589bf834c7466cae4ee58787f70589ed", "Staked(address,uint256,uint256,uint256)", {"user": indexed(p.address), "amount": p.uint256, "duration": p.uint256, "rate": p.uint256}), - StakesTransfered: event("0xd0ceb9c39a11711e51ee4b32b97b05d660d6229ecd8be94ce934fa9e77910263", "StakesTransfered(address,address,uint256)", {"fromUser": indexed(p.address), "toUser": p.address, "numStakes": p.uint256}), - 'Withdrawn(address indexed,uint256,uint256)': event("0x92ccf450a286a957af52509bc1c9939d1a6a481783e142e41e2499f0bb66ebc6", "Withdrawn(address,uint256,uint256)", {"user": indexed(p.address), "amount": p.uint256, "stakedAmount": p.uint256}), - Upgraded: event("0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", "Upgraded(address)", {"implementation": indexed(p.address)}), - 'Staked(address indexed,uint256)': event("0x9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d", "Staked(address,uint256)", {"user": indexed(p.address), "amount": p.uint256}), - 'Withdrawn(address indexed,uint256)': event("0x7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5", "Withdrawn(address,uint256)", {"user": indexed(p.address), "amount": p.uint256}), -} - -export class Contract extends ContractBase { -} - -/// Event types -export type GovernorshipTransferredEventArgs = EParams -export type NewAirDropRootHashEventArgs = EParams -export type NewDurationsEventArgs = EParams -export type NewRatesEventArgs = EParams -export type PausedEventArgs = EParams -export type PendingGovernorshipTransferEventArgs = EParams -export type StakedEventArgs_0 = EParams -export type StakesTransferedEventArgs = EParams -export type WithdrawnEventArgs_0 = EParams -export type UpgradedEventArgs = EParams -export type StakedEventArgs_1 = EParams -export type WithdrawnEventArgs_1 = EParams diff --git a/src/abi/legacy-staking/contract.ts b/src/abi/legacy-staking/contract.ts new file mode 100644 index 00000000..f07fbdea --- /dev/null +++ b/src/abi/legacy-staking/contract.ts @@ -0,0 +1,4 @@ +import { ContractBase } from '../abi.support.js' + +export class Contract extends ContractBase { +} diff --git a/src/abi/legacy-staking/events.ts b/src/abi/legacy-staking/events.ts new file mode 100644 index 00000000..8c63a409 --- /dev/null +++ b/src/abi/legacy-staking/events.ts @@ -0,0 +1,91 @@ +import { address, array, bool, bytes32, uint256, uint8 } from '@subsquid/evm-codec' +import { event, indexed } from '../abi.support.js' +import type { EventParams as EParams } from '../abi.support.js' + +/** GovernorshipTransferred(address,address) */ +export const GovernorshipTransferred = event('0xc7c0c772add429241571afb3805861fb3cfa2af374534088b76cdb4325a87e9a', { + previousGovernor: indexed(address), + newGovernor: indexed(address), +}) +export type GovernorshipTransferredEventArgs = EParams + +/** NewAirDropRootHash(uint8,bytes32,uint256) */ +export const NewAirDropRootHash = event('0x1ac9c006454d2d601a481473a37c95bf489c5923bd7c2a701757d4016a0f022d', { + stakeType: uint8, + rootHash: bytes32, + proofDepth: uint256, +}) +export type NewAirDropRootHashEventArgs = EParams + +/** NewDurations(address,uint256[]) */ +export const NewDurations = event('0x180120279c2eb356244609197b5b64c0fbabd60f8d073b75aba771a296bb63d4', { + user: indexed(address), + durations: array(uint256), +}) +export type NewDurationsEventArgs = EParams + +/** NewRates(address,uint256[]) */ +export const NewRates = event('0xa804368c7f1a6216d92d17d9753b923dfc3da14ae33d231e8d79e39202e249c3', { + user: indexed(address), + rates: array(uint256), +}) +export type NewRatesEventArgs = EParams + +/** Paused(address,bool) */ +export const Paused = event('0xe8699cf681560fd07de85543bd994263f4557bdc5179dd702f256d15fd083e1d', { + user: indexed(address), + yes: bool, +}) +export type PausedEventArgs = EParams + +/** PendingGovernorshipTransfer(address,address) */ +export const PendingGovernorshipTransfer = event('0xa39cc5eb22d0f34d8beaefee8a3f17cc229c1a1d1ef87a5ad47313487b1c4f0d', { + previousGovernor: indexed(address), + newGovernor: indexed(address), +}) +export type PendingGovernorshipTransferEventArgs = EParams + +/** Staked(address,uint256,uint256,uint256) */ +export const Staked = event('0xb4caaf29adda3eefee3ad552a8e85058589bf834c7466cae4ee58787f70589ed', { + user: indexed(address), + amount: uint256, + duration: uint256, + rate: uint256, +}) +export type StakedEventArgs = EParams + +/** StakesTransfered(address,address,uint256) */ +export const StakesTransfered = event('0xd0ceb9c39a11711e51ee4b32b97b05d660d6229ecd8be94ce934fa9e77910263', { + fromUser: indexed(address), + toUser: address, + numStakes: uint256, +}) +export type StakesTransferedEventArgs = EParams + +/** Withdrawn(address,uint256,uint256) */ +export const Withdrawn = event('0x92ccf450a286a957af52509bc1c9939d1a6a481783e142e41e2499f0bb66ebc6', { + user: indexed(address), + amount: uint256, + stakedAmount: uint256, +}) +export type WithdrawnEventArgs = EParams + +/** Upgraded(address) */ +export const Upgraded = event('0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b', { + implementation: indexed(address), +}) +export type UpgradedEventArgs = EParams + +/** Staked(address,uint256) */ +export const Staked_1 = event('0x9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d', { + user: indexed(address), + amount: uint256, +}) +export type StakedEventArgs_1 = EParams + +/** Withdrawn(address,uint256) */ +export const Withdrawn_1 = event('0x7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5', { + user: indexed(address), + amount: uint256, +}) +export type WithdrawnEventArgs_1 = EParams diff --git a/src/abi/legacy-staking/index.ts b/src/abi/legacy-staking/index.ts new file mode 100644 index 00000000..b629f9cd --- /dev/null +++ b/src/abi/legacy-staking/index.ts @@ -0,0 +1,3 @@ +export * as events from './events.js' + +export { Contract } from './contract.js' diff --git a/src/abi/lido.abi.ts b/src/abi/lido.abi.ts deleted file mode 100644 index 5388446c..00000000 --- a/src/abi/lido.abi.ts +++ /dev/null @@ -1,1580 +0,0 @@ -export const ABI_JSON = [ - { - "type": "function", - "name": "resume", - "constant": false, - "payable": false, - "inputs": [], - "outputs": [] - }, - { - "type": "function", - "name": "name", - "constant": true, - "stateMutability": "pure", - "payable": false, - "inputs": [], - "outputs": [ - { - "type": "string", - "name": "" - } - ] - }, - { - "type": "function", - "name": "stop", - "constant": false, - "payable": false, - "inputs": [], - "outputs": [] - }, - { - "type": "function", - "name": "hasInitialized", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [ - { - "type": "bool", - "name": "" - } - ] - }, - { - "type": "function", - "name": "approve", - "constant": false, - "payable": false, - "inputs": [ - { - "type": "address", - "name": "_spender" - }, - { - "type": "uint256", - "name": "_amount" - } - ], - "outputs": [ - { - "type": "bool", - "name": "" - } - ] - }, - { - "type": "function", - "name": "STAKING_CONTROL_ROLE", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [ - { - "type": "bytes32", - "name": "" - } - ] - }, - { - "type": "function", - "name": "totalSupply", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [ - { - "type": "uint256", - "name": "" - } - ] - }, - { - "type": "function", - "name": "getSharesByPooledEth", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [ - { - "type": "uint256", - "name": "_ethAmount" - } - ], - "outputs": [ - { - "type": "uint256", - "name": "" - } - ] - }, - { - "type": "function", - "name": "isStakingPaused", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [ - { - "type": "bool", - "name": "" - } - ] - }, - { - "type": "function", - "name": "transferFrom", - "constant": false, - "payable": false, - "inputs": [ - { - "type": "address", - "name": "_sender" - }, - { - "type": "address", - "name": "_recipient" - }, - { - "type": "uint256", - "name": "_amount" - } - ], - "outputs": [ - { - "type": "bool", - "name": "" - } - ] - }, - { - "type": "function", - "name": "getEVMScriptExecutor", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [ - { - "type": "bytes", - "name": "_script" - } - ], - "outputs": [ - { - "type": "address", - "name": "" - } - ] - }, - { - "type": "function", - "name": "setStakingLimit", - "constant": false, - "payable": false, - "inputs": [ - { - "type": "uint256", - "name": "_maxStakeLimit" - }, - { - "type": "uint256", - "name": "_stakeLimitIncreasePerBlock" - } - ], - "outputs": [] - }, - { - "type": "function", - "name": "RESUME_ROLE", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [ - { - "type": "bytes32", - "name": "" - } - ] - }, - { - "type": "function", - "name": "finalizeUpgrade_v2", - "constant": false, - "payable": false, - "inputs": [ - { - "type": "address", - "name": "_lidoLocator" - }, - { - "type": "address", - "name": "_eip712StETH" - } - ], - "outputs": [] - }, - { - "type": "function", - "name": "decimals", - "constant": true, - "stateMutability": "pure", - "payable": false, - "inputs": [], - "outputs": [ - { - "type": "uint8", - "name": "" - } - ] - }, - { - "type": "function", - "name": "getRecoveryVault", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [ - { - "type": "address", - "name": "" - } - ] - }, - { - "type": "function", - "name": "DOMAIN_SEPARATOR", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [ - { - "type": "bytes32", - "name": "" - } - ] - }, - { - "type": "function", - "name": "getTotalPooledEther", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [ - { - "type": "uint256", - "name": "" - } - ] - }, - { - "type": "function", - "name": "unsafeChangeDepositedValidators", - "constant": false, - "payable": false, - "inputs": [ - { - "type": "uint256", - "name": "_newDepositedValidators" - } - ], - "outputs": [] - }, - { - "type": "function", - "name": "PAUSE_ROLE", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [ - { - "type": "bytes32", - "name": "" - } - ] - }, - { - "type": "function", - "name": "increaseAllowance", - "constant": false, - "payable": false, - "inputs": [ - { - "type": "address", - "name": "_spender" - }, - { - "type": "uint256", - "name": "_addedValue" - } - ], - "outputs": [ - { - "type": "bool", - "name": "" - } - ] - }, - { - "type": "function", - "name": "getTreasury", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [ - { - "type": "address", - "name": "" - } - ] - }, - { - "type": "function", - "name": "isStopped", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [ - { - "type": "bool", - "name": "" - } - ] - }, - { - "type": "function", - "name": "getBufferedEther", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [ - { - "type": "uint256", - "name": "" - } - ] - }, - { - "type": "function", - "name": "initialize", - "constant": false, - "stateMutability": "payable", - "payable": true, - "inputs": [ - { - "type": "address", - "name": "_lidoLocator" - }, - { - "type": "address", - "name": "_eip712StETH" - } - ], - "outputs": [] - }, - { - "type": "function", - "name": "receiveELRewards", - "constant": false, - "stateMutability": "payable", - "payable": true, - "inputs": [], - "outputs": [] - }, - { - "type": "function", - "name": "getWithdrawalCredentials", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [ - { - "type": "bytes32", - "name": "" - } - ] - }, - { - "type": "function", - "name": "getCurrentStakeLimit", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [ - { - "type": "uint256", - "name": "" - } - ] - }, - { - "type": "function", - "name": "getStakeLimitFullInfo", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [ - { - "type": "bool", - "name": "isStakingPaused" - }, - { - "type": "bool", - "name": "isStakingLimitSet" - }, - { - "type": "uint256", - "name": "currentStakeLimit" - }, - { - "type": "uint256", - "name": "maxStakeLimit" - }, - { - "type": "uint256", - "name": "maxStakeLimitGrowthBlocks" - }, - { - "type": "uint256", - "name": "prevStakeLimit" - }, - { - "type": "uint256", - "name": "prevStakeBlockNumber" - } - ] - }, - { - "type": "function", - "name": "transferSharesFrom", - "constant": false, - "payable": false, - "inputs": [ - { - "type": "address", - "name": "_sender" - }, - { - "type": "address", - "name": "_recipient" - }, - { - "type": "uint256", - "name": "_sharesAmount" - } - ], - "outputs": [ - { - "type": "uint256", - "name": "" - } - ] - }, - { - "type": "function", - "name": "balanceOf", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [ - { - "type": "address", - "name": "_account" - } - ], - "outputs": [ - { - "type": "uint256", - "name": "" - } - ] - }, - { - "type": "function", - "name": "resumeStaking", - "constant": false, - "payable": false, - "inputs": [], - "outputs": [] - }, - { - "type": "function", - "name": "getFeeDistribution", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [ - { - "type": "uint16", - "name": "treasuryFeeBasisPoints" - }, - { - "type": "uint16", - "name": "insuranceFeeBasisPoints" - }, - { - "type": "uint16", - "name": "operatorsFeeBasisPoints" - } - ] - }, - { - "type": "function", - "name": "receiveWithdrawals", - "constant": false, - "stateMutability": "payable", - "payable": true, - "inputs": [], - "outputs": [] - }, - { - "type": "function", - "name": "getPooledEthByShares", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [ - { - "type": "uint256", - "name": "_sharesAmount" - } - ], - "outputs": [ - { - "type": "uint256", - "name": "" - } - ] - }, - { - "type": "function", - "name": "allowRecoverability", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [ - { - "type": "address", - "name": "token" - } - ], - "outputs": [ - { - "type": "bool", - "name": "" - } - ] - }, - { - "type": "function", - "name": "nonces", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [ - { - "type": "address", - "name": "owner" - } - ], - "outputs": [ - { - "type": "uint256", - "name": "" - } - ] - }, - { - "type": "function", - "name": "appId", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [ - { - "type": "bytes32", - "name": "" - } - ] - }, - { - "type": "function", - "name": "getOracle", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [ - { - "type": "address", - "name": "" - } - ] - }, - { - "type": "function", - "name": "eip712Domain", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [ - { - "type": "string", - "name": "name" - }, - { - "type": "string", - "name": "version" - }, - { - "type": "uint256", - "name": "chainId" - }, - { - "type": "address", - "name": "verifyingContract" - } - ] - }, - { - "type": "function", - "name": "getContractVersion", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [ - { - "type": "uint256", - "name": "" - } - ] - }, - { - "type": "function", - "name": "getInitializationBlock", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [ - { - "type": "uint256", - "name": "" - } - ] - }, - { - "type": "function", - "name": "transferShares", - "constant": false, - "payable": false, - "inputs": [ - { - "type": "address", - "name": "_recipient" - }, - { - "type": "uint256", - "name": "_sharesAmount" - } - ], - "outputs": [ - { - "type": "uint256", - "name": "" - } - ] - }, - { - "type": "function", - "name": "symbol", - "constant": true, - "stateMutability": "pure", - "payable": false, - "inputs": [], - "outputs": [ - { - "type": "string", - "name": "" - } - ] - }, - { - "type": "function", - "name": "getEIP712StETH", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [ - { - "type": "address", - "name": "" - } - ] - }, - { - "type": "function", - "name": "transferToVault", - "constant": false, - "payable": false, - "inputs": [ - { - "type": "address", - "name": "" - } - ], - "outputs": [] - }, - { - "type": "function", - "name": "canPerform", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [ - { - "type": "address", - "name": "_sender" - }, - { - "type": "bytes32", - "name": "_role" - }, - { - "type": "uint256[]", - "name": "_params" - } - ], - "outputs": [ - { - "type": "bool", - "name": "" - } - ] - }, - { - "type": "function", - "name": "submit", - "constant": false, - "stateMutability": "payable", - "payable": true, - "inputs": [ - { - "type": "address", - "name": "_referral" - } - ], - "outputs": [ - { - "type": "uint256", - "name": "" - } - ] - }, - { - "type": "function", - "name": "decreaseAllowance", - "constant": false, - "payable": false, - "inputs": [ - { - "type": "address", - "name": "_spender" - }, - { - "type": "uint256", - "name": "_subtractedValue" - } - ], - "outputs": [ - { - "type": "bool", - "name": "" - } - ] - }, - { - "type": "function", - "name": "getEVMScriptRegistry", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [ - { - "type": "address", - "name": "" - } - ] - }, - { - "type": "function", - "name": "transfer", - "constant": false, - "payable": false, - "inputs": [ - { - "type": "address", - "name": "_recipient" - }, - { - "type": "uint256", - "name": "_amount" - } - ], - "outputs": [ - { - "type": "bool", - "name": "" - } - ] - }, - { - "type": "function", - "name": "deposit", - "constant": false, - "payable": false, - "inputs": [ - { - "type": "uint256", - "name": "_maxDepositsCount" - }, - { - "type": "uint256", - "name": "_stakingModuleId" - }, - { - "type": "bytes", - "name": "_depositCalldata" - } - ], - "outputs": [] - }, - { - "type": "function", - "name": "UNSAFE_CHANGE_DEPOSITED_VALIDATORS_ROLE", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [ - { - "type": "bytes32", - "name": "" - } - ] - }, - { - "type": "function", - "name": "getBeaconStat", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [ - { - "type": "uint256", - "name": "depositedValidators" - }, - { - "type": "uint256", - "name": "beaconValidators" - }, - { - "type": "uint256", - "name": "beaconBalance" - } - ] - }, - { - "type": "function", - "name": "removeStakingLimit", - "constant": false, - "payable": false, - "inputs": [], - "outputs": [] - }, - { - "type": "function", - "name": "handleOracleReport", - "constant": false, - "payable": false, - "inputs": [ - { - "type": "uint256", - "name": "_reportTimestamp" - }, - { - "type": "uint256", - "name": "_timeElapsed" - }, - { - "type": "uint256", - "name": "_clValidators" - }, - { - "type": "uint256", - "name": "_clBalance" - }, - { - "type": "uint256", - "name": "_withdrawalVaultBalance" - }, - { - "type": "uint256", - "name": "_elRewardsVaultBalance" - }, - { - "type": "uint256", - "name": "_sharesRequestedToBurn" - }, - { - "type": "uint256[]", - "name": "_withdrawalFinalizationBatches" - }, - { - "type": "uint256", - "name": "_simulatedShareRate" - } - ], - "outputs": [ - { - "type": "uint256[4]", - "name": "postRebaseAmounts" - } - ] - }, - { - "type": "function", - "name": "getFee", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [ - { - "type": "uint16", - "name": "totalFee" - } - ] - }, - { - "type": "function", - "name": "kernel", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [ - { - "type": "address", - "name": "" - } - ] - }, - { - "type": "function", - "name": "getTotalShares", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [ - { - "type": "uint256", - "name": "" - } - ] - }, - { - "type": "function", - "name": "permit", - "constant": false, - "payable": false, - "inputs": [ - { - "type": "address", - "name": "_owner" - }, - { - "type": "address", - "name": "_spender" - }, - { - "type": "uint256", - "name": "_value" - }, - { - "type": "uint256", - "name": "_deadline" - }, - { - "type": "uint8", - "name": "_v" - }, - { - "type": "bytes32", - "name": "_r" - }, - { - "type": "bytes32", - "name": "_s" - } - ], - "outputs": [] - }, - { - "type": "function", - "name": "allowance", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [ - { - "type": "address", - "name": "_owner" - }, - { - "type": "address", - "name": "_spender" - } - ], - "outputs": [ - { - "type": "uint256", - "name": "" - } - ] - }, - { - "type": "function", - "name": "isPetrified", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [ - { - "type": "bool", - "name": "" - } - ] - }, - { - "type": "function", - "name": "getLidoLocator", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [ - { - "type": "address", - "name": "" - } - ] - }, - { - "type": "function", - "name": "canDeposit", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [ - { - "type": "bool", - "name": "" - } - ] - }, - { - "type": "function", - "name": "STAKING_PAUSE_ROLE", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [ - { - "type": "bytes32", - "name": "" - } - ] - }, - { - "type": "function", - "name": "getDepositableEther", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [ - { - "type": "uint256", - "name": "" - } - ] - }, - { - "type": "function", - "name": "sharesOf", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [ - { - "type": "address", - "name": "_account" - } - ], - "outputs": [ - { - "type": "uint256", - "name": "" - } - ] - }, - { - "type": "function", - "name": "pauseStaking", - "constant": false, - "payable": false, - "inputs": [], - "outputs": [] - }, - { - "type": "function", - "name": "getTotalELRewardsCollected", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [ - { - "type": "uint256", - "name": "" - } - ] - }, - { - "type": "fallback", - "stateMutability": "payable" - }, - { - "type": "event", - "anonymous": false, - "name": "StakingPaused", - "inputs": [] - }, - { - "type": "event", - "anonymous": false, - "name": "StakingResumed", - "inputs": [] - }, - { - "type": "event", - "anonymous": false, - "name": "StakingLimitSet", - "inputs": [ - { - "type": "uint256", - "name": "maxStakeLimit", - "indexed": false - }, - { - "type": "uint256", - "name": "stakeLimitIncreasePerBlock", - "indexed": false - } - ] - }, - { - "type": "event", - "anonymous": false, - "name": "StakingLimitRemoved", - "inputs": [] - }, - { - "type": "event", - "anonymous": false, - "name": "CLValidatorsUpdated", - "inputs": [ - { - "type": "uint256", - "name": "reportTimestamp", - "indexed": true - }, - { - "type": "uint256", - "name": "preCLValidators", - "indexed": false - }, - { - "type": "uint256", - "name": "postCLValidators", - "indexed": false - } - ] - }, - { - "type": "event", - "anonymous": false, - "name": "DepositedValidatorsChanged", - "inputs": [ - { - "type": "uint256", - "name": "depositedValidators", - "indexed": false - } - ] - }, - { - "type": "event", - "anonymous": false, - "name": "ETHDistributed", - "inputs": [ - { - "type": "uint256", - "name": "reportTimestamp", - "indexed": true - }, - { - "type": "uint256", - "name": "preCLBalance", - "indexed": false - }, - { - "type": "uint256", - "name": "postCLBalance", - "indexed": false - }, - { - "type": "uint256", - "name": "withdrawalsWithdrawn", - "indexed": false - }, - { - "type": "uint256", - "name": "executionLayerRewardsWithdrawn", - "indexed": false - }, - { - "type": "uint256", - "name": "postBufferedEther", - "indexed": false - } - ] - }, - { - "type": "event", - "anonymous": false, - "name": "TokenRebased", - "inputs": [ - { - "type": "uint256", - "name": "reportTimestamp", - "indexed": true - }, - { - "type": "uint256", - "name": "timeElapsed", - "indexed": false - }, - { - "type": "uint256", - "name": "preTotalShares", - "indexed": false - }, - { - "type": "uint256", - "name": "preTotalEther", - "indexed": false - }, - { - "type": "uint256", - "name": "postTotalShares", - "indexed": false - }, - { - "type": "uint256", - "name": "postTotalEther", - "indexed": false - }, - { - "type": "uint256", - "name": "sharesMintedAsFees", - "indexed": false - } - ] - }, - { - "type": "event", - "anonymous": false, - "name": "LidoLocatorSet", - "inputs": [ - { - "type": "address", - "name": "lidoLocator", - "indexed": false - } - ] - }, - { - "type": "event", - "anonymous": false, - "name": "ELRewardsReceived", - "inputs": [ - { - "type": "uint256", - "name": "amount", - "indexed": false - } - ] - }, - { - "type": "event", - "anonymous": false, - "name": "WithdrawalsReceived", - "inputs": [ - { - "type": "uint256", - "name": "amount", - "indexed": false - } - ] - }, - { - "type": "event", - "anonymous": false, - "name": "Submitted", - "inputs": [ - { - "type": "address", - "name": "sender", - "indexed": true - }, - { - "type": "uint256", - "name": "amount", - "indexed": false - }, - { - "type": "address", - "name": "referral", - "indexed": false - } - ] - }, - { - "type": "event", - "anonymous": false, - "name": "Unbuffered", - "inputs": [ - { - "type": "uint256", - "name": "amount", - "indexed": false - } - ] - }, - { - "type": "event", - "anonymous": false, - "name": "ScriptResult", - "inputs": [ - { - "type": "address", - "name": "executor", - "indexed": true - }, - { - "type": "bytes", - "name": "script", - "indexed": false - }, - { - "type": "bytes", - "name": "input", - "indexed": false - }, - { - "type": "bytes", - "name": "returnData", - "indexed": false - } - ] - }, - { - "type": "event", - "anonymous": false, - "name": "RecoverToVault", - "inputs": [ - { - "type": "address", - "name": "vault", - "indexed": true - }, - { - "type": "address", - "name": "token", - "indexed": true - }, - { - "type": "uint256", - "name": "amount", - "indexed": false - } - ] - }, - { - "type": "event", - "anonymous": false, - "name": "EIP712StETHInitialized", - "inputs": [ - { - "type": "address", - "name": "eip712StETH", - "indexed": false - } - ] - }, - { - "type": "event", - "anonymous": false, - "name": "TransferShares", - "inputs": [ - { - "type": "address", - "name": "from", - "indexed": true - }, - { - "type": "address", - "name": "to", - "indexed": true - }, - { - "type": "uint256", - "name": "sharesValue", - "indexed": false - } - ] - }, - { - "type": "event", - "anonymous": false, - "name": "SharesBurnt", - "inputs": [ - { - "type": "address", - "name": "account", - "indexed": true - }, - { - "type": "uint256", - "name": "preRebaseTokenAmount", - "indexed": false - }, - { - "type": "uint256", - "name": "postRebaseTokenAmount", - "indexed": false - }, - { - "type": "uint256", - "name": "sharesAmount", - "indexed": false - } - ] - }, - { - "type": "event", - "anonymous": false, - "name": "Stopped", - "inputs": [] - }, - { - "type": "event", - "anonymous": false, - "name": "Resumed", - "inputs": [] - }, - { - "type": "event", - "anonymous": false, - "name": "Transfer", - "inputs": [ - { - "type": "address", - "name": "from", - "indexed": true - }, - { - "type": "address", - "name": "to", - "indexed": true - }, - { - "type": "uint256", - "name": "value", - "indexed": false - } - ] - }, - { - "type": "event", - "anonymous": false, - "name": "Approval", - "inputs": [ - { - "type": "address", - "name": "owner", - "indexed": true - }, - { - "type": "address", - "name": "spender", - "indexed": true - }, - { - "type": "uint256", - "name": "value", - "indexed": false - } - ] - }, - { - "type": "event", - "anonymous": false, - "name": "ContractVersionSet", - "inputs": [ - { - "type": "uint256", - "name": "version", - "indexed": false - } - ] - } -] as const diff --git a/src/abi/maverick-v2-factory.ts b/src/abi/maverick-v2-factory.ts deleted file mode 100644 index 544c7485..00000000 --- a/src/abi/maverick-v2-factory.ts +++ /dev/null @@ -1,13 +0,0 @@ -import * as p from '@subsquid/evm-codec' -import { event, fun, viewFun, indexed, ContractBase } from '@subsquid/evm-abi' -import type { EventParams as EParams, FunctionArguments, FunctionReturn } from '@subsquid/evm-abi' - -export const events = { - PoolCreated: event("0x848331e408557f4b7eb6561ca1c18a3ac43004fbe64b8b5bce613855cfdf22d2", "PoolCreated(address,uint8,uint256,uint256,uint256,uint256,int32,address,address,uint8,address)", {"poolAddress": p.address, "protocolFeeRatio": p.uint8, "feeAIn": p.uint256, "feeBIn": p.uint256, "tickSpacing": p.uint256, "lookback": p.uint256, "activeTick": p.int32, "tokenA": p.address, "tokenB": p.address, "kinds": p.uint8, "accessor": p.address}), -} - -export class Contract extends ContractBase { -} - -/// Event types -export type PoolCreatedEventArgs = EParams diff --git a/src/abi/maverick-v2-factory/contract.ts b/src/abi/maverick-v2-factory/contract.ts new file mode 100644 index 00000000..f07fbdea --- /dev/null +++ b/src/abi/maverick-v2-factory/contract.ts @@ -0,0 +1,4 @@ +import { ContractBase } from '../abi.support.js' + +export class Contract extends ContractBase { +} diff --git a/src/abi/maverick-v2-factory/events.ts b/src/abi/maverick-v2-factory/events.ts new file mode 100644 index 00000000..15715fd0 --- /dev/null +++ b/src/abi/maverick-v2-factory/events.ts @@ -0,0 +1,19 @@ +import { address, int32, uint256, uint8 } from '@subsquid/evm-codec' +import { event } from '../abi.support.js' +import type { EventParams as EParams } from '../abi.support.js' + +/** PoolCreated(address,uint8,uint256,uint256,uint256,uint256,int32,address,address,uint8,address) */ +export const PoolCreated = event('0x848331e408557f4b7eb6561ca1c18a3ac43004fbe64b8b5bce613855cfdf22d2', { + poolAddress: address, + protocolFeeRatio: uint8, + feeAIn: uint256, + feeBIn: uint256, + tickSpacing: uint256, + lookback: uint256, + activeTick: int32, + tokenA: address, + tokenB: address, + kinds: uint8, + accessor: address, +}) +export type PoolCreatedEventArgs = EParams diff --git a/src/abi/maverick-v2-factory/index.ts b/src/abi/maverick-v2-factory/index.ts new file mode 100644 index 00000000..b629f9cd --- /dev/null +++ b/src/abi/maverick-v2-factory/index.ts @@ -0,0 +1,3 @@ +export * as events from './events.js' + +export { Contract } from './contract.js' diff --git a/src/abi/meta-morpho.ts b/src/abi/meta-morpho.ts deleted file mode 100644 index 93d59e98..00000000 --- a/src/abi/meta-morpho.ts +++ /dev/null @@ -1,532 +0,0 @@ -import * as p from '@subsquid/evm-codec' -import { event, fun, viewFun, indexed, ContractBase } from '@subsquid/evm-abi' -import type { EventParams as EParams, FunctionArguments, FunctionReturn } from '@subsquid/evm-abi' - -export const events = { - AccrueInterest: event("0xf66f28b40975dbb933913542c7e6a0f50a1d0f20aa74ea6e0efe65ab616323ec", "AccrueInterest(uint256,uint256)", {"newTotalAssets": p.uint256, "feeShares": p.uint256}), - Approval: event("0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925", "Approval(address,address,uint256)", {"owner": indexed(p.address), "spender": indexed(p.address), "value": p.uint256}), - Deposit: event("0xdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d7", "Deposit(address,address,uint256,uint256)", {"sender": indexed(p.address), "owner": indexed(p.address), "assets": p.uint256, "shares": p.uint256}), - EIP712DomainChanged: event("0x0a6387c9ea3628b88a633bb4f3b151770f70085117a15f9bf3787cda53f13d31", "EIP712DomainChanged()", {}), - OwnershipTransferStarted: event("0x38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e22700", "OwnershipTransferStarted(address,address)", {"previousOwner": indexed(p.address), "newOwner": indexed(p.address)}), - OwnershipTransferred: event("0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", "OwnershipTransferred(address,address)", {"previousOwner": indexed(p.address), "newOwner": indexed(p.address)}), - ReallocateSupply: event("0x89bf199df65bf65155e3e0a8abc4ad4a1be606220c8295840dba2ab5656c1f6d", "ReallocateSupply(address,bytes32,uint256,uint256)", {"caller": indexed(p.address), "id": indexed(p.bytes32), "suppliedAssets": p.uint256, "suppliedShares": p.uint256}), - ReallocateWithdraw: event("0xdd8bf5226dff861316e0fa7863fdb7dc7b87c614eb29a135f524eb79d5a1189a", "ReallocateWithdraw(address,bytes32,uint256,uint256)", {"caller": indexed(p.address), "id": indexed(p.bytes32), "withdrawnAssets": p.uint256, "withdrawnShares": p.uint256}), - RevokePendingCap: event("0x1026ceca5ed3747eb5edec555732d4a6f901ce1a875ecf981064628cadde1120", "RevokePendingCap(address,bytes32)", {"caller": indexed(p.address), "id": indexed(p.bytes32)}), - RevokePendingGuardian: event("0xc40a085ccfa20f5fd518ade5c3a77a7ecbdfbb4c75efcdca6146a8e3c841d663", "RevokePendingGuardian(address)", {"caller": indexed(p.address)}), - RevokePendingMarketRemoval: event("0xcbeb8ecdaa5a3c133e62219b63bfc35bce3fda13065d2bed32e3b7dde60a59f4", "RevokePendingMarketRemoval(address,bytes32)", {"caller": indexed(p.address), "id": indexed(p.bytes32)}), - RevokePendingTimelock: event("0x921828337692c347c634c5d2aacbc7b756014674bd236f3cc2058d8e284a951b", "RevokePendingTimelock(address)", {"caller": indexed(p.address)}), - SetCap: event("0xe86b6d3313d3098f4c5f689c935de8fde876a597c185def2cedab85efedac686", "SetCap(address,bytes32,uint256)", {"caller": indexed(p.address), "id": indexed(p.bytes32), "cap": p.uint256}), - SetCurator: event("0xbd0a63c12948fbc9194a5839019f99c9d71db924e5c70018265bc778b8f1a506", "SetCurator(address)", {"newCurator": indexed(p.address)}), - SetFee: event("0x01fe2943baee27f47add82886c2200f910c749c461c9b63c5fe83901a53bdb49", "SetFee(address,uint256)", {"caller": indexed(p.address), "newFee": p.uint256}), - SetFeeRecipient: event("0x2e979f80fe4d43055c584cf4a8467c55875ea36728fc37176c05acd784eb7a73", "SetFeeRecipient(address)", {"newFeeRecipient": indexed(p.address)}), - SetGuardian: event("0xcb11cc8aade2f5a556749d1b2380d108a16fac3431e6a5d5ce12ef9de0bd76e3", "SetGuardian(address,address)", {"caller": indexed(p.address), "guardian": indexed(p.address)}), - SetIsAllocator: event("0x74dc60cbc81a9472d04ad1d20e151d369c41104d655ed3f2f3091166a502cd8d", "SetIsAllocator(address,bool)", {"allocator": indexed(p.address), "isAllocator": p.bool}), - SetSkimRecipient: event("0x2e7908865670e21b9779422cadf5f1cba271a62bb95c71eaaf615c0a1c48ebee", "SetSkimRecipient(address)", {"newSkimRecipient": indexed(p.address)}), - SetSupplyQueue: event("0x6ce31538fc7fba95714ddc8a275a09252b4b1fb8f33d2550aa58a5f62ad934de", "SetSupplyQueue(address,bytes32[])", {"caller": indexed(p.address), "newSupplyQueue": p.array(p.bytes32)}), - SetTimelock: event("0xd28e9b90ee9b37c5936ff84392d71f29ff18117d7e76bcee60615262a90a3f75", "SetTimelock(address,uint256)", {"caller": indexed(p.address), "newTimelock": p.uint256}), - SetWithdrawQueue: event("0xe0c2db6b54586be6d7d49943139fccf0dd315ba63e55364a76c73cd8fdba724d", "SetWithdrawQueue(address,bytes32[])", {"caller": indexed(p.address), "newWithdrawQueue": p.array(p.bytes32)}), - Skim: event("0x2ae72b44f59d038340fca5739135a1d51fc5ab720bb02d983e4c5ff4119ca7b8", "Skim(address,address,uint256)", {"caller": indexed(p.address), "token": indexed(p.address), "amount": p.uint256}), - SubmitCap: event("0xe851bb5856808a50efd748be463b8f35bcfb5ec74c5bfde776fe0a4d2a26db27", "SubmitCap(address,bytes32,uint256)", {"caller": indexed(p.address), "id": indexed(p.bytes32), "cap": p.uint256}), - SubmitGuardian: event("0x7633313af54753bce8a149927263b1a55eba857ba4ef1d13c6aee25d384d3c4b", "SubmitGuardian(address)", {"newGuardian": indexed(p.address)}), - SubmitMarketRemoval: event("0x3240fc70754c5a2b4dab10bf7081a00024bfc8491581ee3d355360ec0dd91f16", "SubmitMarketRemoval(address,bytes32)", {"caller": indexed(p.address), "id": indexed(p.bytes32)}), - SubmitTimelock: event("0xb3aa0ade2442acf51d06713c2d1a5a3ec0373cce969d42b53f4689f97bccf380", "SubmitTimelock(uint256)", {"newTimelock": p.uint256}), - Transfer: event("0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", "Transfer(address,address,uint256)", {"from": indexed(p.address), "to": indexed(p.address), "value": p.uint256}), - UpdateLastTotalAssets: event("0x15c027cc4fd826d986cad358803439f7326d3aa4ed969ff90dbee4bc150f68e9", "UpdateLastTotalAssets(uint256)", {"updatedTotalAssets": p.uint256}), - Withdraw: event("0xfbde797d201c681b91056529119e0b02407c7bb96a4a2c75c01fc9667232c8db", "Withdraw(address,address,address,uint256,uint256)", {"sender": indexed(p.address), "receiver": indexed(p.address), "owner": indexed(p.address), "assets": p.uint256, "shares": p.uint256}), -} - -export const functions = { - DECIMALS_OFFSET: viewFun("0xaea70acc", "DECIMALS_OFFSET()", {}, p.uint8), - DOMAIN_SEPARATOR: viewFun("0x3644e515", "DOMAIN_SEPARATOR()", {}, p.bytes32), - MORPHO: viewFun("0x3acb5624", "MORPHO()", {}, p.address), - acceptCap: fun("0x6fda3868", "acceptCap((address,address,address,address,uint256))", {"marketParams": p.struct({"loanToken": p.address, "collateralToken": p.address, "oracle": p.address, "irm": p.address, "lltv": p.uint256})}, ), - acceptGuardian: fun("0xa5f31d61", "acceptGuardian()", {}, ), - acceptOwnership: fun("0x79ba5097", "acceptOwnership()", {}, ), - acceptTimelock: fun("0x8a2c7b39", "acceptTimelock()", {}, ), - allowance: viewFun("0xdd62ed3e", "allowance(address,address)", {"owner": p.address, "spender": p.address}, p.uint256), - approve: fun("0x095ea7b3", "approve(address,uint256)", {"spender": p.address, "value": p.uint256}, p.bool), - asset: viewFun("0x38d52e0f", "asset()", {}, p.address), - balanceOf: viewFun("0x70a08231", "balanceOf(address)", {"account": p.address}, p.uint256), - config: viewFun("0xcc718f76", "config(bytes32)", {"_0": p.bytes32}, {"cap": p.uint184, "enabled": p.bool, "removableAt": p.uint64}), - convertToAssets: viewFun("0x07a2d13a", "convertToAssets(uint256)", {"shares": p.uint256}, p.uint256), - convertToShares: viewFun("0xc6e6f592", "convertToShares(uint256)", {"assets": p.uint256}, p.uint256), - curator: viewFun("0xe66f53b7", "curator()", {}, p.address), - decimals: viewFun("0x313ce567", "decimals()", {}, p.uint8), - deposit: fun("0x6e553f65", "deposit(uint256,address)", {"assets": p.uint256, "receiver": p.address}, p.uint256), - eip712Domain: viewFun("0x84b0196e", "eip712Domain()", {}, {"fields": p.bytes1, "name": p.string, "version": p.string, "chainId": p.uint256, "verifyingContract": p.address, "salt": p.bytes32, "extensions": p.array(p.uint256)}), - fee: viewFun("0xddca3f43", "fee()", {}, p.uint96), - feeRecipient: viewFun("0x46904840", "feeRecipient()", {}, p.address), - guardian: viewFun("0x452a9320", "guardian()", {}, p.address), - isAllocator: viewFun("0x4dedf20e", "isAllocator(address)", {"_0": p.address}, p.bool), - lastTotalAssets: viewFun("0x568efc07", "lastTotalAssets()", {}, p.uint256), - maxDeposit: viewFun("0x402d267d", "maxDeposit(address)", {"_0": p.address}, p.uint256), - maxMint: viewFun("0xc63d75b6", "maxMint(address)", {"_0": p.address}, p.uint256), - maxRedeem: viewFun("0xd905777e", "maxRedeem(address)", {"owner": p.address}, p.uint256), - maxWithdraw: viewFun("0xce96cb77", "maxWithdraw(address)", {"owner": p.address}, p.uint256), - mint: fun("0x94bf804d", "mint(uint256,address)", {"shares": p.uint256, "receiver": p.address}, p.uint256), - multicall: fun("0xac9650d8", "multicall(bytes[])", {"data": p.array(p.bytes)}, p.array(p.bytes)), - name: viewFun("0x06fdde03", "name()", {}, p.string), - nonces: viewFun("0x7ecebe00", "nonces(address)", {"owner": p.address}, p.uint256), - owner: viewFun("0x8da5cb5b", "owner()", {}, p.address), - pendingCap: viewFun("0xa31be5d6", "pendingCap(bytes32)", {"_0": p.bytes32}, {"value": p.uint192, "validAt": p.uint64}), - pendingGuardian: viewFun("0x762c31ba", "pendingGuardian()", {}, {"value": p.address, "validAt": p.uint64}), - pendingOwner: viewFun("0xe30c3978", "pendingOwner()", {}, p.address), - pendingTimelock: viewFun("0x7cc4d9a1", "pendingTimelock()", {}, {"value": p.uint192, "validAt": p.uint64}), - permit: fun("0xd505accf", "permit(address,address,uint256,uint256,uint8,bytes32,bytes32)", {"owner": p.address, "spender": p.address, "value": p.uint256, "deadline": p.uint256, "v": p.uint8, "r": p.bytes32, "s": p.bytes32}, ), - previewDeposit: viewFun("0xef8b30f7", "previewDeposit(uint256)", {"assets": p.uint256}, p.uint256), - previewMint: viewFun("0xb3d7f6b9", "previewMint(uint256)", {"shares": p.uint256}, p.uint256), - previewRedeem: viewFun("0x4cdad506", "previewRedeem(uint256)", {"shares": p.uint256}, p.uint256), - previewWithdraw: viewFun("0x0a28a477", "previewWithdraw(uint256)", {"assets": p.uint256}, p.uint256), - reallocate: fun("0x7299aa31", "reallocate(((address,address,address,address,uint256),uint256)[])", {"allocations": p.array(p.struct({"marketParams": p.struct({"loanToken": p.address, "collateralToken": p.address, "oracle": p.address, "irm": p.address, "lltv": p.uint256}), "assets": p.uint256}))}, ), - redeem: fun("0xba087652", "redeem(uint256,address,address)", {"shares": p.uint256, "receiver": p.address, "owner": p.address}, p.uint256), - renounceOwnership: fun("0x715018a6", "renounceOwnership()", {}, ), - revokePendingCap: fun("0x102f7b6c", "revokePendingCap(bytes32)", {"id": p.bytes32}, ), - revokePendingGuardian: fun("0x1ecca77c", "revokePendingGuardian()", {}, ), - revokePendingMarketRemoval: fun("0x4b998de5", "revokePendingMarketRemoval(bytes32)", {"id": p.bytes32}, ), - revokePendingTimelock: fun("0xc9649aa9", "revokePendingTimelock()", {}, ), - setCurator: fun("0xe90956cf", "setCurator(address)", {"newCurator": p.address}, ), - setFee: fun("0x69fe0e2d", "setFee(uint256)", {"newFee": p.uint256}, ), - setFeeRecipient: fun("0xe74b981b", "setFeeRecipient(address)", {"newFeeRecipient": p.address}, ), - setIsAllocator: fun("0xb192a84a", "setIsAllocator(address,bool)", {"newAllocator": p.address, "newIsAllocator": p.bool}, ), - setSkimRecipient: fun("0x2b30997b", "setSkimRecipient(address)", {"newSkimRecipient": p.address}, ), - setSupplyQueue: fun("0x2acc56f9", "setSupplyQueue(bytes32[])", {"newSupplyQueue": p.array(p.bytes32)}, ), - skim: fun("0xbc25cf77", "skim(address)", {"token": p.address}, ), - skimRecipient: viewFun("0x388af5b5", "skimRecipient()", {}, p.address), - submitCap: fun("0x3b24c2bf", "submitCap((address,address,address,address,uint256),uint256)", {"marketParams": p.struct({"loanToken": p.address, "collateralToken": p.address, "oracle": p.address, "irm": p.address, "lltv": p.uint256}), "newSupplyCap": p.uint256}, ), - submitGuardian: fun("0x9d6b4a45", "submitGuardian(address)", {"newGuardian": p.address}, ), - submitMarketRemoval: fun("0x84755b5f", "submitMarketRemoval((address,address,address,address,uint256))", {"marketParams": p.struct({"loanToken": p.address, "collateralToken": p.address, "oracle": p.address, "irm": p.address, "lltv": p.uint256})}, ), - submitTimelock: fun("0x7224a512", "submitTimelock(uint256)", {"newTimelock": p.uint256}, ), - supplyQueue: viewFun("0xf7d18521", "supplyQueue(uint256)", {"_0": p.uint256}, p.bytes32), - supplyQueueLength: viewFun("0xa17b3130", "supplyQueueLength()", {}, p.uint256), - symbol: viewFun("0x95d89b41", "symbol()", {}, p.string), - timelock: viewFun("0xd33219b4", "timelock()", {}, p.uint256), - totalAssets: viewFun("0x01e1d114", "totalAssets()", {}, p.uint256), - totalSupply: viewFun("0x18160ddd", "totalSupply()", {}, p.uint256), - transfer: fun("0xa9059cbb", "transfer(address,uint256)", {"to": p.address, "value": p.uint256}, p.bool), - transferFrom: fun("0x23b872dd", "transferFrom(address,address,uint256)", {"from": p.address, "to": p.address, "value": p.uint256}, p.bool), - transferOwnership: fun("0xf2fde38b", "transferOwnership(address)", {"newOwner": p.address}, ), - updateWithdrawQueue: fun("0x41b67833", "updateWithdrawQueue(uint256[])", {"indexes": p.array(p.uint256)}, ), - withdraw: fun("0xb460af94", "withdraw(uint256,address,address)", {"assets": p.uint256, "receiver": p.address, "owner": p.address}, p.uint256), - withdrawQueue: viewFun("0x62518ddf", "withdrawQueue(uint256)", {"_0": p.uint256}, p.bytes32), - withdrawQueueLength: viewFun("0x33f91ebb", "withdrawQueueLength()", {}, p.uint256), -} - -export class Contract extends ContractBase { - - DECIMALS_OFFSET() { - return this.eth_call(functions.DECIMALS_OFFSET, {}) - } - - DOMAIN_SEPARATOR() { - return this.eth_call(functions.DOMAIN_SEPARATOR, {}) - } - - MORPHO() { - return this.eth_call(functions.MORPHO, {}) - } - - allowance(owner: AllowanceParams["owner"], spender: AllowanceParams["spender"]) { - return this.eth_call(functions.allowance, {owner, spender}) - } - - asset() { - return this.eth_call(functions.asset, {}) - } - - balanceOf(account: BalanceOfParams["account"]) { - return this.eth_call(functions.balanceOf, {account}) - } - - config(_0: ConfigParams["_0"]) { - return this.eth_call(functions.config, {_0}) - } - - convertToAssets(shares: ConvertToAssetsParams["shares"]) { - return this.eth_call(functions.convertToAssets, {shares}) - } - - convertToShares(assets: ConvertToSharesParams["assets"]) { - return this.eth_call(functions.convertToShares, {assets}) - } - - curator() { - return this.eth_call(functions.curator, {}) - } - - decimals() { - return this.eth_call(functions.decimals, {}) - } - - eip712Domain() { - return this.eth_call(functions.eip712Domain, {}) - } - - fee() { - return this.eth_call(functions.fee, {}) - } - - feeRecipient() { - return this.eth_call(functions.feeRecipient, {}) - } - - guardian() { - return this.eth_call(functions.guardian, {}) - } - - isAllocator(_0: IsAllocatorParams["_0"]) { - return this.eth_call(functions.isAllocator, {_0}) - } - - lastTotalAssets() { - return this.eth_call(functions.lastTotalAssets, {}) - } - - maxDeposit(_0: MaxDepositParams["_0"]) { - return this.eth_call(functions.maxDeposit, {_0}) - } - - maxMint(_0: MaxMintParams["_0"]) { - return this.eth_call(functions.maxMint, {_0}) - } - - maxRedeem(owner: MaxRedeemParams["owner"]) { - return this.eth_call(functions.maxRedeem, {owner}) - } - - maxWithdraw(owner: MaxWithdrawParams["owner"]) { - return this.eth_call(functions.maxWithdraw, {owner}) - } - - name() { - return this.eth_call(functions.name, {}) - } - - nonces(owner: NoncesParams["owner"]) { - return this.eth_call(functions.nonces, {owner}) - } - - owner() { - return this.eth_call(functions.owner, {}) - } - - pendingCap(_0: PendingCapParams["_0"]) { - return this.eth_call(functions.pendingCap, {_0}) - } - - pendingGuardian() { - return this.eth_call(functions.pendingGuardian, {}) - } - - pendingOwner() { - return this.eth_call(functions.pendingOwner, {}) - } - - pendingTimelock() { - return this.eth_call(functions.pendingTimelock, {}) - } - - previewDeposit(assets: PreviewDepositParams["assets"]) { - return this.eth_call(functions.previewDeposit, {assets}) - } - - previewMint(shares: PreviewMintParams["shares"]) { - return this.eth_call(functions.previewMint, {shares}) - } - - previewRedeem(shares: PreviewRedeemParams["shares"]) { - return this.eth_call(functions.previewRedeem, {shares}) - } - - previewWithdraw(assets: PreviewWithdrawParams["assets"]) { - return this.eth_call(functions.previewWithdraw, {assets}) - } - - skimRecipient() { - return this.eth_call(functions.skimRecipient, {}) - } - - supplyQueue(_0: SupplyQueueParams["_0"]) { - return this.eth_call(functions.supplyQueue, {_0}) - } - - supplyQueueLength() { - return this.eth_call(functions.supplyQueueLength, {}) - } - - symbol() { - return this.eth_call(functions.symbol, {}) - } - - timelock() { - return this.eth_call(functions.timelock, {}) - } - - totalAssets() { - return this.eth_call(functions.totalAssets, {}) - } - - totalSupply() { - return this.eth_call(functions.totalSupply, {}) - } - - withdrawQueue(_0: WithdrawQueueParams["_0"]) { - return this.eth_call(functions.withdrawQueue, {_0}) - } - - withdrawQueueLength() { - return this.eth_call(functions.withdrawQueueLength, {}) - } -} - -/// Event types -export type AccrueInterestEventArgs = EParams -export type ApprovalEventArgs = EParams -export type DepositEventArgs = EParams -export type EIP712DomainChangedEventArgs = EParams -export type OwnershipTransferStartedEventArgs = EParams -export type OwnershipTransferredEventArgs = EParams -export type ReallocateSupplyEventArgs = EParams -export type ReallocateWithdrawEventArgs = EParams -export type RevokePendingCapEventArgs = EParams -export type RevokePendingGuardianEventArgs = EParams -export type RevokePendingMarketRemovalEventArgs = EParams -export type RevokePendingTimelockEventArgs = EParams -export type SetCapEventArgs = EParams -export type SetCuratorEventArgs = EParams -export type SetFeeEventArgs = EParams -export type SetFeeRecipientEventArgs = EParams -export type SetGuardianEventArgs = EParams -export type SetIsAllocatorEventArgs = EParams -export type SetSkimRecipientEventArgs = EParams -export type SetSupplyQueueEventArgs = EParams -export type SetTimelockEventArgs = EParams -export type SetWithdrawQueueEventArgs = EParams -export type SkimEventArgs = EParams -export type SubmitCapEventArgs = EParams -export type SubmitGuardianEventArgs = EParams -export type SubmitMarketRemovalEventArgs = EParams -export type SubmitTimelockEventArgs = EParams -export type TransferEventArgs = EParams -export type UpdateLastTotalAssetsEventArgs = EParams -export type WithdrawEventArgs = EParams - -/// Function types -export type DECIMALS_OFFSETParams = FunctionArguments -export type DECIMALS_OFFSETReturn = FunctionReturn - -export type DOMAIN_SEPARATORParams = FunctionArguments -export type DOMAIN_SEPARATORReturn = FunctionReturn - -export type MORPHOParams = FunctionArguments -export type MORPHOReturn = FunctionReturn - -export type AcceptCapParams = FunctionArguments -export type AcceptCapReturn = FunctionReturn - -export type AcceptGuardianParams = FunctionArguments -export type AcceptGuardianReturn = FunctionReturn - -export type AcceptOwnershipParams = FunctionArguments -export type AcceptOwnershipReturn = FunctionReturn - -export type AcceptTimelockParams = FunctionArguments -export type AcceptTimelockReturn = FunctionReturn - -export type AllowanceParams = FunctionArguments -export type AllowanceReturn = FunctionReturn - -export type ApproveParams = FunctionArguments -export type ApproveReturn = FunctionReturn - -export type AssetParams = FunctionArguments -export type AssetReturn = FunctionReturn - -export type BalanceOfParams = FunctionArguments -export type BalanceOfReturn = FunctionReturn - -export type ConfigParams = FunctionArguments -export type ConfigReturn = FunctionReturn - -export type ConvertToAssetsParams = FunctionArguments -export type ConvertToAssetsReturn = FunctionReturn - -export type ConvertToSharesParams = FunctionArguments -export type ConvertToSharesReturn = FunctionReturn - -export type CuratorParams = FunctionArguments -export type CuratorReturn = FunctionReturn - -export type DecimalsParams = FunctionArguments -export type DecimalsReturn = FunctionReturn - -export type DepositParams = FunctionArguments -export type DepositReturn = FunctionReturn - -export type Eip712DomainParams = FunctionArguments -export type Eip712DomainReturn = FunctionReturn - -export type FeeParams = FunctionArguments -export type FeeReturn = FunctionReturn - -export type FeeRecipientParams = FunctionArguments -export type FeeRecipientReturn = FunctionReturn - -export type GuardianParams = FunctionArguments -export type GuardianReturn = FunctionReturn - -export type IsAllocatorParams = FunctionArguments -export type IsAllocatorReturn = FunctionReturn - -export type LastTotalAssetsParams = FunctionArguments -export type LastTotalAssetsReturn = FunctionReturn - -export type MaxDepositParams = FunctionArguments -export type MaxDepositReturn = FunctionReturn - -export type MaxMintParams = FunctionArguments -export type MaxMintReturn = FunctionReturn - -export type MaxRedeemParams = FunctionArguments -export type MaxRedeemReturn = FunctionReturn - -export type MaxWithdrawParams = FunctionArguments -export type MaxWithdrawReturn = FunctionReturn - -export type MintParams = FunctionArguments -export type MintReturn = FunctionReturn - -export type MulticallParams = FunctionArguments -export type MulticallReturn = FunctionReturn - -export type NameParams = FunctionArguments -export type NameReturn = FunctionReturn - -export type NoncesParams = FunctionArguments -export type NoncesReturn = FunctionReturn - -export type OwnerParams = FunctionArguments -export type OwnerReturn = FunctionReturn - -export type PendingCapParams = FunctionArguments -export type PendingCapReturn = FunctionReturn - -export type PendingGuardianParams = FunctionArguments -export type PendingGuardianReturn = FunctionReturn - -export type PendingOwnerParams = FunctionArguments -export type PendingOwnerReturn = FunctionReturn - -export type PendingTimelockParams = FunctionArguments -export type PendingTimelockReturn = FunctionReturn - -export type PermitParams = FunctionArguments -export type PermitReturn = FunctionReturn - -export type PreviewDepositParams = FunctionArguments -export type PreviewDepositReturn = FunctionReturn - -export type PreviewMintParams = FunctionArguments -export type PreviewMintReturn = FunctionReturn - -export type PreviewRedeemParams = FunctionArguments -export type PreviewRedeemReturn = FunctionReturn - -export type PreviewWithdrawParams = FunctionArguments -export type PreviewWithdrawReturn = FunctionReturn - -export type ReallocateParams = FunctionArguments -export type ReallocateReturn = FunctionReturn - -export type RedeemParams = FunctionArguments -export type RedeemReturn = FunctionReturn - -export type RenounceOwnershipParams = FunctionArguments -export type RenounceOwnershipReturn = FunctionReturn - -export type RevokePendingCapParams = FunctionArguments -export type RevokePendingCapReturn = FunctionReturn - -export type RevokePendingGuardianParams = FunctionArguments -export type RevokePendingGuardianReturn = FunctionReturn - -export type RevokePendingMarketRemovalParams = FunctionArguments -export type RevokePendingMarketRemovalReturn = FunctionReturn - -export type RevokePendingTimelockParams = FunctionArguments -export type RevokePendingTimelockReturn = FunctionReturn - -export type SetCuratorParams = FunctionArguments -export type SetCuratorReturn = FunctionReturn - -export type SetFeeParams = FunctionArguments -export type SetFeeReturn = FunctionReturn - -export type SetFeeRecipientParams = FunctionArguments -export type SetFeeRecipientReturn = FunctionReturn - -export type SetIsAllocatorParams = FunctionArguments -export type SetIsAllocatorReturn = FunctionReturn - -export type SetSkimRecipientParams = FunctionArguments -export type SetSkimRecipientReturn = FunctionReturn - -export type SetSupplyQueueParams = FunctionArguments -export type SetSupplyQueueReturn = FunctionReturn - -export type SkimParams = FunctionArguments -export type SkimReturn = FunctionReturn - -export type SkimRecipientParams = FunctionArguments -export type SkimRecipientReturn = FunctionReturn - -export type SubmitCapParams = FunctionArguments -export type SubmitCapReturn = FunctionReturn - -export type SubmitGuardianParams = FunctionArguments -export type SubmitGuardianReturn = FunctionReturn - -export type SubmitMarketRemovalParams = FunctionArguments -export type SubmitMarketRemovalReturn = FunctionReturn - -export type SubmitTimelockParams = FunctionArguments -export type SubmitTimelockReturn = FunctionReturn - -export type SupplyQueueParams = FunctionArguments -export type SupplyQueueReturn = FunctionReturn - -export type SupplyQueueLengthParams = FunctionArguments -export type SupplyQueueLengthReturn = FunctionReturn - -export type SymbolParams = FunctionArguments -export type SymbolReturn = FunctionReturn - -export type TimelockParams = FunctionArguments -export type TimelockReturn = FunctionReturn - -export type TotalAssetsParams = FunctionArguments -export type TotalAssetsReturn = FunctionReturn - -export type TotalSupplyParams = FunctionArguments -export type TotalSupplyReturn = FunctionReturn - -export type TransferParams = FunctionArguments -export type TransferReturn = FunctionReturn - -export type TransferFromParams = FunctionArguments -export type TransferFromReturn = FunctionReturn - -export type TransferOwnershipParams = FunctionArguments -export type TransferOwnershipReturn = FunctionReturn - -export type UpdateWithdrawQueueParams = FunctionArguments -export type UpdateWithdrawQueueReturn = FunctionReturn - -export type WithdrawParams = FunctionArguments -export type WithdrawReturn = FunctionReturn - -export type WithdrawQueueParams = FunctionArguments -export type WithdrawQueueReturn = FunctionReturn - -export type WithdrawQueueLengthParams = FunctionArguments -export type WithdrawQueueLengthReturn = FunctionReturn - diff --git a/src/abi/meta-morpho/contract.ts b/src/abi/meta-morpho/contract.ts new file mode 100644 index 00000000..74837a06 --- /dev/null +++ b/src/abi/meta-morpho/contract.ts @@ -0,0 +1,201 @@ +import { ContractBase } from '../abi.support.js' +import { DECIMALS_OFFSET, DOMAIN_SEPARATOR, MORPHO, allowance, approve, asset, balanceOf, config, convertToAssets, convertToShares, curator, decimals, deposit, eip712Domain, fee, feeRecipient, guardian, isAllocator, lastTotalAssets, maxDeposit, maxMint, maxRedeem, maxWithdraw, mint, multicall, name, nonces, owner, pendingCap, pendingGuardian, pendingOwner, pendingTimelock, previewDeposit, previewMint, previewRedeem, previewWithdraw, redeem, skimRecipient, supplyQueue, supplyQueueLength, symbol, timelock, totalAssets, totalSupply, transfer, transferFrom, withdraw, withdrawQueue, withdrawQueueLength } from './functions.js' +import type { AllowanceParams, ApproveParams, BalanceOfParams, ConfigParams, ConvertToAssetsParams, ConvertToSharesParams, DepositParams, IsAllocatorParams, MaxDepositParams, MaxMintParams, MaxRedeemParams, MaxWithdrawParams, MintParams, MulticallParams, NoncesParams, PendingCapParams, PreviewDepositParams, PreviewMintParams, PreviewRedeemParams, PreviewWithdrawParams, RedeemParams, SupplyQueueParams, TransferFromParams, TransferParams, WithdrawParams, WithdrawQueueParams } from './functions.js' + +export class Contract extends ContractBase { + DECIMALS_OFFSET() { + return this.eth_call(DECIMALS_OFFSET, {}) + } + + DOMAIN_SEPARATOR() { + return this.eth_call(DOMAIN_SEPARATOR, {}) + } + + MORPHO() { + return this.eth_call(MORPHO, {}) + } + + allowance(owner: AllowanceParams["owner"], spender: AllowanceParams["spender"]) { + return this.eth_call(allowance, {owner, spender}) + } + + approve(spender: ApproveParams["spender"], value: ApproveParams["value"]) { + return this.eth_call(approve, {spender, value}) + } + + asset() { + return this.eth_call(asset, {}) + } + + balanceOf(account: BalanceOfParams["account"]) { + return this.eth_call(balanceOf, {account}) + } + + config(_0: ConfigParams["_0"]) { + return this.eth_call(config, {_0}) + } + + convertToAssets(shares: ConvertToAssetsParams["shares"]) { + return this.eth_call(convertToAssets, {shares}) + } + + convertToShares(assets: ConvertToSharesParams["assets"]) { + return this.eth_call(convertToShares, {assets}) + } + + curator() { + return this.eth_call(curator, {}) + } + + decimals() { + return this.eth_call(decimals, {}) + } + + deposit(assets: DepositParams["assets"], receiver: DepositParams["receiver"]) { + return this.eth_call(deposit, {assets, receiver}) + } + + eip712Domain() { + return this.eth_call(eip712Domain, {}) + } + + fee() { + return this.eth_call(fee, {}) + } + + feeRecipient() { + return this.eth_call(feeRecipient, {}) + } + + guardian() { + return this.eth_call(guardian, {}) + } + + isAllocator(_0: IsAllocatorParams["_0"]) { + return this.eth_call(isAllocator, {_0}) + } + + lastTotalAssets() { + return this.eth_call(lastTotalAssets, {}) + } + + maxDeposit(_0: MaxDepositParams["_0"]) { + return this.eth_call(maxDeposit, {_0}) + } + + maxMint(_0: MaxMintParams["_0"]) { + return this.eth_call(maxMint, {_0}) + } + + maxRedeem(owner: MaxRedeemParams["owner"]) { + return this.eth_call(maxRedeem, {owner}) + } + + maxWithdraw(owner: MaxWithdrawParams["owner"]) { + return this.eth_call(maxWithdraw, {owner}) + } + + mint(shares: MintParams["shares"], receiver: MintParams["receiver"]) { + return this.eth_call(mint, {shares, receiver}) + } + + multicall(data: MulticallParams["data"]) { + return this.eth_call(multicall, {data}) + } + + name() { + return this.eth_call(name, {}) + } + + nonces(owner: NoncesParams["owner"]) { + return this.eth_call(nonces, {owner}) + } + + owner() { + return this.eth_call(owner, {}) + } + + pendingCap(_0: PendingCapParams["_0"]) { + return this.eth_call(pendingCap, {_0}) + } + + pendingGuardian() { + return this.eth_call(pendingGuardian, {}) + } + + pendingOwner() { + return this.eth_call(pendingOwner, {}) + } + + pendingTimelock() { + return this.eth_call(pendingTimelock, {}) + } + + previewDeposit(assets: PreviewDepositParams["assets"]) { + return this.eth_call(previewDeposit, {assets}) + } + + previewMint(shares: PreviewMintParams["shares"]) { + return this.eth_call(previewMint, {shares}) + } + + previewRedeem(shares: PreviewRedeemParams["shares"]) { + return this.eth_call(previewRedeem, {shares}) + } + + previewWithdraw(assets: PreviewWithdrawParams["assets"]) { + return this.eth_call(previewWithdraw, {assets}) + } + + redeem(shares: RedeemParams["shares"], receiver: RedeemParams["receiver"], owner: RedeemParams["owner"]) { + return this.eth_call(redeem, {shares, receiver, owner}) + } + + skimRecipient() { + return this.eth_call(skimRecipient, {}) + } + + supplyQueue(_0: SupplyQueueParams["_0"]) { + return this.eth_call(supplyQueue, {_0}) + } + + supplyQueueLength() { + return this.eth_call(supplyQueueLength, {}) + } + + symbol() { + return this.eth_call(symbol, {}) + } + + timelock() { + return this.eth_call(timelock, {}) + } + + totalAssets() { + return this.eth_call(totalAssets, {}) + } + + totalSupply() { + return this.eth_call(totalSupply, {}) + } + + transfer(to: TransferParams["to"], value: TransferParams["value"]) { + return this.eth_call(transfer, {to, value}) + } + + transferFrom(from: TransferFromParams["from"], to: TransferFromParams["to"], value: TransferFromParams["value"]) { + return this.eth_call(transferFrom, {from, to, value}) + } + + withdraw(assets: WithdrawParams["assets"], receiver: WithdrawParams["receiver"], owner: WithdrawParams["owner"]) { + return this.eth_call(withdraw, {assets, receiver, owner}) + } + + withdrawQueue(_0: WithdrawQueueParams["_0"]) { + return this.eth_call(withdrawQueue, {_0}) + } + + withdrawQueueLength() { + return this.eth_call(withdrawQueueLength, {}) + } +} diff --git a/src/abi/meta-morpho/events.ts b/src/abi/meta-morpho/events.ts new file mode 100644 index 00000000..71d2e0ff --- /dev/null +++ b/src/abi/meta-morpho/events.ts @@ -0,0 +1,216 @@ +import { address, array, bool, bytes32, uint256 } from '@subsquid/evm-codec' +import { event, indexed } from '../abi.support.js' +import type { EventParams as EParams } from '../abi.support.js' + +/** AccrueInterest(uint256,uint256) */ +export const AccrueInterest = event('0xf66f28b40975dbb933913542c7e6a0f50a1d0f20aa74ea6e0efe65ab616323ec', { + newTotalAssets: uint256, + feeShares: uint256, +}) +export type AccrueInterestEventArgs = EParams + +/** Approval(address,address,uint256) */ +export const Approval = event('0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925', { + owner: indexed(address), + spender: indexed(address), + value: uint256, +}) +export type ApprovalEventArgs = EParams + +/** Deposit(address,address,uint256,uint256) */ +export const Deposit = event('0xdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d7', { + sender: indexed(address), + owner: indexed(address), + assets: uint256, + shares: uint256, +}) +export type DepositEventArgs = EParams + +/** EIP712DomainChanged() */ +export const EIP712DomainChanged = event('0x0a6387c9ea3628b88a633bb4f3b151770f70085117a15f9bf3787cda53f13d31', {}) +export type EIP712DomainChangedEventArgs = EParams + +/** OwnershipTransferStarted(address,address) */ +export const OwnershipTransferStarted = event('0x38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e22700', { + previousOwner: indexed(address), + newOwner: indexed(address), +}) +export type OwnershipTransferStartedEventArgs = EParams + +/** OwnershipTransferred(address,address) */ +export const OwnershipTransferred = event('0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0', { + previousOwner: indexed(address), + newOwner: indexed(address), +}) +export type OwnershipTransferredEventArgs = EParams + +/** ReallocateSupply(address,bytes32,uint256,uint256) */ +export const ReallocateSupply = event('0x89bf199df65bf65155e3e0a8abc4ad4a1be606220c8295840dba2ab5656c1f6d', { + caller: indexed(address), + id: indexed(bytes32), + suppliedAssets: uint256, + suppliedShares: uint256, +}) +export type ReallocateSupplyEventArgs = EParams + +/** ReallocateWithdraw(address,bytes32,uint256,uint256) */ +export const ReallocateWithdraw = event('0xdd8bf5226dff861316e0fa7863fdb7dc7b87c614eb29a135f524eb79d5a1189a', { + caller: indexed(address), + id: indexed(bytes32), + withdrawnAssets: uint256, + withdrawnShares: uint256, +}) +export type ReallocateWithdrawEventArgs = EParams + +/** RevokePendingCap(address,bytes32) */ +export const RevokePendingCap = event('0x1026ceca5ed3747eb5edec555732d4a6f901ce1a875ecf981064628cadde1120', { + caller: indexed(address), + id: indexed(bytes32), +}) +export type RevokePendingCapEventArgs = EParams + +/** RevokePendingGuardian(address) */ +export const RevokePendingGuardian = event('0xc40a085ccfa20f5fd518ade5c3a77a7ecbdfbb4c75efcdca6146a8e3c841d663', { + caller: indexed(address), +}) +export type RevokePendingGuardianEventArgs = EParams + +/** RevokePendingMarketRemoval(address,bytes32) */ +export const RevokePendingMarketRemoval = event('0xcbeb8ecdaa5a3c133e62219b63bfc35bce3fda13065d2bed32e3b7dde60a59f4', { + caller: indexed(address), + id: indexed(bytes32), +}) +export type RevokePendingMarketRemovalEventArgs = EParams + +/** RevokePendingTimelock(address) */ +export const RevokePendingTimelock = event('0x921828337692c347c634c5d2aacbc7b756014674bd236f3cc2058d8e284a951b', { + caller: indexed(address), +}) +export type RevokePendingTimelockEventArgs = EParams + +/** SetCap(address,bytes32,uint256) */ +export const SetCap = event('0xe86b6d3313d3098f4c5f689c935de8fde876a597c185def2cedab85efedac686', { + caller: indexed(address), + id: indexed(bytes32), + cap: uint256, +}) +export type SetCapEventArgs = EParams + +/** SetCurator(address) */ +export const SetCurator = event('0xbd0a63c12948fbc9194a5839019f99c9d71db924e5c70018265bc778b8f1a506', { + newCurator: indexed(address), +}) +export type SetCuratorEventArgs = EParams + +/** SetFee(address,uint256) */ +export const SetFee = event('0x01fe2943baee27f47add82886c2200f910c749c461c9b63c5fe83901a53bdb49', { + caller: indexed(address), + newFee: uint256, +}) +export type SetFeeEventArgs = EParams + +/** SetFeeRecipient(address) */ +export const SetFeeRecipient = event('0x2e979f80fe4d43055c584cf4a8467c55875ea36728fc37176c05acd784eb7a73', { + newFeeRecipient: indexed(address), +}) +export type SetFeeRecipientEventArgs = EParams + +/** SetGuardian(address,address) */ +export const SetGuardian = event('0xcb11cc8aade2f5a556749d1b2380d108a16fac3431e6a5d5ce12ef9de0bd76e3', { + caller: indexed(address), + guardian: indexed(address), +}) +export type SetGuardianEventArgs = EParams + +/** SetIsAllocator(address,bool) */ +export const SetIsAllocator = event('0x74dc60cbc81a9472d04ad1d20e151d369c41104d655ed3f2f3091166a502cd8d', { + allocator: indexed(address), + isAllocator: bool, +}) +export type SetIsAllocatorEventArgs = EParams + +/** SetSkimRecipient(address) */ +export const SetSkimRecipient = event('0x2e7908865670e21b9779422cadf5f1cba271a62bb95c71eaaf615c0a1c48ebee', { + newSkimRecipient: indexed(address), +}) +export type SetSkimRecipientEventArgs = EParams + +/** SetSupplyQueue(address,bytes32[]) */ +export const SetSupplyQueue = event('0x6ce31538fc7fba95714ddc8a275a09252b4b1fb8f33d2550aa58a5f62ad934de', { + caller: indexed(address), + newSupplyQueue: array(bytes32), +}) +export type SetSupplyQueueEventArgs = EParams + +/** SetTimelock(address,uint256) */ +export const SetTimelock = event('0xd28e9b90ee9b37c5936ff84392d71f29ff18117d7e76bcee60615262a90a3f75', { + caller: indexed(address), + newTimelock: uint256, +}) +export type SetTimelockEventArgs = EParams + +/** SetWithdrawQueue(address,bytes32[]) */ +export const SetWithdrawQueue = event('0xe0c2db6b54586be6d7d49943139fccf0dd315ba63e55364a76c73cd8fdba724d', { + caller: indexed(address), + newWithdrawQueue: array(bytes32), +}) +export type SetWithdrawQueueEventArgs = EParams + +/** Skim(address,address,uint256) */ +export const Skim = event('0x2ae72b44f59d038340fca5739135a1d51fc5ab720bb02d983e4c5ff4119ca7b8', { + caller: indexed(address), + token: indexed(address), + amount: uint256, +}) +export type SkimEventArgs = EParams + +/** SubmitCap(address,bytes32,uint256) */ +export const SubmitCap = event('0xe851bb5856808a50efd748be463b8f35bcfb5ec74c5bfde776fe0a4d2a26db27', { + caller: indexed(address), + id: indexed(bytes32), + cap: uint256, +}) +export type SubmitCapEventArgs = EParams + +/** SubmitGuardian(address) */ +export const SubmitGuardian = event('0x7633313af54753bce8a149927263b1a55eba857ba4ef1d13c6aee25d384d3c4b', { + newGuardian: indexed(address), +}) +export type SubmitGuardianEventArgs = EParams + +/** SubmitMarketRemoval(address,bytes32) */ +export const SubmitMarketRemoval = event('0x3240fc70754c5a2b4dab10bf7081a00024bfc8491581ee3d355360ec0dd91f16', { + caller: indexed(address), + id: indexed(bytes32), +}) +export type SubmitMarketRemovalEventArgs = EParams + +/** SubmitTimelock(uint256) */ +export const SubmitTimelock = event('0xb3aa0ade2442acf51d06713c2d1a5a3ec0373cce969d42b53f4689f97bccf380', { + newTimelock: uint256, +}) +export type SubmitTimelockEventArgs = EParams + +/** Transfer(address,address,uint256) */ +export const Transfer = event('0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', { + from: indexed(address), + to: indexed(address), + value: uint256, +}) +export type TransferEventArgs = EParams + +/** UpdateLastTotalAssets(uint256) */ +export const UpdateLastTotalAssets = event('0x15c027cc4fd826d986cad358803439f7326d3aa4ed969ff90dbee4bc150f68e9', { + updatedTotalAssets: uint256, +}) +export type UpdateLastTotalAssetsEventArgs = EParams + +/** Withdraw(address,address,address,uint256,uint256) */ +export const Withdraw = event('0xfbde797d201c681b91056529119e0b02407c7bb96a4a2c75c01fc9667232c8db', { + sender: indexed(address), + receiver: indexed(address), + owner: indexed(address), + assets: uint256, + shares: uint256, +}) +export type WithdrawEventArgs = EParams diff --git a/src/abi/meta-morpho/functions.ts b/src/abi/meta-morpho/functions.ts new file mode 100644 index 00000000..c7bea8e3 --- /dev/null +++ b/src/abi/meta-morpho/functions.ts @@ -0,0 +1,523 @@ +import { address, array, bool, bytes, bytes1, bytes32, string, struct, uint184, uint192, uint256, uint64, uint8, uint96 } from '@subsquid/evm-codec' +import { func } from '../abi.support.js' +import type { FunctionArguments, FunctionReturn } from '../abi.support.js' + +/** DECIMALS_OFFSET() */ +export const DECIMALS_OFFSET = func('0xaea70acc', {}, uint8) +export type DECIMALS_OFFSETParams = FunctionArguments +export type DECIMALS_OFFSETReturn = FunctionReturn + +/** DOMAIN_SEPARATOR() */ +export const DOMAIN_SEPARATOR = func('0x3644e515', {}, bytes32) +export type DOMAIN_SEPARATORParams = FunctionArguments +export type DOMAIN_SEPARATORReturn = FunctionReturn + +/** MORPHO() */ +export const MORPHO = func('0x3acb5624', {}, address) +export type MORPHOParams = FunctionArguments +export type MORPHOReturn = FunctionReturn + +/** acceptCap((address,address,address,address,uint256)) */ +export const acceptCap = func('0x6fda3868', { + marketParams: struct({ + loanToken: address, + collateralToken: address, + oracle: address, + irm: address, + lltv: uint256, + }), +}) +export type AcceptCapParams = FunctionArguments +export type AcceptCapReturn = FunctionReturn + +/** acceptGuardian() */ +export const acceptGuardian = func('0xa5f31d61', {}) +export type AcceptGuardianParams = FunctionArguments +export type AcceptGuardianReturn = FunctionReturn + +/** acceptOwnership() */ +export const acceptOwnership = func('0x79ba5097', {}) +export type AcceptOwnershipParams = FunctionArguments +export type AcceptOwnershipReturn = FunctionReturn + +/** acceptTimelock() */ +export const acceptTimelock = func('0x8a2c7b39', {}) +export type AcceptTimelockParams = FunctionArguments +export type AcceptTimelockReturn = FunctionReturn + +/** allowance(address,address) */ +export const allowance = func('0xdd62ed3e', { + owner: address, + spender: address, +}, uint256) +export type AllowanceParams = FunctionArguments +export type AllowanceReturn = FunctionReturn + +/** approve(address,uint256) */ +export const approve = func('0x095ea7b3', { + spender: address, + value: uint256, +}, bool) +export type ApproveParams = FunctionArguments +export type ApproveReturn = FunctionReturn + +/** asset() */ +export const asset = func('0x38d52e0f', {}, address) +export type AssetParams = FunctionArguments +export type AssetReturn = FunctionReturn + +/** balanceOf(address) */ +export const balanceOf = func('0x70a08231', { + account: address, +}, uint256) +export type BalanceOfParams = FunctionArguments +export type BalanceOfReturn = FunctionReturn + +/** config(bytes32) */ +export const config = func('0xcc718f76', { + _0: bytes32, +}, struct({ + cap: uint184, + enabled: bool, + removableAt: uint64, +})) +export type ConfigParams = FunctionArguments +export type ConfigReturn = FunctionReturn + +/** convertToAssets(uint256) */ +export const convertToAssets = func('0x07a2d13a', { + shares: uint256, +}, uint256) +export type ConvertToAssetsParams = FunctionArguments +export type ConvertToAssetsReturn = FunctionReturn + +/** convertToShares(uint256) */ +export const convertToShares = func('0xc6e6f592', { + assets: uint256, +}, uint256) +export type ConvertToSharesParams = FunctionArguments +export type ConvertToSharesReturn = FunctionReturn + +/** curator() */ +export const curator = func('0xe66f53b7', {}, address) +export type CuratorParams = FunctionArguments +export type CuratorReturn = FunctionReturn + +/** decimals() */ +export const decimals = func('0x313ce567', {}, uint8) +export type DecimalsParams = FunctionArguments +export type DecimalsReturn = FunctionReturn + +/** deposit(uint256,address) */ +export const deposit = func('0x6e553f65', { + assets: uint256, + receiver: address, +}, uint256) +export type DepositParams = FunctionArguments +export type DepositReturn = FunctionReturn + +/** eip712Domain() */ +export const eip712Domain = func('0x84b0196e', {}, struct({ + fields: bytes1, + name: string, + version: string, + chainId: uint256, + verifyingContract: address, + salt: bytes32, + extensions: array(uint256), +})) +export type Eip712DomainParams = FunctionArguments +export type Eip712DomainReturn = FunctionReturn + +/** fee() */ +export const fee = func('0xddca3f43', {}, uint96) +export type FeeParams = FunctionArguments +export type FeeReturn = FunctionReturn + +/** feeRecipient() */ +export const feeRecipient = func('0x46904840', {}, address) +export type FeeRecipientParams = FunctionArguments +export type FeeRecipientReturn = FunctionReturn + +/** guardian() */ +export const guardian = func('0x452a9320', {}, address) +export type GuardianParams = FunctionArguments +export type GuardianReturn = FunctionReturn + +/** isAllocator(address) */ +export const isAllocator = func('0x4dedf20e', { + _0: address, +}, bool) +export type IsAllocatorParams = FunctionArguments +export type IsAllocatorReturn = FunctionReturn + +/** lastTotalAssets() */ +export const lastTotalAssets = func('0x568efc07', {}, uint256) +export type LastTotalAssetsParams = FunctionArguments +export type LastTotalAssetsReturn = FunctionReturn + +/** maxDeposit(address) */ +export const maxDeposit = func('0x402d267d', { + _0: address, +}, uint256) +export type MaxDepositParams = FunctionArguments +export type MaxDepositReturn = FunctionReturn + +/** maxMint(address) */ +export const maxMint = func('0xc63d75b6', { + _0: address, +}, uint256) +export type MaxMintParams = FunctionArguments +export type MaxMintReturn = FunctionReturn + +/** maxRedeem(address) */ +export const maxRedeem = func('0xd905777e', { + owner: address, +}, uint256) +export type MaxRedeemParams = FunctionArguments +export type MaxRedeemReturn = FunctionReturn + +/** maxWithdraw(address) */ +export const maxWithdraw = func('0xce96cb77', { + owner: address, +}, uint256) +export type MaxWithdrawParams = FunctionArguments +export type MaxWithdrawReturn = FunctionReturn + +/** mint(uint256,address) */ +export const mint = func('0x94bf804d', { + shares: uint256, + receiver: address, +}, uint256) +export type MintParams = FunctionArguments +export type MintReturn = FunctionReturn + +/** multicall(bytes[]) */ +export const multicall = func('0xac9650d8', { + data: array(bytes), +}, array(bytes)) +export type MulticallParams = FunctionArguments +export type MulticallReturn = FunctionReturn + +/** name() */ +export const name = func('0x06fdde03', {}, string) +export type NameParams = FunctionArguments +export type NameReturn = FunctionReturn + +/** nonces(address) */ +export const nonces = func('0x7ecebe00', { + owner: address, +}, uint256) +export type NoncesParams = FunctionArguments +export type NoncesReturn = FunctionReturn + +/** owner() */ +export const owner = func('0x8da5cb5b', {}, address) +export type OwnerParams = FunctionArguments +export type OwnerReturn = FunctionReturn + +/** pendingCap(bytes32) */ +export const pendingCap = func('0xa31be5d6', { + _0: bytes32, +}, struct({ + value: uint192, + validAt: uint64, +})) +export type PendingCapParams = FunctionArguments +export type PendingCapReturn = FunctionReturn + +/** pendingGuardian() */ +export const pendingGuardian = func('0x762c31ba', {}, struct({ + value: address, + validAt: uint64, +})) +export type PendingGuardianParams = FunctionArguments +export type PendingGuardianReturn = FunctionReturn + +/** pendingOwner() */ +export const pendingOwner = func('0xe30c3978', {}, address) +export type PendingOwnerParams = FunctionArguments +export type PendingOwnerReturn = FunctionReturn + +/** pendingTimelock() */ +export const pendingTimelock = func('0x7cc4d9a1', {}, struct({ + value: uint192, + validAt: uint64, +})) +export type PendingTimelockParams = FunctionArguments +export type PendingTimelockReturn = FunctionReturn + +/** permit(address,address,uint256,uint256,uint8,bytes32,bytes32) */ +export const permit = func('0xd505accf', { + owner: address, + spender: address, + value: uint256, + deadline: uint256, + v: uint8, + r: bytes32, + s: bytes32, +}) +export type PermitParams = FunctionArguments +export type PermitReturn = FunctionReturn + +/** previewDeposit(uint256) */ +export const previewDeposit = func('0xef8b30f7', { + assets: uint256, +}, uint256) +export type PreviewDepositParams = FunctionArguments +export type PreviewDepositReturn = FunctionReturn + +/** previewMint(uint256) */ +export const previewMint = func('0xb3d7f6b9', { + shares: uint256, +}, uint256) +export type PreviewMintParams = FunctionArguments +export type PreviewMintReturn = FunctionReturn + +/** previewRedeem(uint256) */ +export const previewRedeem = func('0x4cdad506', { + shares: uint256, +}, uint256) +export type PreviewRedeemParams = FunctionArguments +export type PreviewRedeemReturn = FunctionReturn + +/** previewWithdraw(uint256) */ +export const previewWithdraw = func('0x0a28a477', { + assets: uint256, +}, uint256) +export type PreviewWithdrawParams = FunctionArguments +export type PreviewWithdrawReturn = FunctionReturn + +/** reallocate(((address,address,address,address,uint256),uint256)[]) */ +export const reallocate = func('0x7299aa31', { + allocations: array(struct({ + marketParams: struct({ + loanToken: address, + collateralToken: address, + oracle: address, + irm: address, + lltv: uint256, + }), + assets: uint256, + })), +}) +export type ReallocateParams = FunctionArguments +export type ReallocateReturn = FunctionReturn + +/** redeem(uint256,address,address) */ +export const redeem = func('0xba087652', { + shares: uint256, + receiver: address, + owner: address, +}, uint256) +export type RedeemParams = FunctionArguments +export type RedeemReturn = FunctionReturn + +/** renounceOwnership() */ +export const renounceOwnership = func('0x715018a6', {}) +export type RenounceOwnershipParams = FunctionArguments +export type RenounceOwnershipReturn = FunctionReturn + +/** revokePendingCap(bytes32) */ +export const revokePendingCap = func('0x102f7b6c', { + id: bytes32, +}) +export type RevokePendingCapParams = FunctionArguments +export type RevokePendingCapReturn = FunctionReturn + +/** revokePendingGuardian() */ +export const revokePendingGuardian = func('0x1ecca77c', {}) +export type RevokePendingGuardianParams = FunctionArguments +export type RevokePendingGuardianReturn = FunctionReturn + +/** revokePendingMarketRemoval(bytes32) */ +export const revokePendingMarketRemoval = func('0x4b998de5', { + id: bytes32, +}) +export type RevokePendingMarketRemovalParams = FunctionArguments +export type RevokePendingMarketRemovalReturn = FunctionReturn + +/** revokePendingTimelock() */ +export const revokePendingTimelock = func('0xc9649aa9', {}) +export type RevokePendingTimelockParams = FunctionArguments +export type RevokePendingTimelockReturn = FunctionReturn + +/** setCurator(address) */ +export const setCurator = func('0xe90956cf', { + newCurator: address, +}) +export type SetCuratorParams = FunctionArguments +export type SetCuratorReturn = FunctionReturn + +/** setFee(uint256) */ +export const setFee = func('0x69fe0e2d', { + newFee: uint256, +}) +export type SetFeeParams = FunctionArguments +export type SetFeeReturn = FunctionReturn + +/** setFeeRecipient(address) */ +export const setFeeRecipient = func('0xe74b981b', { + newFeeRecipient: address, +}) +export type SetFeeRecipientParams = FunctionArguments +export type SetFeeRecipientReturn = FunctionReturn + +/** setIsAllocator(address,bool) */ +export const setIsAllocator = func('0xb192a84a', { + newAllocator: address, + newIsAllocator: bool, +}) +export type SetIsAllocatorParams = FunctionArguments +export type SetIsAllocatorReturn = FunctionReturn + +/** setSkimRecipient(address) */ +export const setSkimRecipient = func('0x2b30997b', { + newSkimRecipient: address, +}) +export type SetSkimRecipientParams = FunctionArguments +export type SetSkimRecipientReturn = FunctionReturn + +/** setSupplyQueue(bytes32[]) */ +export const setSupplyQueue = func('0x2acc56f9', { + newSupplyQueue: array(bytes32), +}) +export type SetSupplyQueueParams = FunctionArguments +export type SetSupplyQueueReturn = FunctionReturn + +/** skim(address) */ +export const skim = func('0xbc25cf77', { + token: address, +}) +export type SkimParams = FunctionArguments +export type SkimReturn = FunctionReturn + +/** skimRecipient() */ +export const skimRecipient = func('0x388af5b5', {}, address) +export type SkimRecipientParams = FunctionArguments +export type SkimRecipientReturn = FunctionReturn + +/** submitCap((address,address,address,address,uint256),uint256) */ +export const submitCap = func('0x3b24c2bf', { + marketParams: struct({ + loanToken: address, + collateralToken: address, + oracle: address, + irm: address, + lltv: uint256, + }), + newSupplyCap: uint256, +}) +export type SubmitCapParams = FunctionArguments +export type SubmitCapReturn = FunctionReturn + +/** submitGuardian(address) */ +export const submitGuardian = func('0x9d6b4a45', { + newGuardian: address, +}) +export type SubmitGuardianParams = FunctionArguments +export type SubmitGuardianReturn = FunctionReturn + +/** submitMarketRemoval((address,address,address,address,uint256)) */ +export const submitMarketRemoval = func('0x84755b5f', { + marketParams: struct({ + loanToken: address, + collateralToken: address, + oracle: address, + irm: address, + lltv: uint256, + }), +}) +export type SubmitMarketRemovalParams = FunctionArguments +export type SubmitMarketRemovalReturn = FunctionReturn + +/** submitTimelock(uint256) */ +export const submitTimelock = func('0x7224a512', { + newTimelock: uint256, +}) +export type SubmitTimelockParams = FunctionArguments +export type SubmitTimelockReturn = FunctionReturn + +/** supplyQueue(uint256) */ +export const supplyQueue = func('0xf7d18521', { + _0: uint256, +}, bytes32) +export type SupplyQueueParams = FunctionArguments +export type SupplyQueueReturn = FunctionReturn + +/** supplyQueueLength() */ +export const supplyQueueLength = func('0xa17b3130', {}, uint256) +export type SupplyQueueLengthParams = FunctionArguments +export type SupplyQueueLengthReturn = FunctionReturn + +/** symbol() */ +export const symbol = func('0x95d89b41', {}, string) +export type SymbolParams = FunctionArguments +export type SymbolReturn = FunctionReturn + +/** timelock() */ +export const timelock = func('0xd33219b4', {}, uint256) +export type TimelockParams = FunctionArguments +export type TimelockReturn = FunctionReturn + +/** totalAssets() */ +export const totalAssets = func('0x01e1d114', {}, uint256) +export type TotalAssetsParams = FunctionArguments +export type TotalAssetsReturn = FunctionReturn + +/** totalSupply() */ +export const totalSupply = func('0x18160ddd', {}, uint256) +export type TotalSupplyParams = FunctionArguments +export type TotalSupplyReturn = FunctionReturn + +/** transfer(address,uint256) */ +export const transfer = func('0xa9059cbb', { + to: address, + value: uint256, +}, bool) +export type TransferParams = FunctionArguments +export type TransferReturn = FunctionReturn + +/** transferFrom(address,address,uint256) */ +export const transferFrom = func('0x23b872dd', { + from: address, + to: address, + value: uint256, +}, bool) +export type TransferFromParams = FunctionArguments +export type TransferFromReturn = FunctionReturn + +/** transferOwnership(address) */ +export const transferOwnership = func('0xf2fde38b', { + newOwner: address, +}) +export type TransferOwnershipParams = FunctionArguments +export type TransferOwnershipReturn = FunctionReturn + +/** updateWithdrawQueue(uint256[]) */ +export const updateWithdrawQueue = func('0x41b67833', { + indexes: array(uint256), +}) +export type UpdateWithdrawQueueParams = FunctionArguments +export type UpdateWithdrawQueueReturn = FunctionReturn + +/** withdraw(uint256,address,address) */ +export const withdraw = func('0xb460af94', { + assets: uint256, + receiver: address, + owner: address, +}, uint256) +export type WithdrawParams = FunctionArguments +export type WithdrawReturn = FunctionReturn + +/** withdrawQueue(uint256) */ +export const withdrawQueue = func('0x62518ddf', { + _0: uint256, +}, bytes32) +export type WithdrawQueueParams = FunctionArguments +export type WithdrawQueueReturn = FunctionReturn + +/** withdrawQueueLength() */ +export const withdrawQueueLength = func('0x33f91ebb', {}, uint256) +export type WithdrawQueueLengthParams = FunctionArguments +export type WithdrawQueueLengthReturn = FunctionReturn diff --git a/src/abi/meta-morpho/index.ts b/src/abi/meta-morpho/index.ts new file mode 100644 index 00000000..11829d6e --- /dev/null +++ b/src/abi/meta-morpho/index.ts @@ -0,0 +1,4 @@ +export * as events from './events.js' +export * as functions from './functions.js' + +export { Contract } from './contract.js' diff --git a/src/abi/metropolis-lb-factory.ts b/src/abi/metropolis-lb-factory.ts deleted file mode 100644 index 4f8702a0..00000000 --- a/src/abi/metropolis-lb-factory.ts +++ /dev/null @@ -1,302 +0,0 @@ -import * as p from '@subsquid/evm-codec' -import { event, fun, viewFun, indexed, ContractBase } from '@subsquid/evm-abi' -import type { EventParams as EParams, FunctionArguments, FunctionReturn } from '@subsquid/evm-abi' - -export const events = { - FeeRecipientSet: event("0x15d80a013f22151bc7246e3bc132e12828cde19de98870475e3fa70840152721", "FeeRecipientSet(address,address)", {"oldRecipient": p.address, "newRecipient": p.address}), - FlashLoanFeeSet: event("0x5c34e91c94c78b662a45d0bd4a25a4e32c584c54a45a76e4a4d43be27ba40e50", "FlashLoanFeeSet(uint256,uint256)", {"oldFlashLoanFee": p.uint256, "newFlashLoanFee": p.uint256}), - LBPairCreated: event("0x2c8d104b27c6b7f4492017a6f5cf3803043688934ebcaa6a03540beeaf976aff", "LBPairCreated(address,address,uint256,address,uint256)", {"tokenX": indexed(p.address), "tokenY": indexed(p.address), "binStep": indexed(p.uint256), "LBPair": p.address, "pid": p.uint256}), - LBPairIgnoredStateChanged: event("0x44cf35361c9ff3c8c1397ec6410d5495cc481feaef35c9af11da1a637107de4f", "LBPairIgnoredStateChanged(address,bool)", {"LBPair": indexed(p.address), "ignored": p.bool}), - LBPairImplementationSet: event("0x900d0e3d359f50e4f923ecdc06b401e07dbb9f485e17b07bcfc91a13000b277e", "LBPairImplementationSet(address,address)", {"oldLBPairImplementation": p.address, "LBPairImplementation": p.address}), - OwnershipTransferStarted: event("0x38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e22700", "OwnershipTransferStarted(address,address)", {"previousOwner": indexed(p.address), "newOwner": indexed(p.address)}), - OwnershipTransferred: event("0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", "OwnershipTransferred(address,address)", {"previousOwner": indexed(p.address), "newOwner": indexed(p.address)}), - PresetOpenStateChanged: event("0x58a8b6a02b964cca2712e5a71d7b0d564a56b4a0f573b4c47f389341ade14cfd", "PresetOpenStateChanged(uint256,bool)", {"binStep": indexed(p.uint256), "isOpen": indexed(p.bool)}), - PresetRemoved: event("0xdd86b848bb56ff540caa68683fa467d0e7eb5f8b2d44e4ee435742eeeae9be13", "PresetRemoved(uint256)", {"binStep": indexed(p.uint256)}), - PresetSet: event("0x839844a256a87f87c9c835117d9a1c40be013954064c937072acb32d36db6a28", "PresetSet(uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256)", {"binStep": indexed(p.uint256), "baseFactor": p.uint256, "filterPeriod": p.uint256, "decayPeriod": p.uint256, "reductionFactor": p.uint256, "variableFeeControl": p.uint256, "protocolShare": p.uint256, "maxVolatilityAccumulator": p.uint256}), - QuoteAssetAdded: event("0x84cc2115995684dcb0cd3d3a9565e3d32f075de81db70c8dc3a719b2a47af67e", "QuoteAssetAdded(address)", {"quoteAsset": indexed(p.address)}), - QuoteAssetRemoved: event("0x0b767739217755d8af5a2ba75b181a19fa1750f8bb701f09311cb19a90140cb3", "QuoteAssetRemoved(address)", {"quoteAsset": indexed(p.address)}), - RoleAdminChanged: event("0xbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff", "RoleAdminChanged(bytes32,bytes32,bytes32)", {"role": indexed(p.bytes32), "previousAdminRole": indexed(p.bytes32), "newAdminRole": indexed(p.bytes32)}), - RoleGranted: event("0x2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d", "RoleGranted(bytes32,address,address)", {"role": indexed(p.bytes32), "account": indexed(p.address), "sender": indexed(p.address)}), - RoleRevoked: event("0xf6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b", "RoleRevoked(bytes32,address,address)", {"role": indexed(p.bytes32), "account": indexed(p.address), "sender": indexed(p.address)}), -} - -export const functions = { - DEFAULT_ADMIN_ROLE: viewFun("0xa217fddf", "DEFAULT_ADMIN_ROLE()", {}, p.bytes32), - LB_HOOKS_MANAGER_ROLE: viewFun("0x1af5bacc", "LB_HOOKS_MANAGER_ROLE()", {}, p.bytes32), - acceptOwnership: fun("0x79ba5097", "acceptOwnership()", {}, ), - addQuoteAsset: fun("0x5a440923", "addQuoteAsset(address)", {"quoteAsset": p.address}, ), - createLBPair: fun("0x659ac74b", "createLBPair(address,address,uint24,uint16)", {"tokenX": p.address, "tokenY": p.address, "activeId": p.uint24, "binStep": p.uint16}, p.address), - forceDecay: fun("0x3c78a941", "forceDecay(address)", {"pair": p.address}, ), - getAllBinSteps: viewFun("0x5b35875c", "getAllBinSteps()", {}, p.array(p.uint256)), - getAllLBPairs: viewFun("0x6622e0d7", "getAllLBPairs(address,address)", {"tokenX": p.address, "tokenY": p.address}, p.array(p.struct({"binStep": p.uint16, "LBPair": p.address, "createdByOwner": p.bool, "ignoredForRouting": p.bool}))), - getFeeRecipient: viewFun("0x4ccb20c0", "getFeeRecipient()", {}, p.address), - getFlashLoanFee: viewFun("0xfd90c2be", "getFlashLoanFee()", {}, p.uint256), - getLBPairAtIndex: viewFun("0x7daf5d66", "getLBPairAtIndex(uint256)", {"index": p.uint256}, p.address), - getLBPairImplementation: viewFun("0xaf371065", "getLBPairImplementation()", {}, p.address), - getLBPairInformation: viewFun("0x704037bd", "getLBPairInformation(address,address,uint256)", {"tokenA": p.address, "tokenB": p.address, "binStep": p.uint256}, p.struct({"binStep": p.uint16, "LBPair": p.address, "createdByOwner": p.bool, "ignoredForRouting": p.bool})), - getMaxFlashLoanFee: viewFun("0x8ce9aa1c", "getMaxFlashLoanFee()", {}, p.uint256), - getMinBinStep: viewFun("0x701ab8c1", "getMinBinStep()", {}, p.uint256), - getNumberOfLBPairs: viewFun("0x4e937c3a", "getNumberOfLBPairs()", {}, p.uint256), - getNumberOfQuoteAssets: viewFun("0x80c5061e", "getNumberOfQuoteAssets()", {}, p.uint256), - getOpenBinSteps: viewFun("0x0282c9c1", "getOpenBinSteps()", {}, p.array(p.uint256)), - getPreset: viewFun("0xaabc4b3c", "getPreset(uint256)", {"binStep": p.uint256}, {"baseFactor": p.uint256, "filterPeriod": p.uint256, "decayPeriod": p.uint256, "reductionFactor": p.uint256, "variableFeeControl": p.uint256, "protocolShare": p.uint256, "maxVolatilityAccumulator": p.uint256, "isOpen": p.bool}), - getQuoteAssetAtIndex: viewFun("0x0752092b", "getQuoteAssetAtIndex(uint256)", {"index": p.uint256}, p.address), - getRoleAdmin: viewFun("0x248a9ca3", "getRoleAdmin(bytes32)", {"role": p.bytes32}, p.bytes32), - grantRole: fun("0x2f2ff15d", "grantRole(bytes32,address)", {"role": p.bytes32, "account": p.address}, ), - hasRole: viewFun("0x91d14854", "hasRole(bytes32,address)", {"role": p.bytes32, "account": p.address}, p.bool), - isQuoteAsset: viewFun("0x27721842", "isQuoteAsset(address)", {"token": p.address}, p.bool), - owner: viewFun("0x8da5cb5b", "owner()", {}, p.address), - pendingOwner: viewFun("0xe30c3978", "pendingOwner()", {}, p.address), - removeLBHooksOnPair: fun("0x2cc06b8c", "removeLBHooksOnPair(address,address,uint16)", {"tokenX": p.address, "tokenY": p.address, "binStep": p.uint16}, ), - removePreset: fun("0xe203a31f", "removePreset(uint16)", {"binStep": p.uint16}, ), - removeQuoteAsset: fun("0xddbfd941", "removeQuoteAsset(address)", {"quoteAsset": p.address}, ), - renounceOwnership: fun("0x715018a6", "renounceOwnership()", {}, ), - renounceRole: fun("0x36568abe", "renounceRole(bytes32,address)", {"role": p.bytes32, "callerConfirmation": p.address}, ), - revokeRole: fun("0xd547741f", "revokeRole(bytes32,address)", {"role": p.bytes32, "account": p.address}, ), - setFeeRecipient: fun("0xe74b981b", "setFeeRecipient(address)", {"feeRecipient": p.address}, ), - setFeesParametersOnPair: fun("0x093ff769", "setFeesParametersOnPair(address,address,uint16,uint16,uint16,uint16,uint16,uint24,uint16,uint24)", {"tokenX": p.address, "tokenY": p.address, "binStep": p.uint16, "baseFactor": p.uint16, "filterPeriod": p.uint16, "decayPeriod": p.uint16, "reductionFactor": p.uint16, "variableFeeControl": p.uint24, "protocolShare": p.uint16, "maxVolatilityAccumulator": p.uint24}, ), - setFlashLoanFee: fun("0xe92d0d5d", "setFlashLoanFee(uint256)", {"flashLoanFee": p.uint256}, ), - setLBHooksParametersOnPair: fun("0x3a2f1a91", "setLBHooksParametersOnPair(address,address,uint16,bytes32,bytes)", {"tokenX": p.address, "tokenY": p.address, "binStep": p.uint16, "hooksParameters": p.bytes32, "onHooksSetData": p.bytes}, ), - setLBPairIgnored: fun("0x69d56ea3", "setLBPairIgnored(address,address,uint16,bool)", {"tokenX": p.address, "tokenY": p.address, "binStep": p.uint16, "ignored": p.bool}, ), - setLBPairImplementation: fun("0xb0384781", "setLBPairImplementation(address)", {"newLBPairImplementation": p.address}, ), - setPreset: fun("0x379ee803", "setPreset(uint16,uint16,uint16,uint16,uint16,uint24,uint16,uint24,bool)", {"binStep": p.uint16, "baseFactor": p.uint16, "filterPeriod": p.uint16, "decayPeriod": p.uint16, "reductionFactor": p.uint16, "variableFeeControl": p.uint24, "protocolShare": p.uint16, "maxVolatilityAccumulator": p.uint24, "isOpen": p.bool}, ), - setPresetOpenState: fun("0x4cd161d3", "setPresetOpenState(uint16,bool)", {"binStep": p.uint16, "isOpen": p.bool}, ), - supportsInterface: viewFun("0x01ffc9a7", "supportsInterface(bytes4)", {"interfaceId": p.bytes4}, p.bool), - transferOwnership: fun("0xf2fde38b", "transferOwnership(address)", {"newOwner": p.address}, ), -} - -export class Contract extends ContractBase { - - DEFAULT_ADMIN_ROLE() { - return this.eth_call(functions.DEFAULT_ADMIN_ROLE, {}) - } - - LB_HOOKS_MANAGER_ROLE() { - return this.eth_call(functions.LB_HOOKS_MANAGER_ROLE, {}) - } - - getAllBinSteps() { - return this.eth_call(functions.getAllBinSteps, {}) - } - - getAllLBPairs(tokenX: GetAllLBPairsParams["tokenX"], tokenY: GetAllLBPairsParams["tokenY"]) { - return this.eth_call(functions.getAllLBPairs, {tokenX, tokenY}) - } - - getFeeRecipient() { - return this.eth_call(functions.getFeeRecipient, {}) - } - - getFlashLoanFee() { - return this.eth_call(functions.getFlashLoanFee, {}) - } - - getLBPairAtIndex(index: GetLBPairAtIndexParams["index"]) { - return this.eth_call(functions.getLBPairAtIndex, {index}) - } - - getLBPairImplementation() { - return this.eth_call(functions.getLBPairImplementation, {}) - } - - getLBPairInformation(tokenA: GetLBPairInformationParams["tokenA"], tokenB: GetLBPairInformationParams["tokenB"], binStep: GetLBPairInformationParams["binStep"]) { - return this.eth_call(functions.getLBPairInformation, {tokenA, tokenB, binStep}) - } - - getMaxFlashLoanFee() { - return this.eth_call(functions.getMaxFlashLoanFee, {}) - } - - getMinBinStep() { - return this.eth_call(functions.getMinBinStep, {}) - } - - getNumberOfLBPairs() { - return this.eth_call(functions.getNumberOfLBPairs, {}) - } - - getNumberOfQuoteAssets() { - return this.eth_call(functions.getNumberOfQuoteAssets, {}) - } - - getOpenBinSteps() { - return this.eth_call(functions.getOpenBinSteps, {}) - } - - getPreset(binStep: GetPresetParams["binStep"]) { - return this.eth_call(functions.getPreset, {binStep}) - } - - getQuoteAssetAtIndex(index: GetQuoteAssetAtIndexParams["index"]) { - return this.eth_call(functions.getQuoteAssetAtIndex, {index}) - } - - getRoleAdmin(role: GetRoleAdminParams["role"]) { - return this.eth_call(functions.getRoleAdmin, {role}) - } - - hasRole(role: HasRoleParams["role"], account: HasRoleParams["account"]) { - return this.eth_call(functions.hasRole, {role, account}) - } - - isQuoteAsset(token: IsQuoteAssetParams["token"]) { - return this.eth_call(functions.isQuoteAsset, {token}) - } - - owner() { - return this.eth_call(functions.owner, {}) - } - - pendingOwner() { - return this.eth_call(functions.pendingOwner, {}) - } - - supportsInterface(interfaceId: SupportsInterfaceParams["interfaceId"]) { - return this.eth_call(functions.supportsInterface, {interfaceId}) - } -} - -/// Event types -export type FeeRecipientSetEventArgs = EParams -export type FlashLoanFeeSetEventArgs = EParams -export type LBPairCreatedEventArgs = EParams -export type LBPairIgnoredStateChangedEventArgs = EParams -export type LBPairImplementationSetEventArgs = EParams -export type OwnershipTransferStartedEventArgs = EParams -export type OwnershipTransferredEventArgs = EParams -export type PresetOpenStateChangedEventArgs = EParams -export type PresetRemovedEventArgs = EParams -export type PresetSetEventArgs = EParams -export type QuoteAssetAddedEventArgs = EParams -export type QuoteAssetRemovedEventArgs = EParams -export type RoleAdminChangedEventArgs = EParams -export type RoleGrantedEventArgs = EParams -export type RoleRevokedEventArgs = EParams - -/// Function types -export type DEFAULT_ADMIN_ROLEParams = FunctionArguments -export type DEFAULT_ADMIN_ROLEReturn = FunctionReturn - -export type LB_HOOKS_MANAGER_ROLEParams = FunctionArguments -export type LB_HOOKS_MANAGER_ROLEReturn = FunctionReturn - -export type AcceptOwnershipParams = FunctionArguments -export type AcceptOwnershipReturn = FunctionReturn - -export type AddQuoteAssetParams = FunctionArguments -export type AddQuoteAssetReturn = FunctionReturn - -export type CreateLBPairParams = FunctionArguments -export type CreateLBPairReturn = FunctionReturn - -export type ForceDecayParams = FunctionArguments -export type ForceDecayReturn = FunctionReturn - -export type GetAllBinStepsParams = FunctionArguments -export type GetAllBinStepsReturn = FunctionReturn - -export type GetAllLBPairsParams = FunctionArguments -export type GetAllLBPairsReturn = FunctionReturn - -export type GetFeeRecipientParams = FunctionArguments -export type GetFeeRecipientReturn = FunctionReturn - -export type GetFlashLoanFeeParams = FunctionArguments -export type GetFlashLoanFeeReturn = FunctionReturn - -export type GetLBPairAtIndexParams = FunctionArguments -export type GetLBPairAtIndexReturn = FunctionReturn - -export type GetLBPairImplementationParams = FunctionArguments -export type GetLBPairImplementationReturn = FunctionReturn - -export type GetLBPairInformationParams = FunctionArguments -export type GetLBPairInformationReturn = FunctionReturn - -export type GetMaxFlashLoanFeeParams = FunctionArguments -export type GetMaxFlashLoanFeeReturn = FunctionReturn - -export type GetMinBinStepParams = FunctionArguments -export type GetMinBinStepReturn = FunctionReturn - -export type GetNumberOfLBPairsParams = FunctionArguments -export type GetNumberOfLBPairsReturn = FunctionReturn - -export type GetNumberOfQuoteAssetsParams = FunctionArguments -export type GetNumberOfQuoteAssetsReturn = FunctionReturn - -export type GetOpenBinStepsParams = FunctionArguments -export type GetOpenBinStepsReturn = FunctionReturn - -export type GetPresetParams = FunctionArguments -export type GetPresetReturn = FunctionReturn - -export type GetQuoteAssetAtIndexParams = FunctionArguments -export type GetQuoteAssetAtIndexReturn = FunctionReturn - -export type GetRoleAdminParams = FunctionArguments -export type GetRoleAdminReturn = FunctionReturn - -export type GrantRoleParams = FunctionArguments -export type GrantRoleReturn = FunctionReturn - -export type HasRoleParams = FunctionArguments -export type HasRoleReturn = FunctionReturn - -export type IsQuoteAssetParams = FunctionArguments -export type IsQuoteAssetReturn = FunctionReturn - -export type OwnerParams = FunctionArguments -export type OwnerReturn = FunctionReturn - -export type PendingOwnerParams = FunctionArguments -export type PendingOwnerReturn = FunctionReturn - -export type RemoveLBHooksOnPairParams = FunctionArguments -export type RemoveLBHooksOnPairReturn = FunctionReturn - -export type RemovePresetParams = FunctionArguments -export type RemovePresetReturn = FunctionReturn - -export type RemoveQuoteAssetParams = FunctionArguments -export type RemoveQuoteAssetReturn = FunctionReturn - -export type RenounceOwnershipParams = FunctionArguments -export type RenounceOwnershipReturn = FunctionReturn - -export type RenounceRoleParams = FunctionArguments -export type RenounceRoleReturn = FunctionReturn - -export type RevokeRoleParams = FunctionArguments -export type RevokeRoleReturn = FunctionReturn - -export type SetFeeRecipientParams = FunctionArguments -export type SetFeeRecipientReturn = FunctionReturn - -export type SetFeesParametersOnPairParams = FunctionArguments -export type SetFeesParametersOnPairReturn = FunctionReturn - -export type SetFlashLoanFeeParams = FunctionArguments -export type SetFlashLoanFeeReturn = FunctionReturn - -export type SetLBHooksParametersOnPairParams = FunctionArguments -export type SetLBHooksParametersOnPairReturn = FunctionReturn - -export type SetLBPairIgnoredParams = FunctionArguments -export type SetLBPairIgnoredReturn = FunctionReturn - -export type SetLBPairImplementationParams = FunctionArguments -export type SetLBPairImplementationReturn = FunctionReturn - -export type SetPresetParams = FunctionArguments -export type SetPresetReturn = FunctionReturn - -export type SetPresetOpenStateParams = FunctionArguments -export type SetPresetOpenStateReturn = FunctionReturn - -export type SupportsInterfaceParams = FunctionArguments -export type SupportsInterfaceReturn = FunctionReturn - -export type TransferOwnershipParams = FunctionArguments -export type TransferOwnershipReturn = FunctionReturn - diff --git a/src/abi/metropolis-lb-factory/contract.ts b/src/abi/metropolis-lb-factory/contract.ts new file mode 100644 index 00000000..e056424b --- /dev/null +++ b/src/abi/metropolis-lb-factory/contract.ts @@ -0,0 +1,97 @@ +import { ContractBase } from '../abi.support.js' +import { DEFAULT_ADMIN_ROLE, LB_HOOKS_MANAGER_ROLE, createLBPair, getAllBinSteps, getAllLBPairs, getFeeRecipient, getFlashLoanFee, getLBPairAtIndex, getLBPairImplementation, getLBPairInformation, getMaxFlashLoanFee, getMinBinStep, getNumberOfLBPairs, getNumberOfQuoteAssets, getOpenBinSteps, getPreset, getQuoteAssetAtIndex, getRoleAdmin, hasRole, isQuoteAsset, owner, pendingOwner, supportsInterface } from './functions.js' +import type { CreateLBPairParams, GetAllLBPairsParams, GetLBPairAtIndexParams, GetLBPairInformationParams, GetPresetParams, GetQuoteAssetAtIndexParams, GetRoleAdminParams, HasRoleParams, IsQuoteAssetParams, SupportsInterfaceParams } from './functions.js' + +export class Contract extends ContractBase { + DEFAULT_ADMIN_ROLE() { + return this.eth_call(DEFAULT_ADMIN_ROLE, {}) + } + + LB_HOOKS_MANAGER_ROLE() { + return this.eth_call(LB_HOOKS_MANAGER_ROLE, {}) + } + + createLBPair(tokenX: CreateLBPairParams["tokenX"], tokenY: CreateLBPairParams["tokenY"], activeId: CreateLBPairParams["activeId"], binStep: CreateLBPairParams["binStep"]) { + return this.eth_call(createLBPair, {tokenX, tokenY, activeId, binStep}) + } + + getAllBinSteps() { + return this.eth_call(getAllBinSteps, {}) + } + + getAllLBPairs(tokenX: GetAllLBPairsParams["tokenX"], tokenY: GetAllLBPairsParams["tokenY"]) { + return this.eth_call(getAllLBPairs, {tokenX, tokenY}) + } + + getFeeRecipient() { + return this.eth_call(getFeeRecipient, {}) + } + + getFlashLoanFee() { + return this.eth_call(getFlashLoanFee, {}) + } + + getLBPairAtIndex(index: GetLBPairAtIndexParams["index"]) { + return this.eth_call(getLBPairAtIndex, {index}) + } + + getLBPairImplementation() { + return this.eth_call(getLBPairImplementation, {}) + } + + getLBPairInformation(tokenA: GetLBPairInformationParams["tokenA"], tokenB: GetLBPairInformationParams["tokenB"], binStep: GetLBPairInformationParams["binStep"]) { + return this.eth_call(getLBPairInformation, {tokenA, tokenB, binStep}) + } + + getMaxFlashLoanFee() { + return this.eth_call(getMaxFlashLoanFee, {}) + } + + getMinBinStep() { + return this.eth_call(getMinBinStep, {}) + } + + getNumberOfLBPairs() { + return this.eth_call(getNumberOfLBPairs, {}) + } + + getNumberOfQuoteAssets() { + return this.eth_call(getNumberOfQuoteAssets, {}) + } + + getOpenBinSteps() { + return this.eth_call(getOpenBinSteps, {}) + } + + getPreset(binStep: GetPresetParams["binStep"]) { + return this.eth_call(getPreset, {binStep}) + } + + getQuoteAssetAtIndex(index: GetQuoteAssetAtIndexParams["index"]) { + return this.eth_call(getQuoteAssetAtIndex, {index}) + } + + getRoleAdmin(role: GetRoleAdminParams["role"]) { + return this.eth_call(getRoleAdmin, {role}) + } + + hasRole(role: HasRoleParams["role"], account: HasRoleParams["account"]) { + return this.eth_call(hasRole, {role, account}) + } + + isQuoteAsset(token: IsQuoteAssetParams["token"]) { + return this.eth_call(isQuoteAsset, {token}) + } + + owner() { + return this.eth_call(owner, {}) + } + + pendingOwner() { + return this.eth_call(pendingOwner, {}) + } + + supportsInterface(interfaceId: SupportsInterfaceParams["interfaceId"]) { + return this.eth_call(supportsInterface, {interfaceId}) + } +} diff --git a/src/abi/metropolis-lb-factory/events.ts b/src/abi/metropolis-lb-factory/events.ts new file mode 100644 index 00000000..64ea9609 --- /dev/null +++ b/src/abi/metropolis-lb-factory/events.ts @@ -0,0 +1,117 @@ +import { address, bool, bytes32, uint256 } from '@subsquid/evm-codec' +import { event, indexed } from '../abi.support.js' +import type { EventParams as EParams } from '../abi.support.js' + +/** FeeRecipientSet(address,address) */ +export const FeeRecipientSet = event('0x15d80a013f22151bc7246e3bc132e12828cde19de98870475e3fa70840152721', { + oldRecipient: address, + newRecipient: address, +}) +export type FeeRecipientSetEventArgs = EParams + +/** FlashLoanFeeSet(uint256,uint256) */ +export const FlashLoanFeeSet = event('0x5c34e91c94c78b662a45d0bd4a25a4e32c584c54a45a76e4a4d43be27ba40e50', { + oldFlashLoanFee: uint256, + newFlashLoanFee: uint256, +}) +export type FlashLoanFeeSetEventArgs = EParams + +/** LBPairCreated(address,address,uint256,address,uint256) */ +export const LBPairCreated = event('0x2c8d104b27c6b7f4492017a6f5cf3803043688934ebcaa6a03540beeaf976aff', { + tokenX: indexed(address), + tokenY: indexed(address), + binStep: indexed(uint256), + LBPair: address, + pid: uint256, +}) +export type LBPairCreatedEventArgs = EParams + +/** LBPairIgnoredStateChanged(address,bool) */ +export const LBPairIgnoredStateChanged = event('0x44cf35361c9ff3c8c1397ec6410d5495cc481feaef35c9af11da1a637107de4f', { + LBPair: indexed(address), + ignored: bool, +}) +export type LBPairIgnoredStateChangedEventArgs = EParams + +/** LBPairImplementationSet(address,address) */ +export const LBPairImplementationSet = event('0x900d0e3d359f50e4f923ecdc06b401e07dbb9f485e17b07bcfc91a13000b277e', { + oldLBPairImplementation: address, + LBPairImplementation: address, +}) +export type LBPairImplementationSetEventArgs = EParams + +/** OwnershipTransferStarted(address,address) */ +export const OwnershipTransferStarted = event('0x38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e22700', { + previousOwner: indexed(address), + newOwner: indexed(address), +}) +export type OwnershipTransferStartedEventArgs = EParams + +/** OwnershipTransferred(address,address) */ +export const OwnershipTransferred = event('0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0', { + previousOwner: indexed(address), + newOwner: indexed(address), +}) +export type OwnershipTransferredEventArgs = EParams + +/** PresetOpenStateChanged(uint256,bool) */ +export const PresetOpenStateChanged = event('0x58a8b6a02b964cca2712e5a71d7b0d564a56b4a0f573b4c47f389341ade14cfd', { + binStep: indexed(uint256), + isOpen: indexed(bool), +}) +export type PresetOpenStateChangedEventArgs = EParams + +/** PresetRemoved(uint256) */ +export const PresetRemoved = event('0xdd86b848bb56ff540caa68683fa467d0e7eb5f8b2d44e4ee435742eeeae9be13', { + binStep: indexed(uint256), +}) +export type PresetRemovedEventArgs = EParams + +/** PresetSet(uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256) */ +export const PresetSet = event('0x839844a256a87f87c9c835117d9a1c40be013954064c937072acb32d36db6a28', { + binStep: indexed(uint256), + baseFactor: uint256, + filterPeriod: uint256, + decayPeriod: uint256, + reductionFactor: uint256, + variableFeeControl: uint256, + protocolShare: uint256, + maxVolatilityAccumulator: uint256, +}) +export type PresetSetEventArgs = EParams + +/** QuoteAssetAdded(address) */ +export const QuoteAssetAdded = event('0x84cc2115995684dcb0cd3d3a9565e3d32f075de81db70c8dc3a719b2a47af67e', { + quoteAsset: indexed(address), +}) +export type QuoteAssetAddedEventArgs = EParams + +/** QuoteAssetRemoved(address) */ +export const QuoteAssetRemoved = event('0x0b767739217755d8af5a2ba75b181a19fa1750f8bb701f09311cb19a90140cb3', { + quoteAsset: indexed(address), +}) +export type QuoteAssetRemovedEventArgs = EParams + +/** RoleAdminChanged(bytes32,bytes32,bytes32) */ +export const RoleAdminChanged = event('0xbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff', { + role: indexed(bytes32), + previousAdminRole: indexed(bytes32), + newAdminRole: indexed(bytes32), +}) +export type RoleAdminChangedEventArgs = EParams + +/** RoleGranted(bytes32,address,address) */ +export const RoleGranted = event('0x2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d', { + role: indexed(bytes32), + account: indexed(address), + sender: indexed(address), +}) +export type RoleGrantedEventArgs = EParams + +/** RoleRevoked(bytes32,address,address) */ +export const RoleRevoked = event('0xf6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b', { + role: indexed(bytes32), + account: indexed(address), + sender: indexed(address), +}) +export type RoleRevokedEventArgs = EParams diff --git a/src/abi/metropolis-lb-factory/functions.ts b/src/abi/metropolis-lb-factory/functions.ts new file mode 100644 index 00000000..6591cd6c --- /dev/null +++ b/src/abi/metropolis-lb-factory/functions.ts @@ -0,0 +1,323 @@ +import { address, array, bool, bytes, bytes32, bytes4, struct, uint16, uint24, uint256 } from '@subsquid/evm-codec' +import { func } from '../abi.support.js' +import type { FunctionArguments, FunctionReturn } from '../abi.support.js' + +/** DEFAULT_ADMIN_ROLE() */ +export const DEFAULT_ADMIN_ROLE = func('0xa217fddf', {}, bytes32) +export type DEFAULT_ADMIN_ROLEParams = FunctionArguments +export type DEFAULT_ADMIN_ROLEReturn = FunctionReturn + +/** LB_HOOKS_MANAGER_ROLE() */ +export const LB_HOOKS_MANAGER_ROLE = func('0x1af5bacc', {}, bytes32) +export type LB_HOOKS_MANAGER_ROLEParams = FunctionArguments +export type LB_HOOKS_MANAGER_ROLEReturn = FunctionReturn + +/** acceptOwnership() */ +export const acceptOwnership = func('0x79ba5097', {}) +export type AcceptOwnershipParams = FunctionArguments +export type AcceptOwnershipReturn = FunctionReturn + +/** addQuoteAsset(address) */ +export const addQuoteAsset = func('0x5a440923', { + quoteAsset: address, +}) +export type AddQuoteAssetParams = FunctionArguments +export type AddQuoteAssetReturn = FunctionReturn + +/** createLBPair(address,address,uint24,uint16) */ +export const createLBPair = func('0x659ac74b', { + tokenX: address, + tokenY: address, + activeId: uint24, + binStep: uint16, +}, address) +export type CreateLBPairParams = FunctionArguments +export type CreateLBPairReturn = FunctionReturn + +/** forceDecay(address) */ +export const forceDecay = func('0x3c78a941', { + pair: address, +}) +export type ForceDecayParams = FunctionArguments +export type ForceDecayReturn = FunctionReturn + +/** getAllBinSteps() */ +export const getAllBinSteps = func('0x5b35875c', {}, array(uint256)) +export type GetAllBinStepsParams = FunctionArguments +export type GetAllBinStepsReturn = FunctionReturn + +/** getAllLBPairs(address,address) */ +export const getAllLBPairs = func('0x6622e0d7', { + tokenX: address, + tokenY: address, +}, array(struct({ + binStep: uint16, + LBPair: address, + createdByOwner: bool, + ignoredForRouting: bool, +}))) +export type GetAllLBPairsParams = FunctionArguments +export type GetAllLBPairsReturn = FunctionReturn + +/** getFeeRecipient() */ +export const getFeeRecipient = func('0x4ccb20c0', {}, address) +export type GetFeeRecipientParams = FunctionArguments +export type GetFeeRecipientReturn = FunctionReturn + +/** getFlashLoanFee() */ +export const getFlashLoanFee = func('0xfd90c2be', {}, uint256) +export type GetFlashLoanFeeParams = FunctionArguments +export type GetFlashLoanFeeReturn = FunctionReturn + +/** getLBPairAtIndex(uint256) */ +export const getLBPairAtIndex = func('0x7daf5d66', { + index: uint256, +}, address) +export type GetLBPairAtIndexParams = FunctionArguments +export type GetLBPairAtIndexReturn = FunctionReturn + +/** getLBPairImplementation() */ +export const getLBPairImplementation = func('0xaf371065', {}, address) +export type GetLBPairImplementationParams = FunctionArguments +export type GetLBPairImplementationReturn = FunctionReturn + +/** getLBPairInformation(address,address,uint256) */ +export const getLBPairInformation = func('0x704037bd', { + tokenA: address, + tokenB: address, + binStep: uint256, +}, struct({ + binStep: uint16, + LBPair: address, + createdByOwner: bool, + ignoredForRouting: bool, +})) +export type GetLBPairInformationParams = FunctionArguments +export type GetLBPairInformationReturn = FunctionReturn + +/** getMaxFlashLoanFee() */ +export const getMaxFlashLoanFee = func('0x8ce9aa1c', {}, uint256) +export type GetMaxFlashLoanFeeParams = FunctionArguments +export type GetMaxFlashLoanFeeReturn = FunctionReturn + +/** getMinBinStep() */ +export const getMinBinStep = func('0x701ab8c1', {}, uint256) +export type GetMinBinStepParams = FunctionArguments +export type GetMinBinStepReturn = FunctionReturn + +/** getNumberOfLBPairs() */ +export const getNumberOfLBPairs = func('0x4e937c3a', {}, uint256) +export type GetNumberOfLBPairsParams = FunctionArguments +export type GetNumberOfLBPairsReturn = FunctionReturn + +/** getNumberOfQuoteAssets() */ +export const getNumberOfQuoteAssets = func('0x80c5061e', {}, uint256) +export type GetNumberOfQuoteAssetsParams = FunctionArguments +export type GetNumberOfQuoteAssetsReturn = FunctionReturn + +/** getOpenBinSteps() */ +export const getOpenBinSteps = func('0x0282c9c1', {}, array(uint256)) +export type GetOpenBinStepsParams = FunctionArguments +export type GetOpenBinStepsReturn = FunctionReturn + +/** getPreset(uint256) */ +export const getPreset = func('0xaabc4b3c', { + binStep: uint256, +}, struct({ + baseFactor: uint256, + filterPeriod: uint256, + decayPeriod: uint256, + reductionFactor: uint256, + variableFeeControl: uint256, + protocolShare: uint256, + maxVolatilityAccumulator: uint256, + isOpen: bool, +})) +export type GetPresetParams = FunctionArguments +export type GetPresetReturn = FunctionReturn + +/** getQuoteAssetAtIndex(uint256) */ +export const getQuoteAssetAtIndex = func('0x0752092b', { + index: uint256, +}, address) +export type GetQuoteAssetAtIndexParams = FunctionArguments +export type GetQuoteAssetAtIndexReturn = FunctionReturn + +/** getRoleAdmin(bytes32) */ +export const getRoleAdmin = func('0x248a9ca3', { + role: bytes32, +}, bytes32) +export type GetRoleAdminParams = FunctionArguments +export type GetRoleAdminReturn = FunctionReturn + +/** grantRole(bytes32,address) */ +export const grantRole = func('0x2f2ff15d', { + role: bytes32, + account: address, +}) +export type GrantRoleParams = FunctionArguments +export type GrantRoleReturn = FunctionReturn + +/** hasRole(bytes32,address) */ +export const hasRole = func('0x91d14854', { + role: bytes32, + account: address, +}, bool) +export type HasRoleParams = FunctionArguments +export type HasRoleReturn = FunctionReturn + +/** isQuoteAsset(address) */ +export const isQuoteAsset = func('0x27721842', { + token: address, +}, bool) +export type IsQuoteAssetParams = FunctionArguments +export type IsQuoteAssetReturn = FunctionReturn + +/** owner() */ +export const owner = func('0x8da5cb5b', {}, address) +export type OwnerParams = FunctionArguments +export type OwnerReturn = FunctionReturn + +/** pendingOwner() */ +export const pendingOwner = func('0xe30c3978', {}, address) +export type PendingOwnerParams = FunctionArguments +export type PendingOwnerReturn = FunctionReturn + +/** removeLBHooksOnPair(address,address,uint16) */ +export const removeLBHooksOnPair = func('0x2cc06b8c', { + tokenX: address, + tokenY: address, + binStep: uint16, +}) +export type RemoveLBHooksOnPairParams = FunctionArguments +export type RemoveLBHooksOnPairReturn = FunctionReturn + +/** removePreset(uint16) */ +export const removePreset = func('0xe203a31f', { + binStep: uint16, +}) +export type RemovePresetParams = FunctionArguments +export type RemovePresetReturn = FunctionReturn + +/** removeQuoteAsset(address) */ +export const removeQuoteAsset = func('0xddbfd941', { + quoteAsset: address, +}) +export type RemoveQuoteAssetParams = FunctionArguments +export type RemoveQuoteAssetReturn = FunctionReturn + +/** renounceOwnership() */ +export const renounceOwnership = func('0x715018a6', {}) +export type RenounceOwnershipParams = FunctionArguments +export type RenounceOwnershipReturn = FunctionReturn + +/** renounceRole(bytes32,address) */ +export const renounceRole = func('0x36568abe', { + role: bytes32, + callerConfirmation: address, +}) +export type RenounceRoleParams = FunctionArguments +export type RenounceRoleReturn = FunctionReturn + +/** revokeRole(bytes32,address) */ +export const revokeRole = func('0xd547741f', { + role: bytes32, + account: address, +}) +export type RevokeRoleParams = FunctionArguments +export type RevokeRoleReturn = FunctionReturn + +/** setFeeRecipient(address) */ +export const setFeeRecipient = func('0xe74b981b', { + feeRecipient: address, +}) +export type SetFeeRecipientParams = FunctionArguments +export type SetFeeRecipientReturn = FunctionReturn + +/** setFeesParametersOnPair(address,address,uint16,uint16,uint16,uint16,uint16,uint24,uint16,uint24) */ +export const setFeesParametersOnPair = func('0x093ff769', { + tokenX: address, + tokenY: address, + binStep: uint16, + baseFactor: uint16, + filterPeriod: uint16, + decayPeriod: uint16, + reductionFactor: uint16, + variableFeeControl: uint24, + protocolShare: uint16, + maxVolatilityAccumulator: uint24, +}) +export type SetFeesParametersOnPairParams = FunctionArguments +export type SetFeesParametersOnPairReturn = FunctionReturn + +/** setFlashLoanFee(uint256) */ +export const setFlashLoanFee = func('0xe92d0d5d', { + flashLoanFee: uint256, +}) +export type SetFlashLoanFeeParams = FunctionArguments +export type SetFlashLoanFeeReturn = FunctionReturn + +/** setLBHooksParametersOnPair(address,address,uint16,bytes32,bytes) */ +export const setLBHooksParametersOnPair = func('0x3a2f1a91', { + tokenX: address, + tokenY: address, + binStep: uint16, + hooksParameters: bytes32, + onHooksSetData: bytes, +}) +export type SetLBHooksParametersOnPairParams = FunctionArguments +export type SetLBHooksParametersOnPairReturn = FunctionReturn + +/** setLBPairIgnored(address,address,uint16,bool) */ +export const setLBPairIgnored = func('0x69d56ea3', { + tokenX: address, + tokenY: address, + binStep: uint16, + ignored: bool, +}) +export type SetLBPairIgnoredParams = FunctionArguments +export type SetLBPairIgnoredReturn = FunctionReturn + +/** setLBPairImplementation(address) */ +export const setLBPairImplementation = func('0xb0384781', { + newLBPairImplementation: address, +}) +export type SetLBPairImplementationParams = FunctionArguments +export type SetLBPairImplementationReturn = FunctionReturn + +/** setPreset(uint16,uint16,uint16,uint16,uint16,uint24,uint16,uint24,bool) */ +export const setPreset = func('0x379ee803', { + binStep: uint16, + baseFactor: uint16, + filterPeriod: uint16, + decayPeriod: uint16, + reductionFactor: uint16, + variableFeeControl: uint24, + protocolShare: uint16, + maxVolatilityAccumulator: uint24, + isOpen: bool, +}) +export type SetPresetParams = FunctionArguments +export type SetPresetReturn = FunctionReturn + +/** setPresetOpenState(uint16,bool) */ +export const setPresetOpenState = func('0x4cd161d3', { + binStep: uint16, + isOpen: bool, +}) +export type SetPresetOpenStateParams = FunctionArguments +export type SetPresetOpenStateReturn = FunctionReturn + +/** supportsInterface(bytes4) */ +export const supportsInterface = func('0x01ffc9a7', { + interfaceId: bytes4, +}, bool) +export type SupportsInterfaceParams = FunctionArguments +export type SupportsInterfaceReturn = FunctionReturn + +/** transferOwnership(address) */ +export const transferOwnership = func('0xf2fde38b', { + newOwner: address, +}) +export type TransferOwnershipParams = FunctionArguments +export type TransferOwnershipReturn = FunctionReturn diff --git a/src/abi/metropolis-lb-factory/index.ts b/src/abi/metropolis-lb-factory/index.ts new file mode 100644 index 00000000..11829d6e --- /dev/null +++ b/src/abi/metropolis-lb-factory/index.ts @@ -0,0 +1,4 @@ +export * as events from './events.js' +export * as functions from './functions.js' + +export { Contract } from './contract.js' diff --git a/src/abi/metropolis-v2-factory.ts b/src/abi/metropolis-v2-factory.ts deleted file mode 100644 index 21a553bb..00000000 --- a/src/abi/metropolis-v2-factory.ts +++ /dev/null @@ -1,106 +0,0 @@ -import * as p from '@subsquid/evm-codec' -import { event, fun, viewFun, indexed, ContractBase } from '@subsquid/evm-abi' -import type { EventParams as EParams, FunctionArguments, FunctionReturn } from '@subsquid/evm-abi' - -export const events = { - PairCreated: event("0x0d3648bd0f6ba80134a33ba9275ac585d9d315f0ad8355cddefde31afa28d0e9", "PairCreated(address,address,address,uint256)", {"token0": indexed(p.address), "token1": indexed(p.address), "pair": p.address, "_3": p.uint256}), -} - -export const functions = { - FEE_DENOMINATOR: viewFun("0xd73792a9", "FEE_DENOMINATOR()", {}, p.uint256), - INIT_CODE_PAIR_HASH: viewFun("0x5855a25a", "INIT_CODE_PAIR_HASH()", {}, p.bytes32), - OWNER_FEE_SHARE_MAX: viewFun("0x90fd0687", "OWNER_FEE_SHARE_MAX()", {}, p.uint256), - allPairs: viewFun("0x1e3dd18b", "allPairs(uint256)", {"_0": p.uint256}, p.address), - allPairsLength: viewFun("0x574f2ba3", "allPairsLength()", {}, p.uint256), - createPair: fun("0xc9c65396", "createPair(address,address)", {"tokenA": p.address, "tokenB": p.address}, p.address), - feeTo: viewFun("0x017e7e58", "feeTo()", {}, p.address), - feeToSetter: viewFun("0x094b7415", "feeToSetter()", {}, p.address), - getPair: viewFun("0xe6a43905", "getPair(address,address)", {"_0": p.address, "_1": p.address}, p.address), - ownerFeeShare: viewFun("0x69c8b572", "ownerFeeShare()", {}, p.uint256), - setFeeTo: fun("0xf46901ed", "setFeeTo(address)", {"_feeTo": p.address}, ), - setFeeToSetter: fun("0xa2e74af6", "setFeeToSetter(address)", {"_feeToSetter": p.address}, ), - setOwnerFeeShare: fun("0x91b83178", "setOwnerFeeShare(uint256)", {"newOwnerFeeShare": p.uint256}, ), -} - -export class Contract extends ContractBase { - - FEE_DENOMINATOR() { - return this.eth_call(functions.FEE_DENOMINATOR, {}) - } - - INIT_CODE_PAIR_HASH() { - return this.eth_call(functions.INIT_CODE_PAIR_HASH, {}) - } - - OWNER_FEE_SHARE_MAX() { - return this.eth_call(functions.OWNER_FEE_SHARE_MAX, {}) - } - - allPairs(_0: AllPairsParams["_0"]) { - return this.eth_call(functions.allPairs, {_0}) - } - - allPairsLength() { - return this.eth_call(functions.allPairsLength, {}) - } - - feeTo() { - return this.eth_call(functions.feeTo, {}) - } - - feeToSetter() { - return this.eth_call(functions.feeToSetter, {}) - } - - getPair(_0: GetPairParams["_0"], _1: GetPairParams["_1"]) { - return this.eth_call(functions.getPair, {_0, _1}) - } - - ownerFeeShare() { - return this.eth_call(functions.ownerFeeShare, {}) - } -} - -/// Event types -export type PairCreatedEventArgs = EParams - -/// Function types -export type FEE_DENOMINATORParams = FunctionArguments -export type FEE_DENOMINATORReturn = FunctionReturn - -export type INIT_CODE_PAIR_HASHParams = FunctionArguments -export type INIT_CODE_PAIR_HASHReturn = FunctionReturn - -export type OWNER_FEE_SHARE_MAXParams = FunctionArguments -export type OWNER_FEE_SHARE_MAXReturn = FunctionReturn - -export type AllPairsParams = FunctionArguments -export type AllPairsReturn = FunctionReturn - -export type AllPairsLengthParams = FunctionArguments -export type AllPairsLengthReturn = FunctionReturn - -export type CreatePairParams = FunctionArguments -export type CreatePairReturn = FunctionReturn - -export type FeeToParams = FunctionArguments -export type FeeToReturn = FunctionReturn - -export type FeeToSetterParams = FunctionArguments -export type FeeToSetterReturn = FunctionReturn - -export type GetPairParams = FunctionArguments -export type GetPairReturn = FunctionReturn - -export type OwnerFeeShareParams = FunctionArguments -export type OwnerFeeShareReturn = FunctionReturn - -export type SetFeeToParams = FunctionArguments -export type SetFeeToReturn = FunctionReturn - -export type SetFeeToSetterParams = FunctionArguments -export type SetFeeToSetterReturn = FunctionReturn - -export type SetOwnerFeeShareParams = FunctionArguments -export type SetOwnerFeeShareReturn = FunctionReturn - diff --git a/src/abi/metropolis-v2-factory/contract.ts b/src/abi/metropolis-v2-factory/contract.ts new file mode 100644 index 00000000..b1142bd8 --- /dev/null +++ b/src/abi/metropolis-v2-factory/contract.ts @@ -0,0 +1,45 @@ +import { ContractBase } from '../abi.support.js' +import { FEE_DENOMINATOR, INIT_CODE_PAIR_HASH, OWNER_FEE_SHARE_MAX, allPairs, allPairsLength, createPair, feeTo, feeToSetter, getPair, ownerFeeShare } from './functions.js' +import type { AllPairsParams, CreatePairParams, GetPairParams } from './functions.js' + +export class Contract extends ContractBase { + FEE_DENOMINATOR() { + return this.eth_call(FEE_DENOMINATOR, {}) + } + + INIT_CODE_PAIR_HASH() { + return this.eth_call(INIT_CODE_PAIR_HASH, {}) + } + + OWNER_FEE_SHARE_MAX() { + return this.eth_call(OWNER_FEE_SHARE_MAX, {}) + } + + allPairs(_0: AllPairsParams["_0"]) { + return this.eth_call(allPairs, {_0}) + } + + allPairsLength() { + return this.eth_call(allPairsLength, {}) + } + + createPair(tokenA: CreatePairParams["tokenA"], tokenB: CreatePairParams["tokenB"]) { + return this.eth_call(createPair, {tokenA, tokenB}) + } + + feeTo() { + return this.eth_call(feeTo, {}) + } + + feeToSetter() { + return this.eth_call(feeToSetter, {}) + } + + getPair(_0: GetPairParams["_0"], _1: GetPairParams["_1"]) { + return this.eth_call(getPair, {_0, _1}) + } + + ownerFeeShare() { + return this.eth_call(ownerFeeShare, {}) + } +} diff --git a/src/abi/metropolis-v2-factory/events.ts b/src/abi/metropolis-v2-factory/events.ts new file mode 100644 index 00000000..9963cc1d --- /dev/null +++ b/src/abi/metropolis-v2-factory/events.ts @@ -0,0 +1,12 @@ +import { address, uint256 } from '@subsquid/evm-codec' +import { event, indexed } from '../abi.support.js' +import type { EventParams as EParams } from '../abi.support.js' + +/** PairCreated(address,address,address,uint256) */ +export const PairCreated = event('0x0d3648bd0f6ba80134a33ba9275ac585d9d315f0ad8355cddefde31afa28d0e9', { + token0: indexed(address), + token1: indexed(address), + pair: address, + _3: uint256, +}) +export type PairCreatedEventArgs = EParams diff --git a/src/abi/metropolis-v2-factory/functions.ts b/src/abi/metropolis-v2-factory/functions.ts new file mode 100644 index 00000000..6e72f3d1 --- /dev/null +++ b/src/abi/metropolis-v2-factory/functions.ts @@ -0,0 +1,82 @@ +import { address, bytes32, uint256 } from '@subsquid/evm-codec' +import { func } from '../abi.support.js' +import type { FunctionArguments, FunctionReturn } from '../abi.support.js' + +/** FEE_DENOMINATOR() */ +export const FEE_DENOMINATOR = func('0xd73792a9', {}, uint256) +export type FEE_DENOMINATORParams = FunctionArguments +export type FEE_DENOMINATORReturn = FunctionReturn + +/** INIT_CODE_PAIR_HASH() */ +export const INIT_CODE_PAIR_HASH = func('0x5855a25a', {}, bytes32) +export type INIT_CODE_PAIR_HASHParams = FunctionArguments +export type INIT_CODE_PAIR_HASHReturn = FunctionReturn + +/** OWNER_FEE_SHARE_MAX() */ +export const OWNER_FEE_SHARE_MAX = func('0x90fd0687', {}, uint256) +export type OWNER_FEE_SHARE_MAXParams = FunctionArguments +export type OWNER_FEE_SHARE_MAXReturn = FunctionReturn + +/** allPairs(uint256) */ +export const allPairs = func('0x1e3dd18b', { + _0: uint256, +}, address) +export type AllPairsParams = FunctionArguments +export type AllPairsReturn = FunctionReturn + +/** allPairsLength() */ +export const allPairsLength = func('0x574f2ba3', {}, uint256) +export type AllPairsLengthParams = FunctionArguments +export type AllPairsLengthReturn = FunctionReturn + +/** createPair(address,address) */ +export const createPair = func('0xc9c65396', { + tokenA: address, + tokenB: address, +}, address) +export type CreatePairParams = FunctionArguments +export type CreatePairReturn = FunctionReturn + +/** feeTo() */ +export const feeTo = func('0x017e7e58', {}, address) +export type FeeToParams = FunctionArguments +export type FeeToReturn = FunctionReturn + +/** feeToSetter() */ +export const feeToSetter = func('0x094b7415', {}, address) +export type FeeToSetterParams = FunctionArguments +export type FeeToSetterReturn = FunctionReturn + +/** getPair(address,address) */ +export const getPair = func('0xe6a43905', { + _0: address, + _1: address, +}, address) +export type GetPairParams = FunctionArguments +export type GetPairReturn = FunctionReturn + +/** ownerFeeShare() */ +export const ownerFeeShare = func('0x69c8b572', {}, uint256) +export type OwnerFeeShareParams = FunctionArguments +export type OwnerFeeShareReturn = FunctionReturn + +/** setFeeTo(address) */ +export const setFeeTo = func('0xf46901ed', { + _feeTo: address, +}) +export type SetFeeToParams = FunctionArguments +export type SetFeeToReturn = FunctionReturn + +/** setFeeToSetter(address) */ +export const setFeeToSetter = func('0xa2e74af6', { + _feeToSetter: address, +}) +export type SetFeeToSetterParams = FunctionArguments +export type SetFeeToSetterReturn = FunctionReturn + +/** setOwnerFeeShare(uint256) */ +export const setOwnerFeeShare = func('0x91b83178', { + newOwnerFeeShare: uint256, +}) +export type SetOwnerFeeShareParams = FunctionArguments +export type SetOwnerFeeShareReturn = FunctionReturn diff --git a/src/abi/metropolis-v2-factory/index.ts b/src/abi/metropolis-v2-factory/index.ts new file mode 100644 index 00000000..11829d6e --- /dev/null +++ b/src/abi/metropolis-v2-factory/index.ts @@ -0,0 +1,4 @@ +export * as events from './events.js' +export * as functions from './functions.js' + +export { Contract } from './contract.js' diff --git a/src/abi/morpho.ts b/src/abi/morpho.ts deleted file mode 100644 index b2987f25..00000000 --- a/src/abi/morpho.ts +++ /dev/null @@ -1,206 +0,0 @@ -import * as p from '@subsquid/evm-codec' -import { event, fun, viewFun, indexed, ContractBase } from '@subsquid/evm-abi' -import type { EventParams as EParams, FunctionArguments, FunctionReturn } from '@subsquid/evm-abi' - -export const events = { - AccrueInterest: event("0x9d9bd501d0657d7dfe415f779a620a62b78bc508ddc0891fbbd8b7ac0f8fce87", "AccrueInterest(bytes32,uint256,uint256,uint256)", {"id": indexed(p.bytes32), "prevBorrowRate": p.uint256, "interest": p.uint256, "feeShares": p.uint256}), - Borrow: event("0x570954540bed6b1304a87dfe815a5eda4a648f7097a16240dcd85c9b5fd42a43", "Borrow(bytes32,address,address,address,uint256,uint256)", {"id": indexed(p.bytes32), "caller": p.address, "onBehalf": indexed(p.address), "receiver": indexed(p.address), "assets": p.uint256, "shares": p.uint256}), - CreateMarket: event("0xac4b2400f169220b0c0afdde7a0b32e775ba727ea1cb30b35f935cdaab8683ac", "CreateMarket(bytes32,(address,address,address,address,uint256))", {"id": indexed(p.bytes32), "marketParams": p.struct({"loanToken": p.address, "collateralToken": p.address, "oracle": p.address, "irm": p.address, "lltv": p.uint256})}), - EnableIrm: event("0x590e04cdebeccba40f566186b9746ad295a4cd358ea4fefaaea6ce79630d96c0", "EnableIrm(address)", {"irm": indexed(p.address)}), - EnableLltv: event("0x297b80e7a896fad470c630f6575072d609bde997260ff3db851939405ec29139", "EnableLltv(uint256)", {"lltv": p.uint256}), - FlashLoan: event("0xc76f1b4fe4396ac07a9fa55a415d4ca430e72651d37d3401f3bed7cb13fc4f12", "FlashLoan(address,address,uint256)", {"caller": indexed(p.address), "token": indexed(p.address), "assets": p.uint256}), - IncrementNonce: event("0xa58af1a0c70dba0c7aa60d1a1a147ebd61000d1690a968828ac718bca927f2c7", "IncrementNonce(address,address,uint256)", {"caller": indexed(p.address), "authorizer": indexed(p.address), "usedNonce": p.uint256}), - Liquidate: event("0xa4946ede45d0c6f06a0f5ce92c9ad3b4751452d2fe0e25010783bcab57a67e41", "Liquidate(bytes32,address,address,uint256,uint256,uint256,uint256,uint256)", {"id": indexed(p.bytes32), "caller": indexed(p.address), "borrower": indexed(p.address), "repaidAssets": p.uint256, "repaidShares": p.uint256, "seizedAssets": p.uint256, "badDebtAssets": p.uint256, "badDebtShares": p.uint256}), - Repay: event("0x52acb05cebbd3cd39715469f22afbf5a17496295ef3bc9bb5944056c63ccaa09", "Repay(bytes32,address,address,uint256,uint256)", {"id": indexed(p.bytes32), "caller": indexed(p.address), "onBehalf": indexed(p.address), "assets": p.uint256, "shares": p.uint256}), - SetAuthorization: event("0xd5e969f01efe921d3f766bdebad25f0a05e3f237311f56482bf132d0326309c0", "SetAuthorization(address,address,address,bool)", {"caller": indexed(p.address), "authorizer": indexed(p.address), "authorized": indexed(p.address), "newIsAuthorized": p.bool}), - SetFee: event("0x139d6f58e9a127229667c8e3b36e88890a66cfc8ab1024ddc513e189e125b75b", "SetFee(bytes32,uint256)", {"id": indexed(p.bytes32), "newFee": p.uint256}), - SetFeeRecipient: event("0x2e979f80fe4d43055c584cf4a8467c55875ea36728fc37176c05acd784eb7a73", "SetFeeRecipient(address)", {"newFeeRecipient": indexed(p.address)}), - SetOwner: event("0x167d3e9c1016ab80e58802ca9da10ce5c6a0f4debc46a2e7a2cd9e56899a4fb5", "SetOwner(address)", {"newOwner": indexed(p.address)}), - Supply: event("0xedf8870433c83823eb071d3df1caa8d008f12f6440918c20d75a3602cda30fe0", "Supply(bytes32,address,address,uint256,uint256)", {"id": indexed(p.bytes32), "caller": indexed(p.address), "onBehalf": indexed(p.address), "assets": p.uint256, "shares": p.uint256}), - SupplyCollateral: event("0xa3b9472a1399e17e123f3c2e6586c23e504184d504de59cdaa2b375e880c6184", "SupplyCollateral(bytes32,address,address,uint256)", {"id": indexed(p.bytes32), "caller": indexed(p.address), "onBehalf": indexed(p.address), "assets": p.uint256}), - Withdraw: event("0xa56fc0ad5702ec05ce63666221f796fb62437c32db1aa1aa075fc6484cf58fbf", "Withdraw(bytes32,address,address,address,uint256,uint256)", {"id": indexed(p.bytes32), "caller": p.address, "onBehalf": indexed(p.address), "receiver": indexed(p.address), "assets": p.uint256, "shares": p.uint256}), - WithdrawCollateral: event("0xe80ebd7cc9223d7382aab2e0d1d6155c65651f83d53c8b9b06901d167e321142", "WithdrawCollateral(bytes32,address,address,address,uint256)", {"id": indexed(p.bytes32), "caller": p.address, "onBehalf": indexed(p.address), "receiver": indexed(p.address), "assets": p.uint256}), -} - -export const functions = { - DOMAIN_SEPARATOR: viewFun("0x3644e515", "DOMAIN_SEPARATOR()", {}, p.bytes32), - accrueInterest: fun("0x151c1ade", "accrueInterest((address,address,address,address,uint256))", {"marketParams": p.struct({"loanToken": p.address, "collateralToken": p.address, "oracle": p.address, "irm": p.address, "lltv": p.uint256})}, ), - borrow: fun("0x50d8cd4b", "borrow((address,address,address,address,uint256),uint256,uint256,address,address)", {"marketParams": p.struct({"loanToken": p.address, "collateralToken": p.address, "oracle": p.address, "irm": p.address, "lltv": p.uint256}), "assets": p.uint256, "shares": p.uint256, "onBehalf": p.address, "receiver": p.address}, {"_0": p.uint256, "_1": p.uint256}), - createMarket: fun("0x8c1358a2", "createMarket((address,address,address,address,uint256))", {"marketParams": p.struct({"loanToken": p.address, "collateralToken": p.address, "oracle": p.address, "irm": p.address, "lltv": p.uint256})}, ), - enableIrm: fun("0x5a64f51e", "enableIrm(address)", {"irm": p.address}, ), - enableLltv: fun("0x4d98a93b", "enableLltv(uint256)", {"lltv": p.uint256}, ), - extSloads: viewFun("0x7784c685", "extSloads(bytes32[])", {"slots": p.array(p.bytes32)}, p.array(p.bytes32)), - feeRecipient: viewFun("0x46904840", "feeRecipient()", {}, p.address), - flashLoan: fun("0xe0232b42", "flashLoan(address,uint256,bytes)", {"token": p.address, "assets": p.uint256, "data": p.bytes}, ), - idToMarketParams: viewFun("0x2c3c9157", "idToMarketParams(bytes32)", {"_0": p.bytes32}, {"loanToken": p.address, "collateralToken": p.address, "oracle": p.address, "irm": p.address, "lltv": p.uint256}), - isAuthorized: viewFun("0x65e4ad9e", "isAuthorized(address,address)", {"_0": p.address, "_1": p.address}, p.bool), - isIrmEnabled: viewFun("0xf2b863ce", "isIrmEnabled(address)", {"_0": p.address}, p.bool), - isLltvEnabled: viewFun("0xb485f3b8", "isLltvEnabled(uint256)", {"_0": p.uint256}, p.bool), - liquidate: fun("0xd8eabcb8", "liquidate((address,address,address,address,uint256),address,uint256,uint256,bytes)", {"marketParams": p.struct({"loanToken": p.address, "collateralToken": p.address, "oracle": p.address, "irm": p.address, "lltv": p.uint256}), "borrower": p.address, "seizedAssets": p.uint256, "repaidShares": p.uint256, "data": p.bytes}, {"_0": p.uint256, "_1": p.uint256}), - market: viewFun("0x5c60e39a", "market(bytes32)", {"_0": p.bytes32}, {"totalSupplyAssets": p.uint128, "totalSupplyShares": p.uint128, "totalBorrowAssets": p.uint128, "totalBorrowShares": p.uint128, "lastUpdate": p.uint128, "fee": p.uint128}), - nonce: viewFun("0x70ae92d2", "nonce(address)", {"_0": p.address}, p.uint256), - owner: viewFun("0x8da5cb5b", "owner()", {}, p.address), - position: viewFun("0x93c52062", "position(bytes32,address)", {"_0": p.bytes32, "_1": p.address}, {"supplyShares": p.uint256, "borrowShares": p.uint128, "collateral": p.uint128}), - repay: fun("0x20b76e81", "repay((address,address,address,address,uint256),uint256,uint256,address,bytes)", {"marketParams": p.struct({"loanToken": p.address, "collateralToken": p.address, "oracle": p.address, "irm": p.address, "lltv": p.uint256}), "assets": p.uint256, "shares": p.uint256, "onBehalf": p.address, "data": p.bytes}, {"_0": p.uint256, "_1": p.uint256}), - setAuthorization: fun("0xeecea000", "setAuthorization(address,bool)", {"authorized": p.address, "newIsAuthorized": p.bool}, ), - setAuthorizationWithSig: fun("0x8069218f", "setAuthorizationWithSig((address,address,bool,uint256,uint256),(uint8,bytes32,bytes32))", {"authorization": p.struct({"authorizer": p.address, "authorized": p.address, "isAuthorized": p.bool, "nonce": p.uint256, "deadline": p.uint256}), "signature": p.struct({"v": p.uint8, "r": p.bytes32, "s": p.bytes32})}, ), - setFee: fun("0x2b4f013c", "setFee((address,address,address,address,uint256),uint256)", {"marketParams": p.struct({"loanToken": p.address, "collateralToken": p.address, "oracle": p.address, "irm": p.address, "lltv": p.uint256}), "newFee": p.uint256}, ), - setFeeRecipient: fun("0xe74b981b", "setFeeRecipient(address)", {"newFeeRecipient": p.address}, ), - setOwner: fun("0x13af4035", "setOwner(address)", {"newOwner": p.address}, ), - supply: fun("0xa99aad89", "supply((address,address,address,address,uint256),uint256,uint256,address,bytes)", {"marketParams": p.struct({"loanToken": p.address, "collateralToken": p.address, "oracle": p.address, "irm": p.address, "lltv": p.uint256}), "assets": p.uint256, "shares": p.uint256, "onBehalf": p.address, "data": p.bytes}, {"_0": p.uint256, "_1": p.uint256}), - supplyCollateral: fun("0x238d6579", "supplyCollateral((address,address,address,address,uint256),uint256,address,bytes)", {"marketParams": p.struct({"loanToken": p.address, "collateralToken": p.address, "oracle": p.address, "irm": p.address, "lltv": p.uint256}), "assets": p.uint256, "onBehalf": p.address, "data": p.bytes}, ), - withdraw: fun("0x5c2bea49", "withdraw((address,address,address,address,uint256),uint256,uint256,address,address)", {"marketParams": p.struct({"loanToken": p.address, "collateralToken": p.address, "oracle": p.address, "irm": p.address, "lltv": p.uint256}), "assets": p.uint256, "shares": p.uint256, "onBehalf": p.address, "receiver": p.address}, {"_0": p.uint256, "_1": p.uint256}), - withdrawCollateral: fun("0x8720316d", "withdrawCollateral((address,address,address,address,uint256),uint256,address,address)", {"marketParams": p.struct({"loanToken": p.address, "collateralToken": p.address, "oracle": p.address, "irm": p.address, "lltv": p.uint256}), "assets": p.uint256, "onBehalf": p.address, "receiver": p.address}, ), -} - -export class Contract extends ContractBase { - - DOMAIN_SEPARATOR() { - return this.eth_call(functions.DOMAIN_SEPARATOR, {}) - } - - extSloads(slots: ExtSloadsParams["slots"]) { - return this.eth_call(functions.extSloads, {slots}) - } - - feeRecipient() { - return this.eth_call(functions.feeRecipient, {}) - } - - idToMarketParams(_0: IdToMarketParamsParams["_0"]) { - return this.eth_call(functions.idToMarketParams, {_0}) - } - - isAuthorized(_0: IsAuthorizedParams["_0"], _1: IsAuthorizedParams["_1"]) { - return this.eth_call(functions.isAuthorized, {_0, _1}) - } - - isIrmEnabled(_0: IsIrmEnabledParams["_0"]) { - return this.eth_call(functions.isIrmEnabled, {_0}) - } - - isLltvEnabled(_0: IsLltvEnabledParams["_0"]) { - return this.eth_call(functions.isLltvEnabled, {_0}) - } - - market(_0: MarketParams["_0"]) { - return this.eth_call(functions.market, {_0}) - } - - nonce(_0: NonceParams["_0"]) { - return this.eth_call(functions.nonce, {_0}) - } - - owner() { - return this.eth_call(functions.owner, {}) - } - - position(_0: PositionParams["_0"], _1: PositionParams["_1"]) { - return this.eth_call(functions.position, {_0, _1}) - } -} - -/// Event types -export type AccrueInterestEventArgs = EParams -export type BorrowEventArgs = EParams -export type CreateMarketEventArgs = EParams -export type EnableIrmEventArgs = EParams -export type EnableLltvEventArgs = EParams -export type FlashLoanEventArgs = EParams -export type IncrementNonceEventArgs = EParams -export type LiquidateEventArgs = EParams -export type RepayEventArgs = EParams -export type SetAuthorizationEventArgs = EParams -export type SetFeeEventArgs = EParams -export type SetFeeRecipientEventArgs = EParams -export type SetOwnerEventArgs = EParams -export type SupplyEventArgs = EParams -export type SupplyCollateralEventArgs = EParams -export type WithdrawEventArgs = EParams -export type WithdrawCollateralEventArgs = EParams - -/// Function types -export type DOMAIN_SEPARATORParams = FunctionArguments -export type DOMAIN_SEPARATORReturn = FunctionReturn - -export type AccrueInterestParams = FunctionArguments -export type AccrueInterestReturn = FunctionReturn - -export type BorrowParams = FunctionArguments -export type BorrowReturn = FunctionReturn - -export type CreateMarketParams = FunctionArguments -export type CreateMarketReturn = FunctionReturn - -export type EnableIrmParams = FunctionArguments -export type EnableIrmReturn = FunctionReturn - -export type EnableLltvParams = FunctionArguments -export type EnableLltvReturn = FunctionReturn - -export type ExtSloadsParams = FunctionArguments -export type ExtSloadsReturn = FunctionReturn - -export type FeeRecipientParams = FunctionArguments -export type FeeRecipientReturn = FunctionReturn - -export type FlashLoanParams = FunctionArguments -export type FlashLoanReturn = FunctionReturn - -export type IdToMarketParamsParams = FunctionArguments -export type IdToMarketParamsReturn = FunctionReturn - -export type IsAuthorizedParams = FunctionArguments -export type IsAuthorizedReturn = FunctionReturn - -export type IsIrmEnabledParams = FunctionArguments -export type IsIrmEnabledReturn = FunctionReturn - -export type IsLltvEnabledParams = FunctionArguments -export type IsLltvEnabledReturn = FunctionReturn - -export type LiquidateParams = FunctionArguments -export type LiquidateReturn = FunctionReturn - -export type MarketParams = FunctionArguments -export type MarketReturn = FunctionReturn - -export type NonceParams = FunctionArguments -export type NonceReturn = FunctionReturn - -export type OwnerParams = FunctionArguments -export type OwnerReturn = FunctionReturn - -export type PositionParams = FunctionArguments -export type PositionReturn = FunctionReturn - -export type RepayParams = FunctionArguments -export type RepayReturn = FunctionReturn - -export type SetAuthorizationParams = FunctionArguments -export type SetAuthorizationReturn = FunctionReturn - -export type SetAuthorizationWithSigParams = FunctionArguments -export type SetAuthorizationWithSigReturn = FunctionReturn - -export type SetFeeParams = FunctionArguments -export type SetFeeReturn = FunctionReturn - -export type SetFeeRecipientParams = FunctionArguments -export type SetFeeRecipientReturn = FunctionReturn - -export type SetOwnerParams = FunctionArguments -export type SetOwnerReturn = FunctionReturn - -export type SupplyParams = FunctionArguments -export type SupplyReturn = FunctionReturn - -export type SupplyCollateralParams = FunctionArguments -export type SupplyCollateralReturn = FunctionReturn - -export type WithdrawParams = FunctionArguments -export type WithdrawReturn = FunctionReturn - -export type WithdrawCollateralParams = FunctionArguments -export type WithdrawCollateralReturn = FunctionReturn - diff --git a/src/abi/morpho/contract.ts b/src/abi/morpho/contract.ts new file mode 100644 index 00000000..58c1adba --- /dev/null +++ b/src/abi/morpho/contract.ts @@ -0,0 +1,69 @@ +import { ContractBase } from '../abi.support.js' +import { DOMAIN_SEPARATOR, borrow, extSloads, feeRecipient, idToMarketParams, isAuthorized, isIrmEnabled, isLltvEnabled, liquidate, market, nonce, owner, position, repay, supply, withdraw } from './functions.js' +import type { BorrowParams, ExtSloadsParams, IdToMarketParamsParams, IsAuthorizedParams, IsIrmEnabledParams, IsLltvEnabledParams, LiquidateParams, MarketParams, NonceParams, PositionParams, RepayParams, SupplyParams, WithdrawParams } from './functions.js' + +export class Contract extends ContractBase { + DOMAIN_SEPARATOR() { + return this.eth_call(DOMAIN_SEPARATOR, {}) + } + + borrow(marketParams: BorrowParams["marketParams"], assets: BorrowParams["assets"], shares: BorrowParams["shares"], onBehalf: BorrowParams["onBehalf"], receiver: BorrowParams["receiver"]) { + return this.eth_call(borrow, {marketParams, assets, shares, onBehalf, receiver}) + } + + extSloads(slots: ExtSloadsParams["slots"]) { + return this.eth_call(extSloads, {slots}) + } + + feeRecipient() { + return this.eth_call(feeRecipient, {}) + } + + idToMarketParams(_0: IdToMarketParamsParams["_0"]) { + return this.eth_call(idToMarketParams, {_0}) + } + + isAuthorized(_0: IsAuthorizedParams["_0"], _1: IsAuthorizedParams["_1"]) { + return this.eth_call(isAuthorized, {_0, _1}) + } + + isIrmEnabled(_0: IsIrmEnabledParams["_0"]) { + return this.eth_call(isIrmEnabled, {_0}) + } + + isLltvEnabled(_0: IsLltvEnabledParams["_0"]) { + return this.eth_call(isLltvEnabled, {_0}) + } + + liquidate(marketParams: LiquidateParams["marketParams"], borrower: LiquidateParams["borrower"], seizedAssets: LiquidateParams["seizedAssets"], repaidShares: LiquidateParams["repaidShares"], data: LiquidateParams["data"]) { + return this.eth_call(liquidate, {marketParams, borrower, seizedAssets, repaidShares, data}) + } + + market(_0: MarketParams["_0"]) { + return this.eth_call(market, {_0}) + } + + nonce(_0: NonceParams["_0"]) { + return this.eth_call(nonce, {_0}) + } + + owner() { + return this.eth_call(owner, {}) + } + + position(_0: PositionParams["_0"], _1: PositionParams["_1"]) { + return this.eth_call(position, {_0, _1}) + } + + repay(marketParams: RepayParams["marketParams"], assets: RepayParams["assets"], shares: RepayParams["shares"], onBehalf: RepayParams["onBehalf"], data: RepayParams["data"]) { + return this.eth_call(repay, {marketParams, assets, shares, onBehalf, data}) + } + + supply(marketParams: SupplyParams["marketParams"], assets: SupplyParams["assets"], shares: SupplyParams["shares"], onBehalf: SupplyParams["onBehalf"], data: SupplyParams["data"]) { + return this.eth_call(supply, {marketParams, assets, shares, onBehalf, data}) + } + + withdraw(marketParams: WithdrawParams["marketParams"], assets: WithdrawParams["assets"], shares: WithdrawParams["shares"], onBehalf: WithdrawParams["onBehalf"], receiver: WithdrawParams["receiver"]) { + return this.eth_call(withdraw, {marketParams, assets, shares, onBehalf, receiver}) + } +} diff --git a/src/abi/morpho/events.ts b/src/abi/morpho/events.ts new file mode 100644 index 00000000..6a675d92 --- /dev/null +++ b/src/abi/morpho/events.ts @@ -0,0 +1,155 @@ +import { address, bool, bytes32, struct, uint256 } from '@subsquid/evm-codec' +import { event, indexed } from '../abi.support.js' +import type { EventParams as EParams } from '../abi.support.js' + +/** AccrueInterest(bytes32,uint256,uint256,uint256) */ +export const AccrueInterest = event('0x9d9bd501d0657d7dfe415f779a620a62b78bc508ddc0891fbbd8b7ac0f8fce87', { + id: indexed(bytes32), + prevBorrowRate: uint256, + interest: uint256, + feeShares: uint256, +}) +export type AccrueInterestEventArgs = EParams + +/** Borrow(bytes32,address,address,address,uint256,uint256) */ +export const Borrow = event('0x570954540bed6b1304a87dfe815a5eda4a648f7097a16240dcd85c9b5fd42a43', { + id: indexed(bytes32), + caller: address, + onBehalf: indexed(address), + receiver: indexed(address), + assets: uint256, + shares: uint256, +}) +export type BorrowEventArgs = EParams + +/** CreateMarket(bytes32,(address,address,address,address,uint256)) */ +export const CreateMarket = event('0xac4b2400f169220b0c0afdde7a0b32e775ba727ea1cb30b35f935cdaab8683ac', { + id: indexed(bytes32), + marketParams: struct({ + loanToken: address, + collateralToken: address, + oracle: address, + irm: address, + lltv: uint256, + }), +}) +export type CreateMarketEventArgs = EParams + +/** EnableIrm(address) */ +export const EnableIrm = event('0x590e04cdebeccba40f566186b9746ad295a4cd358ea4fefaaea6ce79630d96c0', { + irm: indexed(address), +}) +export type EnableIrmEventArgs = EParams + +/** EnableLltv(uint256) */ +export const EnableLltv = event('0x297b80e7a896fad470c630f6575072d609bde997260ff3db851939405ec29139', { + lltv: uint256, +}) +export type EnableLltvEventArgs = EParams + +/** FlashLoan(address,address,uint256) */ +export const FlashLoan = event('0xc76f1b4fe4396ac07a9fa55a415d4ca430e72651d37d3401f3bed7cb13fc4f12', { + caller: indexed(address), + token: indexed(address), + assets: uint256, +}) +export type FlashLoanEventArgs = EParams + +/** IncrementNonce(address,address,uint256) */ +export const IncrementNonce = event('0xa58af1a0c70dba0c7aa60d1a1a147ebd61000d1690a968828ac718bca927f2c7', { + caller: indexed(address), + authorizer: indexed(address), + usedNonce: uint256, +}) +export type IncrementNonceEventArgs = EParams + +/** Liquidate(bytes32,address,address,uint256,uint256,uint256,uint256,uint256) */ +export const Liquidate = event('0xa4946ede45d0c6f06a0f5ce92c9ad3b4751452d2fe0e25010783bcab57a67e41', { + id: indexed(bytes32), + caller: indexed(address), + borrower: indexed(address), + repaidAssets: uint256, + repaidShares: uint256, + seizedAssets: uint256, + badDebtAssets: uint256, + badDebtShares: uint256, +}) +export type LiquidateEventArgs = EParams + +/** Repay(bytes32,address,address,uint256,uint256) */ +export const Repay = event('0x52acb05cebbd3cd39715469f22afbf5a17496295ef3bc9bb5944056c63ccaa09', { + id: indexed(bytes32), + caller: indexed(address), + onBehalf: indexed(address), + assets: uint256, + shares: uint256, +}) +export type RepayEventArgs = EParams + +/** SetAuthorization(address,address,address,bool) */ +export const SetAuthorization = event('0xd5e969f01efe921d3f766bdebad25f0a05e3f237311f56482bf132d0326309c0', { + caller: indexed(address), + authorizer: indexed(address), + authorized: indexed(address), + newIsAuthorized: bool, +}) +export type SetAuthorizationEventArgs = EParams + +/** SetFee(bytes32,uint256) */ +export const SetFee = event('0x139d6f58e9a127229667c8e3b36e88890a66cfc8ab1024ddc513e189e125b75b', { + id: indexed(bytes32), + newFee: uint256, +}) +export type SetFeeEventArgs = EParams + +/** SetFeeRecipient(address) */ +export const SetFeeRecipient = event('0x2e979f80fe4d43055c584cf4a8467c55875ea36728fc37176c05acd784eb7a73', { + newFeeRecipient: indexed(address), +}) +export type SetFeeRecipientEventArgs = EParams + +/** SetOwner(address) */ +export const SetOwner = event('0x167d3e9c1016ab80e58802ca9da10ce5c6a0f4debc46a2e7a2cd9e56899a4fb5', { + newOwner: indexed(address), +}) +export type SetOwnerEventArgs = EParams + +/** Supply(bytes32,address,address,uint256,uint256) */ +export const Supply = event('0xedf8870433c83823eb071d3df1caa8d008f12f6440918c20d75a3602cda30fe0', { + id: indexed(bytes32), + caller: indexed(address), + onBehalf: indexed(address), + assets: uint256, + shares: uint256, +}) +export type SupplyEventArgs = EParams + +/** SupplyCollateral(bytes32,address,address,uint256) */ +export const SupplyCollateral = event('0xa3b9472a1399e17e123f3c2e6586c23e504184d504de59cdaa2b375e880c6184', { + id: indexed(bytes32), + caller: indexed(address), + onBehalf: indexed(address), + assets: uint256, +}) +export type SupplyCollateralEventArgs = EParams + +/** Withdraw(bytes32,address,address,address,uint256,uint256) */ +export const Withdraw = event('0xa56fc0ad5702ec05ce63666221f796fb62437c32db1aa1aa075fc6484cf58fbf', { + id: indexed(bytes32), + caller: address, + onBehalf: indexed(address), + receiver: indexed(address), + assets: uint256, + shares: uint256, +}) +export type WithdrawEventArgs = EParams + +/** WithdrawCollateral(bytes32,address,address,address,uint256) */ +export const WithdrawCollateral = event('0xe80ebd7cc9223d7382aab2e0d1d6155c65651f83d53c8b9b06901d167e321142', { + id: indexed(bytes32), + caller: address, + onBehalf: indexed(address), + receiver: indexed(address), + assets: uint256, +}) +export type WithdrawCollateralEventArgs = EParams diff --git a/src/abi/morpho/functions.ts b/src/abi/morpho/functions.ts new file mode 100644 index 00000000..e656e01b --- /dev/null +++ b/src/abi/morpho/functions.ts @@ -0,0 +1,328 @@ +import { address, array, bool, bytes, bytes32, struct, uint128, uint256, uint8 } from '@subsquid/evm-codec' +import { func } from '../abi.support.js' +import type { FunctionArguments, FunctionReturn } from '../abi.support.js' + +/** DOMAIN_SEPARATOR() */ +export const DOMAIN_SEPARATOR = func('0x3644e515', {}, bytes32) +export type DOMAIN_SEPARATORParams = FunctionArguments +export type DOMAIN_SEPARATORReturn = FunctionReturn + +/** accrueInterest((address,address,address,address,uint256)) */ +export const accrueInterest = func('0x151c1ade', { + marketParams: struct({ + loanToken: address, + collateralToken: address, + oracle: address, + irm: address, + lltv: uint256, + }), +}) +export type AccrueInterestParams = FunctionArguments +export type AccrueInterestReturn = FunctionReturn + +/** borrow((address,address,address,address,uint256),uint256,uint256,address,address) */ +export const borrow = func('0x50d8cd4b', { + marketParams: struct({ + loanToken: address, + collateralToken: address, + oracle: address, + irm: address, + lltv: uint256, + }), + assets: uint256, + shares: uint256, + onBehalf: address, + receiver: address, +}, struct({ + _0: uint256, + _1: uint256, +})) +export type BorrowParams = FunctionArguments +export type BorrowReturn = FunctionReturn + +/** createMarket((address,address,address,address,uint256)) */ +export const createMarket = func('0x8c1358a2', { + marketParams: struct({ + loanToken: address, + collateralToken: address, + oracle: address, + irm: address, + lltv: uint256, + }), +}) +export type CreateMarketParams = FunctionArguments +export type CreateMarketReturn = FunctionReturn + +/** enableIrm(address) */ +export const enableIrm = func('0x5a64f51e', { + irm: address, +}) +export type EnableIrmParams = FunctionArguments +export type EnableIrmReturn = FunctionReturn + +/** enableLltv(uint256) */ +export const enableLltv = func('0x4d98a93b', { + lltv: uint256, +}) +export type EnableLltvParams = FunctionArguments +export type EnableLltvReturn = FunctionReturn + +/** extSloads(bytes32[]) */ +export const extSloads = func('0x7784c685', { + slots: array(bytes32), +}, array(bytes32)) +export type ExtSloadsParams = FunctionArguments +export type ExtSloadsReturn = FunctionReturn + +/** feeRecipient() */ +export const feeRecipient = func('0x46904840', {}, address) +export type FeeRecipientParams = FunctionArguments +export type FeeRecipientReturn = FunctionReturn + +/** flashLoan(address,uint256,bytes) */ +export const flashLoan = func('0xe0232b42', { + token: address, + assets: uint256, + data: bytes, +}) +export type FlashLoanParams = FunctionArguments +export type FlashLoanReturn = FunctionReturn + +/** idToMarketParams(bytes32) */ +export const idToMarketParams = func('0x2c3c9157', { + _0: bytes32, +}, struct({ + loanToken: address, + collateralToken: address, + oracle: address, + irm: address, + lltv: uint256, +})) +export type IdToMarketParamsParams = FunctionArguments +export type IdToMarketParamsReturn = FunctionReturn + +/** isAuthorized(address,address) */ +export const isAuthorized = func('0x65e4ad9e', { + _0: address, + _1: address, +}, bool) +export type IsAuthorizedParams = FunctionArguments +export type IsAuthorizedReturn = FunctionReturn + +/** isIrmEnabled(address) */ +export const isIrmEnabled = func('0xf2b863ce', { + _0: address, +}, bool) +export type IsIrmEnabledParams = FunctionArguments +export type IsIrmEnabledReturn = FunctionReturn + +/** isLltvEnabled(uint256) */ +export const isLltvEnabled = func('0xb485f3b8', { + _0: uint256, +}, bool) +export type IsLltvEnabledParams = FunctionArguments +export type IsLltvEnabledReturn = FunctionReturn + +/** liquidate((address,address,address,address,uint256),address,uint256,uint256,bytes) */ +export const liquidate = func('0xd8eabcb8', { + marketParams: struct({ + loanToken: address, + collateralToken: address, + oracle: address, + irm: address, + lltv: uint256, + }), + borrower: address, + seizedAssets: uint256, + repaidShares: uint256, + data: bytes, +}, struct({ + _0: uint256, + _1: uint256, +})) +export type LiquidateParams = FunctionArguments +export type LiquidateReturn = FunctionReturn + +/** market(bytes32) */ +export const market = func('0x5c60e39a', { + _0: bytes32, +}, struct({ + totalSupplyAssets: uint128, + totalSupplyShares: uint128, + totalBorrowAssets: uint128, + totalBorrowShares: uint128, + lastUpdate: uint128, + fee: uint128, +})) +export type MarketParams = FunctionArguments +export type MarketReturn = FunctionReturn + +/** nonce(address) */ +export const nonce = func('0x70ae92d2', { + _0: address, +}, uint256) +export type NonceParams = FunctionArguments +export type NonceReturn = FunctionReturn + +/** owner() */ +export const owner = func('0x8da5cb5b', {}, address) +export type OwnerParams = FunctionArguments +export type OwnerReturn = FunctionReturn + +/** position(bytes32,address) */ +export const position = func('0x93c52062', { + _0: bytes32, + _1: address, +}, struct({ + supplyShares: uint256, + borrowShares: uint128, + collateral: uint128, +})) +export type PositionParams = FunctionArguments +export type PositionReturn = FunctionReturn + +/** repay((address,address,address,address,uint256),uint256,uint256,address,bytes) */ +export const repay = func('0x20b76e81', { + marketParams: struct({ + loanToken: address, + collateralToken: address, + oracle: address, + irm: address, + lltv: uint256, + }), + assets: uint256, + shares: uint256, + onBehalf: address, + data: bytes, +}, struct({ + _0: uint256, + _1: uint256, +})) +export type RepayParams = FunctionArguments +export type RepayReturn = FunctionReturn + +/** setAuthorization(address,bool) */ +export const setAuthorization = func('0xeecea000', { + authorized: address, + newIsAuthorized: bool, +}) +export type SetAuthorizationParams = FunctionArguments +export type SetAuthorizationReturn = FunctionReturn + +/** setAuthorizationWithSig((address,address,bool,uint256,uint256),(uint8,bytes32,bytes32)) */ +export const setAuthorizationWithSig = func('0x8069218f', { + authorization: struct({ + authorizer: address, + authorized: address, + isAuthorized: bool, + nonce: uint256, + deadline: uint256, + }), + signature: struct({ + v: uint8, + r: bytes32, + s: bytes32, + }), +}) +export type SetAuthorizationWithSigParams = FunctionArguments +export type SetAuthorizationWithSigReturn = FunctionReturn + +/** setFee((address,address,address,address,uint256),uint256) */ +export const setFee = func('0x2b4f013c', { + marketParams: struct({ + loanToken: address, + collateralToken: address, + oracle: address, + irm: address, + lltv: uint256, + }), + newFee: uint256, +}) +export type SetFeeParams = FunctionArguments +export type SetFeeReturn = FunctionReturn + +/** setFeeRecipient(address) */ +export const setFeeRecipient = func('0xe74b981b', { + newFeeRecipient: address, +}) +export type SetFeeRecipientParams = FunctionArguments +export type SetFeeRecipientReturn = FunctionReturn + +/** setOwner(address) */ +export const setOwner = func('0x13af4035', { + newOwner: address, +}) +export type SetOwnerParams = FunctionArguments +export type SetOwnerReturn = FunctionReturn + +/** supply((address,address,address,address,uint256),uint256,uint256,address,bytes) */ +export const supply = func('0xa99aad89', { + marketParams: struct({ + loanToken: address, + collateralToken: address, + oracle: address, + irm: address, + lltv: uint256, + }), + assets: uint256, + shares: uint256, + onBehalf: address, + data: bytes, +}, struct({ + _0: uint256, + _1: uint256, +})) +export type SupplyParams = FunctionArguments +export type SupplyReturn = FunctionReturn + +/** supplyCollateral((address,address,address,address,uint256),uint256,address,bytes) */ +export const supplyCollateral = func('0x238d6579', { + marketParams: struct({ + loanToken: address, + collateralToken: address, + oracle: address, + irm: address, + lltv: uint256, + }), + assets: uint256, + onBehalf: address, + data: bytes, +}) +export type SupplyCollateralParams = FunctionArguments +export type SupplyCollateralReturn = FunctionReturn + +/** withdraw((address,address,address,address,uint256),uint256,uint256,address,address) */ +export const withdraw = func('0x5c2bea49', { + marketParams: struct({ + loanToken: address, + collateralToken: address, + oracle: address, + irm: address, + lltv: uint256, + }), + assets: uint256, + shares: uint256, + onBehalf: address, + receiver: address, +}, struct({ + _0: uint256, + _1: uint256, +})) +export type WithdrawParams = FunctionArguments +export type WithdrawReturn = FunctionReturn + +/** withdrawCollateral((address,address,address,address,uint256),uint256,address,address) */ +export const withdrawCollateral = func('0x8720316d', { + marketParams: struct({ + loanToken: address, + collateralToken: address, + oracle: address, + irm: address, + lltv: uint256, + }), + assets: uint256, + onBehalf: address, + receiver: address, +}) +export type WithdrawCollateralParams = FunctionArguments +export type WithdrawCollateralReturn = FunctionReturn diff --git a/src/abi/morpho/index.ts b/src/abi/morpho/index.ts new file mode 100644 index 00000000..11829d6e --- /dev/null +++ b/src/abi/morpho/index.ts @@ -0,0 +1,4 @@ +export * as events from './events.js' +export * as functions from './functions.js' + +export { Contract } from './contract.js' diff --git a/src/abi/multicall.ts b/src/abi/multicall.ts index 3f7f10ce..17783e9e 100644 --- a/src/abi/multicall.ts +++ b/src/abi/multicall.ts @@ -1,174 +1,186 @@ import * as p from '@subsquid/evm-codec' -import {fun, ContractBase, type AbiFunction, type FunctionReturn, type FunctionArguments} from '@subsquid/evm-abi' - -const aggregate = fun('0x252dba42', "aggregate((address,bytes)[])", { - calls: p.array(p.struct({ - target: p.address, - callData: p.bytes - })) -}, {blockNumber: p.uint256, returnData: p.array(p.bytes)}) - -const tryAggregate = fun('0xbce38bd7', "tryAggregate(bool,(address,bytes)[])", { - requireSuccess: p.bool, - calls: p.array(p.struct({target: p.address, callData: p.bytes})) -}, p.array(p.struct({success: p.bool, returnData: p.bytes}))) - -export type MulticallResult> = { - success: true - value: FunctionReturn -} | { - success: false - returnData?: string - value?: undefined -} +import {func, ContractBase, type AbiFunction, type FunctionReturn, type FunctionArguments} from '@subsquid/evm-abi' + +// aggregate((address,bytes)[]) +const aggregate = func( + '0x252dba42', + { + calls: p.array( + p.struct({ + target: p.address, + callData: p.bytes, + }), + ), + }, + p.struct({blockNumber: p.uint256, returnData: p.array(p.bytes)}), +) + +// tryAggregate(bool,(address,bytes)[]) +const tryAggregate = func( + '0xbce38bd7', + { + requireSuccess: p.bool, + calls: p.array(p.struct({target: p.address, callData: p.bytes})), + }, + p.array(p.struct({success: p.bool, returnData: p.bytes})), +) + +export type MulticallResult> = + | { + success: true + value: FunctionReturn + } + | { + success: false + returnData?: string + value?: undefined + } type AnyFunc = AbiFunction -type AggregateTuple = [func: T, address: string, args: T extends AnyFunc ? FunctionArguments : never] -type Call = {target: string, func: AnyFunc, callData: string} +type AggregateTuple = [ + func: T, + address: string, + args: T extends AnyFunc ? FunctionArguments : never, +] +type Call = {target: string; func: AnyFunc; callData: string} export class Multicall extends ContractBase { - static aggregate = aggregate - static tryAggregate = tryAggregate + static aggregate = aggregate + static tryAggregate = tryAggregate + + aggregate( + func: TF, + address: string, + calls: FunctionArguments[], + pageSize?: number, + ): Promise[]> + + aggregate( + func: TF, + calls: (readonly [address: string, args: FunctionArguments])[], + pageSize?: number, + ): Promise[]> + + aggregate(calls: AggregateTuple[], pageSize?: number): Promise + + async aggregate(...args: any[]): Promise { + let [calls, pageSize] = this.makeCalls(args) + if (calls.length === 0) return [] + + const pages = Array.from(splitArray(pageSize, calls)) + const results = await Promise.all( + pages.map(async (page) => { + const {returnData} = await this.eth_call(aggregate, {calls: page}) + return returnData.map((data, i) => page[i].func.decodeResult(data)) + }), + ) + + return results.flat() + } - aggregate( - func: TF, - address: string, - calls: FunctionArguments[], - pageSize?: number - ): Promise[]> - - aggregate( - func: TF, - calls: (readonly [address: string, args: FunctionArguments])[], - pageSize?: number - ): Promise[]> - - aggregate( - calls: AggregateTuple[], - pageSize?: number - ): Promise - - async aggregate(...args: any[]): Promise { - let [calls, pageSize] = this.makeCalls(args) - if (calls.length === 0) return [] - - const pages = Array.from(splitArray(pageSize, calls)) - const results = await Promise.all( - pages.map(async (page) => { - const {returnData} = await this.eth_call(aggregate, {calls: page}) - return returnData.map((data, i) => page[i].func.decodeResult(data)) - }) - ) - - return results.flat() - } - - tryAggregate( - func: TF, - address: string, - calls: FunctionArguments[], - pageSize?: number - ): Promise[]> - - tryAggregate( - func: TF, - calls: (readonly [address: string, args: FunctionArguments])[], - pageSize?: number - ): Promise[]> - - tryAggregate( - calls: AggregateTuple[], - pageSize?: number - ): Promise[]> - - async tryAggregate(...args: any[]): Promise { - let [calls, pageSize] = this.makeCalls(args) - if (calls.length === 0) return [] - - const pages = Array.from(splitArray(pageSize, calls)) - const results = await Promise.all( - pages.map(async (page) => { - const response = await this.eth_call(tryAggregate, { - requireSuccess: false, - calls: page, - }) - return response.map((res, i) => { - if (res.success) { - try { - return { - success: true, - value: page[i].func.decodeResult(res.returnData) - } - } catch (err: any) { - return {success: false, returnData: res.returnData} + tryAggregate( + func: TF, + address: string, + calls: FunctionArguments[], + pageSize?: number, + ): Promise[]> + + tryAggregate( + func: TF, + calls: (readonly [address: string, args: FunctionArguments])[], + pageSize?: number, + ): Promise[]> + + tryAggregate(calls: AggregateTuple[], pageSize?: number): Promise[]> + + async tryAggregate(...args: any[]): Promise { + let [calls, pageSize] = this.makeCalls(args) + if (calls.length === 0) return [] + + const pages = Array.from(splitArray(pageSize, calls)) + const results = await Promise.all( + pages.map(async (page) => { + const response = await this.eth_call(tryAggregate, { + requireSuccess: false, + calls: page, + }) + return response.map((res, i) => { + if (res.success) { + try { + return { + success: true, + value: page[i].func.decodeResult(res.returnData), + } + } catch (err: any) { + return {success: false, returnData: res.returnData} + } + } else { + return {success: false} + } + }) + }), + ) + + return results.flat() + } + + private makeCalls(args: any[]): [calls: Call[], page: number] { + let page = typeof args[args.length - 1] == 'number' ? args.pop()! : Number.MAX_SAFE_INTEGER + switch (args.length) { + case 1: { + let list: AggregateTuple[] = args[0] + let calls: Call[] = new Array(list.length) + for (let i = 0; i < list.length; i++) { + let [func, address, args] = list[i] + calls[i] = {target: address, callData: func.encode(args), func} } - } else { - return {success: false} - } - }) - }) - ) - - return results.flat() - } - - private makeCalls(args: any[]): [calls: Call[], page: number] { - let page = typeof args[args.length - 1] == 'number' ? args.pop()! : Number.MAX_SAFE_INTEGER - switch (args.length) { - case 1: { - let list: AggregateTuple[] = args[0] - let calls: Call[] = new Array(list.length) - for (let i = 0; i < list.length; i++) { - let [func, address, args] = list[i] - calls[i] = {target: address, callData: func.encode(args), func} - } - return [calls, page] - } - case 2: { - let func: AnyFunc = args[0] - let list: [address: string, args: any][] = args[1] - let calls: Call[] = new Array(list.length) - for (let i = 0; i < list.length; i++) { - let [address, args] = list[i] - calls[i] = {target: address, callData: func.encode(args), func} - } - return [calls, page] - } - case 3: { - let func: AnyFunc = args[0] - let address: string = args[1] - let list: any = args[2] - let calls: Call[] = new Array(list.length) - for (let i = 0; i < list.length; i++) { - let args = list[i] - calls[i] = {target: address, callData: func.encode(args), func} + return [calls, page] + } + case 2: { + let func: AnyFunc = args[0] + let list: [address: string, args: any][] = args[1] + let calls: Call[] = new Array(list.length) + for (let i = 0; i < list.length; i++) { + let [address, args] = list[i] + calls[i] = {target: address, callData: func.encode(args), func} + } + return [calls, page] + } + case 3: { + let func: AnyFunc = args[0] + let address: string = args[1] + let list: any = args[2] + let calls: Call[] = new Array(list.length) + for (let i = 0; i < list.length; i++) { + let args = list[i] + calls[i] = {target: address, callData: func.encode(args), func} + } + return [calls, page] + } + default: + throw new Error(`Unexpected number of arguments: ${args.length}`) } - return [calls, page] - } - default: - throw new Error(`Unexpected number of arguments: ${args.length}`) } - } } function* splitSlice(maxSize: number, beg: number, end?: number): Iterable<[beg: number, end: number]> { - maxSize = Math.max(1, maxSize) - end = end ?? Number.MAX_SAFE_INTEGER - while (beg < end) { - let left = end - beg - let splits = Math.ceil(left / maxSize) - let step = Math.round(left / splits) - yield [beg, beg + step] - beg += step - } + maxSize = Math.max(1, maxSize) + end = end ?? Number.MAX_SAFE_INTEGER + while (beg < end) { + let left = end - beg + let splits = Math.ceil(left / maxSize) + let step = Math.round(left / splits) + yield [beg, beg + step] + beg += step + } } function* splitArray(maxSize: number, arr: T[]): Iterable { - if (arr.length <= maxSize) { - yield arr - } else { - for (let [beg, end] of splitSlice(maxSize, 0, arr.length)) { - yield arr.slice(beg, end) - } - } -} \ No newline at end of file + if (arr.length <= maxSize) { + yield arr + } else { + for (let [beg, end] of splitSlice(maxSize, 0, arr.length)) { + yield arr.slice(beg, end) + } + } +} diff --git a/src/abi/oeth-oracle-router.ts b/src/abi/oeth-oracle-router.ts deleted file mode 100644 index 84fbc983..00000000 --- a/src/abi/oeth-oracle-router.ts +++ /dev/null @@ -1,23 +0,0 @@ -import * as p from '@subsquid/evm-codec' -import { event, fun, viewFun, indexed, ContractBase } from '@subsquid/evm-abi' -import type { EventParams as EParams, FunctionArguments, FunctionReturn } from '@subsquid/evm-abi' - -export const functions = { - cacheDecimals: fun("0x36b6d944", "cacheDecimals(address)", {"asset": p.address}, p.uint8), - price: viewFun("0xaea91078", "price(address)", {"asset": p.address}, p.uint256), -} - -export class Contract extends ContractBase { - - price(asset: PriceParams["asset"]) { - return this.eth_call(functions.price, {asset}) - } -} - -/// Function types -export type CacheDecimalsParams = FunctionArguments -export type CacheDecimalsReturn = FunctionReturn - -export type PriceParams = FunctionArguments -export type PriceReturn = FunctionReturn - diff --git a/src/abi/oeth-oracle-router/contract.ts b/src/abi/oeth-oracle-router/contract.ts new file mode 100644 index 00000000..9bd09adc --- /dev/null +++ b/src/abi/oeth-oracle-router/contract.ts @@ -0,0 +1,13 @@ +import { ContractBase } from '../abi.support.js' +import { cacheDecimals, price } from './functions.js' +import type { CacheDecimalsParams, PriceParams } from './functions.js' + +export class Contract extends ContractBase { + cacheDecimals(asset: CacheDecimalsParams["asset"]) { + return this.eth_call(cacheDecimals, {asset}) + } + + price(asset: PriceParams["asset"]) { + return this.eth_call(price, {asset}) + } +} diff --git a/src/abi/oeth-oracle-router/functions.ts b/src/abi/oeth-oracle-router/functions.ts new file mode 100644 index 00000000..ef368ed3 --- /dev/null +++ b/src/abi/oeth-oracle-router/functions.ts @@ -0,0 +1,17 @@ +import { address, uint256, uint8 } from '@subsquid/evm-codec' +import { func } from '../abi.support.js' +import type { FunctionArguments, FunctionReturn } from '../abi.support.js' + +/** cacheDecimals(address) */ +export const cacheDecimals = func('0x36b6d944', { + asset: address, +}, uint8) +export type CacheDecimalsParams = FunctionArguments +export type CacheDecimalsReturn = FunctionReturn + +/** price(address) */ +export const price = func('0xaea91078', { + asset: address, +}, uint256) +export type PriceParams = FunctionArguments +export type PriceReturn = FunctionReturn diff --git a/src/abi/oeth-oracle-router/index.ts b/src/abi/oeth-oracle-router/index.ts new file mode 100644 index 00000000..ed5306bd --- /dev/null +++ b/src/abi/oeth-oracle-router/index.ts @@ -0,0 +1,3 @@ +export * as functions from './functions.js' + +export { Contract } from './contract.js' diff --git a/src/abi/oeth-zapper.ts b/src/abi/oeth-zapper.ts deleted file mode 100644 index 6e434aa2..00000000 --- a/src/abi/oeth-zapper.ts +++ /dev/null @@ -1,66 +0,0 @@ -import * as p from '@subsquid/evm-codec' -import { event, fun, viewFun, indexed, ContractBase } from '@subsquid/evm-abi' -import type { EventParams as EParams, FunctionArguments, FunctionReturn } from '@subsquid/evm-abi' - -export const events = { - Zap: event("0x9d0b99c299bdb5656c0c9db6e1886c612db5c2881760ea54ab244f6338b4ebd6", "Zap(address,address,uint256)", {"minter": indexed(p.address), "asset": indexed(p.address), "amount": p.uint256}), -} - -export const functions = { - deposit: fun("0xd0e30db0", "deposit()", {}, p.uint256), - depositSFRXETH: fun("0xd443e97d", "depositSFRXETH(uint256,uint256)", {"amount": p.uint256, "minOETH": p.uint256}, p.uint256), - frxeth: viewFun("0x6f708a9d", "frxeth()", {}, p.address), - oeth: viewFun("0xccfe2a69", "oeth()", {}, p.address), - sfrxeth: viewFun("0xa07311af", "sfrxeth()", {}, p.address), - vault: viewFun("0xfbfa77cf", "vault()", {}, p.address), - weth: viewFun("0x3fc8cef3", "weth()", {}, p.address), -} - -export class Contract extends ContractBase { - - frxeth() { - return this.eth_call(functions.frxeth, {}) - } - - oeth() { - return this.eth_call(functions.oeth, {}) - } - - sfrxeth() { - return this.eth_call(functions.sfrxeth, {}) - } - - vault() { - return this.eth_call(functions.vault, {}) - } - - weth() { - return this.eth_call(functions.weth, {}) - } -} - -/// Event types -export type ZapEventArgs = EParams - -/// Function types -export type DepositParams = FunctionArguments -export type DepositReturn = FunctionReturn - -export type DepositSFRXETHParams = FunctionArguments -export type DepositSFRXETHReturn = FunctionReturn - -export type FrxethParams = FunctionArguments -export type FrxethReturn = FunctionReturn - -export type OethParams = FunctionArguments -export type OethReturn = FunctionReturn - -export type SfrxethParams = FunctionArguments -export type SfrxethReturn = FunctionReturn - -export type VaultParams = FunctionArguments -export type VaultReturn = FunctionReturn - -export type WethParams = FunctionArguments -export type WethReturn = FunctionReturn - diff --git a/src/abi/oeth-zapper/contract.ts b/src/abi/oeth-zapper/contract.ts new file mode 100644 index 00000000..5b0e917c --- /dev/null +++ b/src/abi/oeth-zapper/contract.ts @@ -0,0 +1,33 @@ +import { ContractBase } from '../abi.support.js' +import { deposit, depositSFRXETH, frxeth, oeth, sfrxeth, vault, weth } from './functions.js' +import type { DepositSFRXETHParams } from './functions.js' + +export class Contract extends ContractBase { + deposit() { + return this.eth_call(deposit, {}) + } + + depositSFRXETH(amount: DepositSFRXETHParams["amount"], minOETH: DepositSFRXETHParams["minOETH"]) { + return this.eth_call(depositSFRXETH, {amount, minOETH}) + } + + frxeth() { + return this.eth_call(frxeth, {}) + } + + oeth() { + return this.eth_call(oeth, {}) + } + + sfrxeth() { + return this.eth_call(sfrxeth, {}) + } + + vault() { + return this.eth_call(vault, {}) + } + + weth() { + return this.eth_call(weth, {}) + } +} diff --git a/src/abi/oeth-zapper/events.ts b/src/abi/oeth-zapper/events.ts new file mode 100644 index 00000000..aa9d11bc --- /dev/null +++ b/src/abi/oeth-zapper/events.ts @@ -0,0 +1,11 @@ +import { address, uint256 } from '@subsquid/evm-codec' +import { event, indexed } from '../abi.support.js' +import type { EventParams as EParams } from '../abi.support.js' + +/** Zap(address,address,uint256) */ +export const Zap = event('0x9d0b99c299bdb5656c0c9db6e1886c612db5c2881760ea54ab244f6338b4ebd6', { + minter: indexed(address), + asset: indexed(address), + amount: uint256, +}) +export type ZapEventArgs = EParams diff --git a/src/abi/oeth-zapper/functions.ts b/src/abi/oeth-zapper/functions.ts new file mode 100644 index 00000000..278bd698 --- /dev/null +++ b/src/abi/oeth-zapper/functions.ts @@ -0,0 +1,41 @@ +import { address, uint256 } from '@subsquid/evm-codec' +import { func } from '../abi.support.js' +import type { FunctionArguments, FunctionReturn } from '../abi.support.js' + +/** deposit() */ +export const deposit = func('0xd0e30db0', {}, uint256) +export type DepositParams = FunctionArguments +export type DepositReturn = FunctionReturn + +/** depositSFRXETH(uint256,uint256) */ +export const depositSFRXETH = func('0xd443e97d', { + amount: uint256, + minOETH: uint256, +}, uint256) +export type DepositSFRXETHParams = FunctionArguments +export type DepositSFRXETHReturn = FunctionReturn + +/** frxeth() */ +export const frxeth = func('0x6f708a9d', {}, address) +export type FrxethParams = FunctionArguments +export type FrxethReturn = FunctionReturn + +/** oeth() */ +export const oeth = func('0xccfe2a69', {}, address) +export type OethParams = FunctionArguments +export type OethReturn = FunctionReturn + +/** sfrxeth() */ +export const sfrxeth = func('0xa07311af', {}, address) +export type SfrxethParams = FunctionArguments +export type SfrxethReturn = FunctionReturn + +/** vault() */ +export const vault = func('0xfbfa77cf', {}, address) +export type VaultParams = FunctionArguments +export type VaultReturn = FunctionReturn + +/** weth() */ +export const weth = func('0x3fc8cef3', {}, address) +export type WethParams = FunctionArguments +export type WethReturn = FunctionReturn diff --git a/src/abi/oeth-zapper/index.ts b/src/abi/oeth-zapper/index.ts new file mode 100644 index 00000000..11829d6e --- /dev/null +++ b/src/abi/oeth-zapper/index.ts @@ -0,0 +1,4 @@ +export * as events from './events.js' +export * as functions from './functions.js' + +export { Contract } from './contract.js' diff --git a/src/abi/oeth.abi.ts b/src/abi/oeth.abi.ts deleted file mode 100644 index ec4b524a..00000000 --- a/src/abi/oeth.abi.ts +++ /dev/null @@ -1,656 +0,0 @@ -export const ABI_JSON = [ - { - "type": "event", - "anonymous": false, - "name": "Approval", - "inputs": [ - { - "type": "address", - "name": "owner", - "indexed": true - }, - { - "type": "address", - "name": "spender", - "indexed": true - }, - { - "type": "uint256", - "name": "value", - "indexed": false - } - ] - }, - { - "type": "event", - "anonymous": false, - "name": "GovernorshipTransferred", - "inputs": [ - { - "type": "address", - "name": "previousGovernor", - "indexed": true - }, - { - "type": "address", - "name": "newGovernor", - "indexed": true - } - ] - }, - { - "type": "event", - "anonymous": false, - "name": "PendingGovernorshipTransfer", - "inputs": [ - { - "type": "address", - "name": "previousGovernor", - "indexed": true - }, - { - "type": "address", - "name": "newGovernor", - "indexed": true - } - ] - }, - { - "type": "event", - "anonymous": false, - "name": "TotalSupplyUpdatedHighres", - "inputs": [ - { - "type": "uint256", - "name": "totalSupply", - "indexed": false - }, - { - "type": "uint256", - "name": "rebasingCredits", - "indexed": false - }, - { - "type": "uint256", - "name": "rebasingCreditsPerToken", - "indexed": false - } - ] - }, - { - "type": "event", - "anonymous": false, - "name": "Transfer", - "inputs": [ - { - "type": "address", - "name": "from", - "indexed": true - }, - { - "type": "address", - "name": "to", - "indexed": true - }, - { - "type": "uint256", - "name": "value", - "indexed": false - } - ] - }, - { - "type": "function", - "name": "_totalSupply", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [ - { - "type": "uint256", - "name": "" - } - ] - }, - { - "type": "function", - "name": "allowance", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [ - { - "type": "address", - "name": "_owner" - }, - { - "type": "address", - "name": "_spender" - } - ], - "outputs": [ - { - "type": "uint256", - "name": "" - } - ] - }, - { - "type": "function", - "name": "approve", - "constant": false, - "payable": false, - "inputs": [ - { - "type": "address", - "name": "_spender" - }, - { - "type": "uint256", - "name": "_value" - } - ], - "outputs": [ - { - "type": "bool", - "name": "" - } - ] - }, - { - "type": "function", - "name": "balanceOf", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [ - { - "type": "address", - "name": "_account" - } - ], - "outputs": [ - { - "type": "uint256", - "name": "" - } - ] - }, - { - "type": "function", - "name": "burn", - "constant": false, - "payable": false, - "inputs": [ - { - "type": "address", - "name": "account" - }, - { - "type": "uint256", - "name": "amount" - } - ], - "outputs": [] - }, - { - "type": "function", - "name": "changeSupply", - "constant": false, - "payable": false, - "inputs": [ - { - "type": "uint256", - "name": "_newTotalSupply" - } - ], - "outputs": [] - }, - { - "type": "function", - "name": "claimGovernance", - "constant": false, - "payable": false, - "inputs": [], - "outputs": [] - }, - { - "type": "function", - "name": "creditsBalanceOf", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [ - { - "type": "address", - "name": "_account" - } - ], - "outputs": [ - { - "type": "uint256", - "name": "" - }, - { - "type": "uint256", - "name": "" - } - ] - }, - { - "type": "function", - "name": "creditsBalanceOfHighres", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [ - { - "type": "address", - "name": "_account" - } - ], - "outputs": [ - { - "type": "uint256", - "name": "" - }, - { - "type": "uint256", - "name": "" - }, - { - "type": "bool", - "name": "" - } - ] - }, - { - "type": "function", - "name": "decimals", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [ - { - "type": "uint8", - "name": "" - } - ] - }, - { - "type": "function", - "name": "decreaseAllowance", - "constant": false, - "payable": false, - "inputs": [ - { - "type": "address", - "name": "_spender" - }, - { - "type": "uint256", - "name": "_subtractedValue" - } - ], - "outputs": [ - { - "type": "bool", - "name": "" - } - ] - }, - { - "type": "function", - "name": "governor", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [ - { - "type": "address", - "name": "" - } - ] - }, - { - "type": "function", - "name": "increaseAllowance", - "constant": false, - "payable": false, - "inputs": [ - { - "type": "address", - "name": "_spender" - }, - { - "type": "uint256", - "name": "_addedValue" - } - ], - "outputs": [ - { - "type": "bool", - "name": "" - } - ] - }, - { - "type": "function", - "name": "initialize", - "constant": false, - "payable": false, - "inputs": [ - { - "type": "string", - "name": "_nameArg" - }, - { - "type": "string", - "name": "_symbolArg" - }, - { - "type": "address", - "name": "_vaultAddress" - }, - { - "type": "uint256", - "name": "_initialCreditsPerToken" - } - ], - "outputs": [] - }, - { - "type": "function", - "name": "isGovernor", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [ - { - "type": "bool", - "name": "" - } - ] - }, - { - "type": "function", - "name": "isUpgraded", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [ - { - "type": "address", - "name": "" - } - ], - "outputs": [ - { - "type": "uint256", - "name": "" - } - ] - }, - { - "type": "function", - "name": "mint", - "constant": false, - "payable": false, - "inputs": [ - { - "type": "address", - "name": "_account" - }, - { - "type": "uint256", - "name": "_amount" - } - ], - "outputs": [] - }, - { - "type": "function", - "name": "name", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [ - { - "type": "string", - "name": "" - } - ] - }, - { - "type": "function", - "name": "nonRebasingCreditsPerToken", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [ - { - "type": "address", - "name": "" - } - ], - "outputs": [ - { - "type": "uint256", - "name": "" - } - ] - }, - { - "type": "function", - "name": "nonRebasingSupply", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [ - { - "type": "uint256", - "name": "" - } - ] - }, - { - "type": "function", - "name": "rebaseOptIn", - "constant": false, - "payable": false, - "inputs": [], - "outputs": [] - }, - { - "type": "function", - "name": "rebaseOptOut", - "constant": false, - "payable": false, - "inputs": [], - "outputs": [] - }, - { - "type": "function", - "name": "rebaseState", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [ - { - "type": "address", - "name": "" - } - ], - "outputs": [ - { - "type": "uint8", - "name": "" - } - ] - }, - { - "type": "function", - "name": "rebasingCredits", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [ - { - "type": "uint256", - "name": "" - } - ] - }, - { - "type": "function", - "name": "rebasingCreditsHighres", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [ - { - "type": "uint256", - "name": "" - } - ] - }, - { - "type": "function", - "name": "rebasingCreditsPerToken", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [ - { - "type": "uint256", - "name": "" - } - ] - }, - { - "type": "function", - "name": "rebasingCreditsPerTokenHighres", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [ - { - "type": "uint256", - "name": "" - } - ] - }, - { - "type": "function", - "name": "symbol", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [ - { - "type": "string", - "name": "" - } - ] - }, - { - "type": "function", - "name": "totalSupply", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [ - { - "type": "uint256", - "name": "" - } - ] - }, - { - "type": "function", - "name": "transfer", - "constant": false, - "payable": false, - "inputs": [ - { - "type": "address", - "name": "_to" - }, - { - "type": "uint256", - "name": "_value" - } - ], - "outputs": [ - { - "type": "bool", - "name": "" - } - ] - }, - { - "type": "function", - "name": "transferFrom", - "constant": false, - "payable": false, - "inputs": [ - { - "type": "address", - "name": "_from" - }, - { - "type": "address", - "name": "_to" - }, - { - "type": "uint256", - "name": "_value" - } - ], - "outputs": [ - { - "type": "bool", - "name": "" - } - ] - }, - { - "type": "function", - "name": "transferGovernance", - "constant": false, - "payable": false, - "inputs": [ - { - "type": "address", - "name": "_newGovernor" - } - ], - "outputs": [] - }, - { - "type": "function", - "name": "vaultAddress", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [ - { - "type": "address", - "name": "" - } - ] - } -] as const diff --git a/src/abi/origin-arm.abi.ts b/src/abi/origin-arm.abi.ts new file mode 100644 index 00000000..8f009bb4 --- /dev/null +++ b/src/abi/origin-arm.abi.ts @@ -0,0 +1,1708 @@ +export const ABI_JSON = [ + { + "inputs": [ + { + "internalType": "address", + "name": "_otoken", + "type": "address" + }, + { + "internalType": "address", + "name": "_liquidityAsset", + "type": "address" + }, + { + "internalType": "address", + "name": "_vault", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_claimDelay", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_minSharesToRedeem", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "allowance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "needed", + "type": "uint256" + } + ], + "name": "ERC20InsufficientAllowance", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "balance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "needed", + "type": "uint256" + } + ], + "name": "ERC20InsufficientBalance", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "approver", + "type": "address" + } + ], + "name": "ERC20InvalidApprover", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "receiver", + "type": "address" + } + ], + "name": "ERC20InvalidReceiver", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "ERC20InvalidSender", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + } + ], + "name": "ERC20InvalidSpender", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidInitialization", + "type": "error" + }, + { + "inputs": [], + "name": "NotInitializing", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "bits", + "type": "uint8" + }, + { + "internalType": "int256", + "name": "value", + "type": "int256" + } + ], + "name": "SafeCastOverflowedIntDowncast", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "int256", + "name": "value", + "type": "int256" + } + ], + "name": "SafeCastOverflowedIntToUint", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "bits", + "type": "uint8" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "SafeCastOverflowedUintDowncast", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "SafeCastOverflowedUintToInt", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "armBuffer", + "type": "uint256" + } + ], + "name": "ARMBufferUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "market", + "type": "address" + } + ], + "name": "ActiveMarketUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "market", + "type": "address" + }, + { + "indexed": false, + "internalType": "int256", + "name": "assets", + "type": "int256" + } + ], + "name": "Allocated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "capManager", + "type": "address" + } + ], + "name": "CapManagerUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256[]", + "name": "requestIds", + "type": "uint256[]" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amountClaimed", + "type": "uint256" + } + ], + "name": "ClaimOriginWithdrawals", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "crossPrice", + "type": "uint256" + } + ], + "name": "CrossPriceUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "assets", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "shares", + "type": "uint256" + } + ], + "name": "Deposit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "feeCollector", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "fee", + "type": "uint256" + } + ], + "name": "FeeCollected", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "newFeeCollector", + "type": "address" + } + ], + "name": "FeeCollectorUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "fee", + "type": "uint256" + } + ], + "name": "FeeUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint64", + "name": "version", + "type": "uint64" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "market", + "type": "address" + } + ], + "name": "MarketAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "market", + "type": "address" + } + ], + "name": "MarketRemoved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "OperatorChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "withdrawer", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "requestId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "assets", + "type": "uint256" + } + ], + "name": "RedeemClaimed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "withdrawer", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "requestId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "assets", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "queued", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "claimTimestamp", + "type": "uint256" + } + ], + "name": "RedeemRequested", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "requestId", + "type": "uint256" + } + ], + "name": "RequestOriginWithdrawal", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "traderate0", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "traderate1", + "type": "uint256" + } + ], + "name": "TraderateChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "inputs": [], + "name": "FEE_SCALE", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MAX_CROSS_PRICE_DEVIATION", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "PRICE_SCALE", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "activeMarket", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "_markets", + "type": "address[]" + } + ], + "name": "addMarkets", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "allocate", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "armBuffer", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "baseAsset", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "capManager", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "claimDelay", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256[]", + "name": "requestIds", + "type": "uint256[]" + } + ], + "name": "claimOriginWithdrawals", + "outputs": [ + { + "internalType": "uint256", + "name": "amountClaimed", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "requestId", + "type": "uint256" + } + ], + "name": "claimRedeem", + "outputs": [ + { + "internalType": "uint256", + "name": "assets", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "claimable", + "outputs": [ + { + "internalType": "uint256", + "name": "claimableAmount", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "collectFees", + "outputs": [ + { + "internalType": "uint256", + "name": "fees", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + } + ], + "name": "convertToAssets", + "outputs": [ + { + "internalType": "uint256", + "name": "assets", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "assets", + "type": "uint256" + } + ], + "name": "convertToShares", + "outputs": [ + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "crossPrice", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "assets", + "type": "uint256" + }, + { + "internalType": "address", + "name": "receiver", + "type": "address" + } + ], + "name": "deposit", + "outputs": [ + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "assets", + "type": "uint256" + } + ], + "name": "deposit", + "outputs": [ + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "fee", + "outputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "feeCollector", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "feesAccrued", + "outputs": [ + { + "internalType": "uint256", + "name": "fees", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "_name", + "type": "string" + }, + { + "internalType": "string", + "name": "_symbol", + "type": "string" + }, + { + "internalType": "address", + "name": "_operator", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_fee", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_feeCollector", + "type": "address" + }, + { + "internalType": "address", + "name": "_capManager", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "lastAvailableAssets", + "outputs": [ + { + "internalType": "int128", + "name": "", + "type": "int128" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "liquidityAsset", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "minSharesToRedeem", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "nextWithdrawalIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "operator", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "assets", + "type": "uint256" + } + ], + "name": "previewDeposit", + "outputs": [ + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + } + ], + "name": "previewRedeem", + "outputs": [ + { + "internalType": "uint256", + "name": "assets", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_market", + "type": "address" + } + ], + "name": "removeMarket", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "requestOriginWithdrawal", + "outputs": [ + { + "internalType": "uint256", + "name": "requestId", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + } + ], + "name": "requestRedeem", + "outputs": [ + { + "internalType": "uint256", + "name": "requestId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "assets", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_armBuffer", + "type": "uint256" + } + ], + "name": "setARMBuffer", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_market", + "type": "address" + } + ], + "name": "setActiveMarket", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_capManager", + "type": "address" + } + ], + "name": "setCapManager", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newCrossPrice", + "type": "uint256" + } + ], + "name": "setCrossPrice", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_fee", + "type": "uint256" + } + ], + "name": "setFee", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_feeCollector", + "type": "address" + } + ], + "name": "setFeeCollector", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOperator", + "type": "address" + } + ], + "name": "setOperator", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "setOwner", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "buyT1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "sellT1", + "type": "uint256" + } + ], + "name": "setPrices", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "market", + "type": "address" + } + ], + "name": "supportedMarkets", + "outputs": [ + { + "internalType": "bool", + "name": "supported", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amountIn", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amountOutMin", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "path", + "type": "address[]" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + } + ], + "name": "swapExactTokensForTokens", + "outputs": [ + { + "internalType": "uint256[]", + "name": "amounts", + "type": "uint256[]" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IERC20", + "name": "inToken", + "type": "address" + }, + { + "internalType": "contract IERC20", + "name": "outToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amountIn", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amountOutMin", + "type": "uint256" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + } + ], + "name": "swapExactTokensForTokens", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amountOut", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amountInMax", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "path", + "type": "address[]" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + } + ], + "name": "swapTokensForExactTokens", + "outputs": [ + { + "internalType": "uint256[]", + "name": "amounts", + "type": "uint256[]" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IERC20", + "name": "inToken", + "type": "address" + }, + { + "internalType": "contract IERC20", + "name": "outToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amountOut", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amountInMax", + "type": "uint256" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + } + ], + "name": "swapTokensForExactTokens", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "token0", + "outputs": [ + { + "internalType": "contract IERC20", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "token1", + "outputs": [ + { + "internalType": "contract IERC20", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalAssets", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "traderate0", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "traderate1", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "vault", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "vaultWithdrawalAmount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "requestId", + "type": "uint256" + } + ], + "name": "withdrawalRequests", + "outputs": [ + { + "internalType": "address", + "name": "withdrawer", + "type": "address" + }, + { + "internalType": "bool", + "name": "claimed", + "type": "bool" + }, + { + "internalType": "uint40", + "name": "claimTimestamp", + "type": "uint40" + }, + { + "internalType": "uint128", + "name": "assets", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "queued", + "type": "uint128" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "withdrawsClaimed", + "outputs": [ + { + "internalType": "uint128", + "name": "", + "type": "uint128" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "withdrawsQueued", + "outputs": [ + { + "internalType": "uint128", + "name": "", + "type": "uint128" + } + ], + "stateMutability": "view", + "type": "function" + } +] as const diff --git a/src/abi/origin-arm.ts b/src/abi/origin-arm.ts deleted file mode 100644 index ec3ae7b4..00000000 --- a/src/abi/origin-arm.ts +++ /dev/null @@ -1,486 +0,0 @@ -import * as p from '@subsquid/evm-codec' -import { event, fun, viewFun, indexed, ContractBase } from '@subsquid/evm-abi' -import type { EventParams as EParams, FunctionArguments, FunctionReturn } from '@subsquid/evm-abi' - -export const events = { - ARMBufferUpdated: event("0x29128dbcf994e1ddc09cdbce01c287bb3f6b0cf4dd3c98174cadbbaf67bc22d7", "ARMBufferUpdated(uint256)", {"armBuffer": p.uint256}), - ActiveMarketUpdated: event("0xe9f5fe520e5763f721d470ecb21b23763a3b0b9e720070111b1b935c1107b065", "ActiveMarketUpdated(address)", {"market": indexed(p.address)}), - AdminChanged: event("0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f", "AdminChanged(address,address)", {"previousAdmin": p.address, "newAdmin": p.address}), - Allocated: event("0x8de94c5178842de5720920c14d6abd0f8367785673e0f607f37b91bda0f7700c", "Allocated(address,int256)", {"market": indexed(p.address), "assets": p.int256}), - Approval: event("0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925", "Approval(address,address,uint256)", {"owner": indexed(p.address), "spender": indexed(p.address), "value": p.uint256}), - CapManagerUpdated: event("0xb8fd9afc34c38fcd13b9a3b7646482eb1fddcefb40af2c70609972816eba3208", "CapManagerUpdated(address)", {"capManager": indexed(p.address)}), - ClaimOriginWithdrawals: event("0xfc7782d0ea7f5eb0351be7139942ba2c71155735d797fab90b6f2cdb99bce927", "ClaimOriginWithdrawals(uint256[],uint256)", {"requestIds": p.array(p.uint256), "amountClaimed": p.uint256}), - CrossPriceUpdated: event("0x6f938e86fbdbe7829d0289b348cd9e528f2f17c705f469f4a17a0a2796e007d0", "CrossPriceUpdated(uint256)", {"crossPrice": p.uint256}), - Deposit: event("0x90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a15", "Deposit(address,uint256,uint256)", {"owner": indexed(p.address), "assets": p.uint256, "shares": p.uint256}), - FeeCollected: event("0x06c5efeff5c320943d265dc4e5f1af95ad523555ce0c1957e367dda5514572df", "FeeCollected(address,uint256)", {"feeCollector": indexed(p.address), "fee": p.uint256}), - FeeCollectorUpdated: event("0xe5693914d19c789bdee50a362998c0bc8d035a835f9871da5d51152f0582c34f", "FeeCollectorUpdated(address)", {"newFeeCollector": indexed(p.address)}), - FeeUpdated: event("0x8c4d35e54a3f2ef1134138fd8ea3daee6a3c89e10d2665996babdf70261e2c76", "FeeUpdated(uint256)", {"fee": p.uint256}), - Initialized: event("0xc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2", "Initialized(uint64)", {"version": p.uint64}), - MarketAdded: event("0xbc600b1f03d316c479b49930c28e328809316458d5b5dacbb7419df5f6f89647", "MarketAdded(address)", {"market": indexed(p.address)}), - MarketRemoved: event("0x59d7b1e52008dc342c9421dadfc773114b914a65682a4e4b53cf60a970df0d77", "MarketRemoved(address)", {"market": indexed(p.address)}), - OperatorChanged: event("0x4721129e0e676ed6a92909bb24e853ccdd63ad72280cc2e974e38e480e0e6e54", "OperatorChanged(address)", {"newAdmin": p.address}), - RedeemClaimed: event("0x36dd2c9b55f12509e3b5f4f4d765ddefc2776a28018b18da2335cf2ab93bb268", "RedeemClaimed(address,uint256,uint256)", {"withdrawer": indexed(p.address), "requestId": indexed(p.uint256), "assets": p.uint256}), - RedeemRequested: event("0xc04c86cfd81036557541f9c68971ace59cbc9057ecab7d48874a6177ad117f4f", "RedeemRequested(address,uint256,uint256,uint256,uint256)", {"withdrawer": indexed(p.address), "requestId": indexed(p.uint256), "assets": p.uint256, "queued": p.uint256, "claimTimestamp": p.uint256}), - RequestOriginWithdrawal: event("0xb3a9170802de02e4fcb5968e12fb0b19c1e9e83035699af404f3dffbcdb6ac68", "RequestOriginWithdrawal(uint256,uint256)", {"amount": p.uint256, "requestId": p.uint256}), - TraderateChanged: event("0xa2136948fd1e5333c2ee27c9e48848a560b693e6bbd18082623a738179ff2952", "TraderateChanged(uint256,uint256)", {"traderate0": p.uint256, "traderate1": p.uint256}), - Transfer: event("0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", "Transfer(address,address,uint256)", {"from": indexed(p.address), "to": indexed(p.address), "value": p.uint256}), -} - -export const functions = { - FEE_SCALE: viewFun("0x8a5fddd8", "FEE_SCALE()", {}, p.uint256), - MAX_CROSS_PRICE_DEVIATION: viewFun("0x090b78c5", "MAX_CROSS_PRICE_DEVIATION()", {}, p.uint256), - PRICE_SCALE: viewFun("0xc33f59d3", "PRICE_SCALE()", {}, p.uint256), - activeMarket: viewFun("0xce318c51", "activeMarket()", {}, p.address), - addMarkets: fun("0xda40385d", "addMarkets(address[])", {"_markets": p.array(p.address)}, ), - allocate: fun("0xabaa9916", "allocate()", {}, ), - allowance: viewFun("0xdd62ed3e", "allowance(address,address)", {"owner": p.address, "spender": p.address}, p.uint256), - approve: fun("0x095ea7b3", "approve(address,uint256)", {"spender": p.address, "value": p.uint256}, p.bool), - armBuffer: viewFun("0xa4c84f25", "armBuffer()", {}, p.uint256), - balanceOf: viewFun("0x70a08231", "balanceOf(address)", {"account": p.address}, p.uint256), - baseAsset: viewFun("0xcdf456e1", "baseAsset()", {}, p.address), - capManager: viewFun("0x6d785a87", "capManager()", {}, p.address), - claimDelay: viewFun("0x1c8ec299", "claimDelay()", {}, p.uint256), - claimOriginWithdrawals: fun("0x01d5850f", "claimOriginWithdrawals(uint256[])", {"requestIds": p.array(p.uint256)}, p.uint256), - claimRedeem: fun("0xe46cf747", "claimRedeem(uint256)", {"requestId": p.uint256}, p.uint256), - claimable: viewFun("0xaf38d757", "claimable()", {}, p.uint256), - collectFees: fun("0xc8796572", "collectFees()", {}, p.uint256), - convertToAssets: viewFun("0x07a2d13a", "convertToAssets(uint256)", {"shares": p.uint256}, p.uint256), - convertToShares: viewFun("0xc6e6f592", "convertToShares(uint256)", {"assets": p.uint256}, p.uint256), - crossPrice: viewFun("0xf5488330", "crossPrice()", {}, p.uint256), - decimals: viewFun("0x313ce567", "decimals()", {}, p.uint8), - 'deposit(uint256,address)': fun("0x6e553f65", "deposit(uint256,address)", {"assets": p.uint256, "receiver": p.address}, p.uint256), - 'deposit(uint256)': fun("0xb6b55f25", "deposit(uint256)", {"assets": p.uint256}, p.uint256), - fee: viewFun("0xddca3f43", "fee()", {}, p.uint16), - feeCollector: viewFun("0xc415b95c", "feeCollector()", {}, p.address), - feesAccrued: viewFun("0x94db0595", "feesAccrued()", {}, p.uint256), - initialize: fun("0xb3ddda2a", "initialize(string,string,address,uint256,address,address)", {"_name": p.string, "_symbol": p.string, "_operator": p.address, "_fee": p.uint256, "_feeCollector": p.address, "_capManager": p.address}, ), - lastAvailableAssets: viewFun("0x2eb6328b", "lastAvailableAssets()", {}, p.int128), - liquidityAsset: viewFun("0x209b2bca", "liquidityAsset()", {}, p.address), - minSharesToRedeem: viewFun("0x50d0ea39", "minSharesToRedeem()", {}, p.uint256), - name: viewFun("0x06fdde03", "name()", {}, p.string), - nextWithdrawalIndex: viewFun("0xbba9282e", "nextWithdrawalIndex()", {}, p.uint256), - operator: viewFun("0x570ca735", "operator()", {}, p.address), - owner: viewFun("0x8da5cb5b", "owner()", {}, p.address), - previewDeposit: viewFun("0xef8b30f7", "previewDeposit(uint256)", {"assets": p.uint256}, p.uint256), - previewRedeem: viewFun("0x4cdad506", "previewRedeem(uint256)", {"shares": p.uint256}, p.uint256), - removeMarket: fun("0xdb913236", "removeMarket(address)", {"_market": p.address}, ), - requestOriginWithdrawal: fun("0xaa5928be", "requestOriginWithdrawal(uint256)", {"amount": p.uint256}, p.uint256), - requestRedeem: fun("0xaa2f892d", "requestRedeem(uint256)", {"shares": p.uint256}, {"requestId": p.uint256, "assets": p.uint256}), - setARMBuffer: fun("0x95f9e9e6", "setARMBuffer(uint256)", {"_armBuffer": p.uint256}, ), - setActiveMarket: fun("0xab710b24", "setActiveMarket(address)", {"_market": p.address}, ), - setCapManager: fun("0x0e608b30", "setCapManager(address)", {"_capManager": p.address}, ), - setCrossPrice: fun("0x30486f3c", "setCrossPrice(uint256)", {"newCrossPrice": p.uint256}, ), - setFee: fun("0x69fe0e2d", "setFee(uint256)", {"_fee": p.uint256}, ), - setFeeCollector: fun("0xa42dce80", "setFeeCollector(address)", {"_feeCollector": p.address}, ), - setOperator: fun("0xb3ab15fb", "setOperator(address)", {"newOperator": p.address}, ), - setOwner: fun("0x13af4035", "setOwner(address)", {"newOwner": p.address}, ), - setPrices: fun("0x05fefda7", "setPrices(uint256,uint256)", {"buyT1": p.uint256, "sellT1": p.uint256}, ), - supportedMarkets: viewFun("0x20761fc4", "supportedMarkets(address)", {"market": p.address}, p.bool), - 'swapExactTokensForTokens(uint256,uint256,address[],address,uint256)': fun("0x38ed1739", "swapExactTokensForTokens(uint256,uint256,address[],address,uint256)", {"amountIn": p.uint256, "amountOutMin": p.uint256, "path": p.array(p.address), "to": p.address, "deadline": p.uint256}, p.array(p.uint256)), - 'swapExactTokensForTokens(address,address,uint256,uint256,address)': fun("0x6c08c57e", "swapExactTokensForTokens(address,address,uint256,uint256,address)", {"inToken": p.address, "outToken": p.address, "amountIn": p.uint256, "amountOutMin": p.uint256, "to": p.address}, ), - 'swapTokensForExactTokens(uint256,uint256,address[],address,uint256)': fun("0x8803dbee", "swapTokensForExactTokens(uint256,uint256,address[],address,uint256)", {"amountOut": p.uint256, "amountInMax": p.uint256, "path": p.array(p.address), "to": p.address, "deadline": p.uint256}, p.array(p.uint256)), - 'swapTokensForExactTokens(address,address,uint256,uint256,address)': fun("0xf7d31809", "swapTokensForExactTokens(address,address,uint256,uint256,address)", {"inToken": p.address, "outToken": p.address, "amountOut": p.uint256, "amountInMax": p.uint256, "to": p.address}, ), - symbol: viewFun("0x95d89b41", "symbol()", {}, p.string), - token0: viewFun("0x0dfe1681", "token0()", {}, p.address), - token1: viewFun("0xd21220a7", "token1()", {}, p.address), - totalAssets: viewFun("0x01e1d114", "totalAssets()", {}, p.uint256), - totalSupply: viewFun("0x18160ddd", "totalSupply()", {}, p.uint256), - traderate0: viewFun("0x45059a6b", "traderate0()", {}, p.uint256), - traderate1: viewFun("0xcf1de5d8", "traderate1()", {}, p.uint256), - transfer: fun("0xa9059cbb", "transfer(address,uint256)", {"to": p.address, "value": p.uint256}, p.bool), - transferFrom: fun("0x23b872dd", "transferFrom(address,address,uint256)", {"from": p.address, "to": p.address, "value": p.uint256}, p.bool), - vault: viewFun("0xfbfa77cf", "vault()", {}, p.address), - vaultWithdrawalAmount: viewFun("0x0fa28841", "vaultWithdrawalAmount()", {}, p.uint256), - withdrawalRequests: viewFun("0x937b2581", "withdrawalRequests(uint256)", {"requestId": p.uint256}, {"withdrawer": p.address, "claimed": p.bool, "claimTimestamp": p.uint40, "assets": p.uint128, "queued": p.uint128}), - withdrawsClaimed: viewFun("0x35ce81c4", "withdrawsClaimed()", {}, p.uint128), - withdrawsQueued: viewFun("0x6ec68625", "withdrawsQueued()", {}, p.uint128), -} - -export class Contract extends ContractBase { - - FEE_SCALE() { - return this.eth_call(functions.FEE_SCALE, {}) - } - - MAX_CROSS_PRICE_DEVIATION() { - return this.eth_call(functions.MAX_CROSS_PRICE_DEVIATION, {}) - } - - PRICE_SCALE() { - return this.eth_call(functions.PRICE_SCALE, {}) - } - - activeMarket() { - return this.eth_call(functions.activeMarket, {}) - } - - allowance(owner: AllowanceParams["owner"], spender: AllowanceParams["spender"]) { - return this.eth_call(functions.allowance, {owner, spender}) - } - - armBuffer() { - return this.eth_call(functions.armBuffer, {}) - } - - balanceOf(account: BalanceOfParams["account"]) { - return this.eth_call(functions.balanceOf, {account}) - } - - baseAsset() { - return this.eth_call(functions.baseAsset, {}) - } - - capManager() { - return this.eth_call(functions.capManager, {}) - } - - claimDelay() { - return this.eth_call(functions.claimDelay, {}) - } - - claimable() { - return this.eth_call(functions.claimable, {}) - } - - convertToAssets(shares: ConvertToAssetsParams["shares"]) { - return this.eth_call(functions.convertToAssets, {shares}) - } - - convertToShares(assets: ConvertToSharesParams["assets"]) { - return this.eth_call(functions.convertToShares, {assets}) - } - - crossPrice() { - return this.eth_call(functions.crossPrice, {}) - } - - decimals() { - return this.eth_call(functions.decimals, {}) - } - - fee() { - return this.eth_call(functions.fee, {}) - } - - feeCollector() { - return this.eth_call(functions.feeCollector, {}) - } - - feesAccrued() { - return this.eth_call(functions.feesAccrued, {}) - } - - lastAvailableAssets() { - return this.eth_call(functions.lastAvailableAssets, {}) - } - - liquidityAsset() { - return this.eth_call(functions.liquidityAsset, {}) - } - - minSharesToRedeem() { - return this.eth_call(functions.minSharesToRedeem, {}) - } - - name() { - return this.eth_call(functions.name, {}) - } - - nextWithdrawalIndex() { - return this.eth_call(functions.nextWithdrawalIndex, {}) - } - - operator() { - return this.eth_call(functions.operator, {}) - } - - owner() { - return this.eth_call(functions.owner, {}) - } - - previewDeposit(assets: PreviewDepositParams["assets"]) { - return this.eth_call(functions.previewDeposit, {assets}) - } - - previewRedeem(shares: PreviewRedeemParams["shares"]) { - return this.eth_call(functions.previewRedeem, {shares}) - } - - supportedMarkets(market: SupportedMarketsParams["market"]) { - return this.eth_call(functions.supportedMarkets, {market}) - } - - symbol() { - return this.eth_call(functions.symbol, {}) - } - - token0() { - return this.eth_call(functions.token0, {}) - } - - token1() { - return this.eth_call(functions.token1, {}) - } - - totalAssets() { - return this.eth_call(functions.totalAssets, {}) - } - - totalSupply() { - return this.eth_call(functions.totalSupply, {}) - } - - traderate0() { - return this.eth_call(functions.traderate0, {}) - } - - traderate1() { - return this.eth_call(functions.traderate1, {}) - } - - vault() { - return this.eth_call(functions.vault, {}) - } - - vaultWithdrawalAmount() { - return this.eth_call(functions.vaultWithdrawalAmount, {}) - } - - withdrawalRequests(requestId: WithdrawalRequestsParams["requestId"]) { - return this.eth_call(functions.withdrawalRequests, {requestId}) - } - - withdrawsClaimed() { - return this.eth_call(functions.withdrawsClaimed, {}) - } - - withdrawsQueued() { - return this.eth_call(functions.withdrawsQueued, {}) - } -} - -/// Event types -export type ARMBufferUpdatedEventArgs = EParams -export type ActiveMarketUpdatedEventArgs = EParams -export type AdminChangedEventArgs = EParams -export type AllocatedEventArgs = EParams -export type ApprovalEventArgs = EParams -export type CapManagerUpdatedEventArgs = EParams -export type ClaimOriginWithdrawalsEventArgs = EParams -export type CrossPriceUpdatedEventArgs = EParams -export type DepositEventArgs = EParams -export type FeeCollectedEventArgs = EParams -export type FeeCollectorUpdatedEventArgs = EParams -export type FeeUpdatedEventArgs = EParams -export type InitializedEventArgs = EParams -export type MarketAddedEventArgs = EParams -export type MarketRemovedEventArgs = EParams -export type OperatorChangedEventArgs = EParams -export type RedeemClaimedEventArgs = EParams -export type RedeemRequestedEventArgs = EParams -export type RequestOriginWithdrawalEventArgs = EParams -export type TraderateChangedEventArgs = EParams -export type TransferEventArgs = EParams - -/// Function types -export type FEE_SCALEParams = FunctionArguments -export type FEE_SCALEReturn = FunctionReturn - -export type MAX_CROSS_PRICE_DEVIATIONParams = FunctionArguments -export type MAX_CROSS_PRICE_DEVIATIONReturn = FunctionReturn - -export type PRICE_SCALEParams = FunctionArguments -export type PRICE_SCALEReturn = FunctionReturn - -export type ActiveMarketParams = FunctionArguments -export type ActiveMarketReturn = FunctionReturn - -export type AddMarketsParams = FunctionArguments -export type AddMarketsReturn = FunctionReturn - -export type AllocateParams = FunctionArguments -export type AllocateReturn = FunctionReturn - -export type AllowanceParams = FunctionArguments -export type AllowanceReturn = FunctionReturn - -export type ApproveParams = FunctionArguments -export type ApproveReturn = FunctionReturn - -export type ArmBufferParams = FunctionArguments -export type ArmBufferReturn = FunctionReturn - -export type BalanceOfParams = FunctionArguments -export type BalanceOfReturn = FunctionReturn - -export type BaseAssetParams = FunctionArguments -export type BaseAssetReturn = FunctionReturn - -export type CapManagerParams = FunctionArguments -export type CapManagerReturn = FunctionReturn - -export type ClaimDelayParams = FunctionArguments -export type ClaimDelayReturn = FunctionReturn - -export type ClaimOriginWithdrawalsParams = FunctionArguments -export type ClaimOriginWithdrawalsReturn = FunctionReturn - -export type ClaimRedeemParams = FunctionArguments -export type ClaimRedeemReturn = FunctionReturn - -export type ClaimableParams = FunctionArguments -export type ClaimableReturn = FunctionReturn - -export type CollectFeesParams = FunctionArguments -export type CollectFeesReturn = FunctionReturn - -export type ConvertToAssetsParams = FunctionArguments -export type ConvertToAssetsReturn = FunctionReturn - -export type ConvertToSharesParams = FunctionArguments -export type ConvertToSharesReturn = FunctionReturn - -export type CrossPriceParams = FunctionArguments -export type CrossPriceReturn = FunctionReturn - -export type DecimalsParams = FunctionArguments -export type DecimalsReturn = FunctionReturn - -export type DepositParams_0 = FunctionArguments -export type DepositReturn_0 = FunctionReturn - -export type DepositParams_1 = FunctionArguments -export type DepositReturn_1 = FunctionReturn - -export type FeeParams = FunctionArguments -export type FeeReturn = FunctionReturn - -export type FeeCollectorParams = FunctionArguments -export type FeeCollectorReturn = FunctionReturn - -export type FeesAccruedParams = FunctionArguments -export type FeesAccruedReturn = FunctionReturn - -export type InitializeParams = FunctionArguments -export type InitializeReturn = FunctionReturn - -export type LastAvailableAssetsParams = FunctionArguments -export type LastAvailableAssetsReturn = FunctionReturn - -export type LiquidityAssetParams = FunctionArguments -export type LiquidityAssetReturn = FunctionReturn - -export type MinSharesToRedeemParams = FunctionArguments -export type MinSharesToRedeemReturn = FunctionReturn - -export type NameParams = FunctionArguments -export type NameReturn = FunctionReturn - -export type NextWithdrawalIndexParams = FunctionArguments -export type NextWithdrawalIndexReturn = FunctionReturn - -export type OperatorParams = FunctionArguments -export type OperatorReturn = FunctionReturn - -export type OwnerParams = FunctionArguments -export type OwnerReturn = FunctionReturn - -export type PreviewDepositParams = FunctionArguments -export type PreviewDepositReturn = FunctionReturn - -export type PreviewRedeemParams = FunctionArguments -export type PreviewRedeemReturn = FunctionReturn - -export type RemoveMarketParams = FunctionArguments -export type RemoveMarketReturn = FunctionReturn - -export type RequestOriginWithdrawalParams = FunctionArguments -export type RequestOriginWithdrawalReturn = FunctionReturn - -export type RequestRedeemParams = FunctionArguments -export type RequestRedeemReturn = FunctionReturn - -export type SetARMBufferParams = FunctionArguments -export type SetARMBufferReturn = FunctionReturn - -export type SetActiveMarketParams = FunctionArguments -export type SetActiveMarketReturn = FunctionReturn - -export type SetCapManagerParams = FunctionArguments -export type SetCapManagerReturn = FunctionReturn - -export type SetCrossPriceParams = FunctionArguments -export type SetCrossPriceReturn = FunctionReturn - -export type SetFeeParams = FunctionArguments -export type SetFeeReturn = FunctionReturn - -export type SetFeeCollectorParams = FunctionArguments -export type SetFeeCollectorReturn = FunctionReturn - -export type SetOperatorParams = FunctionArguments -export type SetOperatorReturn = FunctionReturn - -export type SetOwnerParams = FunctionArguments -export type SetOwnerReturn = FunctionReturn - -export type SetPricesParams = FunctionArguments -export type SetPricesReturn = FunctionReturn - -export type SupportedMarketsParams = FunctionArguments -export type SupportedMarketsReturn = FunctionReturn - -export type SwapExactTokensForTokensParams_0 = FunctionArguments -export type SwapExactTokensForTokensReturn_0 = FunctionReturn - -export type SwapExactTokensForTokensParams_1 = FunctionArguments -export type SwapExactTokensForTokensReturn_1 = FunctionReturn - -export type SwapTokensForExactTokensParams_0 = FunctionArguments -export type SwapTokensForExactTokensReturn_0 = FunctionReturn - -export type SwapTokensForExactTokensParams_1 = FunctionArguments -export type SwapTokensForExactTokensReturn_1 = FunctionReturn - -export type SymbolParams = FunctionArguments -export type SymbolReturn = FunctionReturn - -export type Token0Params = FunctionArguments -export type Token0Return = FunctionReturn - -export type Token1Params = FunctionArguments -export type Token1Return = FunctionReturn - -export type TotalAssetsParams = FunctionArguments -export type TotalAssetsReturn = FunctionReturn - -export type TotalSupplyParams = FunctionArguments -export type TotalSupplyReturn = FunctionReturn - -export type Traderate0Params = FunctionArguments -export type Traderate0Return = FunctionReturn - -export type Traderate1Params = FunctionArguments -export type Traderate1Return = FunctionReturn - -export type TransferParams = FunctionArguments -export type TransferReturn = FunctionReturn - -export type TransferFromParams = FunctionArguments -export type TransferFromReturn = FunctionReturn - -export type VaultParams = FunctionArguments -export type VaultReturn = FunctionReturn - -export type VaultWithdrawalAmountParams = FunctionArguments -export type VaultWithdrawalAmountReturn = FunctionReturn - -export type WithdrawalRequestsParams = FunctionArguments -export type WithdrawalRequestsReturn = FunctionReturn - -export type WithdrawsClaimedParams = FunctionArguments -export type WithdrawsClaimedReturn = FunctionReturn - -export type WithdrawsQueuedParams = FunctionArguments -export type WithdrawsQueuedReturn = FunctionReturn - diff --git a/src/abi/origin-arm/contract.ts b/src/abi/origin-arm/contract.ts new file mode 100644 index 00000000..74a5f8b4 --- /dev/null +++ b/src/abi/origin-arm/contract.ts @@ -0,0 +1,213 @@ +import { ContractBase } from '../abi.support.js' +import { FEE_SCALE, MAX_CROSS_PRICE_DEVIATION, PRICE_SCALE, activeMarket, allowance, approve, armBuffer, balanceOf, baseAsset, capManager, claimDelay, claimOriginWithdrawals, claimRedeem, claimable, collectFees, convertToAssets, convertToShares, crossPrice, decimals, deposit, deposit_1, fee, feeCollector, feesAccrued, lastAvailableAssets, liquidityAsset, minSharesToRedeem, name, nextWithdrawalIndex, operator, owner, previewDeposit, previewRedeem, requestOriginWithdrawal, requestRedeem, supportedMarkets, swapExactTokensForTokens, swapTokensForExactTokens, symbol, token0, token1, totalAssets, totalSupply, traderate0, traderate1, transfer, transferFrom, vault, vaultWithdrawalAmount, withdrawalRequests, withdrawsClaimed, withdrawsQueued } from './functions.js' +import type { AllowanceParams, ApproveParams, BalanceOfParams, ClaimOriginWithdrawalsParams, ClaimRedeemParams, ConvertToAssetsParams, ConvertToSharesParams, DepositParams, DepositParams_1, PreviewDepositParams, PreviewRedeemParams, RequestOriginWithdrawalParams, RequestRedeemParams, SupportedMarketsParams, SwapExactTokensForTokensParams, SwapTokensForExactTokensParams, TransferFromParams, TransferParams, WithdrawalRequestsParams } from './functions.js' + +export class Contract extends ContractBase { + FEE_SCALE() { + return this.eth_call(FEE_SCALE, {}) + } + + MAX_CROSS_PRICE_DEVIATION() { + return this.eth_call(MAX_CROSS_PRICE_DEVIATION, {}) + } + + PRICE_SCALE() { + return this.eth_call(PRICE_SCALE, {}) + } + + activeMarket() { + return this.eth_call(activeMarket, {}) + } + + allowance(owner: AllowanceParams["owner"], spender: AllowanceParams["spender"]) { + return this.eth_call(allowance, {owner, spender}) + } + + approve(spender: ApproveParams["spender"], value: ApproveParams["value"]) { + return this.eth_call(approve, {spender, value}) + } + + armBuffer() { + return this.eth_call(armBuffer, {}) + } + + balanceOf(account: BalanceOfParams["account"]) { + return this.eth_call(balanceOf, {account}) + } + + baseAsset() { + return this.eth_call(baseAsset, {}) + } + + capManager() { + return this.eth_call(capManager, {}) + } + + claimDelay() { + return this.eth_call(claimDelay, {}) + } + + claimOriginWithdrawals(requestIds: ClaimOriginWithdrawalsParams["requestIds"]) { + return this.eth_call(claimOriginWithdrawals, {requestIds}) + } + + claimRedeem(requestId: ClaimRedeemParams["requestId"]) { + return this.eth_call(claimRedeem, {requestId}) + } + + claimable() { + return this.eth_call(claimable, {}) + } + + collectFees() { + return this.eth_call(collectFees, {}) + } + + convertToAssets(shares: ConvertToAssetsParams["shares"]) { + return this.eth_call(convertToAssets, {shares}) + } + + convertToShares(assets: ConvertToSharesParams["assets"]) { + return this.eth_call(convertToShares, {assets}) + } + + crossPrice() { + return this.eth_call(crossPrice, {}) + } + + decimals() { + return this.eth_call(decimals, {}) + } + + deposit(assets: DepositParams["assets"], receiver: DepositParams["receiver"]) { + return this.eth_call(deposit, {assets, receiver}) + } + + deposit_1(assets: DepositParams_1["assets"]) { + return this.eth_call(deposit_1, {assets}) + } + + fee() { + return this.eth_call(fee, {}) + } + + feeCollector() { + return this.eth_call(feeCollector, {}) + } + + feesAccrued() { + return this.eth_call(feesAccrued, {}) + } + + lastAvailableAssets() { + return this.eth_call(lastAvailableAssets, {}) + } + + liquidityAsset() { + return this.eth_call(liquidityAsset, {}) + } + + minSharesToRedeem() { + return this.eth_call(minSharesToRedeem, {}) + } + + name() { + return this.eth_call(name, {}) + } + + nextWithdrawalIndex() { + return this.eth_call(nextWithdrawalIndex, {}) + } + + operator() { + return this.eth_call(operator, {}) + } + + owner() { + return this.eth_call(owner, {}) + } + + previewDeposit(assets: PreviewDepositParams["assets"]) { + return this.eth_call(previewDeposit, {assets}) + } + + previewRedeem(shares: PreviewRedeemParams["shares"]) { + return this.eth_call(previewRedeem, {shares}) + } + + requestOriginWithdrawal(amount: RequestOriginWithdrawalParams["amount"]) { + return this.eth_call(requestOriginWithdrawal, {amount}) + } + + requestRedeem(shares: RequestRedeemParams["shares"]) { + return this.eth_call(requestRedeem, {shares}) + } + + supportedMarkets(market: SupportedMarketsParams["market"]) { + return this.eth_call(supportedMarkets, {market}) + } + + swapExactTokensForTokens(amountIn: SwapExactTokensForTokensParams["amountIn"], amountOutMin: SwapExactTokensForTokensParams["amountOutMin"], path: SwapExactTokensForTokensParams["path"], to: SwapExactTokensForTokensParams["to"], deadline: SwapExactTokensForTokensParams["deadline"]) { + return this.eth_call(swapExactTokensForTokens, {amountIn, amountOutMin, path, to, deadline}) + } + + swapTokensForExactTokens(amountOut: SwapTokensForExactTokensParams["amountOut"], amountInMax: SwapTokensForExactTokensParams["amountInMax"], path: SwapTokensForExactTokensParams["path"], to: SwapTokensForExactTokensParams["to"], deadline: SwapTokensForExactTokensParams["deadline"]) { + return this.eth_call(swapTokensForExactTokens, {amountOut, amountInMax, path, to, deadline}) + } + + symbol() { + return this.eth_call(symbol, {}) + } + + token0() { + return this.eth_call(token0, {}) + } + + token1() { + return this.eth_call(token1, {}) + } + + totalAssets() { + return this.eth_call(totalAssets, {}) + } + + totalSupply() { + return this.eth_call(totalSupply, {}) + } + + traderate0() { + return this.eth_call(traderate0, {}) + } + + traderate1() { + return this.eth_call(traderate1, {}) + } + + transfer(to: TransferParams["to"], value: TransferParams["value"]) { + return this.eth_call(transfer, {to, value}) + } + + transferFrom(from: TransferFromParams["from"], to: TransferFromParams["to"], value: TransferFromParams["value"]) { + return this.eth_call(transferFrom, {from, to, value}) + } + + vault() { + return this.eth_call(vault, {}) + } + + vaultWithdrawalAmount() { + return this.eth_call(vaultWithdrawalAmount, {}) + } + + withdrawalRequests(requestId: WithdrawalRequestsParams["requestId"]) { + return this.eth_call(withdrawalRequests, {requestId}) + } + + withdrawsClaimed() { + return this.eth_call(withdrawsClaimed, {}) + } + + withdrawsQueued() { + return this.eth_call(withdrawsQueued, {}) + } +} diff --git a/src/abi/origin-arm/events.ts b/src/abi/origin-arm/events.ts new file mode 100644 index 00000000..58e0fd88 --- /dev/null +++ b/src/abi/origin-arm/events.ts @@ -0,0 +1,147 @@ +import { address, array, int256, uint256, uint64 } from '@subsquid/evm-codec' +import { event, indexed } from '../abi.support.js' +import type { EventParams as EParams } from '../abi.support.js' + +/** ARMBufferUpdated(uint256) */ +export const ARMBufferUpdated = event('0x29128dbcf994e1ddc09cdbce01c287bb3f6b0cf4dd3c98174cadbbaf67bc22d7', { + armBuffer: uint256, +}) +export type ARMBufferUpdatedEventArgs = EParams + +/** ActiveMarketUpdated(address) */ +export const ActiveMarketUpdated = event('0xe9f5fe520e5763f721d470ecb21b23763a3b0b9e720070111b1b935c1107b065', { + market: indexed(address), +}) +export type ActiveMarketUpdatedEventArgs = EParams + +/** AdminChanged(address,address) */ +export const AdminChanged = event('0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f', { + previousAdmin: address, + newAdmin: address, +}) +export type AdminChangedEventArgs = EParams + +/** Allocated(address,int256) */ +export const Allocated = event('0x8de94c5178842de5720920c14d6abd0f8367785673e0f607f37b91bda0f7700c', { + market: indexed(address), + assets: int256, +}) +export type AllocatedEventArgs = EParams + +/** Approval(address,address,uint256) */ +export const Approval = event('0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925', { + owner: indexed(address), + spender: indexed(address), + value: uint256, +}) +export type ApprovalEventArgs = EParams + +/** CapManagerUpdated(address) */ +export const CapManagerUpdated = event('0xb8fd9afc34c38fcd13b9a3b7646482eb1fddcefb40af2c70609972816eba3208', { + capManager: indexed(address), +}) +export type CapManagerUpdatedEventArgs = EParams + +/** ClaimOriginWithdrawals(uint256[],uint256) */ +export const ClaimOriginWithdrawals = event('0xfc7782d0ea7f5eb0351be7139942ba2c71155735d797fab90b6f2cdb99bce927', { + requestIds: array(uint256), + amountClaimed: uint256, +}) +export type ClaimOriginWithdrawalsEventArgs = EParams + +/** CrossPriceUpdated(uint256) */ +export const CrossPriceUpdated = event('0x6f938e86fbdbe7829d0289b348cd9e528f2f17c705f469f4a17a0a2796e007d0', { + crossPrice: uint256, +}) +export type CrossPriceUpdatedEventArgs = EParams + +/** Deposit(address,uint256,uint256) */ +export const Deposit = event('0x90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a15', { + owner: indexed(address), + assets: uint256, + shares: uint256, +}) +export type DepositEventArgs = EParams + +/** FeeCollected(address,uint256) */ +export const FeeCollected = event('0x06c5efeff5c320943d265dc4e5f1af95ad523555ce0c1957e367dda5514572df', { + feeCollector: indexed(address), + fee: uint256, +}) +export type FeeCollectedEventArgs = EParams + +/** FeeCollectorUpdated(address) */ +export const FeeCollectorUpdated = event('0xe5693914d19c789bdee50a362998c0bc8d035a835f9871da5d51152f0582c34f', { + newFeeCollector: indexed(address), +}) +export type FeeCollectorUpdatedEventArgs = EParams + +/** FeeUpdated(uint256) */ +export const FeeUpdated = event('0x8c4d35e54a3f2ef1134138fd8ea3daee6a3c89e10d2665996babdf70261e2c76', { + fee: uint256, +}) +export type FeeUpdatedEventArgs = EParams + +/** Initialized(uint64) */ +export const Initialized = event('0xc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2', { + version: uint64, +}) +export type InitializedEventArgs = EParams + +/** MarketAdded(address) */ +export const MarketAdded = event('0xbc600b1f03d316c479b49930c28e328809316458d5b5dacbb7419df5f6f89647', { + market: indexed(address), +}) +export type MarketAddedEventArgs = EParams + +/** MarketRemoved(address) */ +export const MarketRemoved = event('0x59d7b1e52008dc342c9421dadfc773114b914a65682a4e4b53cf60a970df0d77', { + market: indexed(address), +}) +export type MarketRemovedEventArgs = EParams + +/** OperatorChanged(address) */ +export const OperatorChanged = event('0x4721129e0e676ed6a92909bb24e853ccdd63ad72280cc2e974e38e480e0e6e54', { + newAdmin: address, +}) +export type OperatorChangedEventArgs = EParams + +/** RedeemClaimed(address,uint256,uint256) */ +export const RedeemClaimed = event('0x36dd2c9b55f12509e3b5f4f4d765ddefc2776a28018b18da2335cf2ab93bb268', { + withdrawer: indexed(address), + requestId: indexed(uint256), + assets: uint256, +}) +export type RedeemClaimedEventArgs = EParams + +/** RedeemRequested(address,uint256,uint256,uint256,uint256) */ +export const RedeemRequested = event('0xc04c86cfd81036557541f9c68971ace59cbc9057ecab7d48874a6177ad117f4f', { + withdrawer: indexed(address), + requestId: indexed(uint256), + assets: uint256, + queued: uint256, + claimTimestamp: uint256, +}) +export type RedeemRequestedEventArgs = EParams + +/** RequestOriginWithdrawal(uint256,uint256) */ +export const RequestOriginWithdrawal = event('0xb3a9170802de02e4fcb5968e12fb0b19c1e9e83035699af404f3dffbcdb6ac68', { + amount: uint256, + requestId: uint256, +}) +export type RequestOriginWithdrawalEventArgs = EParams + +/** TraderateChanged(uint256,uint256) */ +export const TraderateChanged = event('0xa2136948fd1e5333c2ee27c9e48848a560b693e6bbd18082623a738179ff2952', { + traderate0: uint256, + traderate1: uint256, +}) +export type TraderateChangedEventArgs = EParams + +/** Transfer(address,address,uint256) */ +export const Transfer = event('0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', { + from: indexed(address), + to: indexed(address), + value: uint256, +}) +export type TransferEventArgs = EParams diff --git a/src/abi/origin-arm/functions.ts b/src/abi/origin-arm/functions.ts new file mode 100644 index 00000000..6a63f5bf --- /dev/null +++ b/src/abi/origin-arm/functions.ts @@ -0,0 +1,441 @@ +import { address, array, bool, int128, string, struct, uint128, uint16, uint256, uint40, uint8 } from '@subsquid/evm-codec' +import { func } from '../abi.support.js' +import type { FunctionArguments, FunctionReturn } from '../abi.support.js' + +/** FEE_SCALE() */ +export const FEE_SCALE = func('0x8a5fddd8', {}, uint256) +export type FEE_SCALEParams = FunctionArguments +export type FEE_SCALEReturn = FunctionReturn + +/** MAX_CROSS_PRICE_DEVIATION() */ +export const MAX_CROSS_PRICE_DEVIATION = func('0x090b78c5', {}, uint256) +export type MAX_CROSS_PRICE_DEVIATIONParams = FunctionArguments +export type MAX_CROSS_PRICE_DEVIATIONReturn = FunctionReturn + +/** PRICE_SCALE() */ +export const PRICE_SCALE = func('0xc33f59d3', {}, uint256) +export type PRICE_SCALEParams = FunctionArguments +export type PRICE_SCALEReturn = FunctionReturn + +/** activeMarket() */ +export const activeMarket = func('0xce318c51', {}, address) +export type ActiveMarketParams = FunctionArguments +export type ActiveMarketReturn = FunctionReturn + +/** addMarkets(address[]) */ +export const addMarkets = func('0xda40385d', { + _markets: array(address), +}) +export type AddMarketsParams = FunctionArguments +export type AddMarketsReturn = FunctionReturn + +/** allocate() */ +export const allocate = func('0xabaa9916', {}) +export type AllocateParams = FunctionArguments +export type AllocateReturn = FunctionReturn + +/** allowance(address,address) */ +export const allowance = func('0xdd62ed3e', { + owner: address, + spender: address, +}, uint256) +export type AllowanceParams = FunctionArguments +export type AllowanceReturn = FunctionReturn + +/** approve(address,uint256) */ +export const approve = func('0x095ea7b3', { + spender: address, + value: uint256, +}, bool) +export type ApproveParams = FunctionArguments +export type ApproveReturn = FunctionReturn + +/** armBuffer() */ +export const armBuffer = func('0xa4c84f25', {}, uint256) +export type ArmBufferParams = FunctionArguments +export type ArmBufferReturn = FunctionReturn + +/** balanceOf(address) */ +export const balanceOf = func('0x70a08231', { + account: address, +}, uint256) +export type BalanceOfParams = FunctionArguments +export type BalanceOfReturn = FunctionReturn + +/** baseAsset() */ +export const baseAsset = func('0xcdf456e1', {}, address) +export type BaseAssetParams = FunctionArguments +export type BaseAssetReturn = FunctionReturn + +/** capManager() */ +export const capManager = func('0x6d785a87', {}, address) +export type CapManagerParams = FunctionArguments +export type CapManagerReturn = FunctionReturn + +/** claimDelay() */ +export const claimDelay = func('0x1c8ec299', {}, uint256) +export type ClaimDelayParams = FunctionArguments +export type ClaimDelayReturn = FunctionReturn + +/** claimOriginWithdrawals(uint256[]) */ +export const claimOriginWithdrawals = func('0x01d5850f', { + requestIds: array(uint256), +}, uint256) +export type ClaimOriginWithdrawalsParams = FunctionArguments +export type ClaimOriginWithdrawalsReturn = FunctionReturn + +/** claimRedeem(uint256) */ +export const claimRedeem = func('0xe46cf747', { + requestId: uint256, +}, uint256) +export type ClaimRedeemParams = FunctionArguments +export type ClaimRedeemReturn = FunctionReturn + +/** claimable() */ +export const claimable = func('0xaf38d757', {}, uint256) +export type ClaimableParams = FunctionArguments +export type ClaimableReturn = FunctionReturn + +/** collectFees() */ +export const collectFees = func('0xc8796572', {}, uint256) +export type CollectFeesParams = FunctionArguments +export type CollectFeesReturn = FunctionReturn + +/** convertToAssets(uint256) */ +export const convertToAssets = func('0x07a2d13a', { + shares: uint256, +}, uint256) +export type ConvertToAssetsParams = FunctionArguments +export type ConvertToAssetsReturn = FunctionReturn + +/** convertToShares(uint256) */ +export const convertToShares = func('0xc6e6f592', { + assets: uint256, +}, uint256) +export type ConvertToSharesParams = FunctionArguments +export type ConvertToSharesReturn = FunctionReturn + +/** crossPrice() */ +export const crossPrice = func('0xf5488330', {}, uint256) +export type CrossPriceParams = FunctionArguments +export type CrossPriceReturn = FunctionReturn + +/** decimals() */ +export const decimals = func('0x313ce567', {}, uint8) +export type DecimalsParams = FunctionArguments +export type DecimalsReturn = FunctionReturn + +/** deposit(uint256,address) */ +export const deposit = func('0x6e553f65', { + assets: uint256, + receiver: address, +}, uint256) +export type DepositParams = FunctionArguments +export type DepositReturn = FunctionReturn + +/** deposit(uint256) */ +export const deposit_1 = func('0xb6b55f25', { + assets: uint256, +}, uint256) +export type DepositParams_1 = FunctionArguments +export type DepositReturn_1 = FunctionReturn + +/** fee() */ +export const fee = func('0xddca3f43', {}, uint16) +export type FeeParams = FunctionArguments +export type FeeReturn = FunctionReturn + +/** feeCollector() */ +export const feeCollector = func('0xc415b95c', {}, address) +export type FeeCollectorParams = FunctionArguments +export type FeeCollectorReturn = FunctionReturn + +/** feesAccrued() */ +export const feesAccrued = func('0x94db0595', {}, uint256) +export type FeesAccruedParams = FunctionArguments +export type FeesAccruedReturn = FunctionReturn + +/** initialize(string,string,address,uint256,address,address) */ +export const initialize = func('0xb3ddda2a', { + _name: string, + _symbol: string, + _operator: address, + _fee: uint256, + _feeCollector: address, + _capManager: address, +}) +export type InitializeParams = FunctionArguments +export type InitializeReturn = FunctionReturn + +/** lastAvailableAssets() */ +export const lastAvailableAssets = func('0x2eb6328b', {}, int128) +export type LastAvailableAssetsParams = FunctionArguments +export type LastAvailableAssetsReturn = FunctionReturn + +/** liquidityAsset() */ +export const liquidityAsset = func('0x209b2bca', {}, address) +export type LiquidityAssetParams = FunctionArguments +export type LiquidityAssetReturn = FunctionReturn + +/** minSharesToRedeem() */ +export const minSharesToRedeem = func('0x50d0ea39', {}, uint256) +export type MinSharesToRedeemParams = FunctionArguments +export type MinSharesToRedeemReturn = FunctionReturn + +/** name() */ +export const name = func('0x06fdde03', {}, string) +export type NameParams = FunctionArguments +export type NameReturn = FunctionReturn + +/** nextWithdrawalIndex() */ +export const nextWithdrawalIndex = func('0xbba9282e', {}, uint256) +export type NextWithdrawalIndexParams = FunctionArguments +export type NextWithdrawalIndexReturn = FunctionReturn + +/** operator() */ +export const operator = func('0x570ca735', {}, address) +export type OperatorParams = FunctionArguments +export type OperatorReturn = FunctionReturn + +/** owner() */ +export const owner = func('0x8da5cb5b', {}, address) +export type OwnerParams = FunctionArguments +export type OwnerReturn = FunctionReturn + +/** previewDeposit(uint256) */ +export const previewDeposit = func('0xef8b30f7', { + assets: uint256, +}, uint256) +export type PreviewDepositParams = FunctionArguments +export type PreviewDepositReturn = FunctionReturn + +/** previewRedeem(uint256) */ +export const previewRedeem = func('0x4cdad506', { + shares: uint256, +}, uint256) +export type PreviewRedeemParams = FunctionArguments +export type PreviewRedeemReturn = FunctionReturn + +/** removeMarket(address) */ +export const removeMarket = func('0xdb913236', { + _market: address, +}) +export type RemoveMarketParams = FunctionArguments +export type RemoveMarketReturn = FunctionReturn + +/** requestOriginWithdrawal(uint256) */ +export const requestOriginWithdrawal = func('0xaa5928be', { + amount: uint256, +}, uint256) +export type RequestOriginWithdrawalParams = FunctionArguments +export type RequestOriginWithdrawalReturn = FunctionReturn + +/** requestRedeem(uint256) */ +export const requestRedeem = func('0xaa2f892d', { + shares: uint256, +}, struct({ + requestId: uint256, + assets: uint256, +})) +export type RequestRedeemParams = FunctionArguments +export type RequestRedeemReturn = FunctionReturn + +/** setARMBuffer(uint256) */ +export const setARMBuffer = func('0x95f9e9e6', { + _armBuffer: uint256, +}) +export type SetARMBufferParams = FunctionArguments +export type SetARMBufferReturn = FunctionReturn + +/** setActiveMarket(address) */ +export const setActiveMarket = func('0xab710b24', { + _market: address, +}) +export type SetActiveMarketParams = FunctionArguments +export type SetActiveMarketReturn = FunctionReturn + +/** setCapManager(address) */ +export const setCapManager = func('0x0e608b30', { + _capManager: address, +}) +export type SetCapManagerParams = FunctionArguments +export type SetCapManagerReturn = FunctionReturn + +/** setCrossPrice(uint256) */ +export const setCrossPrice = func('0x30486f3c', { + newCrossPrice: uint256, +}) +export type SetCrossPriceParams = FunctionArguments +export type SetCrossPriceReturn = FunctionReturn + +/** setFee(uint256) */ +export const setFee = func('0x69fe0e2d', { + _fee: uint256, +}) +export type SetFeeParams = FunctionArguments +export type SetFeeReturn = FunctionReturn + +/** setFeeCollector(address) */ +export const setFeeCollector = func('0xa42dce80', { + _feeCollector: address, +}) +export type SetFeeCollectorParams = FunctionArguments +export type SetFeeCollectorReturn = FunctionReturn + +/** setOperator(address) */ +export const setOperator = func('0xb3ab15fb', { + newOperator: address, +}) +export type SetOperatorParams = FunctionArguments +export type SetOperatorReturn = FunctionReturn + +/** setOwner(address) */ +export const setOwner = func('0x13af4035', { + newOwner: address, +}) +export type SetOwnerParams = FunctionArguments +export type SetOwnerReturn = FunctionReturn + +/** setPrices(uint256,uint256) */ +export const setPrices = func('0x05fefda7', { + buyT1: uint256, + sellT1: uint256, +}) +export type SetPricesParams = FunctionArguments +export type SetPricesReturn = FunctionReturn + +/** supportedMarkets(address) */ +export const supportedMarkets = func('0x20761fc4', { + market: address, +}, bool) +export type SupportedMarketsParams = FunctionArguments +export type SupportedMarketsReturn = FunctionReturn + +/** swapExactTokensForTokens(uint256,uint256,address[],address,uint256) */ +export const swapExactTokensForTokens = func('0x38ed1739', { + amountIn: uint256, + amountOutMin: uint256, + path: array(address), + to: address, + deadline: uint256, +}, array(uint256)) +export type SwapExactTokensForTokensParams = FunctionArguments +export type SwapExactTokensForTokensReturn = FunctionReturn + +/** swapExactTokensForTokens(address,address,uint256,uint256,address) */ +export const swapExactTokensForTokens_1 = func('0x6c08c57e', { + inToken: address, + outToken: address, + amountIn: uint256, + amountOutMin: uint256, + to: address, +}) +export type SwapExactTokensForTokensParams_1 = FunctionArguments +export type SwapExactTokensForTokensReturn_1 = FunctionReturn + +/** swapTokensForExactTokens(uint256,uint256,address[],address,uint256) */ +export const swapTokensForExactTokens = func('0x8803dbee', { + amountOut: uint256, + amountInMax: uint256, + path: array(address), + to: address, + deadline: uint256, +}, array(uint256)) +export type SwapTokensForExactTokensParams = FunctionArguments +export type SwapTokensForExactTokensReturn = FunctionReturn + +/** swapTokensForExactTokens(address,address,uint256,uint256,address) */ +export const swapTokensForExactTokens_1 = func('0xf7d31809', { + inToken: address, + outToken: address, + amountOut: uint256, + amountInMax: uint256, + to: address, +}) +export type SwapTokensForExactTokensParams_1 = FunctionArguments +export type SwapTokensForExactTokensReturn_1 = FunctionReturn + +/** symbol() */ +export const symbol = func('0x95d89b41', {}, string) +export type SymbolParams = FunctionArguments +export type SymbolReturn = FunctionReturn + +/** token0() */ +export const token0 = func('0x0dfe1681', {}, address) +export type Token0Params = FunctionArguments +export type Token0Return = FunctionReturn + +/** token1() */ +export const token1 = func('0xd21220a7', {}, address) +export type Token1Params = FunctionArguments +export type Token1Return = FunctionReturn + +/** totalAssets() */ +export const totalAssets = func('0x01e1d114', {}, uint256) +export type TotalAssetsParams = FunctionArguments +export type TotalAssetsReturn = FunctionReturn + +/** totalSupply() */ +export const totalSupply = func('0x18160ddd', {}, uint256) +export type TotalSupplyParams = FunctionArguments +export type TotalSupplyReturn = FunctionReturn + +/** traderate0() */ +export const traderate0 = func('0x45059a6b', {}, uint256) +export type Traderate0Params = FunctionArguments +export type Traderate0Return = FunctionReturn + +/** traderate1() */ +export const traderate1 = func('0xcf1de5d8', {}, uint256) +export type Traderate1Params = FunctionArguments +export type Traderate1Return = FunctionReturn + +/** transfer(address,uint256) */ +export const transfer = func('0xa9059cbb', { + to: address, + value: uint256, +}, bool) +export type TransferParams = FunctionArguments +export type TransferReturn = FunctionReturn + +/** transferFrom(address,address,uint256) */ +export const transferFrom = func('0x23b872dd', { + from: address, + to: address, + value: uint256, +}, bool) +export type TransferFromParams = FunctionArguments +export type TransferFromReturn = FunctionReturn + +/** vault() */ +export const vault = func('0xfbfa77cf', {}, address) +export type VaultParams = FunctionArguments +export type VaultReturn = FunctionReturn + +/** vaultWithdrawalAmount() */ +export const vaultWithdrawalAmount = func('0x0fa28841', {}, uint256) +export type VaultWithdrawalAmountParams = FunctionArguments +export type VaultWithdrawalAmountReturn = FunctionReturn + +/** withdrawalRequests(uint256) */ +export const withdrawalRequests = func('0x937b2581', { + requestId: uint256, +}, struct({ + withdrawer: address, + claimed: bool, + claimTimestamp: uint40, + assets: uint128, + queued: uint128, +})) +export type WithdrawalRequestsParams = FunctionArguments +export type WithdrawalRequestsReturn = FunctionReturn + +/** withdrawsClaimed() */ +export const withdrawsClaimed = func('0x35ce81c4', {}, uint128) +export type WithdrawsClaimedParams = FunctionArguments +export type WithdrawsClaimedReturn = FunctionReturn + +/** withdrawsQueued() */ +export const withdrawsQueued = func('0x6ec68625', {}, uint128) +export type WithdrawsQueuedParams = FunctionArguments +export type WithdrawsQueuedReturn = FunctionReturn diff --git a/src/abi/origin-arm/index.ts b/src/abi/origin-arm/index.ts new file mode 100644 index 00000000..11829d6e --- /dev/null +++ b/src/abi/origin-arm/index.ts @@ -0,0 +1,4 @@ +export * as events from './events.js' +export * as functions from './functions.js' + +export { Contract } from './contract.js' diff --git a/src/abi/origin-ethena-arm.ts b/src/abi/origin-ethena-arm.ts deleted file mode 100644 index 84ab3148..00000000 --- a/src/abi/origin-ethena-arm.ts +++ /dev/null @@ -1,562 +0,0 @@ -import * as p from '@subsquid/evm-codec' -import { event, fun, viewFun, indexed, ContractBase } from '@subsquid/evm-abi' -import type { EventParams as EParams, FunctionArguments, FunctionReturn } from '@subsquid/evm-abi' - -export const events = { - ARMBufferUpdated: event("0x29128dbcf994e1ddc09cdbce01c287bb3f6b0cf4dd3c98174cadbbaf67bc22d7", "ARMBufferUpdated(uint256)", {"armBuffer": p.uint256}), - ActiveMarketUpdated: event("0xe9f5fe520e5763f721d470ecb21b23763a3b0b9e720070111b1b935c1107b065", "ActiveMarketUpdated(address)", {"market": indexed(p.address)}), - AdminChanged: event("0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f", "AdminChanged(address,address)", {"previousAdmin": p.address, "newAdmin": p.address}), - Allocated: event("0x0538e1fc8a5bd2f2ae0c40c0a54b4208673263b92c883fe270768a5151346dfd", "Allocated(address,int256,int256)", {"market": indexed(p.address), "targetLiquidityDelta": p.int256, "actualLiquidityDelta": p.int256}), - Approval: event("0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925", "Approval(address,address,uint256)", {"owner": indexed(p.address), "spender": indexed(p.address), "value": p.uint256}), - CapManagerUpdated: event("0xb8fd9afc34c38fcd13b9a3b7646482eb1fddcefb40af2c70609972816eba3208", "CapManagerUpdated(address)", {"capManager": indexed(p.address)}), - ClaimBaseWithdrawals: event("0x8528f5537e4b9fc69da2fa4d455c4e03a5cc2c5a05d8815c8c06a6242f56ad57", "ClaimBaseWithdrawals(address,uint256)", {"unstaker": indexed(p.address), "liquidityAmount": p.uint256}), - CrossPriceUpdated: event("0x6f938e86fbdbe7829d0289b348cd9e528f2f17c705f469f4a17a0a2796e007d0", "CrossPriceUpdated(uint256)", {"crossPrice": p.uint256}), - Deposit: event("0x90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a15", "Deposit(address,uint256,uint256)", {"owner": indexed(p.address), "assets": p.uint256, "shares": p.uint256}), - FeeCollected: event("0x06c5efeff5c320943d265dc4e5f1af95ad523555ce0c1957e367dda5514572df", "FeeCollected(address,uint256)", {"feeCollector": indexed(p.address), "fee": p.uint256}), - FeeCollectorUpdated: event("0xe5693914d19c789bdee50a362998c0bc8d035a835f9871da5d51152f0582c34f", "FeeCollectorUpdated(address)", {"newFeeCollector": indexed(p.address)}), - FeeUpdated: event("0x8c4d35e54a3f2ef1134138fd8ea3daee6a3c89e10d2665996babdf70261e2c76", "FeeUpdated(uint256)", {"fee": p.uint256}), - Initialized: event("0xc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2", "Initialized(uint64)", {"version": p.uint64}), - MarketAdded: event("0xbc600b1f03d316c479b49930c28e328809316458d5b5dacbb7419df5f6f89647", "MarketAdded(address)", {"market": indexed(p.address)}), - MarketRemoved: event("0x59d7b1e52008dc342c9421dadfc773114b914a65682a4e4b53cf60a970df0d77", "MarketRemoved(address)", {"market": indexed(p.address)}), - OperatorChanged: event("0x4721129e0e676ed6a92909bb24e853ccdd63ad72280cc2e974e38e480e0e6e54", "OperatorChanged(address)", {"newAdmin": p.address}), - RedeemClaimed: event("0x36dd2c9b55f12509e3b5f4f4d765ddefc2776a28018b18da2335cf2ab93bb268", "RedeemClaimed(address,uint256,uint256)", {"withdrawer": indexed(p.address), "requestId": indexed(p.uint256), "assets": p.uint256}), - RedeemRequested: event("0xc04c86cfd81036557541f9c68971ace59cbc9057ecab7d48874a6177ad117f4f", "RedeemRequested(address,uint256,uint256,uint256,uint256)", {"withdrawer": indexed(p.address), "requestId": indexed(p.uint256), "assets": p.uint256, "queued": p.uint256, "claimTimestamp": p.uint256}), - RequestBaseWithdrawal: event("0x9910c447d600210d0328b2c6f5374d7acc58344b9ce5d9c97f5a2a90fa611956", "RequestBaseWithdrawal(address,uint256,uint256)", {"unstaker": indexed(p.address), "baseAmount": p.uint256, "liquidityAmount": p.uint256}), - TraderateChanged: event("0xa2136948fd1e5333c2ee27c9e48848a560b693e6bbd18082623a738179ff2952", "TraderateChanged(uint256,uint256)", {"traderate0": p.uint256, "traderate1": p.uint256}), - Transfer: event("0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", "Transfer(address,address,uint256)", {"from": indexed(p.address), "to": indexed(p.address), "value": p.uint256}), -} - -export const functions = { - DELAY_REQUEST: viewFun("0x74e17388", "DELAY_REQUEST()", {}, p.uint256), - FEE_SCALE: viewFun("0x8a5fddd8", "FEE_SCALE()", {}, p.uint256), - MAX_CROSS_PRICE_DEVIATION: viewFun("0x090b78c5", "MAX_CROSS_PRICE_DEVIATION()", {}, p.uint256), - MAX_UNSTAKERS: viewFun("0xc4c86d57", "MAX_UNSTAKERS()", {}, p.uint8), - PRICE_SCALE: viewFun("0xc33f59d3", "PRICE_SCALE()", {}, p.uint256), - activeMarket: viewFun("0xce318c51", "activeMarket()", {}, p.address), - addMarkets: fun("0xda40385d", "addMarkets(address[])", {"_markets": p.array(p.address)}, ), - allocate: fun("0xabaa9916", "allocate()", {}, {"targetLiquidityDelta": p.int256, "actualLiquidityDelta": p.int256}), - allocateThreshold: viewFun("0x4a8ff603", "allocateThreshold()", {}, p.int256), - allowance: viewFun("0xdd62ed3e", "allowance(address,address)", {"owner": p.address, "spender": p.address}, p.uint256), - approve: fun("0x095ea7b3", "approve(address,uint256)", {"spender": p.address, "value": p.uint256}, p.bool), - armBuffer: viewFun("0xa4c84f25", "armBuffer()", {}, p.uint256), - asset: viewFun("0x38d52e0f", "asset()", {}, p.address), - balanceOf: viewFun("0x70a08231", "balanceOf(address)", {"account": p.address}, p.uint256), - baseAsset: viewFun("0xcdf456e1", "baseAsset()", {}, p.address), - capManager: viewFun("0x6d785a87", "capManager()", {}, p.address), - claimBaseWithdrawals: fun("0xad3a6706", "claimBaseWithdrawals(address)", {"unstaker": p.address}, ), - claimDelay: viewFun("0x1c8ec299", "claimDelay()", {}, p.uint256), - claimRedeem: fun("0xe46cf747", "claimRedeem(uint256)", {"requestId": p.uint256}, p.uint256), - claimable: viewFun("0xaf38d757", "claimable()", {}, p.uint256), - collectFees: fun("0xc8796572", "collectFees()", {}, p.uint256), - convertToAssets: viewFun("0x07a2d13a", "convertToAssets(uint256)", {"shares": p.uint256}, p.uint256), - convertToShares: viewFun("0xc6e6f592", "convertToShares(uint256)", {"assets": p.uint256}, p.uint256), - crossPrice: viewFun("0xf5488330", "crossPrice()", {}, p.uint256), - decimals: viewFun("0x313ce567", "decimals()", {}, p.uint8), - 'deposit(uint256,address)': fun("0x6e553f65", "deposit(uint256,address)", {"assets": p.uint256, "receiver": p.address}, p.uint256), - 'deposit(uint256)': fun("0xb6b55f25", "deposit(uint256)", {"assets": p.uint256}, p.uint256), - fee: viewFun("0xddca3f43", "fee()", {}, p.uint16), - feeCollector: viewFun("0xc415b95c", "feeCollector()", {}, p.address), - feesAccrued: viewFun("0x94db0595", "feesAccrued()", {}, p.uint256), - getReserves: viewFun("0x0902f1ac", "getReserves()", {}, {"reserve0": p.uint256, "reserve1": p.uint256}), - initialize: fun("0xb3ddda2a", "initialize(string,string,address,uint256,address,address)", {"_name": p.string, "_symbol": p.string, "_operator": p.address, "_fee": p.uint256, "_feeCollector": p.address, "_capManager": p.address}, ), - lastAvailableAssets: viewFun("0x2eb6328b", "lastAvailableAssets()", {}, p.int128), - lastRequestTimestamp: viewFun("0xf664a16e", "lastRequestTimestamp()", {}, p.uint32), - liquidityAmountInCooldown: viewFun("0x15780107", "liquidityAmountInCooldown()", {}, p.uint256), - liquidityAsset: viewFun("0x209b2bca", "liquidityAsset()", {}, p.address), - minSharesToRedeem: viewFun("0x50d0ea39", "minSharesToRedeem()", {}, p.uint256), - name: viewFun("0x06fdde03", "name()", {}, p.string), - nextUnstakerIndex: viewFun("0xa2bc8b68", "nextUnstakerIndex()", {}, p.uint8), - nextWithdrawalIndex: viewFun("0xbba9282e", "nextWithdrawalIndex()", {}, p.uint256), - operator: viewFun("0x570ca735", "operator()", {}, p.address), - owner: viewFun("0x8da5cb5b", "owner()", {}, p.address), - previewDeposit: viewFun("0xef8b30f7", "previewDeposit(uint256)", {"assets": p.uint256}, p.uint256), - previewRedeem: viewFun("0x4cdad506", "previewRedeem(uint256)", {"shares": p.uint256}, p.uint256), - removeMarket: fun("0xdb913236", "removeMarket(address)", {"_market": p.address}, ), - requestBaseWithdrawal: fun("0x8831223b", "requestBaseWithdrawal(uint256)", {"baseAmount": p.uint256}, ), - requestRedeem: fun("0xaa2f892d", "requestRedeem(uint256)", {"shares": p.uint256}, {"requestId": p.uint256, "assets": p.uint256}), - setARMBuffer: fun("0x95f9e9e6", "setARMBuffer(uint256)", {"_armBuffer": p.uint256}, ), - setActiveMarket: fun("0xab710b24", "setActiveMarket(address)", {"_market": p.address}, ), - setCapManager: fun("0x0e608b30", "setCapManager(address)", {"_capManager": p.address}, ), - setCrossPrice: fun("0x30486f3c", "setCrossPrice(uint256)", {"newCrossPrice": p.uint256}, ), - setFee: fun("0x69fe0e2d", "setFee(uint256)", {"_fee": p.uint256}, ), - setFeeCollector: fun("0xa42dce80", "setFeeCollector(address)", {"_feeCollector": p.address}, ), - setOperator: fun("0xb3ab15fb", "setOperator(address)", {"newOperator": p.address}, ), - setOwner: fun("0x13af4035", "setOwner(address)", {"newOwner": p.address}, ), - setPrices: fun("0x05fefda7", "setPrices(uint256,uint256)", {"buyT1": p.uint256, "sellT1": p.uint256}, ), - setUnstakers: fun("0xdf744321", "setUnstakers(address[42])", {"_unstakers": p.fixedSizeArray(p.address, 42)}, ), - supportedMarkets: viewFun("0x20761fc4", "supportedMarkets(address)", {"market": p.address}, p.bool), - susde: viewFun("0x032988da", "susde()", {}, p.address), - 'swapExactTokensForTokens(uint256,uint256,address[],address,uint256)': fun("0x38ed1739", "swapExactTokensForTokens(uint256,uint256,address[],address,uint256)", {"amountIn": p.uint256, "amountOutMin": p.uint256, "path": p.array(p.address), "to": p.address, "deadline": p.uint256}, p.array(p.uint256)), - 'swapExactTokensForTokens(address,address,uint256,uint256,address)': fun("0x6c08c57e", "swapExactTokensForTokens(address,address,uint256,uint256,address)", {"inToken": p.address, "outToken": p.address, "amountIn": p.uint256, "amountOutMin": p.uint256, "to": p.address}, p.array(p.uint256)), - 'swapTokensForExactTokens(uint256,uint256,address[],address,uint256)': fun("0x8803dbee", "swapTokensForExactTokens(uint256,uint256,address[],address,uint256)", {"amountOut": p.uint256, "amountInMax": p.uint256, "path": p.array(p.address), "to": p.address, "deadline": p.uint256}, p.array(p.uint256)), - 'swapTokensForExactTokens(address,address,uint256,uint256,address)': fun("0xf7d31809", "swapTokensForExactTokens(address,address,uint256,uint256,address)", {"inToken": p.address, "outToken": p.address, "amountOut": p.uint256, "amountInMax": p.uint256, "to": p.address}, p.array(p.uint256)), - symbol: viewFun("0x95d89b41", "symbol()", {}, p.string), - token0: viewFun("0x0dfe1681", "token0()", {}, p.address), - token1: viewFun("0xd21220a7", "token1()", {}, p.address), - totalAssets: viewFun("0x01e1d114", "totalAssets()", {}, p.uint256), - totalSupply: viewFun("0x18160ddd", "totalSupply()", {}, p.uint256), - traderate0: viewFun("0x45059a6b", "traderate0()", {}, p.uint256), - traderate1: viewFun("0xcf1de5d8", "traderate1()", {}, p.uint256), - transfer: fun("0xa9059cbb", "transfer(address,uint256)", {"to": p.address, "value": p.uint256}, p.bool), - transferFrom: fun("0x23b872dd", "transferFrom(address,address,uint256)", {"from": p.address, "to": p.address, "value": p.uint256}, p.bool), - unstakers: viewFun("0x9be64959", "unstakers(uint256)", {"_0": p.uint256}, p.address), - usde: viewFun("0x0fd761e0", "usde()", {}, p.address), - withdrawalRequests: viewFun("0x937b2581", "withdrawalRequests(uint256)", {"requestId": p.uint256}, {"withdrawer": p.address, "claimed": p.bool, "claimTimestamp": p.uint40, "assets": p.uint128, "queued": p.uint128, "shares": p.uint128}), - withdrawsClaimed: viewFun("0x35ce81c4", "withdrawsClaimed()", {}, p.uint128), - withdrawsQueued: viewFun("0x6ec68625", "withdrawsQueued()", {}, p.uint128), -} - -export class Contract extends ContractBase { - - DELAY_REQUEST() { - return this.eth_call(functions.DELAY_REQUEST, {}) - } - - FEE_SCALE() { - return this.eth_call(functions.FEE_SCALE, {}) - } - - MAX_CROSS_PRICE_DEVIATION() { - return this.eth_call(functions.MAX_CROSS_PRICE_DEVIATION, {}) - } - - MAX_UNSTAKERS() { - return this.eth_call(functions.MAX_UNSTAKERS, {}) - } - - PRICE_SCALE() { - return this.eth_call(functions.PRICE_SCALE, {}) - } - - activeMarket() { - return this.eth_call(functions.activeMarket, {}) - } - - allocateThreshold() { - return this.eth_call(functions.allocateThreshold, {}) - } - - allowance(owner: AllowanceParams["owner"], spender: AllowanceParams["spender"]) { - return this.eth_call(functions.allowance, {owner, spender}) - } - - armBuffer() { - return this.eth_call(functions.armBuffer, {}) - } - - asset() { - return this.eth_call(functions.asset, {}) - } - - balanceOf(account: BalanceOfParams["account"]) { - return this.eth_call(functions.balanceOf, {account}) - } - - baseAsset() { - return this.eth_call(functions.baseAsset, {}) - } - - capManager() { - return this.eth_call(functions.capManager, {}) - } - - claimDelay() { - return this.eth_call(functions.claimDelay, {}) - } - - claimable() { - return this.eth_call(functions.claimable, {}) - } - - convertToAssets(shares: ConvertToAssetsParams["shares"]) { - return this.eth_call(functions.convertToAssets, {shares}) - } - - convertToShares(assets: ConvertToSharesParams["assets"]) { - return this.eth_call(functions.convertToShares, {assets}) - } - - crossPrice() { - return this.eth_call(functions.crossPrice, {}) - } - - decimals() { - return this.eth_call(functions.decimals, {}) - } - - fee() { - return this.eth_call(functions.fee, {}) - } - - feeCollector() { - return this.eth_call(functions.feeCollector, {}) - } - - feesAccrued() { - return this.eth_call(functions.feesAccrued, {}) - } - - getReserves() { - return this.eth_call(functions.getReserves, {}) - } - - lastAvailableAssets() { - return this.eth_call(functions.lastAvailableAssets, {}) - } - - lastRequestTimestamp() { - return this.eth_call(functions.lastRequestTimestamp, {}) - } - - liquidityAmountInCooldown() { - return this.eth_call(functions.liquidityAmountInCooldown, {}) - } - - liquidityAsset() { - return this.eth_call(functions.liquidityAsset, {}) - } - - minSharesToRedeem() { - return this.eth_call(functions.minSharesToRedeem, {}) - } - - name() { - return this.eth_call(functions.name, {}) - } - - nextUnstakerIndex() { - return this.eth_call(functions.nextUnstakerIndex, {}) - } - - nextWithdrawalIndex() { - return this.eth_call(functions.nextWithdrawalIndex, {}) - } - - operator() { - return this.eth_call(functions.operator, {}) - } - - owner() { - return this.eth_call(functions.owner, {}) - } - - previewDeposit(assets: PreviewDepositParams["assets"]) { - return this.eth_call(functions.previewDeposit, {assets}) - } - - previewRedeem(shares: PreviewRedeemParams["shares"]) { - return this.eth_call(functions.previewRedeem, {shares}) - } - - supportedMarkets(market: SupportedMarketsParams["market"]) { - return this.eth_call(functions.supportedMarkets, {market}) - } - - susde() { - return this.eth_call(functions.susde, {}) - } - - symbol() { - return this.eth_call(functions.symbol, {}) - } - - token0() { - return this.eth_call(functions.token0, {}) - } - - token1() { - return this.eth_call(functions.token1, {}) - } - - totalAssets() { - return this.eth_call(functions.totalAssets, {}) - } - - totalSupply() { - return this.eth_call(functions.totalSupply, {}) - } - - traderate0() { - return this.eth_call(functions.traderate0, {}) - } - - traderate1() { - return this.eth_call(functions.traderate1, {}) - } - - unstakers(_0: UnstakersParams["_0"]) { - return this.eth_call(functions.unstakers, {_0}) - } - - usde() { - return this.eth_call(functions.usde, {}) - } - - withdrawalRequests(requestId: WithdrawalRequestsParams["requestId"]) { - return this.eth_call(functions.withdrawalRequests, {requestId}) - } - - withdrawsClaimed() { - return this.eth_call(functions.withdrawsClaimed, {}) - } - - withdrawsQueued() { - return this.eth_call(functions.withdrawsQueued, {}) - } -} - -/// Event types -export type ARMBufferUpdatedEventArgs = EParams -export type ActiveMarketUpdatedEventArgs = EParams -export type AdminChangedEventArgs = EParams -export type AllocatedEventArgs = EParams -export type ApprovalEventArgs = EParams -export type CapManagerUpdatedEventArgs = EParams -export type ClaimBaseWithdrawalsEventArgs = EParams -export type CrossPriceUpdatedEventArgs = EParams -export type DepositEventArgs = EParams -export type FeeCollectedEventArgs = EParams -export type FeeCollectorUpdatedEventArgs = EParams -export type FeeUpdatedEventArgs = EParams -export type InitializedEventArgs = EParams -export type MarketAddedEventArgs = EParams -export type MarketRemovedEventArgs = EParams -export type OperatorChangedEventArgs = EParams -export type RedeemClaimedEventArgs = EParams -export type RedeemRequestedEventArgs = EParams -export type RequestBaseWithdrawalEventArgs = EParams -export type TraderateChangedEventArgs = EParams -export type TransferEventArgs = EParams - -/// Function types -export type DELAY_REQUESTParams = FunctionArguments -export type DELAY_REQUESTReturn = FunctionReturn - -export type FEE_SCALEParams = FunctionArguments -export type FEE_SCALEReturn = FunctionReturn - -export type MAX_CROSS_PRICE_DEVIATIONParams = FunctionArguments -export type MAX_CROSS_PRICE_DEVIATIONReturn = FunctionReturn - -export type MAX_UNSTAKERSParams = FunctionArguments -export type MAX_UNSTAKERSReturn = FunctionReturn - -export type PRICE_SCALEParams = FunctionArguments -export type PRICE_SCALEReturn = FunctionReturn - -export type ActiveMarketParams = FunctionArguments -export type ActiveMarketReturn = FunctionReturn - -export type AddMarketsParams = FunctionArguments -export type AddMarketsReturn = FunctionReturn - -export type AllocateParams = FunctionArguments -export type AllocateReturn = FunctionReturn - -export type AllocateThresholdParams = FunctionArguments -export type AllocateThresholdReturn = FunctionReturn - -export type AllowanceParams = FunctionArguments -export type AllowanceReturn = FunctionReturn - -export type ApproveParams = FunctionArguments -export type ApproveReturn = FunctionReturn - -export type ArmBufferParams = FunctionArguments -export type ArmBufferReturn = FunctionReturn - -export type AssetParams = FunctionArguments -export type AssetReturn = FunctionReturn - -export type BalanceOfParams = FunctionArguments -export type BalanceOfReturn = FunctionReturn - -export type BaseAssetParams = FunctionArguments -export type BaseAssetReturn = FunctionReturn - -export type CapManagerParams = FunctionArguments -export type CapManagerReturn = FunctionReturn - -export type ClaimBaseWithdrawalsParams = FunctionArguments -export type ClaimBaseWithdrawalsReturn = FunctionReturn - -export type ClaimDelayParams = FunctionArguments -export type ClaimDelayReturn = FunctionReturn - -export type ClaimRedeemParams = FunctionArguments -export type ClaimRedeemReturn = FunctionReturn - -export type ClaimableParams = FunctionArguments -export type ClaimableReturn = FunctionReturn - -export type CollectFeesParams = FunctionArguments -export type CollectFeesReturn = FunctionReturn - -export type ConvertToAssetsParams = FunctionArguments -export type ConvertToAssetsReturn = FunctionReturn - -export type ConvertToSharesParams = FunctionArguments -export type ConvertToSharesReturn = FunctionReturn - -export type CrossPriceParams = FunctionArguments -export type CrossPriceReturn = FunctionReturn - -export type DecimalsParams = FunctionArguments -export type DecimalsReturn = FunctionReturn - -export type DepositParams_0 = FunctionArguments -export type DepositReturn_0 = FunctionReturn - -export type DepositParams_1 = FunctionArguments -export type DepositReturn_1 = FunctionReturn - -export type FeeParams = FunctionArguments -export type FeeReturn = FunctionReturn - -export type FeeCollectorParams = FunctionArguments -export type FeeCollectorReturn = FunctionReturn - -export type FeesAccruedParams = FunctionArguments -export type FeesAccruedReturn = FunctionReturn - -export type GetReservesParams = FunctionArguments -export type GetReservesReturn = FunctionReturn - -export type InitializeParams = FunctionArguments -export type InitializeReturn = FunctionReturn - -export type LastAvailableAssetsParams = FunctionArguments -export type LastAvailableAssetsReturn = FunctionReturn - -export type LastRequestTimestampParams = FunctionArguments -export type LastRequestTimestampReturn = FunctionReturn - -export type LiquidityAmountInCooldownParams = FunctionArguments -export type LiquidityAmountInCooldownReturn = FunctionReturn - -export type LiquidityAssetParams = FunctionArguments -export type LiquidityAssetReturn = FunctionReturn - -export type MinSharesToRedeemParams = FunctionArguments -export type MinSharesToRedeemReturn = FunctionReturn - -export type NameParams = FunctionArguments -export type NameReturn = FunctionReturn - -export type NextUnstakerIndexParams = FunctionArguments -export type NextUnstakerIndexReturn = FunctionReturn - -export type NextWithdrawalIndexParams = FunctionArguments -export type NextWithdrawalIndexReturn = FunctionReturn - -export type OperatorParams = FunctionArguments -export type OperatorReturn = FunctionReturn - -export type OwnerParams = FunctionArguments -export type OwnerReturn = FunctionReturn - -export type PreviewDepositParams = FunctionArguments -export type PreviewDepositReturn = FunctionReturn - -export type PreviewRedeemParams = FunctionArguments -export type PreviewRedeemReturn = FunctionReturn - -export type RemoveMarketParams = FunctionArguments -export type RemoveMarketReturn = FunctionReturn - -export type RequestBaseWithdrawalParams = FunctionArguments -export type RequestBaseWithdrawalReturn = FunctionReturn - -export type RequestRedeemParams = FunctionArguments -export type RequestRedeemReturn = FunctionReturn - -export type SetARMBufferParams = FunctionArguments -export type SetARMBufferReturn = FunctionReturn - -export type SetActiveMarketParams = FunctionArguments -export type SetActiveMarketReturn = FunctionReturn - -export type SetCapManagerParams = FunctionArguments -export type SetCapManagerReturn = FunctionReturn - -export type SetCrossPriceParams = FunctionArguments -export type SetCrossPriceReturn = FunctionReturn - -export type SetFeeParams = FunctionArguments -export type SetFeeReturn = FunctionReturn - -export type SetFeeCollectorParams = FunctionArguments -export type SetFeeCollectorReturn = FunctionReturn - -export type SetOperatorParams = FunctionArguments -export type SetOperatorReturn = FunctionReturn - -export type SetOwnerParams = FunctionArguments -export type SetOwnerReturn = FunctionReturn - -export type SetPricesParams = FunctionArguments -export type SetPricesReturn = FunctionReturn - -export type SetUnstakersParams = FunctionArguments -export type SetUnstakersReturn = FunctionReturn - -export type SupportedMarketsParams = FunctionArguments -export type SupportedMarketsReturn = FunctionReturn - -export type SusdeParams = FunctionArguments -export type SusdeReturn = FunctionReturn - -export type SwapExactTokensForTokensParams_0 = FunctionArguments -export type SwapExactTokensForTokensReturn_0 = FunctionReturn - -export type SwapExactTokensForTokensParams_1 = FunctionArguments -export type SwapExactTokensForTokensReturn_1 = FunctionReturn - -export type SwapTokensForExactTokensParams_0 = FunctionArguments -export type SwapTokensForExactTokensReturn_0 = FunctionReturn - -export type SwapTokensForExactTokensParams_1 = FunctionArguments -export type SwapTokensForExactTokensReturn_1 = FunctionReturn - -export type SymbolParams = FunctionArguments -export type SymbolReturn = FunctionReturn - -export type Token0Params = FunctionArguments -export type Token0Return = FunctionReturn - -export type Token1Params = FunctionArguments -export type Token1Return = FunctionReturn - -export type TotalAssetsParams = FunctionArguments -export type TotalAssetsReturn = FunctionReturn - -export type TotalSupplyParams = FunctionArguments -export type TotalSupplyReturn = FunctionReturn - -export type Traderate0Params = FunctionArguments -export type Traderate0Return = FunctionReturn - -export type Traderate1Params = FunctionArguments -export type Traderate1Return = FunctionReturn - -export type TransferParams = FunctionArguments -export type TransferReturn = FunctionReturn - -export type TransferFromParams = FunctionArguments -export type TransferFromReturn = FunctionReturn - -export type UnstakersParams = FunctionArguments -export type UnstakersReturn = FunctionReturn - -export type UsdeParams = FunctionArguments -export type UsdeReturn = FunctionReturn - -export type WithdrawalRequestsParams = FunctionArguments -export type WithdrawalRequestsReturn = FunctionReturn - -export type WithdrawsClaimedParams = FunctionArguments -export type WithdrawsClaimedReturn = FunctionReturn - -export type WithdrawsQueuedParams = FunctionArguments -export type WithdrawsQueuedReturn = FunctionReturn - diff --git a/src/abi/origin-ethena-arm/contract.ts b/src/abi/origin-ethena-arm/contract.ts new file mode 100644 index 00000000..28447d4c --- /dev/null +++ b/src/abi/origin-ethena-arm/contract.ts @@ -0,0 +1,253 @@ +import { ContractBase } from '../abi.support.js' +import { DELAY_REQUEST, FEE_SCALE, MAX_CROSS_PRICE_DEVIATION, MAX_UNSTAKERS, PRICE_SCALE, activeMarket, allocate, allocateThreshold, allowance, approve, armBuffer, asset, balanceOf, baseAsset, capManager, claimDelay, claimRedeem, claimable, collectFees, convertToAssets, convertToShares, crossPrice, decimals, deposit, deposit_1, fee, feeCollector, feesAccrued, getReserves, lastAvailableAssets, lastRequestTimestamp, liquidityAmountInCooldown, liquidityAsset, minSharesToRedeem, name, nextUnstakerIndex, nextWithdrawalIndex, operator, owner, previewDeposit, previewRedeem, requestRedeem, supportedMarkets, susde, swapExactTokensForTokens, swapExactTokensForTokens_1, swapTokensForExactTokens, swapTokensForExactTokens_1, symbol, token0, token1, totalAssets, totalSupply, traderate0, traderate1, transfer, transferFrom, unstakers, usde, withdrawalRequests, withdrawsClaimed, withdrawsQueued } from './functions.js' +import type { AllowanceParams, ApproveParams, BalanceOfParams, ClaimRedeemParams, ConvertToAssetsParams, ConvertToSharesParams, DepositParams, DepositParams_1, PreviewDepositParams, PreviewRedeemParams, RequestRedeemParams, SupportedMarketsParams, SwapExactTokensForTokensParams, SwapExactTokensForTokensParams_1, SwapTokensForExactTokensParams, SwapTokensForExactTokensParams_1, TransferFromParams, TransferParams, UnstakersParams, WithdrawalRequestsParams } from './functions.js' + +export class Contract extends ContractBase { + DELAY_REQUEST() { + return this.eth_call(DELAY_REQUEST, {}) + } + + FEE_SCALE() { + return this.eth_call(FEE_SCALE, {}) + } + + MAX_CROSS_PRICE_DEVIATION() { + return this.eth_call(MAX_CROSS_PRICE_DEVIATION, {}) + } + + MAX_UNSTAKERS() { + return this.eth_call(MAX_UNSTAKERS, {}) + } + + PRICE_SCALE() { + return this.eth_call(PRICE_SCALE, {}) + } + + activeMarket() { + return this.eth_call(activeMarket, {}) + } + + allocate() { + return this.eth_call(allocate, {}) + } + + allocateThreshold() { + return this.eth_call(allocateThreshold, {}) + } + + allowance(owner: AllowanceParams["owner"], spender: AllowanceParams["spender"]) { + return this.eth_call(allowance, {owner, spender}) + } + + approve(spender: ApproveParams["spender"], value: ApproveParams["value"]) { + return this.eth_call(approve, {spender, value}) + } + + armBuffer() { + return this.eth_call(armBuffer, {}) + } + + asset() { + return this.eth_call(asset, {}) + } + + balanceOf(account: BalanceOfParams["account"]) { + return this.eth_call(balanceOf, {account}) + } + + baseAsset() { + return this.eth_call(baseAsset, {}) + } + + capManager() { + return this.eth_call(capManager, {}) + } + + claimDelay() { + return this.eth_call(claimDelay, {}) + } + + claimRedeem(requestId: ClaimRedeemParams["requestId"]) { + return this.eth_call(claimRedeem, {requestId}) + } + + claimable() { + return this.eth_call(claimable, {}) + } + + collectFees() { + return this.eth_call(collectFees, {}) + } + + convertToAssets(shares: ConvertToAssetsParams["shares"]) { + return this.eth_call(convertToAssets, {shares}) + } + + convertToShares(assets: ConvertToSharesParams["assets"]) { + return this.eth_call(convertToShares, {assets}) + } + + crossPrice() { + return this.eth_call(crossPrice, {}) + } + + decimals() { + return this.eth_call(decimals, {}) + } + + deposit(assets: DepositParams["assets"], receiver: DepositParams["receiver"]) { + return this.eth_call(deposit, {assets, receiver}) + } + + deposit_1(assets: DepositParams_1["assets"]) { + return this.eth_call(deposit_1, {assets}) + } + + fee() { + return this.eth_call(fee, {}) + } + + feeCollector() { + return this.eth_call(feeCollector, {}) + } + + feesAccrued() { + return this.eth_call(feesAccrued, {}) + } + + getReserves() { + return this.eth_call(getReserves, {}) + } + + lastAvailableAssets() { + return this.eth_call(lastAvailableAssets, {}) + } + + lastRequestTimestamp() { + return this.eth_call(lastRequestTimestamp, {}) + } + + liquidityAmountInCooldown() { + return this.eth_call(liquidityAmountInCooldown, {}) + } + + liquidityAsset() { + return this.eth_call(liquidityAsset, {}) + } + + minSharesToRedeem() { + return this.eth_call(minSharesToRedeem, {}) + } + + name() { + return this.eth_call(name, {}) + } + + nextUnstakerIndex() { + return this.eth_call(nextUnstakerIndex, {}) + } + + nextWithdrawalIndex() { + return this.eth_call(nextWithdrawalIndex, {}) + } + + operator() { + return this.eth_call(operator, {}) + } + + owner() { + return this.eth_call(owner, {}) + } + + previewDeposit(assets: PreviewDepositParams["assets"]) { + return this.eth_call(previewDeposit, {assets}) + } + + previewRedeem(shares: PreviewRedeemParams["shares"]) { + return this.eth_call(previewRedeem, {shares}) + } + + requestRedeem(shares: RequestRedeemParams["shares"]) { + return this.eth_call(requestRedeem, {shares}) + } + + supportedMarkets(market: SupportedMarketsParams["market"]) { + return this.eth_call(supportedMarkets, {market}) + } + + susde() { + return this.eth_call(susde, {}) + } + + swapExactTokensForTokens(amountIn: SwapExactTokensForTokensParams["amountIn"], amountOutMin: SwapExactTokensForTokensParams["amountOutMin"], path: SwapExactTokensForTokensParams["path"], to: SwapExactTokensForTokensParams["to"], deadline: SwapExactTokensForTokensParams["deadline"]) { + return this.eth_call(swapExactTokensForTokens, {amountIn, amountOutMin, path, to, deadline}) + } + + swapExactTokensForTokens_1(inToken: SwapExactTokensForTokensParams_1["inToken"], outToken: SwapExactTokensForTokensParams_1["outToken"], amountIn: SwapExactTokensForTokensParams_1["amountIn"], amountOutMin: SwapExactTokensForTokensParams_1["amountOutMin"], to: SwapExactTokensForTokensParams_1["to"]) { + return this.eth_call(swapExactTokensForTokens_1, {inToken, outToken, amountIn, amountOutMin, to}) + } + + swapTokensForExactTokens(amountOut: SwapTokensForExactTokensParams["amountOut"], amountInMax: SwapTokensForExactTokensParams["amountInMax"], path: SwapTokensForExactTokensParams["path"], to: SwapTokensForExactTokensParams["to"], deadline: SwapTokensForExactTokensParams["deadline"]) { + return this.eth_call(swapTokensForExactTokens, {amountOut, amountInMax, path, to, deadline}) + } + + swapTokensForExactTokens_1(inToken: SwapTokensForExactTokensParams_1["inToken"], outToken: SwapTokensForExactTokensParams_1["outToken"], amountOut: SwapTokensForExactTokensParams_1["amountOut"], amountInMax: SwapTokensForExactTokensParams_1["amountInMax"], to: SwapTokensForExactTokensParams_1["to"]) { + return this.eth_call(swapTokensForExactTokens_1, {inToken, outToken, amountOut, amountInMax, to}) + } + + symbol() { + return this.eth_call(symbol, {}) + } + + token0() { + return this.eth_call(token0, {}) + } + + token1() { + return this.eth_call(token1, {}) + } + + totalAssets() { + return this.eth_call(totalAssets, {}) + } + + totalSupply() { + return this.eth_call(totalSupply, {}) + } + + traderate0() { + return this.eth_call(traderate0, {}) + } + + traderate1() { + return this.eth_call(traderate1, {}) + } + + transfer(to: TransferParams["to"], value: TransferParams["value"]) { + return this.eth_call(transfer, {to, value}) + } + + transferFrom(from: TransferFromParams["from"], to: TransferFromParams["to"], value: TransferFromParams["value"]) { + return this.eth_call(transferFrom, {from, to, value}) + } + + unstakers(_0: UnstakersParams["_0"]) { + return this.eth_call(unstakers, {_0}) + } + + usde() { + return this.eth_call(usde, {}) + } + + withdrawalRequests(requestId: WithdrawalRequestsParams["requestId"]) { + return this.eth_call(withdrawalRequests, {requestId}) + } + + withdrawsClaimed() { + return this.eth_call(withdrawsClaimed, {}) + } + + withdrawsQueued() { + return this.eth_call(withdrawsQueued, {}) + } +} diff --git a/src/abi/origin-ethena-arm/events.ts b/src/abi/origin-ethena-arm/events.ts new file mode 100644 index 00000000..b296aac5 --- /dev/null +++ b/src/abi/origin-ethena-arm/events.ts @@ -0,0 +1,149 @@ +import { address, int256, uint256, uint64 } from '@subsquid/evm-codec' +import { event, indexed } from '../abi.support.js' +import type { EventParams as EParams } from '../abi.support.js' + +/** ARMBufferUpdated(uint256) */ +export const ARMBufferUpdated = event('0x29128dbcf994e1ddc09cdbce01c287bb3f6b0cf4dd3c98174cadbbaf67bc22d7', { + armBuffer: uint256, +}) +export type ARMBufferUpdatedEventArgs = EParams + +/** ActiveMarketUpdated(address) */ +export const ActiveMarketUpdated = event('0xe9f5fe520e5763f721d470ecb21b23763a3b0b9e720070111b1b935c1107b065', { + market: indexed(address), +}) +export type ActiveMarketUpdatedEventArgs = EParams + +/** AdminChanged(address,address) */ +export const AdminChanged = event('0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f', { + previousAdmin: address, + newAdmin: address, +}) +export type AdminChangedEventArgs = EParams + +/** Allocated(address,int256,int256) */ +export const Allocated = event('0x0538e1fc8a5bd2f2ae0c40c0a54b4208673263b92c883fe270768a5151346dfd', { + market: indexed(address), + targetLiquidityDelta: int256, + actualLiquidityDelta: int256, +}) +export type AllocatedEventArgs = EParams + +/** Approval(address,address,uint256) */ +export const Approval = event('0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925', { + owner: indexed(address), + spender: indexed(address), + value: uint256, +}) +export type ApprovalEventArgs = EParams + +/** CapManagerUpdated(address) */ +export const CapManagerUpdated = event('0xb8fd9afc34c38fcd13b9a3b7646482eb1fddcefb40af2c70609972816eba3208', { + capManager: indexed(address), +}) +export type CapManagerUpdatedEventArgs = EParams + +/** ClaimBaseWithdrawals(address,uint256) */ +export const ClaimBaseWithdrawals = event('0x8528f5537e4b9fc69da2fa4d455c4e03a5cc2c5a05d8815c8c06a6242f56ad57', { + unstaker: indexed(address), + liquidityAmount: uint256, +}) +export type ClaimBaseWithdrawalsEventArgs = EParams + +/** CrossPriceUpdated(uint256) */ +export const CrossPriceUpdated = event('0x6f938e86fbdbe7829d0289b348cd9e528f2f17c705f469f4a17a0a2796e007d0', { + crossPrice: uint256, +}) +export type CrossPriceUpdatedEventArgs = EParams + +/** Deposit(address,uint256,uint256) */ +export const Deposit = event('0x90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a15', { + owner: indexed(address), + assets: uint256, + shares: uint256, +}) +export type DepositEventArgs = EParams + +/** FeeCollected(address,uint256) */ +export const FeeCollected = event('0x06c5efeff5c320943d265dc4e5f1af95ad523555ce0c1957e367dda5514572df', { + feeCollector: indexed(address), + fee: uint256, +}) +export type FeeCollectedEventArgs = EParams + +/** FeeCollectorUpdated(address) */ +export const FeeCollectorUpdated = event('0xe5693914d19c789bdee50a362998c0bc8d035a835f9871da5d51152f0582c34f', { + newFeeCollector: indexed(address), +}) +export type FeeCollectorUpdatedEventArgs = EParams + +/** FeeUpdated(uint256) */ +export const FeeUpdated = event('0x8c4d35e54a3f2ef1134138fd8ea3daee6a3c89e10d2665996babdf70261e2c76', { + fee: uint256, +}) +export type FeeUpdatedEventArgs = EParams + +/** Initialized(uint64) */ +export const Initialized = event('0xc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2', { + version: uint64, +}) +export type InitializedEventArgs = EParams + +/** MarketAdded(address) */ +export const MarketAdded = event('0xbc600b1f03d316c479b49930c28e328809316458d5b5dacbb7419df5f6f89647', { + market: indexed(address), +}) +export type MarketAddedEventArgs = EParams + +/** MarketRemoved(address) */ +export const MarketRemoved = event('0x59d7b1e52008dc342c9421dadfc773114b914a65682a4e4b53cf60a970df0d77', { + market: indexed(address), +}) +export type MarketRemovedEventArgs = EParams + +/** OperatorChanged(address) */ +export const OperatorChanged = event('0x4721129e0e676ed6a92909bb24e853ccdd63ad72280cc2e974e38e480e0e6e54', { + newAdmin: address, +}) +export type OperatorChangedEventArgs = EParams + +/** RedeemClaimed(address,uint256,uint256) */ +export const RedeemClaimed = event('0x36dd2c9b55f12509e3b5f4f4d765ddefc2776a28018b18da2335cf2ab93bb268', { + withdrawer: indexed(address), + requestId: indexed(uint256), + assets: uint256, +}) +export type RedeemClaimedEventArgs = EParams + +/** RedeemRequested(address,uint256,uint256,uint256,uint256) */ +export const RedeemRequested = event('0xc04c86cfd81036557541f9c68971ace59cbc9057ecab7d48874a6177ad117f4f', { + withdrawer: indexed(address), + requestId: indexed(uint256), + assets: uint256, + queued: uint256, + claimTimestamp: uint256, +}) +export type RedeemRequestedEventArgs = EParams + +/** RequestBaseWithdrawal(address,uint256,uint256) */ +export const RequestBaseWithdrawal = event('0x9910c447d600210d0328b2c6f5374d7acc58344b9ce5d9c97f5a2a90fa611956', { + unstaker: indexed(address), + baseAmount: uint256, + liquidityAmount: uint256, +}) +export type RequestBaseWithdrawalEventArgs = EParams + +/** TraderateChanged(uint256,uint256) */ +export const TraderateChanged = event('0xa2136948fd1e5333c2ee27c9e48848a560b693e6bbd18082623a738179ff2952', { + traderate0: uint256, + traderate1: uint256, +}) +export type TraderateChangedEventArgs = EParams + +/** Transfer(address,address,uint256) */ +export const Transfer = event('0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', { + from: indexed(address), + to: indexed(address), + value: uint256, +}) +export type TransferEventArgs = EParams diff --git a/src/abi/origin-ethena-arm/functions.ts b/src/abi/origin-ethena-arm/functions.ts new file mode 100644 index 00000000..bf76dcb1 --- /dev/null +++ b/src/abi/origin-ethena-arm/functions.ts @@ -0,0 +1,502 @@ +import { address, array, bool, fixedSizeArray, int128, int256, string, struct, uint128, uint16, uint256, uint32, uint40, uint8 } from '@subsquid/evm-codec' +import { func } from '../abi.support.js' +import type { FunctionArguments, FunctionReturn } from '../abi.support.js' + +/** DELAY_REQUEST() */ +export const DELAY_REQUEST = func('0x74e17388', {}, uint256) +export type DELAY_REQUESTParams = FunctionArguments +export type DELAY_REQUESTReturn = FunctionReturn + +/** FEE_SCALE() */ +export const FEE_SCALE = func('0x8a5fddd8', {}, uint256) +export type FEE_SCALEParams = FunctionArguments +export type FEE_SCALEReturn = FunctionReturn + +/** MAX_CROSS_PRICE_DEVIATION() */ +export const MAX_CROSS_PRICE_DEVIATION = func('0x090b78c5', {}, uint256) +export type MAX_CROSS_PRICE_DEVIATIONParams = FunctionArguments +export type MAX_CROSS_PRICE_DEVIATIONReturn = FunctionReturn + +/** MAX_UNSTAKERS() */ +export const MAX_UNSTAKERS = func('0xc4c86d57', {}, uint8) +export type MAX_UNSTAKERSParams = FunctionArguments +export type MAX_UNSTAKERSReturn = FunctionReturn + +/** PRICE_SCALE() */ +export const PRICE_SCALE = func('0xc33f59d3', {}, uint256) +export type PRICE_SCALEParams = FunctionArguments +export type PRICE_SCALEReturn = FunctionReturn + +/** activeMarket() */ +export const activeMarket = func('0xce318c51', {}, address) +export type ActiveMarketParams = FunctionArguments +export type ActiveMarketReturn = FunctionReturn + +/** addMarkets(address[]) */ +export const addMarkets = func('0xda40385d', { + _markets: array(address), +}) +export type AddMarketsParams = FunctionArguments +export type AddMarketsReturn = FunctionReturn + +/** allocate() */ +export const allocate = func('0xabaa9916', {}, struct({ + targetLiquidityDelta: int256, + actualLiquidityDelta: int256, +})) +export type AllocateParams = FunctionArguments +export type AllocateReturn = FunctionReturn + +/** allocateThreshold() */ +export const allocateThreshold = func('0x4a8ff603', {}, int256) +export type AllocateThresholdParams = FunctionArguments +export type AllocateThresholdReturn = FunctionReturn + +/** allowance(address,address) */ +export const allowance = func('0xdd62ed3e', { + owner: address, + spender: address, +}, uint256) +export type AllowanceParams = FunctionArguments +export type AllowanceReturn = FunctionReturn + +/** approve(address,uint256) */ +export const approve = func('0x095ea7b3', { + spender: address, + value: uint256, +}, bool) +export type ApproveParams = FunctionArguments +export type ApproveReturn = FunctionReturn + +/** armBuffer() */ +export const armBuffer = func('0xa4c84f25', {}, uint256) +export type ArmBufferParams = FunctionArguments +export type ArmBufferReturn = FunctionReturn + +/** asset() */ +export const asset = func('0x38d52e0f', {}, address) +export type AssetParams = FunctionArguments +export type AssetReturn = FunctionReturn + +/** balanceOf(address) */ +export const balanceOf = func('0x70a08231', { + account: address, +}, uint256) +export type BalanceOfParams = FunctionArguments +export type BalanceOfReturn = FunctionReturn + +/** baseAsset() */ +export const baseAsset = func('0xcdf456e1', {}, address) +export type BaseAssetParams = FunctionArguments +export type BaseAssetReturn = FunctionReturn + +/** capManager() */ +export const capManager = func('0x6d785a87', {}, address) +export type CapManagerParams = FunctionArguments +export type CapManagerReturn = FunctionReturn + +/** claimBaseWithdrawals(address) */ +export const claimBaseWithdrawals = func('0xad3a6706', { + unstaker: address, +}) +export type ClaimBaseWithdrawalsParams = FunctionArguments +export type ClaimBaseWithdrawalsReturn = FunctionReturn + +/** claimDelay() */ +export const claimDelay = func('0x1c8ec299', {}, uint256) +export type ClaimDelayParams = FunctionArguments +export type ClaimDelayReturn = FunctionReturn + +/** claimRedeem(uint256) */ +export const claimRedeem = func('0xe46cf747', { + requestId: uint256, +}, uint256) +export type ClaimRedeemParams = FunctionArguments +export type ClaimRedeemReturn = FunctionReturn + +/** claimable() */ +export const claimable = func('0xaf38d757', {}, uint256) +export type ClaimableParams = FunctionArguments +export type ClaimableReturn = FunctionReturn + +/** collectFees() */ +export const collectFees = func('0xc8796572', {}, uint256) +export type CollectFeesParams = FunctionArguments +export type CollectFeesReturn = FunctionReturn + +/** convertToAssets(uint256) */ +export const convertToAssets = func('0x07a2d13a', { + shares: uint256, +}, uint256) +export type ConvertToAssetsParams = FunctionArguments +export type ConvertToAssetsReturn = FunctionReturn + +/** convertToShares(uint256) */ +export const convertToShares = func('0xc6e6f592', { + assets: uint256, +}, uint256) +export type ConvertToSharesParams = FunctionArguments +export type ConvertToSharesReturn = FunctionReturn + +/** crossPrice() */ +export const crossPrice = func('0xf5488330', {}, uint256) +export type CrossPriceParams = FunctionArguments +export type CrossPriceReturn = FunctionReturn + +/** decimals() */ +export const decimals = func('0x313ce567', {}, uint8) +export type DecimalsParams = FunctionArguments +export type DecimalsReturn = FunctionReturn + +/** deposit(uint256,address) */ +export const deposit = func('0x6e553f65', { + assets: uint256, + receiver: address, +}, uint256) +export type DepositParams = FunctionArguments +export type DepositReturn = FunctionReturn + +/** deposit(uint256) */ +export const deposit_1 = func('0xb6b55f25', { + assets: uint256, +}, uint256) +export type DepositParams_1 = FunctionArguments +export type DepositReturn_1 = FunctionReturn + +/** fee() */ +export const fee = func('0xddca3f43', {}, uint16) +export type FeeParams = FunctionArguments +export type FeeReturn = FunctionReturn + +/** feeCollector() */ +export const feeCollector = func('0xc415b95c', {}, address) +export type FeeCollectorParams = FunctionArguments +export type FeeCollectorReturn = FunctionReturn + +/** feesAccrued() */ +export const feesAccrued = func('0x94db0595', {}, uint256) +export type FeesAccruedParams = FunctionArguments +export type FeesAccruedReturn = FunctionReturn + +/** getReserves() */ +export const getReserves = func('0x0902f1ac', {}, struct({ + reserve0: uint256, + reserve1: uint256, +})) +export type GetReservesParams = FunctionArguments +export type GetReservesReturn = FunctionReturn + +/** initialize(string,string,address,uint256,address,address) */ +export const initialize = func('0xb3ddda2a', { + _name: string, + _symbol: string, + _operator: address, + _fee: uint256, + _feeCollector: address, + _capManager: address, +}) +export type InitializeParams = FunctionArguments +export type InitializeReturn = FunctionReturn + +/** lastAvailableAssets() */ +export const lastAvailableAssets = func('0x2eb6328b', {}, int128) +export type LastAvailableAssetsParams = FunctionArguments +export type LastAvailableAssetsReturn = FunctionReturn + +/** lastRequestTimestamp() */ +export const lastRequestTimestamp = func('0xf664a16e', {}, uint32) +export type LastRequestTimestampParams = FunctionArguments +export type LastRequestTimestampReturn = FunctionReturn + +/** liquidityAmountInCooldown() */ +export const liquidityAmountInCooldown = func('0x15780107', {}, uint256) +export type LiquidityAmountInCooldownParams = FunctionArguments +export type LiquidityAmountInCooldownReturn = FunctionReturn + +/** liquidityAsset() */ +export const liquidityAsset = func('0x209b2bca', {}, address) +export type LiquidityAssetParams = FunctionArguments +export type LiquidityAssetReturn = FunctionReturn + +/** minSharesToRedeem() */ +export const minSharesToRedeem = func('0x50d0ea39', {}, uint256) +export type MinSharesToRedeemParams = FunctionArguments +export type MinSharesToRedeemReturn = FunctionReturn + +/** name() */ +export const name = func('0x06fdde03', {}, string) +export type NameParams = FunctionArguments +export type NameReturn = FunctionReturn + +/** nextUnstakerIndex() */ +export const nextUnstakerIndex = func('0xa2bc8b68', {}, uint8) +export type NextUnstakerIndexParams = FunctionArguments +export type NextUnstakerIndexReturn = FunctionReturn + +/** nextWithdrawalIndex() */ +export const nextWithdrawalIndex = func('0xbba9282e', {}, uint256) +export type NextWithdrawalIndexParams = FunctionArguments +export type NextWithdrawalIndexReturn = FunctionReturn + +/** operator() */ +export const operator = func('0x570ca735', {}, address) +export type OperatorParams = FunctionArguments +export type OperatorReturn = FunctionReturn + +/** owner() */ +export const owner = func('0x8da5cb5b', {}, address) +export type OwnerParams = FunctionArguments +export type OwnerReturn = FunctionReturn + +/** previewDeposit(uint256) */ +export const previewDeposit = func('0xef8b30f7', { + assets: uint256, +}, uint256) +export type PreviewDepositParams = FunctionArguments +export type PreviewDepositReturn = FunctionReturn + +/** previewRedeem(uint256) */ +export const previewRedeem = func('0x4cdad506', { + shares: uint256, +}, uint256) +export type PreviewRedeemParams = FunctionArguments +export type PreviewRedeemReturn = FunctionReturn + +/** removeMarket(address) */ +export const removeMarket = func('0xdb913236', { + _market: address, +}) +export type RemoveMarketParams = FunctionArguments +export type RemoveMarketReturn = FunctionReturn + +/** requestBaseWithdrawal(uint256) */ +export const requestBaseWithdrawal = func('0x8831223b', { + baseAmount: uint256, +}) +export type RequestBaseWithdrawalParams = FunctionArguments +export type RequestBaseWithdrawalReturn = FunctionReturn + +/** requestRedeem(uint256) */ +export const requestRedeem = func('0xaa2f892d', { + shares: uint256, +}, struct({ + requestId: uint256, + assets: uint256, +})) +export type RequestRedeemParams = FunctionArguments +export type RequestRedeemReturn = FunctionReturn + +/** setARMBuffer(uint256) */ +export const setARMBuffer = func('0x95f9e9e6', { + _armBuffer: uint256, +}) +export type SetARMBufferParams = FunctionArguments +export type SetARMBufferReturn = FunctionReturn + +/** setActiveMarket(address) */ +export const setActiveMarket = func('0xab710b24', { + _market: address, +}) +export type SetActiveMarketParams = FunctionArguments +export type SetActiveMarketReturn = FunctionReturn + +/** setCapManager(address) */ +export const setCapManager = func('0x0e608b30', { + _capManager: address, +}) +export type SetCapManagerParams = FunctionArguments +export type SetCapManagerReturn = FunctionReturn + +/** setCrossPrice(uint256) */ +export const setCrossPrice = func('0x30486f3c', { + newCrossPrice: uint256, +}) +export type SetCrossPriceParams = FunctionArguments +export type SetCrossPriceReturn = FunctionReturn + +/** setFee(uint256) */ +export const setFee = func('0x69fe0e2d', { + _fee: uint256, +}) +export type SetFeeParams = FunctionArguments +export type SetFeeReturn = FunctionReturn + +/** setFeeCollector(address) */ +export const setFeeCollector = func('0xa42dce80', { + _feeCollector: address, +}) +export type SetFeeCollectorParams = FunctionArguments +export type SetFeeCollectorReturn = FunctionReturn + +/** setOperator(address) */ +export const setOperator = func('0xb3ab15fb', { + newOperator: address, +}) +export type SetOperatorParams = FunctionArguments +export type SetOperatorReturn = FunctionReturn + +/** setOwner(address) */ +export const setOwner = func('0x13af4035', { + newOwner: address, +}) +export type SetOwnerParams = FunctionArguments +export type SetOwnerReturn = FunctionReturn + +/** setPrices(uint256,uint256) */ +export const setPrices = func('0x05fefda7', { + buyT1: uint256, + sellT1: uint256, +}) +export type SetPricesParams = FunctionArguments +export type SetPricesReturn = FunctionReturn + +/** setUnstakers(address[42]) */ +export const setUnstakers = func('0xdf744321', { + _unstakers: fixedSizeArray(address, 42), +}) +export type SetUnstakersParams = FunctionArguments +export type SetUnstakersReturn = FunctionReturn + +/** supportedMarkets(address) */ +export const supportedMarkets = func('0x20761fc4', { + market: address, +}, bool) +export type SupportedMarketsParams = FunctionArguments +export type SupportedMarketsReturn = FunctionReturn + +/** susde() */ +export const susde = func('0x032988da', {}, address) +export type SusdeParams = FunctionArguments +export type SusdeReturn = FunctionReturn + +/** swapExactTokensForTokens(uint256,uint256,address[],address,uint256) */ +export const swapExactTokensForTokens = func('0x38ed1739', { + amountIn: uint256, + amountOutMin: uint256, + path: array(address), + to: address, + deadline: uint256, +}, array(uint256)) +export type SwapExactTokensForTokensParams = FunctionArguments +export type SwapExactTokensForTokensReturn = FunctionReturn + +/** swapExactTokensForTokens(address,address,uint256,uint256,address) */ +export const swapExactTokensForTokens_1 = func('0x6c08c57e', { + inToken: address, + outToken: address, + amountIn: uint256, + amountOutMin: uint256, + to: address, +}, array(uint256)) +export type SwapExactTokensForTokensParams_1 = FunctionArguments +export type SwapExactTokensForTokensReturn_1 = FunctionReturn + +/** swapTokensForExactTokens(uint256,uint256,address[],address,uint256) */ +export const swapTokensForExactTokens = func('0x8803dbee', { + amountOut: uint256, + amountInMax: uint256, + path: array(address), + to: address, + deadline: uint256, +}, array(uint256)) +export type SwapTokensForExactTokensParams = FunctionArguments +export type SwapTokensForExactTokensReturn = FunctionReturn + +/** swapTokensForExactTokens(address,address,uint256,uint256,address) */ +export const swapTokensForExactTokens_1 = func('0xf7d31809', { + inToken: address, + outToken: address, + amountOut: uint256, + amountInMax: uint256, + to: address, +}, array(uint256)) +export type SwapTokensForExactTokensParams_1 = FunctionArguments +export type SwapTokensForExactTokensReturn_1 = FunctionReturn + +/** symbol() */ +export const symbol = func('0x95d89b41', {}, string) +export type SymbolParams = FunctionArguments +export type SymbolReturn = FunctionReturn + +/** token0() */ +export const token0 = func('0x0dfe1681', {}, address) +export type Token0Params = FunctionArguments +export type Token0Return = FunctionReturn + +/** token1() */ +export const token1 = func('0xd21220a7', {}, address) +export type Token1Params = FunctionArguments +export type Token1Return = FunctionReturn + +/** totalAssets() */ +export const totalAssets = func('0x01e1d114', {}, uint256) +export type TotalAssetsParams = FunctionArguments +export type TotalAssetsReturn = FunctionReturn + +/** totalSupply() */ +export const totalSupply = func('0x18160ddd', {}, uint256) +export type TotalSupplyParams = FunctionArguments +export type TotalSupplyReturn = FunctionReturn + +/** traderate0() */ +export const traderate0 = func('0x45059a6b', {}, uint256) +export type Traderate0Params = FunctionArguments +export type Traderate0Return = FunctionReturn + +/** traderate1() */ +export const traderate1 = func('0xcf1de5d8', {}, uint256) +export type Traderate1Params = FunctionArguments +export type Traderate1Return = FunctionReturn + +/** transfer(address,uint256) */ +export const transfer = func('0xa9059cbb', { + to: address, + value: uint256, +}, bool) +export type TransferParams = FunctionArguments +export type TransferReturn = FunctionReturn + +/** transferFrom(address,address,uint256) */ +export const transferFrom = func('0x23b872dd', { + from: address, + to: address, + value: uint256, +}, bool) +export type TransferFromParams = FunctionArguments +export type TransferFromReturn = FunctionReturn + +/** unstakers(uint256) */ +export const unstakers = func('0x9be64959', { + _0: uint256, +}, address) +export type UnstakersParams = FunctionArguments +export type UnstakersReturn = FunctionReturn + +/** usde() */ +export const usde = func('0x0fd761e0', {}, address) +export type UsdeParams = FunctionArguments +export type UsdeReturn = FunctionReturn + +/** withdrawalRequests(uint256) */ +export const withdrawalRequests = func('0x937b2581', { + requestId: uint256, +}, struct({ + withdrawer: address, + claimed: bool, + claimTimestamp: uint40, + assets: uint128, + queued: uint128, + shares: uint128, +})) +export type WithdrawalRequestsParams = FunctionArguments +export type WithdrawalRequestsReturn = FunctionReturn + +/** withdrawsClaimed() */ +export const withdrawsClaimed = func('0x35ce81c4', {}, uint128) +export type WithdrawsClaimedParams = FunctionArguments +export type WithdrawsClaimedReturn = FunctionReturn + +/** withdrawsQueued() */ +export const withdrawsQueued = func('0x6ec68625', {}, uint128) +export type WithdrawsQueuedParams = FunctionArguments +export type WithdrawsQueuedReturn = FunctionReturn diff --git a/src/abi/origin-ethena-arm/index.ts b/src/abi/origin-ethena-arm/index.ts new file mode 100644 index 00000000..11829d6e --- /dev/null +++ b/src/abi/origin-ethena-arm/index.ts @@ -0,0 +1,4 @@ +export * as events from './events.js' +export * as functions from './functions.js' + +export { Contract } from './contract.js' diff --git a/src/abi/origin-etherfi-arm.ts b/src/abi/origin-etherfi-arm.ts deleted file mode 100644 index 809a7241..00000000 --- a/src/abi/origin-etherfi-arm.ts +++ /dev/null @@ -1,560 +0,0 @@ -import * as p from '@subsquid/evm-codec' -import { event, fun, viewFun, indexed, ContractBase } from '@subsquid/evm-abi' -import type { EventParams as EParams, FunctionArguments, FunctionReturn } from '@subsquid/evm-abi' - -export const events = { - ARMBufferUpdated: event("0x29128dbcf994e1ddc09cdbce01c287bb3f6b0cf4dd3c98174cadbbaf67bc22d7", "ARMBufferUpdated(uint256)", {"armBuffer": p.uint256}), - ActiveMarketUpdated: event("0xe9f5fe520e5763f721d470ecb21b23763a3b0b9e720070111b1b935c1107b065", "ActiveMarketUpdated(address)", {"market": indexed(p.address)}), - AdminChanged: event("0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f", "AdminChanged(address,address)", {"previousAdmin": p.address, "newAdmin": p.address}), - Allocated: event("0x8de94c5178842de5720920c14d6abd0f8367785673e0f607f37b91bda0f7700c", "Allocated(address,int256)", {"market": indexed(p.address), "assets": p.int256}), - Approval: event("0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925", "Approval(address,address,uint256)", {"owner": indexed(p.address), "spender": indexed(p.address), "value": p.uint256}), - CapManagerUpdated: event("0xb8fd9afc34c38fcd13b9a3b7646482eb1fddcefb40af2c70609972816eba3208", "CapManagerUpdated(address)", {"capManager": indexed(p.address)}), - ClaimEtherFiWithdrawals: event("0x8e1e54871d51b13099eefa0b83d65f5f62d21e09e16029bb5cb77bf651d7d9a5", "ClaimEtherFiWithdrawals(uint256[])", {"requestIds": p.array(p.uint256)}), - CrossPriceUpdated: event("0x6f938e86fbdbe7829d0289b348cd9e528f2f17c705f469f4a17a0a2796e007d0", "CrossPriceUpdated(uint256)", {"crossPrice": p.uint256}), - Deposit: event("0x90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a15", "Deposit(address,uint256,uint256)", {"owner": indexed(p.address), "assets": p.uint256, "shares": p.uint256}), - FeeCollected: event("0x06c5efeff5c320943d265dc4e5f1af95ad523555ce0c1957e367dda5514572df", "FeeCollected(address,uint256)", {"feeCollector": indexed(p.address), "fee": p.uint256}), - FeeCollectorUpdated: event("0xe5693914d19c789bdee50a362998c0bc8d035a835f9871da5d51152f0582c34f", "FeeCollectorUpdated(address)", {"newFeeCollector": indexed(p.address)}), - FeeUpdated: event("0x8c4d35e54a3f2ef1134138fd8ea3daee6a3c89e10d2665996babdf70261e2c76", "FeeUpdated(uint256)", {"fee": p.uint256}), - Initialized: event("0xc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2", "Initialized(uint64)", {"version": p.uint64}), - MarketAdded: event("0xbc600b1f03d316c479b49930c28e328809316458d5b5dacbb7419df5f6f89647", "MarketAdded(address)", {"market": indexed(p.address)}), - MarketRemoved: event("0x59d7b1e52008dc342c9421dadfc773114b914a65682a4e4b53cf60a970df0d77", "MarketRemoved(address)", {"market": indexed(p.address)}), - OperatorChanged: event("0x4721129e0e676ed6a92909bb24e853ccdd63ad72280cc2e974e38e480e0e6e54", "OperatorChanged(address)", {"newAdmin": p.address}), - RedeemClaimed: event("0x36dd2c9b55f12509e3b5f4f4d765ddefc2776a28018b18da2335cf2ab93bb268", "RedeemClaimed(address,uint256,uint256)", {"withdrawer": indexed(p.address), "requestId": indexed(p.uint256), "assets": p.uint256}), - RedeemRequested: event("0xc04c86cfd81036557541f9c68971ace59cbc9057ecab7d48874a6177ad117f4f", "RedeemRequested(address,uint256,uint256,uint256,uint256)", {"withdrawer": indexed(p.address), "requestId": indexed(p.uint256), "assets": p.uint256, "queued": p.uint256, "claimTimestamp": p.uint256}), - RegisterEtherFiWithdrawalRequests: event("0x5bcd3d54a041466fb9b7b96cc95157490816813f67990974e3f3b24b58a5996b", "RegisterEtherFiWithdrawalRequests(uint256[],uint256)", {"requestIds": p.array(p.uint256), "totalAmountRequested": p.uint256}), - RequestEtherFiWithdrawal: event("0x175bf92b330cf62d4fa2e358efef3366f13d7f24cc251f7c7a6943de8c6e7a17", "RequestEtherFiWithdrawal(uint256,uint256)", {"amount": p.uint256, "requestId": p.uint256}), - TraderateChanged: event("0xa2136948fd1e5333c2ee27c9e48848a560b693e6bbd18082623a738179ff2952", "TraderateChanged(uint256,uint256)", {"traderate0": p.uint256, "traderate1": p.uint256}), - Transfer: event("0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", "Transfer(address,address,uint256)", {"from": indexed(p.address), "to": indexed(p.address), "value": p.uint256}), -} - -export const functions = { - FEE_SCALE: viewFun("0x8a5fddd8", "FEE_SCALE()", {}, p.uint256), - MAX_CROSS_PRICE_DEVIATION: viewFun("0x090b78c5", "MAX_CROSS_PRICE_DEVIATION()", {}, p.uint256), - PRICE_SCALE: viewFun("0xc33f59d3", "PRICE_SCALE()", {}, p.uint256), - activeMarket: viewFun("0xce318c51", "activeMarket()", {}, p.address), - addMarkets: fun("0xda40385d", "addMarkets(address[])", {"_markets": p.array(p.address)}, ), - allocate: fun("0xabaa9916", "allocate()", {}, p.int256), - allocateThreshold: viewFun("0x4a8ff603", "allocateThreshold()", {}, p.int256), - allowance: viewFun("0xdd62ed3e", "allowance(address,address)", {"owner": p.address, "spender": p.address}, p.uint256), - approve: fun("0x095ea7b3", "approve(address,uint256)", {"spender": p.address, "value": p.uint256}, p.bool), - armBuffer: viewFun("0xa4c84f25", "armBuffer()", {}, p.uint256), - asset: viewFun("0x38d52e0f", "asset()", {}, p.address), - balanceOf: viewFun("0x70a08231", "balanceOf(address)", {"account": p.address}, p.uint256), - baseAsset: viewFun("0xcdf456e1", "baseAsset()", {}, p.address), - capManager: viewFun("0x6d785a87", "capManager()", {}, p.address), - claimDelay: viewFun("0x1c8ec299", "claimDelay()", {}, p.uint256), - claimEtherFiWithdrawals: fun("0xb45e2d75", "claimEtherFiWithdrawals(uint256[])", {"requestIds": p.array(p.uint256)}, ), - claimRedeem: fun("0xe46cf747", "claimRedeem(uint256)", {"requestId": p.uint256}, p.uint256), - claimable: viewFun("0xaf38d757", "claimable()", {}, p.uint256), - collectFees: fun("0xc8796572", "collectFees()", {}, p.uint256), - convertToAssets: viewFun("0x07a2d13a", "convertToAssets(uint256)", {"shares": p.uint256}, p.uint256), - convertToShares: viewFun("0xc6e6f592", "convertToShares(uint256)", {"assets": p.uint256}, p.uint256), - crossPrice: viewFun("0xf5488330", "crossPrice()", {}, p.uint256), - decimals: viewFun("0x313ce567", "decimals()", {}, p.uint8), - 'deposit(uint256,address)': fun("0x6e553f65", "deposit(uint256,address)", {"assets": p.uint256, "receiver": p.address}, p.uint256), - 'deposit(uint256)': fun("0xb6b55f25", "deposit(uint256)", {"assets": p.uint256}, p.uint256), - eeth: viewFun("0x7f09217b", "eeth()", {}, p.address), - etherfiRedemptionManager: viewFun("0x92a97e1a", "etherfiRedemptionManager()", {}, p.address), - etherfiWithdrawalNFT: viewFun("0xa6b4d947", "etherfiWithdrawalNFT()", {}, p.address), - etherfiWithdrawalQueue: viewFun("0xf0b9510a", "etherfiWithdrawalQueue()", {}, p.address), - etherfiWithdrawalQueueAmount: viewFun("0x9f809234", "etherfiWithdrawalQueueAmount()", {}, p.uint256), - etherfiWithdrawalRequests: viewFun("0x56049dd9", "etherfiWithdrawalRequests(uint256)", {"id": p.uint256}, p.uint256), - fee: viewFun("0xddca3f43", "fee()", {}, p.uint16), - feeCollector: viewFun("0xc415b95c", "feeCollector()", {}, p.address), - feesAccrued: viewFun("0x94db0595", "feesAccrued()", {}, p.uint256), - getReserves: viewFun("0x0902f1ac", "getReserves()", {}, {"reserve0": p.uint256, "reserve1": p.uint256}), - initialize: fun("0xb3ddda2a", "initialize(string,string,address,uint256,address,address)", {"_name": p.string, "_symbol": p.string, "_operator": p.address, "_fee": p.uint256, "_feeCollector": p.address, "_capManager": p.address}, ), - lastAvailableAssets: viewFun("0x2eb6328b", "lastAvailableAssets()", {}, p.int128), - liquidityAsset: viewFun("0x209b2bca", "liquidityAsset()", {}, p.address), - minSharesToRedeem: viewFun("0x50d0ea39", "minSharesToRedeem()", {}, p.uint256), - name: viewFun("0x06fdde03", "name()", {}, p.string), - nextWithdrawalIndex: viewFun("0xbba9282e", "nextWithdrawalIndex()", {}, p.uint256), - onERC721Received: viewFun("0x150b7a02", "onERC721Received(address,address,uint256,bytes)", {"operator": p.address, "from": p.address, "tokenId": p.uint256, "data": p.bytes}, p.bytes4), - operator: viewFun("0x570ca735", "operator()", {}, p.address), - owner: viewFun("0x8da5cb5b", "owner()", {}, p.address), - previewDeposit: viewFun("0xef8b30f7", "previewDeposit(uint256)", {"assets": p.uint256}, p.uint256), - previewRedeem: viewFun("0x4cdad506", "previewRedeem(uint256)", {"shares": p.uint256}, p.uint256), - removeMarket: fun("0xdb913236", "removeMarket(address)", {"_market": p.address}, ), - requestEtherFiWithdrawal: fun("0xad93a6aa", "requestEtherFiWithdrawal(uint256)", {"amount": p.uint256}, p.uint256), - requestRedeem: fun("0xaa2f892d", "requestRedeem(uint256)", {"shares": p.uint256}, {"requestId": p.uint256, "assets": p.uint256}), - setARMBuffer: fun("0x95f9e9e6", "setARMBuffer(uint256)", {"_armBuffer": p.uint256}, ), - setActiveMarket: fun("0xab710b24", "setActiveMarket(address)", {"_market": p.address}, ), - setCapManager: fun("0x0e608b30", "setCapManager(address)", {"_capManager": p.address}, ), - setCrossPrice: fun("0x30486f3c", "setCrossPrice(uint256)", {"newCrossPrice": p.uint256}, ), - setFee: fun("0x69fe0e2d", "setFee(uint256)", {"_fee": p.uint256}, ), - setFeeCollector: fun("0xa42dce80", "setFeeCollector(address)", {"_feeCollector": p.address}, ), - setOperator: fun("0xb3ab15fb", "setOperator(address)", {"newOperator": p.address}, ), - setOwner: fun("0x13af4035", "setOwner(address)", {"newOwner": p.address}, ), - setPrices: fun("0x05fefda7", "setPrices(uint256,uint256)", {"buyT1": p.uint256, "sellT1": p.uint256}, ), - supportedMarkets: viewFun("0x20761fc4", "supportedMarkets(address)", {"market": p.address}, p.bool), - 'swapExactTokensForTokens(uint256,uint256,address[],address,uint256)': fun("0x38ed1739", "swapExactTokensForTokens(uint256,uint256,address[],address,uint256)", {"amountIn": p.uint256, "amountOutMin": p.uint256, "path": p.array(p.address), "to": p.address, "deadline": p.uint256}, p.array(p.uint256)), - 'swapExactTokensForTokens(address,address,uint256,uint256,address)': fun("0x6c08c57e", "swapExactTokensForTokens(address,address,uint256,uint256,address)", {"inToken": p.address, "outToken": p.address, "amountIn": p.uint256, "amountOutMin": p.uint256, "to": p.address}, ), - 'swapTokensForExactTokens(uint256,uint256,address[],address,uint256)': fun("0x8803dbee", "swapTokensForExactTokens(uint256,uint256,address[],address,uint256)", {"amountOut": p.uint256, "amountInMax": p.uint256, "path": p.array(p.address), "to": p.address, "deadline": p.uint256}, p.array(p.uint256)), - 'swapTokensForExactTokens(address,address,uint256,uint256,address)': fun("0xf7d31809", "swapTokensForExactTokens(address,address,uint256,uint256,address)", {"inToken": p.address, "outToken": p.address, "amountOut": p.uint256, "amountInMax": p.uint256, "to": p.address}, ), - symbol: viewFun("0x95d89b41", "symbol()", {}, p.string), - token0: viewFun("0x0dfe1681", "token0()", {}, p.address), - token1: viewFun("0xd21220a7", "token1()", {}, p.address), - totalAssets: viewFun("0x01e1d114", "totalAssets()", {}, p.uint256), - totalSupply: viewFun("0x18160ddd", "totalSupply()", {}, p.uint256), - traderate0: viewFun("0x45059a6b", "traderate0()", {}, p.uint256), - traderate1: viewFun("0xcf1de5d8", "traderate1()", {}, p.uint256), - transfer: fun("0xa9059cbb", "transfer(address,uint256)", {"to": p.address, "value": p.uint256}, p.bool), - transferFrom: fun("0x23b872dd", "transferFrom(address,address,uint256)", {"from": p.address, "to": p.address, "value": p.uint256}, p.bool), - weth: viewFun("0x3fc8cef3", "weth()", {}, p.address), - withdrawalRequests: viewFun("0x937b2581", "withdrawalRequests(uint256)", {"requestId": p.uint256}, {"withdrawer": p.address, "claimed": p.bool, "claimTimestamp": p.uint40, "assets": p.uint128, "queued": p.uint128}), - withdrawsClaimed: viewFun("0x35ce81c4", "withdrawsClaimed()", {}, p.uint128), - withdrawsQueued: viewFun("0x6ec68625", "withdrawsQueued()", {}, p.uint128), -} - -export class Contract extends ContractBase { - - FEE_SCALE() { - return this.eth_call(functions.FEE_SCALE, {}) - } - - MAX_CROSS_PRICE_DEVIATION() { - return this.eth_call(functions.MAX_CROSS_PRICE_DEVIATION, {}) - } - - PRICE_SCALE() { - return this.eth_call(functions.PRICE_SCALE, {}) - } - - activeMarket() { - return this.eth_call(functions.activeMarket, {}) - } - - allocateThreshold() { - return this.eth_call(functions.allocateThreshold, {}) - } - - allowance(owner: AllowanceParams["owner"], spender: AllowanceParams["spender"]) { - return this.eth_call(functions.allowance, {owner, spender}) - } - - armBuffer() { - return this.eth_call(functions.armBuffer, {}) - } - - asset() { - return this.eth_call(functions.asset, {}) - } - - balanceOf(account: BalanceOfParams["account"]) { - return this.eth_call(functions.balanceOf, {account}) - } - - baseAsset() { - return this.eth_call(functions.baseAsset, {}) - } - - capManager() { - return this.eth_call(functions.capManager, {}) - } - - claimDelay() { - return this.eth_call(functions.claimDelay, {}) - } - - claimable() { - return this.eth_call(functions.claimable, {}) - } - - convertToAssets(shares: ConvertToAssetsParams["shares"]) { - return this.eth_call(functions.convertToAssets, {shares}) - } - - convertToShares(assets: ConvertToSharesParams["assets"]) { - return this.eth_call(functions.convertToShares, {assets}) - } - - crossPrice() { - return this.eth_call(functions.crossPrice, {}) - } - - decimals() { - return this.eth_call(functions.decimals, {}) - } - - eeth() { - return this.eth_call(functions.eeth, {}) - } - - etherfiRedemptionManager() { - return this.eth_call(functions.etherfiRedemptionManager, {}) - } - - etherfiWithdrawalNFT() { - return this.eth_call(functions.etherfiWithdrawalNFT, {}) - } - - etherfiWithdrawalQueue() { - return this.eth_call(functions.etherfiWithdrawalQueue, {}) - } - - etherfiWithdrawalQueueAmount() { - return this.eth_call(functions.etherfiWithdrawalQueueAmount, {}) - } - - etherfiWithdrawalRequests(id: EtherfiWithdrawalRequestsParams["id"]) { - return this.eth_call(functions.etherfiWithdrawalRequests, {id}) - } - - fee() { - return this.eth_call(functions.fee, {}) - } - - feeCollector() { - return this.eth_call(functions.feeCollector, {}) - } - - feesAccrued() { - return this.eth_call(functions.feesAccrued, {}) - } - - getReserves() { - return this.eth_call(functions.getReserves, {}) - } - - lastAvailableAssets() { - return this.eth_call(functions.lastAvailableAssets, {}) - } - - liquidityAsset() { - return this.eth_call(functions.liquidityAsset, {}) - } - - minSharesToRedeem() { - return this.eth_call(functions.minSharesToRedeem, {}) - } - - name() { - return this.eth_call(functions.name, {}) - } - - nextWithdrawalIndex() { - return this.eth_call(functions.nextWithdrawalIndex, {}) - } - - onERC721Received(operator: OnERC721ReceivedParams["operator"], from: OnERC721ReceivedParams["from"], tokenId: OnERC721ReceivedParams["tokenId"], data: OnERC721ReceivedParams["data"]) { - return this.eth_call(functions.onERC721Received, {operator, from, tokenId, data}) - } - - operator() { - return this.eth_call(functions.operator, {}) - } - - owner() { - return this.eth_call(functions.owner, {}) - } - - previewDeposit(assets: PreviewDepositParams["assets"]) { - return this.eth_call(functions.previewDeposit, {assets}) - } - - previewRedeem(shares: PreviewRedeemParams["shares"]) { - return this.eth_call(functions.previewRedeem, {shares}) - } - - supportedMarkets(market: SupportedMarketsParams["market"]) { - return this.eth_call(functions.supportedMarkets, {market}) - } - - symbol() { - return this.eth_call(functions.symbol, {}) - } - - token0() { - return this.eth_call(functions.token0, {}) - } - - token1() { - return this.eth_call(functions.token1, {}) - } - - totalAssets() { - return this.eth_call(functions.totalAssets, {}) - } - - totalSupply() { - return this.eth_call(functions.totalSupply, {}) - } - - traderate0() { - return this.eth_call(functions.traderate0, {}) - } - - traderate1() { - return this.eth_call(functions.traderate1, {}) - } - - weth() { - return this.eth_call(functions.weth, {}) - } - - withdrawalRequests(requestId: WithdrawalRequestsParams["requestId"]) { - return this.eth_call(functions.withdrawalRequests, {requestId}) - } - - withdrawsClaimed() { - return this.eth_call(functions.withdrawsClaimed, {}) - } - - withdrawsQueued() { - return this.eth_call(functions.withdrawsQueued, {}) - } -} - -/// Event types -export type ARMBufferUpdatedEventArgs = EParams -export type ActiveMarketUpdatedEventArgs = EParams -export type AdminChangedEventArgs = EParams -export type AllocatedEventArgs = EParams -export type ApprovalEventArgs = EParams -export type CapManagerUpdatedEventArgs = EParams -export type ClaimEtherFiWithdrawalsEventArgs = EParams -export type CrossPriceUpdatedEventArgs = EParams -export type DepositEventArgs = EParams -export type FeeCollectedEventArgs = EParams -export type FeeCollectorUpdatedEventArgs = EParams -export type FeeUpdatedEventArgs = EParams -export type InitializedEventArgs = EParams -export type MarketAddedEventArgs = EParams -export type MarketRemovedEventArgs = EParams -export type OperatorChangedEventArgs = EParams -export type RedeemClaimedEventArgs = EParams -export type RedeemRequestedEventArgs = EParams -export type RegisterEtherFiWithdrawalRequestsEventArgs = EParams -export type RequestEtherFiWithdrawalEventArgs = EParams -export type TraderateChangedEventArgs = EParams -export type TransferEventArgs = EParams - -/// Function types -export type FEE_SCALEParams = FunctionArguments -export type FEE_SCALEReturn = FunctionReturn - -export type MAX_CROSS_PRICE_DEVIATIONParams = FunctionArguments -export type MAX_CROSS_PRICE_DEVIATIONReturn = FunctionReturn - -export type PRICE_SCALEParams = FunctionArguments -export type PRICE_SCALEReturn = FunctionReturn - -export type ActiveMarketParams = FunctionArguments -export type ActiveMarketReturn = FunctionReturn - -export type AddMarketsParams = FunctionArguments -export type AddMarketsReturn = FunctionReturn - -export type AllocateParams = FunctionArguments -export type AllocateReturn = FunctionReturn - -export type AllocateThresholdParams = FunctionArguments -export type AllocateThresholdReturn = FunctionReturn - -export type AllowanceParams = FunctionArguments -export type AllowanceReturn = FunctionReturn - -export type ApproveParams = FunctionArguments -export type ApproveReturn = FunctionReturn - -export type ArmBufferParams = FunctionArguments -export type ArmBufferReturn = FunctionReturn - -export type AssetParams = FunctionArguments -export type AssetReturn = FunctionReturn - -export type BalanceOfParams = FunctionArguments -export type BalanceOfReturn = FunctionReturn - -export type BaseAssetParams = FunctionArguments -export type BaseAssetReturn = FunctionReturn - -export type CapManagerParams = FunctionArguments -export type CapManagerReturn = FunctionReturn - -export type ClaimDelayParams = FunctionArguments -export type ClaimDelayReturn = FunctionReturn - -export type ClaimEtherFiWithdrawalsParams = FunctionArguments -export type ClaimEtherFiWithdrawalsReturn = FunctionReturn - -export type ClaimRedeemParams = FunctionArguments -export type ClaimRedeemReturn = FunctionReturn - -export type ClaimableParams = FunctionArguments -export type ClaimableReturn = FunctionReturn - -export type CollectFeesParams = FunctionArguments -export type CollectFeesReturn = FunctionReturn - -export type ConvertToAssetsParams = FunctionArguments -export type ConvertToAssetsReturn = FunctionReturn - -export type ConvertToSharesParams = FunctionArguments -export type ConvertToSharesReturn = FunctionReturn - -export type CrossPriceParams = FunctionArguments -export type CrossPriceReturn = FunctionReturn - -export type DecimalsParams = FunctionArguments -export type DecimalsReturn = FunctionReturn - -export type DepositParams_0 = FunctionArguments -export type DepositReturn_0 = FunctionReturn - -export type DepositParams_1 = FunctionArguments -export type DepositReturn_1 = FunctionReturn - -export type EethParams = FunctionArguments -export type EethReturn = FunctionReturn - -export type EtherfiRedemptionManagerParams = FunctionArguments -export type EtherfiRedemptionManagerReturn = FunctionReturn - -export type EtherfiWithdrawalNFTParams = FunctionArguments -export type EtherfiWithdrawalNFTReturn = FunctionReturn - -export type EtherfiWithdrawalQueueParams = FunctionArguments -export type EtherfiWithdrawalQueueReturn = FunctionReturn - -export type EtherfiWithdrawalQueueAmountParams = FunctionArguments -export type EtherfiWithdrawalQueueAmountReturn = FunctionReturn - -export type EtherfiWithdrawalRequestsParams = FunctionArguments -export type EtherfiWithdrawalRequestsReturn = FunctionReturn - -export type FeeParams = FunctionArguments -export type FeeReturn = FunctionReturn - -export type FeeCollectorParams = FunctionArguments -export type FeeCollectorReturn = FunctionReturn - -export type FeesAccruedParams = FunctionArguments -export type FeesAccruedReturn = FunctionReturn - -export type GetReservesParams = FunctionArguments -export type GetReservesReturn = FunctionReturn - -export type InitializeParams = FunctionArguments -export type InitializeReturn = FunctionReturn - -export type LastAvailableAssetsParams = FunctionArguments -export type LastAvailableAssetsReturn = FunctionReturn - -export type LiquidityAssetParams = FunctionArguments -export type LiquidityAssetReturn = FunctionReturn - -export type MinSharesToRedeemParams = FunctionArguments -export type MinSharesToRedeemReturn = FunctionReturn - -export type NameParams = FunctionArguments -export type NameReturn = FunctionReturn - -export type NextWithdrawalIndexParams = FunctionArguments -export type NextWithdrawalIndexReturn = FunctionReturn - -export type OnERC721ReceivedParams = FunctionArguments -export type OnERC721ReceivedReturn = FunctionReturn - -export type OperatorParams = FunctionArguments -export type OperatorReturn = FunctionReturn - -export type OwnerParams = FunctionArguments -export type OwnerReturn = FunctionReturn - -export type PreviewDepositParams = FunctionArguments -export type PreviewDepositReturn = FunctionReturn - -export type PreviewRedeemParams = FunctionArguments -export type PreviewRedeemReturn = FunctionReturn - -export type RemoveMarketParams = FunctionArguments -export type RemoveMarketReturn = FunctionReturn - -export type RequestEtherFiWithdrawalParams = FunctionArguments -export type RequestEtherFiWithdrawalReturn = FunctionReturn - -export type RequestRedeemParams = FunctionArguments -export type RequestRedeemReturn = FunctionReturn - -export type SetARMBufferParams = FunctionArguments -export type SetARMBufferReturn = FunctionReturn - -export type SetActiveMarketParams = FunctionArguments -export type SetActiveMarketReturn = FunctionReturn - -export type SetCapManagerParams = FunctionArguments -export type SetCapManagerReturn = FunctionReturn - -export type SetCrossPriceParams = FunctionArguments -export type SetCrossPriceReturn = FunctionReturn - -export type SetFeeParams = FunctionArguments -export type SetFeeReturn = FunctionReturn - -export type SetFeeCollectorParams = FunctionArguments -export type SetFeeCollectorReturn = FunctionReturn - -export type SetOperatorParams = FunctionArguments -export type SetOperatorReturn = FunctionReturn - -export type SetOwnerParams = FunctionArguments -export type SetOwnerReturn = FunctionReturn - -export type SetPricesParams = FunctionArguments -export type SetPricesReturn = FunctionReturn - -export type SupportedMarketsParams = FunctionArguments -export type SupportedMarketsReturn = FunctionReturn - -export type SwapExactTokensForTokensParams_0 = FunctionArguments -export type SwapExactTokensForTokensReturn_0 = FunctionReturn - -export type SwapExactTokensForTokensParams_1 = FunctionArguments -export type SwapExactTokensForTokensReturn_1 = FunctionReturn - -export type SwapTokensForExactTokensParams_0 = FunctionArguments -export type SwapTokensForExactTokensReturn_0 = FunctionReturn - -export type SwapTokensForExactTokensParams_1 = FunctionArguments -export type SwapTokensForExactTokensReturn_1 = FunctionReturn - -export type SymbolParams = FunctionArguments -export type SymbolReturn = FunctionReturn - -export type Token0Params = FunctionArguments -export type Token0Return = FunctionReturn - -export type Token1Params = FunctionArguments -export type Token1Return = FunctionReturn - -export type TotalAssetsParams = FunctionArguments -export type TotalAssetsReturn = FunctionReturn - -export type TotalSupplyParams = FunctionArguments -export type TotalSupplyReturn = FunctionReturn - -export type Traderate0Params = FunctionArguments -export type Traderate0Return = FunctionReturn - -export type Traderate1Params = FunctionArguments -export type Traderate1Return = FunctionReturn - -export type TransferParams = FunctionArguments -export type TransferReturn = FunctionReturn - -export type TransferFromParams = FunctionArguments -export type TransferFromReturn = FunctionReturn - -export type WethParams = FunctionArguments -export type WethReturn = FunctionReturn - -export type WithdrawalRequestsParams = FunctionArguments -export type WithdrawalRequestsReturn = FunctionReturn - -export type WithdrawsClaimedParams = FunctionArguments -export type WithdrawsClaimedReturn = FunctionReturn - -export type WithdrawsQueuedParams = FunctionArguments -export type WithdrawsQueuedReturn = FunctionReturn - diff --git a/src/abi/origin-etherfi-arm/contract.ts b/src/abi/origin-etherfi-arm/contract.ts new file mode 100644 index 00000000..c4c12b9e --- /dev/null +++ b/src/abi/origin-etherfi-arm/contract.ts @@ -0,0 +1,249 @@ +import { ContractBase } from '../abi.support.js' +import { FEE_SCALE, MAX_CROSS_PRICE_DEVIATION, PRICE_SCALE, activeMarket, allocate, allocateThreshold, allowance, approve, armBuffer, asset, balanceOf, baseAsset, capManager, claimDelay, claimRedeem, claimable, collectFees, convertToAssets, convertToShares, crossPrice, decimals, deposit, deposit_1, eeth, etherfiRedemptionManager, etherfiWithdrawalNFT, etherfiWithdrawalQueue, etherfiWithdrawalQueueAmount, etherfiWithdrawalRequests, fee, feeCollector, feesAccrued, getReserves, lastAvailableAssets, liquidityAsset, minSharesToRedeem, name, nextWithdrawalIndex, onERC721Received, operator, owner, previewDeposit, previewRedeem, requestEtherFiWithdrawal, requestRedeem, supportedMarkets, swapExactTokensForTokens, swapTokensForExactTokens, symbol, token0, token1, totalAssets, totalSupply, traderate0, traderate1, transfer, transferFrom, weth, withdrawalRequests, withdrawsClaimed, withdrawsQueued } from './functions.js' +import type { AllowanceParams, ApproveParams, BalanceOfParams, ClaimRedeemParams, ConvertToAssetsParams, ConvertToSharesParams, DepositParams, DepositParams_1, EtherfiWithdrawalRequestsParams, OnERC721ReceivedParams, PreviewDepositParams, PreviewRedeemParams, RequestEtherFiWithdrawalParams, RequestRedeemParams, SupportedMarketsParams, SwapExactTokensForTokensParams, SwapTokensForExactTokensParams, TransferFromParams, TransferParams, WithdrawalRequestsParams } from './functions.js' + +export class Contract extends ContractBase { + FEE_SCALE() { + return this.eth_call(FEE_SCALE, {}) + } + + MAX_CROSS_PRICE_DEVIATION() { + return this.eth_call(MAX_CROSS_PRICE_DEVIATION, {}) + } + + PRICE_SCALE() { + return this.eth_call(PRICE_SCALE, {}) + } + + activeMarket() { + return this.eth_call(activeMarket, {}) + } + + allocate() { + return this.eth_call(allocate, {}) + } + + allocateThreshold() { + return this.eth_call(allocateThreshold, {}) + } + + allowance(owner: AllowanceParams["owner"], spender: AllowanceParams["spender"]) { + return this.eth_call(allowance, {owner, spender}) + } + + approve(spender: ApproveParams["spender"], value: ApproveParams["value"]) { + return this.eth_call(approve, {spender, value}) + } + + armBuffer() { + return this.eth_call(armBuffer, {}) + } + + asset() { + return this.eth_call(asset, {}) + } + + balanceOf(account: BalanceOfParams["account"]) { + return this.eth_call(balanceOf, {account}) + } + + baseAsset() { + return this.eth_call(baseAsset, {}) + } + + capManager() { + return this.eth_call(capManager, {}) + } + + claimDelay() { + return this.eth_call(claimDelay, {}) + } + + claimRedeem(requestId: ClaimRedeemParams["requestId"]) { + return this.eth_call(claimRedeem, {requestId}) + } + + claimable() { + return this.eth_call(claimable, {}) + } + + collectFees() { + return this.eth_call(collectFees, {}) + } + + convertToAssets(shares: ConvertToAssetsParams["shares"]) { + return this.eth_call(convertToAssets, {shares}) + } + + convertToShares(assets: ConvertToSharesParams["assets"]) { + return this.eth_call(convertToShares, {assets}) + } + + crossPrice() { + return this.eth_call(crossPrice, {}) + } + + decimals() { + return this.eth_call(decimals, {}) + } + + deposit(assets: DepositParams["assets"], receiver: DepositParams["receiver"]) { + return this.eth_call(deposit, {assets, receiver}) + } + + deposit_1(assets: DepositParams_1["assets"]) { + return this.eth_call(deposit_1, {assets}) + } + + eeth() { + return this.eth_call(eeth, {}) + } + + etherfiRedemptionManager() { + return this.eth_call(etherfiRedemptionManager, {}) + } + + etherfiWithdrawalNFT() { + return this.eth_call(etherfiWithdrawalNFT, {}) + } + + etherfiWithdrawalQueue() { + return this.eth_call(etherfiWithdrawalQueue, {}) + } + + etherfiWithdrawalQueueAmount() { + return this.eth_call(etherfiWithdrawalQueueAmount, {}) + } + + etherfiWithdrawalRequests(id: EtherfiWithdrawalRequestsParams["id"]) { + return this.eth_call(etherfiWithdrawalRequests, {id}) + } + + fee() { + return this.eth_call(fee, {}) + } + + feeCollector() { + return this.eth_call(feeCollector, {}) + } + + feesAccrued() { + return this.eth_call(feesAccrued, {}) + } + + getReserves() { + return this.eth_call(getReserves, {}) + } + + lastAvailableAssets() { + return this.eth_call(lastAvailableAssets, {}) + } + + liquidityAsset() { + return this.eth_call(liquidityAsset, {}) + } + + minSharesToRedeem() { + return this.eth_call(minSharesToRedeem, {}) + } + + name() { + return this.eth_call(name, {}) + } + + nextWithdrawalIndex() { + return this.eth_call(nextWithdrawalIndex, {}) + } + + onERC721Received(operator: OnERC721ReceivedParams["operator"], from: OnERC721ReceivedParams["from"], tokenId: OnERC721ReceivedParams["tokenId"], data: OnERC721ReceivedParams["data"]) { + return this.eth_call(onERC721Received, {operator, from, tokenId, data}) + } + + operator() { + return this.eth_call(operator, {}) + } + + owner() { + return this.eth_call(owner, {}) + } + + previewDeposit(assets: PreviewDepositParams["assets"]) { + return this.eth_call(previewDeposit, {assets}) + } + + previewRedeem(shares: PreviewRedeemParams["shares"]) { + return this.eth_call(previewRedeem, {shares}) + } + + requestEtherFiWithdrawal(amount: RequestEtherFiWithdrawalParams["amount"]) { + return this.eth_call(requestEtherFiWithdrawal, {amount}) + } + + requestRedeem(shares: RequestRedeemParams["shares"]) { + return this.eth_call(requestRedeem, {shares}) + } + + supportedMarkets(market: SupportedMarketsParams["market"]) { + return this.eth_call(supportedMarkets, {market}) + } + + swapExactTokensForTokens(amountIn: SwapExactTokensForTokensParams["amountIn"], amountOutMin: SwapExactTokensForTokensParams["amountOutMin"], path: SwapExactTokensForTokensParams["path"], to: SwapExactTokensForTokensParams["to"], deadline: SwapExactTokensForTokensParams["deadline"]) { + return this.eth_call(swapExactTokensForTokens, {amountIn, amountOutMin, path, to, deadline}) + } + + swapTokensForExactTokens(amountOut: SwapTokensForExactTokensParams["amountOut"], amountInMax: SwapTokensForExactTokensParams["amountInMax"], path: SwapTokensForExactTokensParams["path"], to: SwapTokensForExactTokensParams["to"], deadline: SwapTokensForExactTokensParams["deadline"]) { + return this.eth_call(swapTokensForExactTokens, {amountOut, amountInMax, path, to, deadline}) + } + + symbol() { + return this.eth_call(symbol, {}) + } + + token0() { + return this.eth_call(token0, {}) + } + + token1() { + return this.eth_call(token1, {}) + } + + totalAssets() { + return this.eth_call(totalAssets, {}) + } + + totalSupply() { + return this.eth_call(totalSupply, {}) + } + + traderate0() { + return this.eth_call(traderate0, {}) + } + + traderate1() { + return this.eth_call(traderate1, {}) + } + + transfer(to: TransferParams["to"], value: TransferParams["value"]) { + return this.eth_call(transfer, {to, value}) + } + + transferFrom(from: TransferFromParams["from"], to: TransferFromParams["to"], value: TransferFromParams["value"]) { + return this.eth_call(transferFrom, {from, to, value}) + } + + weth() { + return this.eth_call(weth, {}) + } + + withdrawalRequests(requestId: WithdrawalRequestsParams["requestId"]) { + return this.eth_call(withdrawalRequests, {requestId}) + } + + withdrawsClaimed() { + return this.eth_call(withdrawsClaimed, {}) + } + + withdrawsQueued() { + return this.eth_call(withdrawsQueued, {}) + } +} diff --git a/src/abi/origin-etherfi-arm/events.ts b/src/abi/origin-etherfi-arm/events.ts new file mode 100644 index 00000000..0330bbda --- /dev/null +++ b/src/abi/origin-etherfi-arm/events.ts @@ -0,0 +1,153 @@ +import { address, array, int256, uint256, uint64 } from '@subsquid/evm-codec' +import { event, indexed } from '../abi.support.js' +import type { EventParams as EParams } from '../abi.support.js' + +/** ARMBufferUpdated(uint256) */ +export const ARMBufferUpdated = event('0x29128dbcf994e1ddc09cdbce01c287bb3f6b0cf4dd3c98174cadbbaf67bc22d7', { + armBuffer: uint256, +}) +export type ARMBufferUpdatedEventArgs = EParams + +/** ActiveMarketUpdated(address) */ +export const ActiveMarketUpdated = event('0xe9f5fe520e5763f721d470ecb21b23763a3b0b9e720070111b1b935c1107b065', { + market: indexed(address), +}) +export type ActiveMarketUpdatedEventArgs = EParams + +/** AdminChanged(address,address) */ +export const AdminChanged = event('0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f', { + previousAdmin: address, + newAdmin: address, +}) +export type AdminChangedEventArgs = EParams + +/** Allocated(address,int256) */ +export const Allocated = event('0x8de94c5178842de5720920c14d6abd0f8367785673e0f607f37b91bda0f7700c', { + market: indexed(address), + assets: int256, +}) +export type AllocatedEventArgs = EParams + +/** Approval(address,address,uint256) */ +export const Approval = event('0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925', { + owner: indexed(address), + spender: indexed(address), + value: uint256, +}) +export type ApprovalEventArgs = EParams + +/** CapManagerUpdated(address) */ +export const CapManagerUpdated = event('0xb8fd9afc34c38fcd13b9a3b7646482eb1fddcefb40af2c70609972816eba3208', { + capManager: indexed(address), +}) +export type CapManagerUpdatedEventArgs = EParams + +/** ClaimEtherFiWithdrawals(uint256[]) */ +export const ClaimEtherFiWithdrawals = event('0x8e1e54871d51b13099eefa0b83d65f5f62d21e09e16029bb5cb77bf651d7d9a5', { + requestIds: array(uint256), +}) +export type ClaimEtherFiWithdrawalsEventArgs = EParams + +/** CrossPriceUpdated(uint256) */ +export const CrossPriceUpdated = event('0x6f938e86fbdbe7829d0289b348cd9e528f2f17c705f469f4a17a0a2796e007d0', { + crossPrice: uint256, +}) +export type CrossPriceUpdatedEventArgs = EParams + +/** Deposit(address,uint256,uint256) */ +export const Deposit = event('0x90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a15', { + owner: indexed(address), + assets: uint256, + shares: uint256, +}) +export type DepositEventArgs = EParams + +/** FeeCollected(address,uint256) */ +export const FeeCollected = event('0x06c5efeff5c320943d265dc4e5f1af95ad523555ce0c1957e367dda5514572df', { + feeCollector: indexed(address), + fee: uint256, +}) +export type FeeCollectedEventArgs = EParams + +/** FeeCollectorUpdated(address) */ +export const FeeCollectorUpdated = event('0xe5693914d19c789bdee50a362998c0bc8d035a835f9871da5d51152f0582c34f', { + newFeeCollector: indexed(address), +}) +export type FeeCollectorUpdatedEventArgs = EParams + +/** FeeUpdated(uint256) */ +export const FeeUpdated = event('0x8c4d35e54a3f2ef1134138fd8ea3daee6a3c89e10d2665996babdf70261e2c76', { + fee: uint256, +}) +export type FeeUpdatedEventArgs = EParams + +/** Initialized(uint64) */ +export const Initialized = event('0xc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2', { + version: uint64, +}) +export type InitializedEventArgs = EParams + +/** MarketAdded(address) */ +export const MarketAdded = event('0xbc600b1f03d316c479b49930c28e328809316458d5b5dacbb7419df5f6f89647', { + market: indexed(address), +}) +export type MarketAddedEventArgs = EParams + +/** MarketRemoved(address) */ +export const MarketRemoved = event('0x59d7b1e52008dc342c9421dadfc773114b914a65682a4e4b53cf60a970df0d77', { + market: indexed(address), +}) +export type MarketRemovedEventArgs = EParams + +/** OperatorChanged(address) */ +export const OperatorChanged = event('0x4721129e0e676ed6a92909bb24e853ccdd63ad72280cc2e974e38e480e0e6e54', { + newAdmin: address, +}) +export type OperatorChangedEventArgs = EParams + +/** RedeemClaimed(address,uint256,uint256) */ +export const RedeemClaimed = event('0x36dd2c9b55f12509e3b5f4f4d765ddefc2776a28018b18da2335cf2ab93bb268', { + withdrawer: indexed(address), + requestId: indexed(uint256), + assets: uint256, +}) +export type RedeemClaimedEventArgs = EParams + +/** RedeemRequested(address,uint256,uint256,uint256,uint256) */ +export const RedeemRequested = event('0xc04c86cfd81036557541f9c68971ace59cbc9057ecab7d48874a6177ad117f4f', { + withdrawer: indexed(address), + requestId: indexed(uint256), + assets: uint256, + queued: uint256, + claimTimestamp: uint256, +}) +export type RedeemRequestedEventArgs = EParams + +/** RegisterEtherFiWithdrawalRequests(uint256[],uint256) */ +export const RegisterEtherFiWithdrawalRequests = event('0x5bcd3d54a041466fb9b7b96cc95157490816813f67990974e3f3b24b58a5996b', { + requestIds: array(uint256), + totalAmountRequested: uint256, +}) +export type RegisterEtherFiWithdrawalRequestsEventArgs = EParams + +/** RequestEtherFiWithdrawal(uint256,uint256) */ +export const RequestEtherFiWithdrawal = event('0x175bf92b330cf62d4fa2e358efef3366f13d7f24cc251f7c7a6943de8c6e7a17', { + amount: uint256, + requestId: uint256, +}) +export type RequestEtherFiWithdrawalEventArgs = EParams + +/** TraderateChanged(uint256,uint256) */ +export const TraderateChanged = event('0xa2136948fd1e5333c2ee27c9e48848a560b693e6bbd18082623a738179ff2952', { + traderate0: uint256, + traderate1: uint256, +}) +export type TraderateChangedEventArgs = EParams + +/** Transfer(address,address,uint256) */ +export const Transfer = event('0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', { + from: indexed(address), + to: indexed(address), + value: uint256, +}) +export type TransferEventArgs = EParams diff --git a/src/abi/origin-etherfi-arm/functions.ts b/src/abi/origin-etherfi-arm/functions.ts new file mode 100644 index 00000000..bcb535a5 --- /dev/null +++ b/src/abi/origin-etherfi-arm/functions.ts @@ -0,0 +1,496 @@ +import { address, array, bool, bytes, bytes4, int128, int256, string, struct, uint128, uint16, uint256, uint40, uint8 } from '@subsquid/evm-codec' +import { func } from '../abi.support.js' +import type { FunctionArguments, FunctionReturn } from '../abi.support.js' + +/** FEE_SCALE() */ +export const FEE_SCALE = func('0x8a5fddd8', {}, uint256) +export type FEE_SCALEParams = FunctionArguments +export type FEE_SCALEReturn = FunctionReturn + +/** MAX_CROSS_PRICE_DEVIATION() */ +export const MAX_CROSS_PRICE_DEVIATION = func('0x090b78c5', {}, uint256) +export type MAX_CROSS_PRICE_DEVIATIONParams = FunctionArguments +export type MAX_CROSS_PRICE_DEVIATIONReturn = FunctionReturn + +/** PRICE_SCALE() */ +export const PRICE_SCALE = func('0xc33f59d3', {}, uint256) +export type PRICE_SCALEParams = FunctionArguments +export type PRICE_SCALEReturn = FunctionReturn + +/** activeMarket() */ +export const activeMarket = func('0xce318c51', {}, address) +export type ActiveMarketParams = FunctionArguments +export type ActiveMarketReturn = FunctionReturn + +/** addMarkets(address[]) */ +export const addMarkets = func('0xda40385d', { + _markets: array(address), +}) +export type AddMarketsParams = FunctionArguments +export type AddMarketsReturn = FunctionReturn + +/** allocate() */ +export const allocate = func('0xabaa9916', {}, int256) +export type AllocateParams = FunctionArguments +export type AllocateReturn = FunctionReturn + +/** allocateThreshold() */ +export const allocateThreshold = func('0x4a8ff603', {}, int256) +export type AllocateThresholdParams = FunctionArguments +export type AllocateThresholdReturn = FunctionReturn + +/** allowance(address,address) */ +export const allowance = func('0xdd62ed3e', { + owner: address, + spender: address, +}, uint256) +export type AllowanceParams = FunctionArguments +export type AllowanceReturn = FunctionReturn + +/** approve(address,uint256) */ +export const approve = func('0x095ea7b3', { + spender: address, + value: uint256, +}, bool) +export type ApproveParams = FunctionArguments +export type ApproveReturn = FunctionReturn + +/** armBuffer() */ +export const armBuffer = func('0xa4c84f25', {}, uint256) +export type ArmBufferParams = FunctionArguments +export type ArmBufferReturn = FunctionReturn + +/** asset() */ +export const asset = func('0x38d52e0f', {}, address) +export type AssetParams = FunctionArguments +export type AssetReturn = FunctionReturn + +/** balanceOf(address) */ +export const balanceOf = func('0x70a08231', { + account: address, +}, uint256) +export type BalanceOfParams = FunctionArguments +export type BalanceOfReturn = FunctionReturn + +/** baseAsset() */ +export const baseAsset = func('0xcdf456e1', {}, address) +export type BaseAssetParams = FunctionArguments +export type BaseAssetReturn = FunctionReturn + +/** capManager() */ +export const capManager = func('0x6d785a87', {}, address) +export type CapManagerParams = FunctionArguments +export type CapManagerReturn = FunctionReturn + +/** claimDelay() */ +export const claimDelay = func('0x1c8ec299', {}, uint256) +export type ClaimDelayParams = FunctionArguments +export type ClaimDelayReturn = FunctionReturn + +/** claimEtherFiWithdrawals(uint256[]) */ +export const claimEtherFiWithdrawals = func('0xb45e2d75', { + requestIds: array(uint256), +}) +export type ClaimEtherFiWithdrawalsParams = FunctionArguments +export type ClaimEtherFiWithdrawalsReturn = FunctionReturn + +/** claimRedeem(uint256) */ +export const claimRedeem = func('0xe46cf747', { + requestId: uint256, +}, uint256) +export type ClaimRedeemParams = FunctionArguments +export type ClaimRedeemReturn = FunctionReturn + +/** claimable() */ +export const claimable = func('0xaf38d757', {}, uint256) +export type ClaimableParams = FunctionArguments +export type ClaimableReturn = FunctionReturn + +/** collectFees() */ +export const collectFees = func('0xc8796572', {}, uint256) +export type CollectFeesParams = FunctionArguments +export type CollectFeesReturn = FunctionReturn + +/** convertToAssets(uint256) */ +export const convertToAssets = func('0x07a2d13a', { + shares: uint256, +}, uint256) +export type ConvertToAssetsParams = FunctionArguments +export type ConvertToAssetsReturn = FunctionReturn + +/** convertToShares(uint256) */ +export const convertToShares = func('0xc6e6f592', { + assets: uint256, +}, uint256) +export type ConvertToSharesParams = FunctionArguments +export type ConvertToSharesReturn = FunctionReturn + +/** crossPrice() */ +export const crossPrice = func('0xf5488330', {}, uint256) +export type CrossPriceParams = FunctionArguments +export type CrossPriceReturn = FunctionReturn + +/** decimals() */ +export const decimals = func('0x313ce567', {}, uint8) +export type DecimalsParams = FunctionArguments +export type DecimalsReturn = FunctionReturn + +/** deposit(uint256,address) */ +export const deposit = func('0x6e553f65', { + assets: uint256, + receiver: address, +}, uint256) +export type DepositParams = FunctionArguments +export type DepositReturn = FunctionReturn + +/** deposit(uint256) */ +export const deposit_1 = func('0xb6b55f25', { + assets: uint256, +}, uint256) +export type DepositParams_1 = FunctionArguments +export type DepositReturn_1 = FunctionReturn + +/** eeth() */ +export const eeth = func('0x7f09217b', {}, address) +export type EethParams = FunctionArguments +export type EethReturn = FunctionReturn + +/** etherfiRedemptionManager() */ +export const etherfiRedemptionManager = func('0x92a97e1a', {}, address) +export type EtherfiRedemptionManagerParams = FunctionArguments +export type EtherfiRedemptionManagerReturn = FunctionReturn + +/** etherfiWithdrawalNFT() */ +export const etherfiWithdrawalNFT = func('0xa6b4d947', {}, address) +export type EtherfiWithdrawalNFTParams = FunctionArguments +export type EtherfiWithdrawalNFTReturn = FunctionReturn + +/** etherfiWithdrawalQueue() */ +export const etherfiWithdrawalQueue = func('0xf0b9510a', {}, address) +export type EtherfiWithdrawalQueueParams = FunctionArguments +export type EtherfiWithdrawalQueueReturn = FunctionReturn + +/** etherfiWithdrawalQueueAmount() */ +export const etherfiWithdrawalQueueAmount = func('0x9f809234', {}, uint256) +export type EtherfiWithdrawalQueueAmountParams = FunctionArguments +export type EtherfiWithdrawalQueueAmountReturn = FunctionReturn + +/** etherfiWithdrawalRequests(uint256) */ +export const etherfiWithdrawalRequests = func('0x56049dd9', { + id: uint256, +}, uint256) +export type EtherfiWithdrawalRequestsParams = FunctionArguments +export type EtherfiWithdrawalRequestsReturn = FunctionReturn + +/** fee() */ +export const fee = func('0xddca3f43', {}, uint16) +export type FeeParams = FunctionArguments +export type FeeReturn = FunctionReturn + +/** feeCollector() */ +export const feeCollector = func('0xc415b95c', {}, address) +export type FeeCollectorParams = FunctionArguments +export type FeeCollectorReturn = FunctionReturn + +/** feesAccrued() */ +export const feesAccrued = func('0x94db0595', {}, uint256) +export type FeesAccruedParams = FunctionArguments +export type FeesAccruedReturn = FunctionReturn + +/** getReserves() */ +export const getReserves = func('0x0902f1ac', {}, struct({ + reserve0: uint256, + reserve1: uint256, +})) +export type GetReservesParams = FunctionArguments +export type GetReservesReturn = FunctionReturn + +/** initialize(string,string,address,uint256,address,address) */ +export const initialize = func('0xb3ddda2a', { + _name: string, + _symbol: string, + _operator: address, + _fee: uint256, + _feeCollector: address, + _capManager: address, +}) +export type InitializeParams = FunctionArguments +export type InitializeReturn = FunctionReturn + +/** lastAvailableAssets() */ +export const lastAvailableAssets = func('0x2eb6328b', {}, int128) +export type LastAvailableAssetsParams = FunctionArguments +export type LastAvailableAssetsReturn = FunctionReturn + +/** liquidityAsset() */ +export const liquidityAsset = func('0x209b2bca', {}, address) +export type LiquidityAssetParams = FunctionArguments +export type LiquidityAssetReturn = FunctionReturn + +/** minSharesToRedeem() */ +export const minSharesToRedeem = func('0x50d0ea39', {}, uint256) +export type MinSharesToRedeemParams = FunctionArguments +export type MinSharesToRedeemReturn = FunctionReturn + +/** name() */ +export const name = func('0x06fdde03', {}, string) +export type NameParams = FunctionArguments +export type NameReturn = FunctionReturn + +/** nextWithdrawalIndex() */ +export const nextWithdrawalIndex = func('0xbba9282e', {}, uint256) +export type NextWithdrawalIndexParams = FunctionArguments +export type NextWithdrawalIndexReturn = FunctionReturn + +/** onERC721Received(address,address,uint256,bytes) */ +export const onERC721Received = func('0x150b7a02', { + operator: address, + from: address, + tokenId: uint256, + data: bytes, +}, bytes4) +export type OnERC721ReceivedParams = FunctionArguments +export type OnERC721ReceivedReturn = FunctionReturn + +/** operator() */ +export const operator = func('0x570ca735', {}, address) +export type OperatorParams = FunctionArguments +export type OperatorReturn = FunctionReturn + +/** owner() */ +export const owner = func('0x8da5cb5b', {}, address) +export type OwnerParams = FunctionArguments +export type OwnerReturn = FunctionReturn + +/** previewDeposit(uint256) */ +export const previewDeposit = func('0xef8b30f7', { + assets: uint256, +}, uint256) +export type PreviewDepositParams = FunctionArguments +export type PreviewDepositReturn = FunctionReturn + +/** previewRedeem(uint256) */ +export const previewRedeem = func('0x4cdad506', { + shares: uint256, +}, uint256) +export type PreviewRedeemParams = FunctionArguments +export type PreviewRedeemReturn = FunctionReturn + +/** removeMarket(address) */ +export const removeMarket = func('0xdb913236', { + _market: address, +}) +export type RemoveMarketParams = FunctionArguments +export type RemoveMarketReturn = FunctionReturn + +/** requestEtherFiWithdrawal(uint256) */ +export const requestEtherFiWithdrawal = func('0xad93a6aa', { + amount: uint256, +}, uint256) +export type RequestEtherFiWithdrawalParams = FunctionArguments +export type RequestEtherFiWithdrawalReturn = FunctionReturn + +/** requestRedeem(uint256) */ +export const requestRedeem = func('0xaa2f892d', { + shares: uint256, +}, struct({ + requestId: uint256, + assets: uint256, +})) +export type RequestRedeemParams = FunctionArguments +export type RequestRedeemReturn = FunctionReturn + +/** setARMBuffer(uint256) */ +export const setARMBuffer = func('0x95f9e9e6', { + _armBuffer: uint256, +}) +export type SetARMBufferParams = FunctionArguments +export type SetARMBufferReturn = FunctionReturn + +/** setActiveMarket(address) */ +export const setActiveMarket = func('0xab710b24', { + _market: address, +}) +export type SetActiveMarketParams = FunctionArguments +export type SetActiveMarketReturn = FunctionReturn + +/** setCapManager(address) */ +export const setCapManager = func('0x0e608b30', { + _capManager: address, +}) +export type SetCapManagerParams = FunctionArguments +export type SetCapManagerReturn = FunctionReturn + +/** setCrossPrice(uint256) */ +export const setCrossPrice = func('0x30486f3c', { + newCrossPrice: uint256, +}) +export type SetCrossPriceParams = FunctionArguments +export type SetCrossPriceReturn = FunctionReturn + +/** setFee(uint256) */ +export const setFee = func('0x69fe0e2d', { + _fee: uint256, +}) +export type SetFeeParams = FunctionArguments +export type SetFeeReturn = FunctionReturn + +/** setFeeCollector(address) */ +export const setFeeCollector = func('0xa42dce80', { + _feeCollector: address, +}) +export type SetFeeCollectorParams = FunctionArguments +export type SetFeeCollectorReturn = FunctionReturn + +/** setOperator(address) */ +export const setOperator = func('0xb3ab15fb', { + newOperator: address, +}) +export type SetOperatorParams = FunctionArguments +export type SetOperatorReturn = FunctionReturn + +/** setOwner(address) */ +export const setOwner = func('0x13af4035', { + newOwner: address, +}) +export type SetOwnerParams = FunctionArguments +export type SetOwnerReturn = FunctionReturn + +/** setPrices(uint256,uint256) */ +export const setPrices = func('0x05fefda7', { + buyT1: uint256, + sellT1: uint256, +}) +export type SetPricesParams = FunctionArguments +export type SetPricesReturn = FunctionReturn + +/** supportedMarkets(address) */ +export const supportedMarkets = func('0x20761fc4', { + market: address, +}, bool) +export type SupportedMarketsParams = FunctionArguments +export type SupportedMarketsReturn = FunctionReturn + +/** swapExactTokensForTokens(uint256,uint256,address[],address,uint256) */ +export const swapExactTokensForTokens = func('0x38ed1739', { + amountIn: uint256, + amountOutMin: uint256, + path: array(address), + to: address, + deadline: uint256, +}, array(uint256)) +export type SwapExactTokensForTokensParams = FunctionArguments +export type SwapExactTokensForTokensReturn = FunctionReturn + +/** swapExactTokensForTokens(address,address,uint256,uint256,address) */ +export const swapExactTokensForTokens_1 = func('0x6c08c57e', { + inToken: address, + outToken: address, + amountIn: uint256, + amountOutMin: uint256, + to: address, +}) +export type SwapExactTokensForTokensParams_1 = FunctionArguments +export type SwapExactTokensForTokensReturn_1 = FunctionReturn + +/** swapTokensForExactTokens(uint256,uint256,address[],address,uint256) */ +export const swapTokensForExactTokens = func('0x8803dbee', { + amountOut: uint256, + amountInMax: uint256, + path: array(address), + to: address, + deadline: uint256, +}, array(uint256)) +export type SwapTokensForExactTokensParams = FunctionArguments +export type SwapTokensForExactTokensReturn = FunctionReturn + +/** swapTokensForExactTokens(address,address,uint256,uint256,address) */ +export const swapTokensForExactTokens_1 = func('0xf7d31809', { + inToken: address, + outToken: address, + amountOut: uint256, + amountInMax: uint256, + to: address, +}) +export type SwapTokensForExactTokensParams_1 = FunctionArguments +export type SwapTokensForExactTokensReturn_1 = FunctionReturn + +/** symbol() */ +export const symbol = func('0x95d89b41', {}, string) +export type SymbolParams = FunctionArguments +export type SymbolReturn = FunctionReturn + +/** token0() */ +export const token0 = func('0x0dfe1681', {}, address) +export type Token0Params = FunctionArguments +export type Token0Return = FunctionReturn + +/** token1() */ +export const token1 = func('0xd21220a7', {}, address) +export type Token1Params = FunctionArguments +export type Token1Return = FunctionReturn + +/** totalAssets() */ +export const totalAssets = func('0x01e1d114', {}, uint256) +export type TotalAssetsParams = FunctionArguments +export type TotalAssetsReturn = FunctionReturn + +/** totalSupply() */ +export const totalSupply = func('0x18160ddd', {}, uint256) +export type TotalSupplyParams = FunctionArguments +export type TotalSupplyReturn = FunctionReturn + +/** traderate0() */ +export const traderate0 = func('0x45059a6b', {}, uint256) +export type Traderate0Params = FunctionArguments +export type Traderate0Return = FunctionReturn + +/** traderate1() */ +export const traderate1 = func('0xcf1de5d8', {}, uint256) +export type Traderate1Params = FunctionArguments +export type Traderate1Return = FunctionReturn + +/** transfer(address,uint256) */ +export const transfer = func('0xa9059cbb', { + to: address, + value: uint256, +}, bool) +export type TransferParams = FunctionArguments +export type TransferReturn = FunctionReturn + +/** transferFrom(address,address,uint256) */ +export const transferFrom = func('0x23b872dd', { + from: address, + to: address, + value: uint256, +}, bool) +export type TransferFromParams = FunctionArguments +export type TransferFromReturn = FunctionReturn + +/** weth() */ +export const weth = func('0x3fc8cef3', {}, address) +export type WethParams = FunctionArguments +export type WethReturn = FunctionReturn + +/** withdrawalRequests(uint256) */ +export const withdrawalRequests = func('0x937b2581', { + requestId: uint256, +}, struct({ + withdrawer: address, + claimed: bool, + claimTimestamp: uint40, + assets: uint128, + queued: uint128, +})) +export type WithdrawalRequestsParams = FunctionArguments +export type WithdrawalRequestsReturn = FunctionReturn + +/** withdrawsClaimed() */ +export const withdrawsClaimed = func('0x35ce81c4', {}, uint128) +export type WithdrawsClaimedParams = FunctionArguments +export type WithdrawsClaimedReturn = FunctionReturn + +/** withdrawsQueued() */ +export const withdrawsQueued = func('0x6ec68625', {}, uint128) +export type WithdrawsQueuedParams = FunctionArguments +export type WithdrawsQueuedReturn = FunctionReturn diff --git a/src/abi/origin-etherfi-arm/index.ts b/src/abi/origin-etherfi-arm/index.ts new file mode 100644 index 00000000..11829d6e --- /dev/null +++ b/src/abi/origin-etherfi-arm/index.ts @@ -0,0 +1,4 @@ +export * as events from './events.js' +export * as functions from './functions.js' + +export { Contract } from './contract.js' diff --git a/src/abi/origin-lens.abi.ts b/src/abi/origin-lens.abi.ts deleted file mode 100644 index b48b0cd6..00000000 --- a/src/abi/origin-lens.abi.ts +++ /dev/null @@ -1,408 +0,0 @@ -export const ABI_JSON = [ - { - "type": "constructor", - "stateMutability": "undefined", - "payable": false, - "inputs": [ - { - "type": "address", - "name": "_oToken" - } - ] - }, - { - "type": "event", - "anonymous": false, - "name": "GovernorshipTransferred", - "inputs": [ - { - "type": "address", - "name": "previousGovernor", - "indexed": true - }, - { - "type": "address", - "name": "newGovernor", - "indexed": true - } - ] - }, - { - "type": "event", - "anonymous": false, - "name": "PendingGovernorshipTransfer", - "inputs": [ - { - "type": "address", - "name": "previousGovernor", - "indexed": true - }, - { - "type": "address", - "name": "newGovernor", - "indexed": true - } - ] - }, - { - "type": "event", - "anonymous": false, - "name": "StrategistUpdated", - "inputs": [ - { - "type": "address", - "name": "_address", - "indexed": false - } - ] - }, - { - "type": "event", - "anonymous": false, - "name": "StrategyTypeChanged", - "inputs": [ - { - "type": "address", - "name": "strategyAddr", - "indexed": true - }, - { - "type": "uint8", - "name": "kind", - "indexed": false - } - ] - }, - { - "type": "function", - "name": "ETH_ADDR", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [ - { - "type": "address", - "name": "" - } - ] - }, - { - "type": "function", - "name": "WETH_ADDR", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [ - { - "type": "address", - "name": "" - } - ] - }, - { - "type": "function", - "name": "assetCount", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [ - { - "type": "uint256", - "name": "" - } - ] - }, - { - "type": "function", - "name": "assets", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [ - { - "type": "uint256", - "name": "" - } - ], - "outputs": [ - { - "type": "address", - "name": "" - } - ] - }, - { - "type": "function", - "name": "cacheStrategies", - "constant": false, - "payable": false, - "inputs": [], - "outputs": [] - }, - { - "type": "function", - "name": "claimGovernance", - "constant": false, - "payable": false, - "inputs": [], - "outputs": [] - }, - { - "type": "function", - "name": "curvePoolCoinCount", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [ - { - "type": "address", - "name": "" - } - ], - "outputs": [ - { - "type": "uint256", - "name": "" - } - ] - }, - { - "type": "function", - "name": "getStrategyAssetBalance", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [ - { - "type": "address", - "name": "strategyAddr" - }, - { - "type": "address", - "name": "asset" - } - ], - "outputs": [ - { - "type": "uint256", - "name": "balance" - } - ] - }, - { - "type": "function", - "name": "getStrategyBalances", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [ - { - "type": "address", - "name": "strategyAddr" - } - ], - "outputs": [ - { - "type": "address[]", - "name": "supportedAssets" - }, - { - "type": "uint256[]", - "name": "assetBalances" - } - ] - }, - { - "type": "function", - "name": "governor", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [ - { - "type": "address", - "name": "" - } - ] - }, - { - "type": "function", - "name": "initialize", - "constant": false, - "payable": false, - "inputs": [ - { - "type": "address", - "name": "_strategistAddr" - }, - { - "type": "address[]", - "name": "_strategies" - }, - { - "type": "uint8[]", - "name": "strategyKinds" - } - ], - "outputs": [] - }, - { - "type": "function", - "name": "isGovernor", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [ - { - "type": "bool", - "name": "" - } - ] - }, - { - "type": "function", - "name": "oToken", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [ - { - "type": "address", - "name": "" - } - ] - }, - { - "type": "function", - "name": "oracleRouter", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [ - { - "type": "address", - "name": "" - } - ] - }, - { - "type": "function", - "name": "setStrategistAddr", - "constant": false, - "payable": false, - "inputs": [ - { - "type": "address", - "name": "_address" - } - ], - "outputs": [] - }, - { - "type": "function", - "name": "setStrategyKind", - "constant": false, - "payable": false, - "inputs": [ - { - "type": "address", - "name": "strategy" - }, - { - "type": "uint8", - "name": "kind" - } - ], - "outputs": [] - }, - { - "type": "function", - "name": "strategies", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [ - { - "type": "uint256", - "name": "" - } - ], - "outputs": [ - { - "type": "address", - "name": "" - } - ] - }, - { - "type": "function", - "name": "strategistAddr", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [ - { - "type": "address", - "name": "" - } - ] - }, - { - "type": "function", - "name": "strategyConfig", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [ - { - "type": "address", - "name": "" - } - ], - "outputs": [ - { - "type": "bool", - "name": "supported" - }, - { - "type": "uint8", - "name": "kind" - } - ] - }, - { - "type": "function", - "name": "transferGovernance", - "constant": false, - "payable": false, - "inputs": [ - { - "type": "address", - "name": "_newGovernor" - } - ], - "outputs": [] - }, - { - "type": "function", - "name": "vault", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [ - { - "type": "address", - "name": "" - } - ] - } -] as const diff --git a/src/abi/origin-lido-arm-cap-manager.ts b/src/abi/origin-lido-arm-cap-manager.ts deleted file mode 100644 index 0306c2cd..00000000 --- a/src/abi/origin-lido-arm-cap-manager.ts +++ /dev/null @@ -1,104 +0,0 @@ -import * as p from '@subsquid/evm-codec' -import { event, fun, viewFun, indexed, ContractBase } from '@subsquid/evm-abi' -import type { EventParams as EParams, FunctionArguments, FunctionReturn } from '@subsquid/evm-abi' - -export const events = { - AccountCapEnabled: event("0x4c563c575a56d9737f009e7e9c600134eb839aea992e7e6cae26a025f8c5574d", "AccountCapEnabled(bool)", {"enabled": p.bool}), - AdminChanged: event("0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f", "AdminChanged(address,address)", {"previousAdmin": p.address, "newAdmin": p.address}), - Initialized: event("0xc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2", "Initialized(uint64)", {"version": p.uint64}), - LiquidityProviderCap: event("0xd5641199fd66ba2e0225ec23448f19db5a5524b3133b8c21c462f32d61e29603", "LiquidityProviderCap(address,uint256)", {"liquidityProvider": indexed(p.address), "cap": p.uint256}), - OperatorChanged: event("0x4721129e0e676ed6a92909bb24e853ccdd63ad72280cc2e974e38e480e0e6e54", "OperatorChanged(address)", {"newAdmin": p.address}), - TotalAssetsCap: event("0xb237111e0971b3cc8dc65f6164aeb3bf03eabde0c4466dd4ce9e6973ee1a5354", "TotalAssetsCap(uint256)", {"cap": p.uint256}), -} - -export const functions = { - accountCapEnabled: viewFun("0x475b070c", "accountCapEnabled()", {}, p.bool), - arm: viewFun("0x370419e5", "arm()", {}, p.address), - initialize: fun("0xc4d66de8", "initialize(address)", {"_operator": p.address}, ), - liquidityProviderCaps: viewFun("0xdb371e9c", "liquidityProviderCaps(address)", {"liquidityProvider": p.address}, p.uint256), - operator: viewFun("0x570ca735", "operator()", {}, p.address), - owner: viewFun("0x8da5cb5b", "owner()", {}, p.address), - postDepositHook: fun("0x7dc46f61", "postDepositHook(address,uint256)", {"liquidityProvider": p.address, "assets": p.uint256}, ), - setAccountCapEnabled: fun("0x1a0a4d9f", "setAccountCapEnabled(bool)", {"_accountCapEnabled": p.bool}, ), - setLiquidityProviderCaps: fun("0xc3d97ad1", "setLiquidityProviderCaps(address[],uint256)", {"_liquidityProviders": p.array(p.address), "cap": p.uint256}, ), - setOperator: fun("0xb3ab15fb", "setOperator(address)", {"newOperator": p.address}, ), - setOwner: fun("0x13af4035", "setOwner(address)", {"newOwner": p.address}, ), - setTotalAssetsCap: fun("0xfabd48ce", "setTotalAssetsCap(uint248)", {"_totalAssetsCap": p.uint248}, ), - totalAssetsCap: viewFun("0x45f663dd", "totalAssetsCap()", {}, p.uint248), -} - -export class Contract extends ContractBase { - - accountCapEnabled() { - return this.eth_call(functions.accountCapEnabled, {}) - } - - arm() { - return this.eth_call(functions.arm, {}) - } - - liquidityProviderCaps(liquidityProvider: LiquidityProviderCapsParams["liquidityProvider"]) { - return this.eth_call(functions.liquidityProviderCaps, {liquidityProvider}) - } - - operator() { - return this.eth_call(functions.operator, {}) - } - - owner() { - return this.eth_call(functions.owner, {}) - } - - totalAssetsCap() { - return this.eth_call(functions.totalAssetsCap, {}) - } -} - -/// Event types -export type AccountCapEnabledEventArgs = EParams -export type AdminChangedEventArgs = EParams -export type InitializedEventArgs = EParams -export type LiquidityProviderCapEventArgs = EParams -export type OperatorChangedEventArgs = EParams -export type TotalAssetsCapEventArgs = EParams - -/// Function types -export type AccountCapEnabledParams = FunctionArguments -export type AccountCapEnabledReturn = FunctionReturn - -export type ArmParams = FunctionArguments -export type ArmReturn = FunctionReturn - -export type InitializeParams = FunctionArguments -export type InitializeReturn = FunctionReturn - -export type LiquidityProviderCapsParams = FunctionArguments -export type LiquidityProviderCapsReturn = FunctionReturn - -export type OperatorParams = FunctionArguments -export type OperatorReturn = FunctionReturn - -export type OwnerParams = FunctionArguments -export type OwnerReturn = FunctionReturn - -export type PostDepositHookParams = FunctionArguments -export type PostDepositHookReturn = FunctionReturn - -export type SetAccountCapEnabledParams = FunctionArguments -export type SetAccountCapEnabledReturn = FunctionReturn - -export type SetLiquidityProviderCapsParams = FunctionArguments -export type SetLiquidityProviderCapsReturn = FunctionReturn - -export type SetOperatorParams = FunctionArguments -export type SetOperatorReturn = FunctionReturn - -export type SetOwnerParams = FunctionArguments -export type SetOwnerReturn = FunctionReturn - -export type SetTotalAssetsCapParams = FunctionArguments -export type SetTotalAssetsCapReturn = FunctionReturn - -export type TotalAssetsCapParams = FunctionArguments -export type TotalAssetsCapReturn = FunctionReturn - diff --git a/src/abi/origin-lido-arm-cap-manager/contract.ts b/src/abi/origin-lido-arm-cap-manager/contract.ts new file mode 100644 index 00000000..3e09da33 --- /dev/null +++ b/src/abi/origin-lido-arm-cap-manager/contract.ts @@ -0,0 +1,29 @@ +import { ContractBase } from '../abi.support.js' +import { accountCapEnabled, arm, liquidityProviderCaps, operator, owner, totalAssetsCap } from './functions.js' +import type { LiquidityProviderCapsParams } from './functions.js' + +export class Contract extends ContractBase { + accountCapEnabled() { + return this.eth_call(accountCapEnabled, {}) + } + + arm() { + return this.eth_call(arm, {}) + } + + liquidityProviderCaps(liquidityProvider: LiquidityProviderCapsParams["liquidityProvider"]) { + return this.eth_call(liquidityProviderCaps, {liquidityProvider}) + } + + operator() { + return this.eth_call(operator, {}) + } + + owner() { + return this.eth_call(owner, {}) + } + + totalAssetsCap() { + return this.eth_call(totalAssetsCap, {}) + } +} diff --git a/src/abi/origin-lido-arm-cap-manager/events.ts b/src/abi/origin-lido-arm-cap-manager/events.ts new file mode 100644 index 00000000..4f81b069 --- /dev/null +++ b/src/abi/origin-lido-arm-cap-manager/events.ts @@ -0,0 +1,41 @@ +import { address, bool, uint256, uint64 } from '@subsquid/evm-codec' +import { event, indexed } from '../abi.support.js' +import type { EventParams as EParams } from '../abi.support.js' + +/** AccountCapEnabled(bool) */ +export const AccountCapEnabled = event('0x4c563c575a56d9737f009e7e9c600134eb839aea992e7e6cae26a025f8c5574d', { + enabled: bool, +}) +export type AccountCapEnabledEventArgs = EParams + +/** AdminChanged(address,address) */ +export const AdminChanged = event('0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f', { + previousAdmin: address, + newAdmin: address, +}) +export type AdminChangedEventArgs = EParams + +/** Initialized(uint64) */ +export const Initialized = event('0xc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2', { + version: uint64, +}) +export type InitializedEventArgs = EParams + +/** LiquidityProviderCap(address,uint256) */ +export const LiquidityProviderCap = event('0xd5641199fd66ba2e0225ec23448f19db5a5524b3133b8c21c462f32d61e29603', { + liquidityProvider: indexed(address), + cap: uint256, +}) +export type LiquidityProviderCapEventArgs = EParams + +/** OperatorChanged(address) */ +export const OperatorChanged = event('0x4721129e0e676ed6a92909bb24e853ccdd63ad72280cc2e974e38e480e0e6e54', { + newAdmin: address, +}) +export type OperatorChangedEventArgs = EParams + +/** TotalAssetsCap(uint256) */ +export const TotalAssetsCap = event('0xb237111e0971b3cc8dc65f6164aeb3bf03eabde0c4466dd4ce9e6973ee1a5354', { + cap: uint256, +}) +export type TotalAssetsCapEventArgs = EParams diff --git a/src/abi/origin-lido-arm-cap-manager/functions.ts b/src/abi/origin-lido-arm-cap-manager/functions.ts new file mode 100644 index 00000000..a4a2be4a --- /dev/null +++ b/src/abi/origin-lido-arm-cap-manager/functions.ts @@ -0,0 +1,86 @@ +import { address, array, bool, uint248, uint256 } from '@subsquid/evm-codec' +import { func } from '../abi.support.js' +import type { FunctionArguments, FunctionReturn } from '../abi.support.js' + +/** accountCapEnabled() */ +export const accountCapEnabled = func('0x475b070c', {}, bool) +export type AccountCapEnabledParams = FunctionArguments +export type AccountCapEnabledReturn = FunctionReturn + +/** arm() */ +export const arm = func('0x370419e5', {}, address) +export type ArmParams = FunctionArguments +export type ArmReturn = FunctionReturn + +/** initialize(address) */ +export const initialize = func('0xc4d66de8', { + _operator: address, +}) +export type InitializeParams = FunctionArguments +export type InitializeReturn = FunctionReturn + +/** liquidityProviderCaps(address) */ +export const liquidityProviderCaps = func('0xdb371e9c', { + liquidityProvider: address, +}, uint256) +export type LiquidityProviderCapsParams = FunctionArguments +export type LiquidityProviderCapsReturn = FunctionReturn + +/** operator() */ +export const operator = func('0x570ca735', {}, address) +export type OperatorParams = FunctionArguments +export type OperatorReturn = FunctionReturn + +/** owner() */ +export const owner = func('0x8da5cb5b', {}, address) +export type OwnerParams = FunctionArguments +export type OwnerReturn = FunctionReturn + +/** postDepositHook(address,uint256) */ +export const postDepositHook = func('0x7dc46f61', { + liquidityProvider: address, + assets: uint256, +}) +export type PostDepositHookParams = FunctionArguments +export type PostDepositHookReturn = FunctionReturn + +/** setAccountCapEnabled(bool) */ +export const setAccountCapEnabled = func('0x1a0a4d9f', { + _accountCapEnabled: bool, +}) +export type SetAccountCapEnabledParams = FunctionArguments +export type SetAccountCapEnabledReturn = FunctionReturn + +/** setLiquidityProviderCaps(address[],uint256) */ +export const setLiquidityProviderCaps = func('0xc3d97ad1', { + _liquidityProviders: array(address), + cap: uint256, +}) +export type SetLiquidityProviderCapsParams = FunctionArguments +export type SetLiquidityProviderCapsReturn = FunctionReturn + +/** setOperator(address) */ +export const setOperator = func('0xb3ab15fb', { + newOperator: address, +}) +export type SetOperatorParams = FunctionArguments +export type SetOperatorReturn = FunctionReturn + +/** setOwner(address) */ +export const setOwner = func('0x13af4035', { + newOwner: address, +}) +export type SetOwnerParams = FunctionArguments +export type SetOwnerReturn = FunctionReturn + +/** setTotalAssetsCap(uint248) */ +export const setTotalAssetsCap = func('0xfabd48ce', { + _totalAssetsCap: uint248, +}) +export type SetTotalAssetsCapParams = FunctionArguments +export type SetTotalAssetsCapReturn = FunctionReturn + +/** totalAssetsCap() */ +export const totalAssetsCap = func('0x45f663dd', {}, uint248) +export type TotalAssetsCapParams = FunctionArguments +export type TotalAssetsCapReturn = FunctionReturn diff --git a/src/abi/origin-lido-arm-cap-manager/index.ts b/src/abi/origin-lido-arm-cap-manager/index.ts new file mode 100644 index 00000000..11829d6e --- /dev/null +++ b/src/abi/origin-lido-arm-cap-manager/index.ts @@ -0,0 +1,4 @@ +export * as events from './events.js' +export * as functions from './functions.js' + +export { Contract } from './contract.js' diff --git a/src/abi/origin-lido-arm.ts b/src/abi/origin-lido-arm.ts deleted file mode 100644 index 60b84566..00000000 --- a/src/abi/origin-lido-arm.ts +++ /dev/null @@ -1,440 +0,0 @@ -import * as p from '@subsquid/evm-codec' -import { event, fun, viewFun, indexed, ContractBase } from '@subsquid/evm-abi' -import type { EventParams as EParams, FunctionArguments, FunctionReturn } from '@subsquid/evm-abi' - -export const events = { - AdminChanged: event("0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f", "AdminChanged(address,address)", {"previousAdmin": p.address, "newAdmin": p.address}), - Approval: event("0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925", "Approval(address,address,uint256)", {"owner": indexed(p.address), "spender": indexed(p.address), "value": p.uint256}), - CapManagerUpdated: event("0xb8fd9afc34c38fcd13b9a3b7646482eb1fddcefb40af2c70609972816eba3208", "CapManagerUpdated(address)", {"capManager": indexed(p.address)}), - ClaimLidoWithdrawals: event("0xb7700a52345bff1ce6201d84f55fe81f2ea203b1b1bdc56a42571819aab2337a", "ClaimLidoWithdrawals(uint256[])", {"requestIds": p.array(p.uint256)}), - CrossPriceUpdated: event("0x6f938e86fbdbe7829d0289b348cd9e528f2f17c705f469f4a17a0a2796e007d0", "CrossPriceUpdated(uint256)", {"crossPrice": p.uint256}), - Deposit: event("0x90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a15", "Deposit(address,uint256,uint256)", {"owner": indexed(p.address), "assets": p.uint256, "shares": p.uint256}), - FeeCollected: event("0x06c5efeff5c320943d265dc4e5f1af95ad523555ce0c1957e367dda5514572df", "FeeCollected(address,uint256)", {"feeCollector": indexed(p.address), "fee": p.uint256}), - FeeCollectorUpdated: event("0xe5693914d19c789bdee50a362998c0bc8d035a835f9871da5d51152f0582c34f", "FeeCollectorUpdated(address)", {"newFeeCollector": indexed(p.address)}), - FeeUpdated: event("0x8c4d35e54a3f2ef1134138fd8ea3daee6a3c89e10d2665996babdf70261e2c76", "FeeUpdated(uint256)", {"fee": p.uint256}), - Initialized: event("0xc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2", "Initialized(uint64)", {"version": p.uint64}), - OperatorChanged: event("0x4721129e0e676ed6a92909bb24e853ccdd63ad72280cc2e974e38e480e0e6e54", "OperatorChanged(address)", {"newAdmin": p.address}), - RedeemClaimed: event("0x36dd2c9b55f12509e3b5f4f4d765ddefc2776a28018b18da2335cf2ab93bb268", "RedeemClaimed(address,uint256,uint256)", {"withdrawer": indexed(p.address), "requestId": indexed(p.uint256), "assets": p.uint256}), - RedeemRequested: event("0xc04c86cfd81036557541f9c68971ace59cbc9057ecab7d48874a6177ad117f4f", "RedeemRequested(address,uint256,uint256,uint256,uint256)", {"withdrawer": indexed(p.address), "requestId": indexed(p.uint256), "assets": p.uint256, "queued": p.uint256, "claimTimestamp": p.uint256}), - RequestLidoWithdrawals: event("0x3fdbeb02a84d41ebaf1c8edce1b73f1617e0d3675168dfeb8d86759c18782da4", "RequestLidoWithdrawals(uint256[],uint256[])", {"amounts": p.array(p.uint256), "requestIds": p.array(p.uint256)}), - TraderateChanged: event("0xa2136948fd1e5333c2ee27c9e48848a560b693e6bbd18082623a738179ff2952", "TraderateChanged(uint256,uint256)", {"traderate0": p.uint256, "traderate1": p.uint256}), - Transfer: event("0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", "Transfer(address,address,uint256)", {"from": indexed(p.address), "to": indexed(p.address), "value": p.uint256}), -} - -export const functions = { - FEE_SCALE: viewFun("0x8a5fddd8", "FEE_SCALE()", {}, p.uint256), - MAX_CROSS_PRICE_DEVIATION: viewFun("0x090b78c5", "MAX_CROSS_PRICE_DEVIATION()", {}, p.uint256), - PRICE_SCALE: viewFun("0xc33f59d3", "PRICE_SCALE()", {}, p.uint256), - allowance: viewFun("0xdd62ed3e", "allowance(address,address)", {"owner": p.address, "spender": p.address}, p.uint256), - approve: fun("0x095ea7b3", "approve(address,uint256)", {"spender": p.address, "value": p.uint256}, p.bool), - balanceOf: viewFun("0x70a08231", "balanceOf(address)", {"account": p.address}, p.uint256), - baseAsset: viewFun("0xcdf456e1", "baseAsset()", {}, p.address), - capManager: viewFun("0x6d785a87", "capManager()", {}, p.address), - claimDelay: viewFun("0x1c8ec299", "claimDelay()", {}, p.uint256), - claimLidoWithdrawals: fun("0x4e1d1840", "claimLidoWithdrawals(uint256[])", {"requestIds": p.array(p.uint256)}, ), - claimRedeem: fun("0xe46cf747", "claimRedeem(uint256)", {"requestId": p.uint256}, p.uint256), - claimable: viewFun("0xaf38d757", "claimable()", {}, p.uint256), - collectFees: fun("0xc8796572", "collectFees()", {}, p.uint256), - convertToAssets: viewFun("0x07a2d13a", "convertToAssets(uint256)", {"shares": p.uint256}, p.uint256), - convertToShares: viewFun("0xc6e6f592", "convertToShares(uint256)", {"assets": p.uint256}, p.uint256), - crossPrice: viewFun("0xf5488330", "crossPrice()", {}, p.uint256), - decimals: viewFun("0x313ce567", "decimals()", {}, p.uint8), - 'deposit(uint256,address)': fun("0x6e553f65", "deposit(uint256,address)", {"assets": p.uint256, "receiver": p.address}, p.uint256), - 'deposit(uint256)': fun("0xb6b55f25", "deposit(uint256)", {"assets": p.uint256}, p.uint256), - fee: viewFun("0xddca3f43", "fee()", {}, p.uint16), - feeCollector: viewFun("0xc415b95c", "feeCollector()", {}, p.address), - feesAccrued: viewFun("0x94db0595", "feesAccrued()", {}, p.uint256), - initialize: fun("0xb3ddda2a", "initialize(string,string,address,uint256,address,address)", {"_name": p.string, "_symbol": p.string, "_operator": p.address, "_fee": p.uint256, "_feeCollector": p.address, "_capManager": p.address}, ), - lastAvailableAssets: viewFun("0x2eb6328b", "lastAvailableAssets()", {}, p.int128), - lidoWithdrawalQueue: viewFun("0xff3368a1", "lidoWithdrawalQueue()", {}, p.address), - lidoWithdrawalQueueAmount: viewFun("0x31ca1c02", "lidoWithdrawalQueueAmount()", {}, p.uint256), - liquidityAsset: viewFun("0x209b2bca", "liquidityAsset()", {}, p.address), - name: viewFun("0x06fdde03", "name()", {}, p.string), - nextWithdrawalIndex: viewFun("0xbba9282e", "nextWithdrawalIndex()", {}, p.uint256), - operator: viewFun("0x570ca735", "operator()", {}, p.address), - owner: viewFun("0x8da5cb5b", "owner()", {}, p.address), - previewDeposit: viewFun("0xef8b30f7", "previewDeposit(uint256)", {"assets": p.uint256}, p.uint256), - previewRedeem: viewFun("0x4cdad506", "previewRedeem(uint256)", {"shares": p.uint256}, p.uint256), - requestLidoWithdrawals: fun("0x674eb980", "requestLidoWithdrawals(uint256[])", {"amounts": p.array(p.uint256)}, p.array(p.uint256)), - requestRedeem: fun("0xaa2f892d", "requestRedeem(uint256)", {"shares": p.uint256}, {"requestId": p.uint256, "assets": p.uint256}), - setCapManager: fun("0x0e608b30", "setCapManager(address)", {"_capManager": p.address}, ), - setCrossPrice: fun("0x30486f3c", "setCrossPrice(uint256)", {"newCrossPrice": p.uint256}, ), - setFee: fun("0x69fe0e2d", "setFee(uint256)", {"_fee": p.uint256}, ), - setFeeCollector: fun("0xa42dce80", "setFeeCollector(address)", {"_feeCollector": p.address}, ), - setOperator: fun("0xb3ab15fb", "setOperator(address)", {"newOperator": p.address}, ), - setOwner: fun("0x13af4035", "setOwner(address)", {"newOwner": p.address}, ), - setPrices: fun("0x05fefda7", "setPrices(uint256,uint256)", {"buyT1": p.uint256, "sellT1": p.uint256}, ), - steth: viewFun("0x953d7ee2", "steth()", {}, p.address), - 'swapExactTokensForTokens(uint256,uint256,address[],address,uint256)': fun("0x38ed1739", "swapExactTokensForTokens(uint256,uint256,address[],address,uint256)", {"amountIn": p.uint256, "amountOutMin": p.uint256, "path": p.array(p.address), "to": p.address, "deadline": p.uint256}, p.array(p.uint256)), - 'swapExactTokensForTokens(address,address,uint256,uint256,address)': fun("0x6c08c57e", "swapExactTokensForTokens(address,address,uint256,uint256,address)", {"inToken": p.address, "outToken": p.address, "amountIn": p.uint256, "amountOutMin": p.uint256, "to": p.address}, ), - 'swapTokensForExactTokens(uint256,uint256,address[],address,uint256)': fun("0x8803dbee", "swapTokensForExactTokens(uint256,uint256,address[],address,uint256)", {"amountOut": p.uint256, "amountInMax": p.uint256, "path": p.array(p.address), "to": p.address, "deadline": p.uint256}, p.array(p.uint256)), - 'swapTokensForExactTokens(address,address,uint256,uint256,address)': fun("0xf7d31809", "swapTokensForExactTokens(address,address,uint256,uint256,address)", {"inToken": p.address, "outToken": p.address, "amountOut": p.uint256, "amountInMax": p.uint256, "to": p.address}, ), - symbol: viewFun("0x95d89b41", "symbol()", {}, p.string), - token0: viewFun("0x0dfe1681", "token0()", {}, p.address), - token1: viewFun("0xd21220a7", "token1()", {}, p.address), - totalAssets: viewFun("0x01e1d114", "totalAssets()", {}, p.uint256), - totalSupply: viewFun("0x18160ddd", "totalSupply()", {}, p.uint256), - traderate0: viewFun("0x45059a6b", "traderate0()", {}, p.uint256), - traderate1: viewFun("0xcf1de5d8", "traderate1()", {}, p.uint256), - transfer: fun("0xa9059cbb", "transfer(address,uint256)", {"to": p.address, "value": p.uint256}, p.bool), - transferFrom: fun("0x23b872dd", "transferFrom(address,address,uint256)", {"from": p.address, "to": p.address, "value": p.uint256}, p.bool), - weth: viewFun("0x3fc8cef3", "weth()", {}, p.address), - withdrawalRequests: viewFun("0x937b2581", "withdrawalRequests(uint256)", {"requestId": p.uint256}, {"withdrawer": p.address, "claimed": p.bool, "claimTimestamp": p.uint40, "assets": p.uint128, "queued": p.uint128}), - withdrawsClaimed: viewFun("0x35ce81c4", "withdrawsClaimed()", {}, p.uint128), - withdrawsQueued: viewFun("0x6ec68625", "withdrawsQueued()", {}, p.uint128), -} - -export class Contract extends ContractBase { - - FEE_SCALE() { - return this.eth_call(functions.FEE_SCALE, {}) - } - - MAX_CROSS_PRICE_DEVIATION() { - return this.eth_call(functions.MAX_CROSS_PRICE_DEVIATION, {}) - } - - PRICE_SCALE() { - return this.eth_call(functions.PRICE_SCALE, {}) - } - - allowance(owner: AllowanceParams["owner"], spender: AllowanceParams["spender"]) { - return this.eth_call(functions.allowance, {owner, spender}) - } - - balanceOf(account: BalanceOfParams["account"]) { - return this.eth_call(functions.balanceOf, {account}) - } - - baseAsset() { - return this.eth_call(functions.baseAsset, {}) - } - - capManager() { - return this.eth_call(functions.capManager, {}) - } - - claimDelay() { - return this.eth_call(functions.claimDelay, {}) - } - - claimable() { - return this.eth_call(functions.claimable, {}) - } - - convertToAssets(shares: ConvertToAssetsParams["shares"]) { - return this.eth_call(functions.convertToAssets, {shares}) - } - - convertToShares(assets: ConvertToSharesParams["assets"]) { - return this.eth_call(functions.convertToShares, {assets}) - } - - crossPrice() { - return this.eth_call(functions.crossPrice, {}) - } - - decimals() { - return this.eth_call(functions.decimals, {}) - } - - fee() { - return this.eth_call(functions.fee, {}) - } - - feeCollector() { - return this.eth_call(functions.feeCollector, {}) - } - - feesAccrued() { - return this.eth_call(functions.feesAccrued, {}) - } - - lastAvailableAssets() { - return this.eth_call(functions.lastAvailableAssets, {}) - } - - lidoWithdrawalQueue() { - return this.eth_call(functions.lidoWithdrawalQueue, {}) - } - - lidoWithdrawalQueueAmount() { - return this.eth_call(functions.lidoWithdrawalQueueAmount, {}) - } - - liquidityAsset() { - return this.eth_call(functions.liquidityAsset, {}) - } - - name() { - return this.eth_call(functions.name, {}) - } - - nextWithdrawalIndex() { - return this.eth_call(functions.nextWithdrawalIndex, {}) - } - - operator() { - return this.eth_call(functions.operator, {}) - } - - owner() { - return this.eth_call(functions.owner, {}) - } - - previewDeposit(assets: PreviewDepositParams["assets"]) { - return this.eth_call(functions.previewDeposit, {assets}) - } - - previewRedeem(shares: PreviewRedeemParams["shares"]) { - return this.eth_call(functions.previewRedeem, {shares}) - } - - steth() { - return this.eth_call(functions.steth, {}) - } - - symbol() { - return this.eth_call(functions.symbol, {}) - } - - token0() { - return this.eth_call(functions.token0, {}) - } - - token1() { - return this.eth_call(functions.token1, {}) - } - - totalAssets() { - return this.eth_call(functions.totalAssets, {}) - } - - totalSupply() { - return this.eth_call(functions.totalSupply, {}) - } - - traderate0() { - return this.eth_call(functions.traderate0, {}) - } - - traderate1() { - return this.eth_call(functions.traderate1, {}) - } - - weth() { - return this.eth_call(functions.weth, {}) - } - - withdrawalRequests(requestId: WithdrawalRequestsParams["requestId"]) { - return this.eth_call(functions.withdrawalRequests, {requestId}) - } - - withdrawsClaimed() { - return this.eth_call(functions.withdrawsClaimed, {}) - } - - withdrawsQueued() { - return this.eth_call(functions.withdrawsQueued, {}) - } -} - -/// Event types -export type AdminChangedEventArgs = EParams -export type ApprovalEventArgs = EParams -export type CapManagerUpdatedEventArgs = EParams -export type ClaimLidoWithdrawalsEventArgs = EParams -export type CrossPriceUpdatedEventArgs = EParams -export type DepositEventArgs = EParams -export type FeeCollectedEventArgs = EParams -export type FeeCollectorUpdatedEventArgs = EParams -export type FeeUpdatedEventArgs = EParams -export type InitializedEventArgs = EParams -export type OperatorChangedEventArgs = EParams -export type RedeemClaimedEventArgs = EParams -export type RedeemRequestedEventArgs = EParams -export type RequestLidoWithdrawalsEventArgs = EParams -export type TraderateChangedEventArgs = EParams -export type TransferEventArgs = EParams - -/// Function types -export type FEE_SCALEParams = FunctionArguments -export type FEE_SCALEReturn = FunctionReturn - -export type MAX_CROSS_PRICE_DEVIATIONParams = FunctionArguments -export type MAX_CROSS_PRICE_DEVIATIONReturn = FunctionReturn - -export type PRICE_SCALEParams = FunctionArguments -export type PRICE_SCALEReturn = FunctionReturn - -export type AllowanceParams = FunctionArguments -export type AllowanceReturn = FunctionReturn - -export type ApproveParams = FunctionArguments -export type ApproveReturn = FunctionReturn - -export type BalanceOfParams = FunctionArguments -export type BalanceOfReturn = FunctionReturn - -export type BaseAssetParams = FunctionArguments -export type BaseAssetReturn = FunctionReturn - -export type CapManagerParams = FunctionArguments -export type CapManagerReturn = FunctionReturn - -export type ClaimDelayParams = FunctionArguments -export type ClaimDelayReturn = FunctionReturn - -export type ClaimLidoWithdrawalsParams = FunctionArguments -export type ClaimLidoWithdrawalsReturn = FunctionReturn - -export type ClaimRedeemParams = FunctionArguments -export type ClaimRedeemReturn = FunctionReturn - -export type ClaimableParams = FunctionArguments -export type ClaimableReturn = FunctionReturn - -export type CollectFeesParams = FunctionArguments -export type CollectFeesReturn = FunctionReturn - -export type ConvertToAssetsParams = FunctionArguments -export type ConvertToAssetsReturn = FunctionReturn - -export type ConvertToSharesParams = FunctionArguments -export type ConvertToSharesReturn = FunctionReturn - -export type CrossPriceParams = FunctionArguments -export type CrossPriceReturn = FunctionReturn - -export type DecimalsParams = FunctionArguments -export type DecimalsReturn = FunctionReturn - -export type DepositParams_0 = FunctionArguments -export type DepositReturn_0 = FunctionReturn - -export type DepositParams_1 = FunctionArguments -export type DepositReturn_1 = FunctionReturn - -export type FeeParams = FunctionArguments -export type FeeReturn = FunctionReturn - -export type FeeCollectorParams = FunctionArguments -export type FeeCollectorReturn = FunctionReturn - -export type FeesAccruedParams = FunctionArguments -export type FeesAccruedReturn = FunctionReturn - -export type InitializeParams = FunctionArguments -export type InitializeReturn = FunctionReturn - -export type LastAvailableAssetsParams = FunctionArguments -export type LastAvailableAssetsReturn = FunctionReturn - -export type LidoWithdrawalQueueParams = FunctionArguments -export type LidoWithdrawalQueueReturn = FunctionReturn - -export type LidoWithdrawalQueueAmountParams = FunctionArguments -export type LidoWithdrawalQueueAmountReturn = FunctionReturn - -export type LiquidityAssetParams = FunctionArguments -export type LiquidityAssetReturn = FunctionReturn - -export type NameParams = FunctionArguments -export type NameReturn = FunctionReturn - -export type NextWithdrawalIndexParams = FunctionArguments -export type NextWithdrawalIndexReturn = FunctionReturn - -export type OperatorParams = FunctionArguments -export type OperatorReturn = FunctionReturn - -export type OwnerParams = FunctionArguments -export type OwnerReturn = FunctionReturn - -export type PreviewDepositParams = FunctionArguments -export type PreviewDepositReturn = FunctionReturn - -export type PreviewRedeemParams = FunctionArguments -export type PreviewRedeemReturn = FunctionReturn - -export type RequestLidoWithdrawalsParams = FunctionArguments -export type RequestLidoWithdrawalsReturn = FunctionReturn - -export type RequestRedeemParams = FunctionArguments -export type RequestRedeemReturn = FunctionReturn - -export type SetCapManagerParams = FunctionArguments -export type SetCapManagerReturn = FunctionReturn - -export type SetCrossPriceParams = FunctionArguments -export type SetCrossPriceReturn = FunctionReturn - -export type SetFeeParams = FunctionArguments -export type SetFeeReturn = FunctionReturn - -export type SetFeeCollectorParams = FunctionArguments -export type SetFeeCollectorReturn = FunctionReturn - -export type SetOperatorParams = FunctionArguments -export type SetOperatorReturn = FunctionReturn - -export type SetOwnerParams = FunctionArguments -export type SetOwnerReturn = FunctionReturn - -export type SetPricesParams = FunctionArguments -export type SetPricesReturn = FunctionReturn - -export type StethParams = FunctionArguments -export type StethReturn = FunctionReturn - -export type SwapExactTokensForTokensParams_0 = FunctionArguments -export type SwapExactTokensForTokensReturn_0 = FunctionReturn - -export type SwapExactTokensForTokensParams_1 = FunctionArguments -export type SwapExactTokensForTokensReturn_1 = FunctionReturn - -export type SwapTokensForExactTokensParams_0 = FunctionArguments -export type SwapTokensForExactTokensReturn_0 = FunctionReturn - -export type SwapTokensForExactTokensParams_1 = FunctionArguments -export type SwapTokensForExactTokensReturn_1 = FunctionReturn - -export type SymbolParams = FunctionArguments -export type SymbolReturn = FunctionReturn - -export type Token0Params = FunctionArguments -export type Token0Return = FunctionReturn - -export type Token1Params = FunctionArguments -export type Token1Return = FunctionReturn - -export type TotalAssetsParams = FunctionArguments -export type TotalAssetsReturn = FunctionReturn - -export type TotalSupplyParams = FunctionArguments -export type TotalSupplyReturn = FunctionReturn - -export type Traderate0Params = FunctionArguments -export type Traderate0Return = FunctionReturn - -export type Traderate1Params = FunctionArguments -export type Traderate1Return = FunctionReturn - -export type TransferParams = FunctionArguments -export type TransferReturn = FunctionReturn - -export type TransferFromParams = FunctionArguments -export type TransferFromReturn = FunctionReturn - -export type WethParams = FunctionArguments -export type WethReturn = FunctionReturn - -export type WithdrawalRequestsParams = FunctionArguments -export type WithdrawalRequestsReturn = FunctionReturn - -export type WithdrawsClaimedParams = FunctionArguments -export type WithdrawsClaimedReturn = FunctionReturn - -export type WithdrawsQueuedParams = FunctionArguments -export type WithdrawsQueuedReturn = FunctionReturn - diff --git a/src/abi/origin-lido-arm/contract.ts b/src/abi/origin-lido-arm/contract.ts new file mode 100644 index 00000000..303d2629 --- /dev/null +++ b/src/abi/origin-lido-arm/contract.ts @@ -0,0 +1,201 @@ +import { ContractBase } from '../abi.support.js' +import { FEE_SCALE, MAX_CROSS_PRICE_DEVIATION, PRICE_SCALE, allowance, approve, balanceOf, baseAsset, capManager, claimDelay, claimRedeem, claimable, collectFees, convertToAssets, convertToShares, crossPrice, decimals, deposit, deposit_1, fee, feeCollector, feesAccrued, lastAvailableAssets, lidoWithdrawalQueue, lidoWithdrawalQueueAmount, liquidityAsset, name, nextWithdrawalIndex, operator, owner, previewDeposit, previewRedeem, requestLidoWithdrawals, requestRedeem, steth, swapExactTokensForTokens, swapTokensForExactTokens, symbol, token0, token1, totalAssets, totalSupply, traderate0, traderate1, transfer, transferFrom, weth, withdrawalRequests, withdrawsClaimed, withdrawsQueued } from './functions.js' +import type { AllowanceParams, ApproveParams, BalanceOfParams, ClaimRedeemParams, ConvertToAssetsParams, ConvertToSharesParams, DepositParams, DepositParams_1, PreviewDepositParams, PreviewRedeemParams, RequestLidoWithdrawalsParams, RequestRedeemParams, SwapExactTokensForTokensParams, SwapTokensForExactTokensParams, TransferFromParams, TransferParams, WithdrawalRequestsParams } from './functions.js' + +export class Contract extends ContractBase { + FEE_SCALE() { + return this.eth_call(FEE_SCALE, {}) + } + + MAX_CROSS_PRICE_DEVIATION() { + return this.eth_call(MAX_CROSS_PRICE_DEVIATION, {}) + } + + PRICE_SCALE() { + return this.eth_call(PRICE_SCALE, {}) + } + + allowance(owner: AllowanceParams["owner"], spender: AllowanceParams["spender"]) { + return this.eth_call(allowance, {owner, spender}) + } + + approve(spender: ApproveParams["spender"], value: ApproveParams["value"]) { + return this.eth_call(approve, {spender, value}) + } + + balanceOf(account: BalanceOfParams["account"]) { + return this.eth_call(balanceOf, {account}) + } + + baseAsset() { + return this.eth_call(baseAsset, {}) + } + + capManager() { + return this.eth_call(capManager, {}) + } + + claimDelay() { + return this.eth_call(claimDelay, {}) + } + + claimRedeem(requestId: ClaimRedeemParams["requestId"]) { + return this.eth_call(claimRedeem, {requestId}) + } + + claimable() { + return this.eth_call(claimable, {}) + } + + collectFees() { + return this.eth_call(collectFees, {}) + } + + convertToAssets(shares: ConvertToAssetsParams["shares"]) { + return this.eth_call(convertToAssets, {shares}) + } + + convertToShares(assets: ConvertToSharesParams["assets"]) { + return this.eth_call(convertToShares, {assets}) + } + + crossPrice() { + return this.eth_call(crossPrice, {}) + } + + decimals() { + return this.eth_call(decimals, {}) + } + + deposit(assets: DepositParams["assets"], receiver: DepositParams["receiver"]) { + return this.eth_call(deposit, {assets, receiver}) + } + + deposit_1(assets: DepositParams_1["assets"]) { + return this.eth_call(deposit_1, {assets}) + } + + fee() { + return this.eth_call(fee, {}) + } + + feeCollector() { + return this.eth_call(feeCollector, {}) + } + + feesAccrued() { + return this.eth_call(feesAccrued, {}) + } + + lastAvailableAssets() { + return this.eth_call(lastAvailableAssets, {}) + } + + lidoWithdrawalQueue() { + return this.eth_call(lidoWithdrawalQueue, {}) + } + + lidoWithdrawalQueueAmount() { + return this.eth_call(lidoWithdrawalQueueAmount, {}) + } + + liquidityAsset() { + return this.eth_call(liquidityAsset, {}) + } + + name() { + return this.eth_call(name, {}) + } + + nextWithdrawalIndex() { + return this.eth_call(nextWithdrawalIndex, {}) + } + + operator() { + return this.eth_call(operator, {}) + } + + owner() { + return this.eth_call(owner, {}) + } + + previewDeposit(assets: PreviewDepositParams["assets"]) { + return this.eth_call(previewDeposit, {assets}) + } + + previewRedeem(shares: PreviewRedeemParams["shares"]) { + return this.eth_call(previewRedeem, {shares}) + } + + requestLidoWithdrawals(amounts: RequestLidoWithdrawalsParams["amounts"]) { + return this.eth_call(requestLidoWithdrawals, {amounts}) + } + + requestRedeem(shares: RequestRedeemParams["shares"]) { + return this.eth_call(requestRedeem, {shares}) + } + + steth() { + return this.eth_call(steth, {}) + } + + swapExactTokensForTokens(amountIn: SwapExactTokensForTokensParams["amountIn"], amountOutMin: SwapExactTokensForTokensParams["amountOutMin"], path: SwapExactTokensForTokensParams["path"], to: SwapExactTokensForTokensParams["to"], deadline: SwapExactTokensForTokensParams["deadline"]) { + return this.eth_call(swapExactTokensForTokens, {amountIn, amountOutMin, path, to, deadline}) + } + + swapTokensForExactTokens(amountOut: SwapTokensForExactTokensParams["amountOut"], amountInMax: SwapTokensForExactTokensParams["amountInMax"], path: SwapTokensForExactTokensParams["path"], to: SwapTokensForExactTokensParams["to"], deadline: SwapTokensForExactTokensParams["deadline"]) { + return this.eth_call(swapTokensForExactTokens, {amountOut, amountInMax, path, to, deadline}) + } + + symbol() { + return this.eth_call(symbol, {}) + } + + token0() { + return this.eth_call(token0, {}) + } + + token1() { + return this.eth_call(token1, {}) + } + + totalAssets() { + return this.eth_call(totalAssets, {}) + } + + totalSupply() { + return this.eth_call(totalSupply, {}) + } + + traderate0() { + return this.eth_call(traderate0, {}) + } + + traderate1() { + return this.eth_call(traderate1, {}) + } + + transfer(to: TransferParams["to"], value: TransferParams["value"]) { + return this.eth_call(transfer, {to, value}) + } + + transferFrom(from: TransferFromParams["from"], to: TransferFromParams["to"], value: TransferFromParams["value"]) { + return this.eth_call(transferFrom, {from, to, value}) + } + + weth() { + return this.eth_call(weth, {}) + } + + withdrawalRequests(requestId: WithdrawalRequestsParams["requestId"]) { + return this.eth_call(withdrawalRequests, {requestId}) + } + + withdrawsClaimed() { + return this.eth_call(withdrawsClaimed, {}) + } + + withdrawsQueued() { + return this.eth_call(withdrawsQueued, {}) + } +} diff --git a/src/abi/origin-lido-arm/events.ts b/src/abi/origin-lido-arm/events.ts new file mode 100644 index 00000000..bda33d62 --- /dev/null +++ b/src/abi/origin-lido-arm/events.ts @@ -0,0 +1,115 @@ +import { address, array, uint256, uint64 } from '@subsquid/evm-codec' +import { event, indexed } from '../abi.support.js' +import type { EventParams as EParams } from '../abi.support.js' + +/** AdminChanged(address,address) */ +export const AdminChanged = event('0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f', { + previousAdmin: address, + newAdmin: address, +}) +export type AdminChangedEventArgs = EParams + +/** Approval(address,address,uint256) */ +export const Approval = event('0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925', { + owner: indexed(address), + spender: indexed(address), + value: uint256, +}) +export type ApprovalEventArgs = EParams + +/** CapManagerUpdated(address) */ +export const CapManagerUpdated = event('0xb8fd9afc34c38fcd13b9a3b7646482eb1fddcefb40af2c70609972816eba3208', { + capManager: indexed(address), +}) +export type CapManagerUpdatedEventArgs = EParams + +/** ClaimLidoWithdrawals(uint256[]) */ +export const ClaimLidoWithdrawals = event('0xb7700a52345bff1ce6201d84f55fe81f2ea203b1b1bdc56a42571819aab2337a', { + requestIds: array(uint256), +}) +export type ClaimLidoWithdrawalsEventArgs = EParams + +/** CrossPriceUpdated(uint256) */ +export const CrossPriceUpdated = event('0x6f938e86fbdbe7829d0289b348cd9e528f2f17c705f469f4a17a0a2796e007d0', { + crossPrice: uint256, +}) +export type CrossPriceUpdatedEventArgs = EParams + +/** Deposit(address,uint256,uint256) */ +export const Deposit = event('0x90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a15', { + owner: indexed(address), + assets: uint256, + shares: uint256, +}) +export type DepositEventArgs = EParams + +/** FeeCollected(address,uint256) */ +export const FeeCollected = event('0x06c5efeff5c320943d265dc4e5f1af95ad523555ce0c1957e367dda5514572df', { + feeCollector: indexed(address), + fee: uint256, +}) +export type FeeCollectedEventArgs = EParams + +/** FeeCollectorUpdated(address) */ +export const FeeCollectorUpdated = event('0xe5693914d19c789bdee50a362998c0bc8d035a835f9871da5d51152f0582c34f', { + newFeeCollector: indexed(address), +}) +export type FeeCollectorUpdatedEventArgs = EParams + +/** FeeUpdated(uint256) */ +export const FeeUpdated = event('0x8c4d35e54a3f2ef1134138fd8ea3daee6a3c89e10d2665996babdf70261e2c76', { + fee: uint256, +}) +export type FeeUpdatedEventArgs = EParams + +/** Initialized(uint64) */ +export const Initialized = event('0xc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2', { + version: uint64, +}) +export type InitializedEventArgs = EParams + +/** OperatorChanged(address) */ +export const OperatorChanged = event('0x4721129e0e676ed6a92909bb24e853ccdd63ad72280cc2e974e38e480e0e6e54', { + newAdmin: address, +}) +export type OperatorChangedEventArgs = EParams + +/** RedeemClaimed(address,uint256,uint256) */ +export const RedeemClaimed = event('0x36dd2c9b55f12509e3b5f4f4d765ddefc2776a28018b18da2335cf2ab93bb268', { + withdrawer: indexed(address), + requestId: indexed(uint256), + assets: uint256, +}) +export type RedeemClaimedEventArgs = EParams + +/** RedeemRequested(address,uint256,uint256,uint256,uint256) */ +export const RedeemRequested = event('0xc04c86cfd81036557541f9c68971ace59cbc9057ecab7d48874a6177ad117f4f', { + withdrawer: indexed(address), + requestId: indexed(uint256), + assets: uint256, + queued: uint256, + claimTimestamp: uint256, +}) +export type RedeemRequestedEventArgs = EParams + +/** RequestLidoWithdrawals(uint256[],uint256[]) */ +export const RequestLidoWithdrawals = event('0x3fdbeb02a84d41ebaf1c8edce1b73f1617e0d3675168dfeb8d86759c18782da4', { + amounts: array(uint256), + requestIds: array(uint256), +}) +export type RequestLidoWithdrawalsEventArgs = EParams + +/** TraderateChanged(uint256,uint256) */ +export const TraderateChanged = event('0xa2136948fd1e5333c2ee27c9e48848a560b693e6bbd18082623a738179ff2952', { + traderate0: uint256, + traderate1: uint256, +}) +export type TraderateChangedEventArgs = EParams + +/** Transfer(address,address,uint256) */ +export const Transfer = event('0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', { + from: indexed(address), + to: indexed(address), + value: uint256, +}) +export type TransferEventArgs = EParams diff --git a/src/abi/origin-lido-arm/functions.ts b/src/abi/origin-lido-arm/functions.ts new file mode 100644 index 00000000..5189ef85 --- /dev/null +++ b/src/abi/origin-lido-arm/functions.ts @@ -0,0 +1,396 @@ +import { address, array, bool, int128, string, struct, uint128, uint16, uint256, uint40, uint8 } from '@subsquid/evm-codec' +import { func } from '../abi.support.js' +import type { FunctionArguments, FunctionReturn } from '../abi.support.js' + +/** FEE_SCALE() */ +export const FEE_SCALE = func('0x8a5fddd8', {}, uint256) +export type FEE_SCALEParams = FunctionArguments +export type FEE_SCALEReturn = FunctionReturn + +/** MAX_CROSS_PRICE_DEVIATION() */ +export const MAX_CROSS_PRICE_DEVIATION = func('0x090b78c5', {}, uint256) +export type MAX_CROSS_PRICE_DEVIATIONParams = FunctionArguments +export type MAX_CROSS_PRICE_DEVIATIONReturn = FunctionReturn + +/** PRICE_SCALE() */ +export const PRICE_SCALE = func('0xc33f59d3', {}, uint256) +export type PRICE_SCALEParams = FunctionArguments +export type PRICE_SCALEReturn = FunctionReturn + +/** allowance(address,address) */ +export const allowance = func('0xdd62ed3e', { + owner: address, + spender: address, +}, uint256) +export type AllowanceParams = FunctionArguments +export type AllowanceReturn = FunctionReturn + +/** approve(address,uint256) */ +export const approve = func('0x095ea7b3', { + spender: address, + value: uint256, +}, bool) +export type ApproveParams = FunctionArguments +export type ApproveReturn = FunctionReturn + +/** balanceOf(address) */ +export const balanceOf = func('0x70a08231', { + account: address, +}, uint256) +export type BalanceOfParams = FunctionArguments +export type BalanceOfReturn = FunctionReturn + +/** baseAsset() */ +export const baseAsset = func('0xcdf456e1', {}, address) +export type BaseAssetParams = FunctionArguments +export type BaseAssetReturn = FunctionReturn + +/** capManager() */ +export const capManager = func('0x6d785a87', {}, address) +export type CapManagerParams = FunctionArguments +export type CapManagerReturn = FunctionReturn + +/** claimDelay() */ +export const claimDelay = func('0x1c8ec299', {}, uint256) +export type ClaimDelayParams = FunctionArguments +export type ClaimDelayReturn = FunctionReturn + +/** claimLidoWithdrawals(uint256[]) */ +export const claimLidoWithdrawals = func('0x4e1d1840', { + requestIds: array(uint256), +}) +export type ClaimLidoWithdrawalsParams = FunctionArguments +export type ClaimLidoWithdrawalsReturn = FunctionReturn + +/** claimRedeem(uint256) */ +export const claimRedeem = func('0xe46cf747', { + requestId: uint256, +}, uint256) +export type ClaimRedeemParams = FunctionArguments +export type ClaimRedeemReturn = FunctionReturn + +/** claimable() */ +export const claimable = func('0xaf38d757', {}, uint256) +export type ClaimableParams = FunctionArguments +export type ClaimableReturn = FunctionReturn + +/** collectFees() */ +export const collectFees = func('0xc8796572', {}, uint256) +export type CollectFeesParams = FunctionArguments +export type CollectFeesReturn = FunctionReturn + +/** convertToAssets(uint256) */ +export const convertToAssets = func('0x07a2d13a', { + shares: uint256, +}, uint256) +export type ConvertToAssetsParams = FunctionArguments +export type ConvertToAssetsReturn = FunctionReturn + +/** convertToShares(uint256) */ +export const convertToShares = func('0xc6e6f592', { + assets: uint256, +}, uint256) +export type ConvertToSharesParams = FunctionArguments +export type ConvertToSharesReturn = FunctionReturn + +/** crossPrice() */ +export const crossPrice = func('0xf5488330', {}, uint256) +export type CrossPriceParams = FunctionArguments +export type CrossPriceReturn = FunctionReturn + +/** decimals() */ +export const decimals = func('0x313ce567', {}, uint8) +export type DecimalsParams = FunctionArguments +export type DecimalsReturn = FunctionReturn + +/** deposit(uint256,address) */ +export const deposit = func('0x6e553f65', { + assets: uint256, + receiver: address, +}, uint256) +export type DepositParams = FunctionArguments +export type DepositReturn = FunctionReturn + +/** deposit(uint256) */ +export const deposit_1 = func('0xb6b55f25', { + assets: uint256, +}, uint256) +export type DepositParams_1 = FunctionArguments +export type DepositReturn_1 = FunctionReturn + +/** fee() */ +export const fee = func('0xddca3f43', {}, uint16) +export type FeeParams = FunctionArguments +export type FeeReturn = FunctionReturn + +/** feeCollector() */ +export const feeCollector = func('0xc415b95c', {}, address) +export type FeeCollectorParams = FunctionArguments +export type FeeCollectorReturn = FunctionReturn + +/** feesAccrued() */ +export const feesAccrued = func('0x94db0595', {}, uint256) +export type FeesAccruedParams = FunctionArguments +export type FeesAccruedReturn = FunctionReturn + +/** initialize(string,string,address,uint256,address,address) */ +export const initialize = func('0xb3ddda2a', { + _name: string, + _symbol: string, + _operator: address, + _fee: uint256, + _feeCollector: address, + _capManager: address, +}) +export type InitializeParams = FunctionArguments +export type InitializeReturn = FunctionReturn + +/** lastAvailableAssets() */ +export const lastAvailableAssets = func('0x2eb6328b', {}, int128) +export type LastAvailableAssetsParams = FunctionArguments +export type LastAvailableAssetsReturn = FunctionReturn + +/** lidoWithdrawalQueue() */ +export const lidoWithdrawalQueue = func('0xff3368a1', {}, address) +export type LidoWithdrawalQueueParams = FunctionArguments +export type LidoWithdrawalQueueReturn = FunctionReturn + +/** lidoWithdrawalQueueAmount() */ +export const lidoWithdrawalQueueAmount = func('0x31ca1c02', {}, uint256) +export type LidoWithdrawalQueueAmountParams = FunctionArguments +export type LidoWithdrawalQueueAmountReturn = FunctionReturn + +/** liquidityAsset() */ +export const liquidityAsset = func('0x209b2bca', {}, address) +export type LiquidityAssetParams = FunctionArguments +export type LiquidityAssetReturn = FunctionReturn + +/** name() */ +export const name = func('0x06fdde03', {}, string) +export type NameParams = FunctionArguments +export type NameReturn = FunctionReturn + +/** nextWithdrawalIndex() */ +export const nextWithdrawalIndex = func('0xbba9282e', {}, uint256) +export type NextWithdrawalIndexParams = FunctionArguments +export type NextWithdrawalIndexReturn = FunctionReturn + +/** operator() */ +export const operator = func('0x570ca735', {}, address) +export type OperatorParams = FunctionArguments +export type OperatorReturn = FunctionReturn + +/** owner() */ +export const owner = func('0x8da5cb5b', {}, address) +export type OwnerParams = FunctionArguments +export type OwnerReturn = FunctionReturn + +/** previewDeposit(uint256) */ +export const previewDeposit = func('0xef8b30f7', { + assets: uint256, +}, uint256) +export type PreviewDepositParams = FunctionArguments +export type PreviewDepositReturn = FunctionReturn + +/** previewRedeem(uint256) */ +export const previewRedeem = func('0x4cdad506', { + shares: uint256, +}, uint256) +export type PreviewRedeemParams = FunctionArguments +export type PreviewRedeemReturn = FunctionReturn + +/** requestLidoWithdrawals(uint256[]) */ +export const requestLidoWithdrawals = func('0x674eb980', { + amounts: array(uint256), +}, array(uint256)) +export type RequestLidoWithdrawalsParams = FunctionArguments +export type RequestLidoWithdrawalsReturn = FunctionReturn + +/** requestRedeem(uint256) */ +export const requestRedeem = func('0xaa2f892d', { + shares: uint256, +}, struct({ + requestId: uint256, + assets: uint256, +})) +export type RequestRedeemParams = FunctionArguments +export type RequestRedeemReturn = FunctionReturn + +/** setCapManager(address) */ +export const setCapManager = func('0x0e608b30', { + _capManager: address, +}) +export type SetCapManagerParams = FunctionArguments +export type SetCapManagerReturn = FunctionReturn + +/** setCrossPrice(uint256) */ +export const setCrossPrice = func('0x30486f3c', { + newCrossPrice: uint256, +}) +export type SetCrossPriceParams = FunctionArguments +export type SetCrossPriceReturn = FunctionReturn + +/** setFee(uint256) */ +export const setFee = func('0x69fe0e2d', { + _fee: uint256, +}) +export type SetFeeParams = FunctionArguments +export type SetFeeReturn = FunctionReturn + +/** setFeeCollector(address) */ +export const setFeeCollector = func('0xa42dce80', { + _feeCollector: address, +}) +export type SetFeeCollectorParams = FunctionArguments +export type SetFeeCollectorReturn = FunctionReturn + +/** setOperator(address) */ +export const setOperator = func('0xb3ab15fb', { + newOperator: address, +}) +export type SetOperatorParams = FunctionArguments +export type SetOperatorReturn = FunctionReturn + +/** setOwner(address) */ +export const setOwner = func('0x13af4035', { + newOwner: address, +}) +export type SetOwnerParams = FunctionArguments +export type SetOwnerReturn = FunctionReturn + +/** setPrices(uint256,uint256) */ +export const setPrices = func('0x05fefda7', { + buyT1: uint256, + sellT1: uint256, +}) +export type SetPricesParams = FunctionArguments +export type SetPricesReturn = FunctionReturn + +/** steth() */ +export const steth = func('0x953d7ee2', {}, address) +export type StethParams = FunctionArguments +export type StethReturn = FunctionReturn + +/** swapExactTokensForTokens(uint256,uint256,address[],address,uint256) */ +export const swapExactTokensForTokens = func('0x38ed1739', { + amountIn: uint256, + amountOutMin: uint256, + path: array(address), + to: address, + deadline: uint256, +}, array(uint256)) +export type SwapExactTokensForTokensParams = FunctionArguments +export type SwapExactTokensForTokensReturn = FunctionReturn + +/** swapExactTokensForTokens(address,address,uint256,uint256,address) */ +export const swapExactTokensForTokens_1 = func('0x6c08c57e', { + inToken: address, + outToken: address, + amountIn: uint256, + amountOutMin: uint256, + to: address, +}) +export type SwapExactTokensForTokensParams_1 = FunctionArguments +export type SwapExactTokensForTokensReturn_1 = FunctionReturn + +/** swapTokensForExactTokens(uint256,uint256,address[],address,uint256) */ +export const swapTokensForExactTokens = func('0x8803dbee', { + amountOut: uint256, + amountInMax: uint256, + path: array(address), + to: address, + deadline: uint256, +}, array(uint256)) +export type SwapTokensForExactTokensParams = FunctionArguments +export type SwapTokensForExactTokensReturn = FunctionReturn + +/** swapTokensForExactTokens(address,address,uint256,uint256,address) */ +export const swapTokensForExactTokens_1 = func('0xf7d31809', { + inToken: address, + outToken: address, + amountOut: uint256, + amountInMax: uint256, + to: address, +}) +export type SwapTokensForExactTokensParams_1 = FunctionArguments +export type SwapTokensForExactTokensReturn_1 = FunctionReturn + +/** symbol() */ +export const symbol = func('0x95d89b41', {}, string) +export type SymbolParams = FunctionArguments +export type SymbolReturn = FunctionReturn + +/** token0() */ +export const token0 = func('0x0dfe1681', {}, address) +export type Token0Params = FunctionArguments +export type Token0Return = FunctionReturn + +/** token1() */ +export const token1 = func('0xd21220a7', {}, address) +export type Token1Params = FunctionArguments +export type Token1Return = FunctionReturn + +/** totalAssets() */ +export const totalAssets = func('0x01e1d114', {}, uint256) +export type TotalAssetsParams = FunctionArguments +export type TotalAssetsReturn = FunctionReturn + +/** totalSupply() */ +export const totalSupply = func('0x18160ddd', {}, uint256) +export type TotalSupplyParams = FunctionArguments +export type TotalSupplyReturn = FunctionReturn + +/** traderate0() */ +export const traderate0 = func('0x45059a6b', {}, uint256) +export type Traderate0Params = FunctionArguments +export type Traderate0Return = FunctionReturn + +/** traderate1() */ +export const traderate1 = func('0xcf1de5d8', {}, uint256) +export type Traderate1Params = FunctionArguments +export type Traderate1Return = FunctionReturn + +/** transfer(address,uint256) */ +export const transfer = func('0xa9059cbb', { + to: address, + value: uint256, +}, bool) +export type TransferParams = FunctionArguments +export type TransferReturn = FunctionReturn + +/** transferFrom(address,address,uint256) */ +export const transferFrom = func('0x23b872dd', { + from: address, + to: address, + value: uint256, +}, bool) +export type TransferFromParams = FunctionArguments +export type TransferFromReturn = FunctionReturn + +/** weth() */ +export const weth = func('0x3fc8cef3', {}, address) +export type WethParams = FunctionArguments +export type WethReturn = FunctionReturn + +/** withdrawalRequests(uint256) */ +export const withdrawalRequests = func('0x937b2581', { + requestId: uint256, +}, struct({ + withdrawer: address, + claimed: bool, + claimTimestamp: uint40, + assets: uint128, + queued: uint128, +})) +export type WithdrawalRequestsParams = FunctionArguments +export type WithdrawalRequestsReturn = FunctionReturn + +/** withdrawsClaimed() */ +export const withdrawsClaimed = func('0x35ce81c4', {}, uint128) +export type WithdrawsClaimedParams = FunctionArguments +export type WithdrawsClaimedReturn = FunctionReturn + +/** withdrawsQueued() */ +export const withdrawsQueued = func('0x6ec68625', {}, uint128) +export type WithdrawsQueuedParams = FunctionArguments +export type WithdrawsQueuedReturn = FunctionReturn diff --git a/src/abi/origin-lido-arm/index.ts b/src/abi/origin-lido-arm/index.ts new file mode 100644 index 00000000..11829d6e --- /dev/null +++ b/src/abi/origin-lido-arm/index.ts @@ -0,0 +1,4 @@ +export * as events from './events.js' +export * as functions from './functions.js' + +export { Contract } from './contract.js' diff --git a/src/abi/otoken-2024-12-21.abi.ts b/src/abi/otoken-2024-12-21.abi.ts new file mode 100644 index 00000000..486a6892 --- /dev/null +++ b/src/abi/otoken-2024-12-21.abi.ts @@ -0,0 +1,712 @@ +export const ABI_JSON = [ + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "AccountRebasingDisabled", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "AccountRebasingEnabled", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousGovernor", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newGovernor", + "type": "address" + } + ], + "name": "GovernorshipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousGovernor", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newGovernor", + "type": "address" + } + ], + "name": "PendingGovernorshipTransfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "totalSupply", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "rebasingCredits", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "rebasingCreditsPerToken", + "type": "uint256" + } + ], + "name": "TotalSupplyUpdatedHighres", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "inputs": [], + "name": "_totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_owner", + "type": "address" + }, + { + "internalType": "address", + "name": "_spender", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_value", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_account", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "burn", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_newTotalSupply", + "type": "uint256" + } + ], + "name": "changeSupply", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "claimGovernance", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_account", + "type": "address" + } + ], + "name": "creditsBalanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_account", + "type": "address" + } + ], + "name": "creditsBalanceOfHighres", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_subtractedValue", + "type": "uint256" + } + ], + "name": "decreaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_account", + "type": "address" + } + ], + "name": "governanceRebaseOptIn", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "governor", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_addedValue", + "type": "uint256" + } + ], + "name": "increaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "_nameArg", + "type": "string" + }, + { + "internalType": "string", + "name": "_symbolArg", + "type": "string" + }, + { + "internalType": "address", + "name": "_vaultAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_initialCreditsPerToken", + "type": "uint256" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "isGovernor", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "isUpgraded", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "mint", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "nonRebasingCreditsPerToken", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "nonRebasingSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "rebaseOptIn", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "rebaseOptOut", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "rebaseState", + "outputs": [ + { + "internalType": "enum OUSD.RebaseOptions", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "rebasingCredits", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "rebasingCreditsHighres", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "rebasingCreditsPerToken", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "rebasingCreditsPerTokenHighres", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_value", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_from", + "type": "address" + }, + { + "internalType": "address", + "name": "_to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_value", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_newGovernor", + "type": "address" + } + ], + "name": "transferGovernance", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "vaultAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + } +] as const diff --git a/src/abi/otoken-2024-12-21.ts b/src/abi/otoken-2024-12-21.ts deleted file mode 100644 index 181e5a86..00000000 --- a/src/abi/otoken-2024-12-21.ts +++ /dev/null @@ -1,246 +0,0 @@ -import * as p from '@subsquid/evm-codec' -import { event, fun, viewFun, indexed, ContractBase } from '@subsquid/evm-abi' -import type { EventParams as EParams, FunctionArguments, FunctionReturn } from '@subsquid/evm-abi' - -export const events = { - AccountRebasingDisabled: event("0x201ace89ad3f5ab7428b91989f6a50d1998791c7b94a0fa812fd64a57687165e", "AccountRebasingDisabled(address)", {"account": p.address}), - AccountRebasingEnabled: event("0x19a249fa2050bac8314ac10e3ad420bd9825574bf750f58810c3c7adfc7b1c6f", "AccountRebasingEnabled(address)", {"account": p.address}), - Approval: event("0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925", "Approval(address,address,uint256)", {"owner": indexed(p.address), "spender": indexed(p.address), "value": p.uint256}), - GovernorshipTransferred: event("0xc7c0c772add429241571afb3805861fb3cfa2af374534088b76cdb4325a87e9a", "GovernorshipTransferred(address,address)", {"previousGovernor": indexed(p.address), "newGovernor": indexed(p.address)}), - PendingGovernorshipTransfer: event("0xa39cc5eb22d0f34d8beaefee8a3f17cc229c1a1d1ef87a5ad47313487b1c4f0d", "PendingGovernorshipTransfer(address,address)", {"previousGovernor": indexed(p.address), "newGovernor": indexed(p.address)}), - TotalSupplyUpdatedHighres: event("0x41645eb819d3011b13f97696a8109d14bfcddfaca7d063ec0564d62a3e257235", "TotalSupplyUpdatedHighres(uint256,uint256,uint256)", {"totalSupply": p.uint256, "rebasingCredits": p.uint256, "rebasingCreditsPerToken": p.uint256}), - Transfer: event("0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", "Transfer(address,address,uint256)", {"from": indexed(p.address), "to": indexed(p.address), "value": p.uint256}), -} - -export const functions = { - _totalSupply: viewFun("0x3eaaf86b", "_totalSupply()", {}, p.uint256), - allowance: viewFun("0xdd62ed3e", "allowance(address,address)", {"_owner": p.address, "_spender": p.address}, p.uint256), - approve: fun("0x095ea7b3", "approve(address,uint256)", {"_spender": p.address, "_value": p.uint256}, p.bool), - balanceOf: viewFun("0x70a08231", "balanceOf(address)", {"_account": p.address}, p.uint256), - burn: fun("0x9dc29fac", "burn(address,uint256)", {"account": p.address, "amount": p.uint256}, ), - changeSupply: fun("0x39a7919f", "changeSupply(uint256)", {"_newTotalSupply": p.uint256}, ), - claimGovernance: fun("0x5d36b190", "claimGovernance()", {}, ), - creditsBalanceOf: viewFun("0xf9854bfc", "creditsBalanceOf(address)", {"_account": p.address}, {"_0": p.uint256, "_1": p.uint256}), - creditsBalanceOfHighres: viewFun("0xe5c4fffe", "creditsBalanceOfHighres(address)", {"_account": p.address}, {"_0": p.uint256, "_1": p.uint256, "_2": p.bool}), - decimals: viewFun("0x313ce567", "decimals()", {}, p.uint8), - decreaseAllowance: fun("0xa457c2d7", "decreaseAllowance(address,uint256)", {"_spender": p.address, "_subtractedValue": p.uint256}, p.bool), - governanceRebaseOptIn: fun("0xbaa9c9db", "governanceRebaseOptIn(address)", {"_account": p.address}, ), - governor: viewFun("0x0c340a24", "governor()", {}, p.address), - increaseAllowance: fun("0x39509351", "increaseAllowance(address,uint256)", {"_spender": p.address, "_addedValue": p.uint256}, p.bool), - initialize: fun("0xf542033f", "initialize(string,string,address,uint256)", {"_nameArg": p.string, "_symbolArg": p.string, "_vaultAddress": p.address, "_initialCreditsPerToken": p.uint256}, ), - isGovernor: viewFun("0xc7af3352", "isGovernor()", {}, p.bool), - isUpgraded: viewFun("0x95ef84b9", "isUpgraded(address)", {"_0": p.address}, p.uint256), - mint: fun("0x40c10f19", "mint(address,uint256)", {"_account": p.address, "_amount": p.uint256}, ), - name: viewFun("0x06fdde03", "name()", {}, p.string), - nonRebasingCreditsPerToken: viewFun("0x609350cd", "nonRebasingCreditsPerToken(address)", {"_0": p.address}, p.uint256), - nonRebasingSupply: viewFun("0xe696393a", "nonRebasingSupply()", {}, p.uint256), - rebaseOptIn: fun("0xf51b0fd4", "rebaseOptIn()", {}, ), - rebaseOptOut: fun("0xc2376dff", "rebaseOptOut()", {}, ), - rebaseState: viewFun("0x456ee286", "rebaseState(address)", {"_0": p.address}, p.uint8), - rebasingCredits: viewFun("0x077f22b7", "rebasingCredits()", {}, p.uint256), - rebasingCreditsHighres: viewFun("0x7d0d66ff", "rebasingCreditsHighres()", {}, p.uint256), - rebasingCreditsPerToken: viewFun("0x6691cb3d", "rebasingCreditsPerToken()", {}, p.uint256), - rebasingCreditsPerTokenHighres: viewFun("0x7a46a9c5", "rebasingCreditsPerTokenHighres()", {}, p.uint256), - symbol: viewFun("0x95d89b41", "symbol()", {}, p.string), - totalSupply: viewFun("0x18160ddd", "totalSupply()", {}, p.uint256), - transfer: fun("0xa9059cbb", "transfer(address,uint256)", {"_to": p.address, "_value": p.uint256}, p.bool), - transferFrom: fun("0x23b872dd", "transferFrom(address,address,uint256)", {"_from": p.address, "_to": p.address, "_value": p.uint256}, p.bool), - transferGovernance: fun("0xd38bfff4", "transferGovernance(address)", {"_newGovernor": p.address}, ), - vaultAddress: viewFun("0x430bf08a", "vaultAddress()", {}, p.address), -} - -export class Contract extends ContractBase { - - _totalSupply() { - return this.eth_call(functions._totalSupply, {}) - } - - allowance(_owner: AllowanceParams["_owner"], _spender: AllowanceParams["_spender"]) { - return this.eth_call(functions.allowance, {_owner, _spender}) - } - - balanceOf(_account: BalanceOfParams["_account"]) { - return this.eth_call(functions.balanceOf, {_account}) - } - - creditsBalanceOf(_account: CreditsBalanceOfParams["_account"]) { - return this.eth_call(functions.creditsBalanceOf, {_account}) - } - - creditsBalanceOfHighres(_account: CreditsBalanceOfHighresParams["_account"]) { - return this.eth_call(functions.creditsBalanceOfHighres, {_account}) - } - - decimals() { - return this.eth_call(functions.decimals, {}) - } - - governor() { - return this.eth_call(functions.governor, {}) - } - - isGovernor() { - return this.eth_call(functions.isGovernor, {}) - } - - isUpgraded(_0: IsUpgradedParams["_0"]) { - return this.eth_call(functions.isUpgraded, {_0}) - } - - name() { - return this.eth_call(functions.name, {}) - } - - nonRebasingCreditsPerToken(_0: NonRebasingCreditsPerTokenParams["_0"]) { - return this.eth_call(functions.nonRebasingCreditsPerToken, {_0}) - } - - nonRebasingSupply() { - return this.eth_call(functions.nonRebasingSupply, {}) - } - - rebaseState(_0: RebaseStateParams["_0"]) { - return this.eth_call(functions.rebaseState, {_0}) - } - - rebasingCredits() { - return this.eth_call(functions.rebasingCredits, {}) - } - - rebasingCreditsHighres() { - return this.eth_call(functions.rebasingCreditsHighres, {}) - } - - rebasingCreditsPerToken() { - return this.eth_call(functions.rebasingCreditsPerToken, {}) - } - - rebasingCreditsPerTokenHighres() { - return this.eth_call(functions.rebasingCreditsPerTokenHighres, {}) - } - - symbol() { - return this.eth_call(functions.symbol, {}) - } - - totalSupply() { - return this.eth_call(functions.totalSupply, {}) - } - - vaultAddress() { - return this.eth_call(functions.vaultAddress, {}) - } -} - -/// Event types -export type AccountRebasingDisabledEventArgs = EParams -export type AccountRebasingEnabledEventArgs = EParams -export type ApprovalEventArgs = EParams -export type GovernorshipTransferredEventArgs = EParams -export type PendingGovernorshipTransferEventArgs = EParams -export type TotalSupplyUpdatedHighresEventArgs = EParams -export type TransferEventArgs = EParams - -/// Function types -export type _totalSupplyParams = FunctionArguments -export type _totalSupplyReturn = FunctionReturn - -export type AllowanceParams = FunctionArguments -export type AllowanceReturn = FunctionReturn - -export type ApproveParams = FunctionArguments -export type ApproveReturn = FunctionReturn - -export type BalanceOfParams = FunctionArguments -export type BalanceOfReturn = FunctionReturn - -export type BurnParams = FunctionArguments -export type BurnReturn = FunctionReturn - -export type ChangeSupplyParams = FunctionArguments -export type ChangeSupplyReturn = FunctionReturn - -export type ClaimGovernanceParams = FunctionArguments -export type ClaimGovernanceReturn = FunctionReturn - -export type CreditsBalanceOfParams = FunctionArguments -export type CreditsBalanceOfReturn = FunctionReturn - -export type CreditsBalanceOfHighresParams = FunctionArguments -export type CreditsBalanceOfHighresReturn = FunctionReturn - -export type DecimalsParams = FunctionArguments -export type DecimalsReturn = FunctionReturn - -export type DecreaseAllowanceParams = FunctionArguments -export type DecreaseAllowanceReturn = FunctionReturn - -export type GovernanceRebaseOptInParams = FunctionArguments -export type GovernanceRebaseOptInReturn = FunctionReturn - -export type GovernorParams = FunctionArguments -export type GovernorReturn = FunctionReturn - -export type IncreaseAllowanceParams = FunctionArguments -export type IncreaseAllowanceReturn = FunctionReturn - -export type InitializeParams = FunctionArguments -export type InitializeReturn = FunctionReturn - -export type IsGovernorParams = FunctionArguments -export type IsGovernorReturn = FunctionReturn - -export type IsUpgradedParams = FunctionArguments -export type IsUpgradedReturn = FunctionReturn - -export type MintParams = FunctionArguments -export type MintReturn = FunctionReturn - -export type NameParams = FunctionArguments -export type NameReturn = FunctionReturn - -export type NonRebasingCreditsPerTokenParams = FunctionArguments -export type NonRebasingCreditsPerTokenReturn = FunctionReturn - -export type NonRebasingSupplyParams = FunctionArguments -export type NonRebasingSupplyReturn = FunctionReturn - -export type RebaseOptInParams = FunctionArguments -export type RebaseOptInReturn = FunctionReturn - -export type RebaseOptOutParams = FunctionArguments -export type RebaseOptOutReturn = FunctionReturn - -export type RebaseStateParams = FunctionArguments -export type RebaseStateReturn = FunctionReturn - -export type RebasingCreditsParams = FunctionArguments -export type RebasingCreditsReturn = FunctionReturn - -export type RebasingCreditsHighresParams = FunctionArguments -export type RebasingCreditsHighresReturn = FunctionReturn - -export type RebasingCreditsPerTokenParams = FunctionArguments -export type RebasingCreditsPerTokenReturn = FunctionReturn - -export type RebasingCreditsPerTokenHighresParams = FunctionArguments -export type RebasingCreditsPerTokenHighresReturn = FunctionReturn - -export type SymbolParams = FunctionArguments -export type SymbolReturn = FunctionReturn - -export type TotalSupplyParams = FunctionArguments -export type TotalSupplyReturn = FunctionReturn - -export type TransferParams = FunctionArguments -export type TransferReturn = FunctionReturn - -export type TransferFromParams = FunctionArguments -export type TransferFromReturn = FunctionReturn - -export type TransferGovernanceParams = FunctionArguments -export type TransferGovernanceReturn = FunctionReturn - -export type VaultAddressParams = FunctionArguments -export type VaultAddressReturn = FunctionReturn - diff --git a/src/abi/otoken-2024-12-21/contract.ts b/src/abi/otoken-2024-12-21/contract.ts new file mode 100644 index 00000000..5012bc5a --- /dev/null +++ b/src/abi/otoken-2024-12-21/contract.ts @@ -0,0 +1,105 @@ +import { ContractBase } from '../abi.support.js' +import { _totalSupply, allowance, approve, balanceOf, creditsBalanceOf, creditsBalanceOfHighres, decimals, decreaseAllowance, governor, increaseAllowance, isGovernor, isUpgraded, name, nonRebasingCreditsPerToken, nonRebasingSupply, rebaseState, rebasingCredits, rebasingCreditsHighres, rebasingCreditsPerToken, rebasingCreditsPerTokenHighres, symbol, totalSupply, transfer, transferFrom, vaultAddress } from './functions.js' +import type { AllowanceParams, ApproveParams, BalanceOfParams, CreditsBalanceOfHighresParams, CreditsBalanceOfParams, DecreaseAllowanceParams, IncreaseAllowanceParams, IsUpgradedParams, NonRebasingCreditsPerTokenParams, RebaseStateParams, TransferFromParams, TransferParams } from './functions.js' + +export class Contract extends ContractBase { + _totalSupply() { + return this.eth_call(_totalSupply, {}) + } + + allowance(_owner: AllowanceParams["_owner"], _spender: AllowanceParams["_spender"]) { + return this.eth_call(allowance, {_owner, _spender}) + } + + approve(_spender: ApproveParams["_spender"], _value: ApproveParams["_value"]) { + return this.eth_call(approve, {_spender, _value}) + } + + balanceOf(_account: BalanceOfParams["_account"]) { + return this.eth_call(balanceOf, {_account}) + } + + creditsBalanceOf(_account: CreditsBalanceOfParams["_account"]) { + return this.eth_call(creditsBalanceOf, {_account}) + } + + creditsBalanceOfHighres(_account: CreditsBalanceOfHighresParams["_account"]) { + return this.eth_call(creditsBalanceOfHighres, {_account}) + } + + decimals() { + return this.eth_call(decimals, {}) + } + + decreaseAllowance(_spender: DecreaseAllowanceParams["_spender"], _subtractedValue: DecreaseAllowanceParams["_subtractedValue"]) { + return this.eth_call(decreaseAllowance, {_spender, _subtractedValue}) + } + + governor() { + return this.eth_call(governor, {}) + } + + increaseAllowance(_spender: IncreaseAllowanceParams["_spender"], _addedValue: IncreaseAllowanceParams["_addedValue"]) { + return this.eth_call(increaseAllowance, {_spender, _addedValue}) + } + + isGovernor() { + return this.eth_call(isGovernor, {}) + } + + isUpgraded(_0: IsUpgradedParams["_0"]) { + return this.eth_call(isUpgraded, {_0}) + } + + name() { + return this.eth_call(name, {}) + } + + nonRebasingCreditsPerToken(_0: NonRebasingCreditsPerTokenParams["_0"]) { + return this.eth_call(nonRebasingCreditsPerToken, {_0}) + } + + nonRebasingSupply() { + return this.eth_call(nonRebasingSupply, {}) + } + + rebaseState(_0: RebaseStateParams["_0"]) { + return this.eth_call(rebaseState, {_0}) + } + + rebasingCredits() { + return this.eth_call(rebasingCredits, {}) + } + + rebasingCreditsHighres() { + return this.eth_call(rebasingCreditsHighres, {}) + } + + rebasingCreditsPerToken() { + return this.eth_call(rebasingCreditsPerToken, {}) + } + + rebasingCreditsPerTokenHighres() { + return this.eth_call(rebasingCreditsPerTokenHighres, {}) + } + + symbol() { + return this.eth_call(symbol, {}) + } + + totalSupply() { + return this.eth_call(totalSupply, {}) + } + + transfer(_to: TransferParams["_to"], _value: TransferParams["_value"]) { + return this.eth_call(transfer, {_to, _value}) + } + + transferFrom(_from: TransferFromParams["_from"], _to: TransferFromParams["_to"], _value: TransferFromParams["_value"]) { + return this.eth_call(transferFrom, {_from, _to, _value}) + } + + vaultAddress() { + return this.eth_call(vaultAddress, {}) + } +} diff --git a/src/abi/otoken-2024-12-21/events.ts b/src/abi/otoken-2024-12-21/events.ts new file mode 100644 index 00000000..9eda16b3 --- /dev/null +++ b/src/abi/otoken-2024-12-21/events.ts @@ -0,0 +1,53 @@ +import { address, uint256 } from '@subsquid/evm-codec' +import { event, indexed } from '../abi.support.js' +import type { EventParams as EParams } from '../abi.support.js' + +/** AccountRebasingDisabled(address) */ +export const AccountRebasingDisabled = event('0x201ace89ad3f5ab7428b91989f6a50d1998791c7b94a0fa812fd64a57687165e', { + account: address, +}) +export type AccountRebasingDisabledEventArgs = EParams + +/** AccountRebasingEnabled(address) */ +export const AccountRebasingEnabled = event('0x19a249fa2050bac8314ac10e3ad420bd9825574bf750f58810c3c7adfc7b1c6f', { + account: address, +}) +export type AccountRebasingEnabledEventArgs = EParams + +/** Approval(address,address,uint256) */ +export const Approval = event('0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925', { + owner: indexed(address), + spender: indexed(address), + value: uint256, +}) +export type ApprovalEventArgs = EParams + +/** GovernorshipTransferred(address,address) */ +export const GovernorshipTransferred = event('0xc7c0c772add429241571afb3805861fb3cfa2af374534088b76cdb4325a87e9a', { + previousGovernor: indexed(address), + newGovernor: indexed(address), +}) +export type GovernorshipTransferredEventArgs = EParams + +/** PendingGovernorshipTransfer(address,address) */ +export const PendingGovernorshipTransfer = event('0xa39cc5eb22d0f34d8beaefee8a3f17cc229c1a1d1ef87a5ad47313487b1c4f0d', { + previousGovernor: indexed(address), + newGovernor: indexed(address), +}) +export type PendingGovernorshipTransferEventArgs = EParams + +/** TotalSupplyUpdatedHighres(uint256,uint256,uint256) */ +export const TotalSupplyUpdatedHighres = event('0x41645eb819d3011b13f97696a8109d14bfcddfaca7d063ec0564d62a3e257235', { + totalSupply: uint256, + rebasingCredits: uint256, + rebasingCreditsPerToken: uint256, +}) +export type TotalSupplyUpdatedHighresEventArgs = EParams + +/** Transfer(address,address,uint256) */ +export const Transfer = event('0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', { + from: indexed(address), + to: indexed(address), + value: uint256, +}) +export type TransferEventArgs = EParams diff --git a/src/abi/otoken-2024-12-21/functions.ts b/src/abi/otoken-2024-12-21/functions.ts new file mode 100644 index 00000000..578918b6 --- /dev/null +++ b/src/abi/otoken-2024-12-21/functions.ts @@ -0,0 +1,228 @@ +import { address, bool, string, struct, uint256, uint8 } from '@subsquid/evm-codec' +import { func } from '../abi.support.js' +import type { FunctionArguments, FunctionReturn } from '../abi.support.js' + +/** _totalSupply() */ +export const _totalSupply = func('0x3eaaf86b', {}, uint256) +export type _totalSupplyParams = FunctionArguments +export type _totalSupplyReturn = FunctionReturn + +/** allowance(address,address) */ +export const allowance = func('0xdd62ed3e', { + _owner: address, + _spender: address, +}, uint256) +export type AllowanceParams = FunctionArguments +export type AllowanceReturn = FunctionReturn + +/** approve(address,uint256) */ +export const approve = func('0x095ea7b3', { + _spender: address, + _value: uint256, +}, bool) +export type ApproveParams = FunctionArguments +export type ApproveReturn = FunctionReturn + +/** balanceOf(address) */ +export const balanceOf = func('0x70a08231', { + _account: address, +}, uint256) +export type BalanceOfParams = FunctionArguments +export type BalanceOfReturn = FunctionReturn + +/** burn(address,uint256) */ +export const burn = func('0x9dc29fac', { + account: address, + amount: uint256, +}) +export type BurnParams = FunctionArguments +export type BurnReturn = FunctionReturn + +/** changeSupply(uint256) */ +export const changeSupply = func('0x39a7919f', { + _newTotalSupply: uint256, +}) +export type ChangeSupplyParams = FunctionArguments +export type ChangeSupplyReturn = FunctionReturn + +/** claimGovernance() */ +export const claimGovernance = func('0x5d36b190', {}) +export type ClaimGovernanceParams = FunctionArguments +export type ClaimGovernanceReturn = FunctionReturn + +/** creditsBalanceOf(address) */ +export const creditsBalanceOf = func('0xf9854bfc', { + _account: address, +}, struct({ + _0: uint256, + _1: uint256, +})) +export type CreditsBalanceOfParams = FunctionArguments +export type CreditsBalanceOfReturn = FunctionReturn + +/** creditsBalanceOfHighres(address) */ +export const creditsBalanceOfHighres = func('0xe5c4fffe', { + _account: address, +}, struct({ + _0: uint256, + _1: uint256, + _2: bool, +})) +export type CreditsBalanceOfHighresParams = FunctionArguments +export type CreditsBalanceOfHighresReturn = FunctionReturn + +/** decimals() */ +export const decimals = func('0x313ce567', {}, uint8) +export type DecimalsParams = FunctionArguments +export type DecimalsReturn = FunctionReturn + +/** decreaseAllowance(address,uint256) */ +export const decreaseAllowance = func('0xa457c2d7', { + _spender: address, + _subtractedValue: uint256, +}, bool) +export type DecreaseAllowanceParams = FunctionArguments +export type DecreaseAllowanceReturn = FunctionReturn + +/** governanceRebaseOptIn(address) */ +export const governanceRebaseOptIn = func('0xbaa9c9db', { + _account: address, +}) +export type GovernanceRebaseOptInParams = FunctionArguments +export type GovernanceRebaseOptInReturn = FunctionReturn + +/** governor() */ +export const governor = func('0x0c340a24', {}, address) +export type GovernorParams = FunctionArguments +export type GovernorReturn = FunctionReturn + +/** increaseAllowance(address,uint256) */ +export const increaseAllowance = func('0x39509351', { + _spender: address, + _addedValue: uint256, +}, bool) +export type IncreaseAllowanceParams = FunctionArguments +export type IncreaseAllowanceReturn = FunctionReturn + +/** initialize(string,string,address,uint256) */ +export const initialize = func('0xf542033f', { + _nameArg: string, + _symbolArg: string, + _vaultAddress: address, + _initialCreditsPerToken: uint256, +}) +export type InitializeParams = FunctionArguments +export type InitializeReturn = FunctionReturn + +/** isGovernor() */ +export const isGovernor = func('0xc7af3352', {}, bool) +export type IsGovernorParams = FunctionArguments +export type IsGovernorReturn = FunctionReturn + +/** isUpgraded(address) */ +export const isUpgraded = func('0x95ef84b9', { + _0: address, +}, uint256) +export type IsUpgradedParams = FunctionArguments +export type IsUpgradedReturn = FunctionReturn + +/** mint(address,uint256) */ +export const mint = func('0x40c10f19', { + _account: address, + _amount: uint256, +}) +export type MintParams = FunctionArguments +export type MintReturn = FunctionReturn + +/** name() */ +export const name = func('0x06fdde03', {}, string) +export type NameParams = FunctionArguments +export type NameReturn = FunctionReturn + +/** nonRebasingCreditsPerToken(address) */ +export const nonRebasingCreditsPerToken = func('0x609350cd', { + _0: address, +}, uint256) +export type NonRebasingCreditsPerTokenParams = FunctionArguments +export type NonRebasingCreditsPerTokenReturn = FunctionReturn + +/** nonRebasingSupply() */ +export const nonRebasingSupply = func('0xe696393a', {}, uint256) +export type NonRebasingSupplyParams = FunctionArguments +export type NonRebasingSupplyReturn = FunctionReturn + +/** rebaseOptIn() */ +export const rebaseOptIn = func('0xf51b0fd4', {}) +export type RebaseOptInParams = FunctionArguments +export type RebaseOptInReturn = FunctionReturn + +/** rebaseOptOut() */ +export const rebaseOptOut = func('0xc2376dff', {}) +export type RebaseOptOutParams = FunctionArguments +export type RebaseOptOutReturn = FunctionReturn + +/** rebaseState(address) */ +export const rebaseState = func('0x456ee286', { + _0: address, +}, uint8) +export type RebaseStateParams = FunctionArguments +export type RebaseStateReturn = FunctionReturn + +/** rebasingCredits() */ +export const rebasingCredits = func('0x077f22b7', {}, uint256) +export type RebasingCreditsParams = FunctionArguments +export type RebasingCreditsReturn = FunctionReturn + +/** rebasingCreditsHighres() */ +export const rebasingCreditsHighres = func('0x7d0d66ff', {}, uint256) +export type RebasingCreditsHighresParams = FunctionArguments +export type RebasingCreditsHighresReturn = FunctionReturn + +/** rebasingCreditsPerToken() */ +export const rebasingCreditsPerToken = func('0x6691cb3d', {}, uint256) +export type RebasingCreditsPerTokenParams = FunctionArguments +export type RebasingCreditsPerTokenReturn = FunctionReturn + +/** rebasingCreditsPerTokenHighres() */ +export const rebasingCreditsPerTokenHighres = func('0x7a46a9c5', {}, uint256) +export type RebasingCreditsPerTokenHighresParams = FunctionArguments +export type RebasingCreditsPerTokenHighresReturn = FunctionReturn + +/** symbol() */ +export const symbol = func('0x95d89b41', {}, string) +export type SymbolParams = FunctionArguments +export type SymbolReturn = FunctionReturn + +/** totalSupply() */ +export const totalSupply = func('0x18160ddd', {}, uint256) +export type TotalSupplyParams = FunctionArguments +export type TotalSupplyReturn = FunctionReturn + +/** transfer(address,uint256) */ +export const transfer = func('0xa9059cbb', { + _to: address, + _value: uint256, +}, bool) +export type TransferParams = FunctionArguments +export type TransferReturn = FunctionReturn + +/** transferFrom(address,address,uint256) */ +export const transferFrom = func('0x23b872dd', { + _from: address, + _to: address, + _value: uint256, +}, bool) +export type TransferFromParams = FunctionArguments +export type TransferFromReturn = FunctionReturn + +/** transferGovernance(address) */ +export const transferGovernance = func('0xd38bfff4', { + _newGovernor: address, +}) +export type TransferGovernanceParams = FunctionArguments +export type TransferGovernanceReturn = FunctionReturn + +/** vaultAddress() */ +export const vaultAddress = func('0x430bf08a', {}, address) +export type VaultAddressParams = FunctionArguments +export type VaultAddressReturn = FunctionReturn diff --git a/src/abi/otoken-2024-12-21/index.ts b/src/abi/otoken-2024-12-21/index.ts new file mode 100644 index 00000000..11829d6e --- /dev/null +++ b/src/abi/otoken-2024-12-21/index.ts @@ -0,0 +1,4 @@ +export * as events from './events.js' +export * as functions from './functions.js' + +export { Contract } from './contract.js' diff --git a/src/abi/otoken-base-harvester.ts b/src/abi/otoken-base-harvester.ts deleted file mode 100644 index 2dc27a09..00000000 --- a/src/abi/otoken-base-harvester.ts +++ /dev/null @@ -1,114 +0,0 @@ -import * as p from '@subsquid/evm-codec' -import { event, fun, viewFun, indexed, ContractBase } from '@subsquid/evm-abi' -import type { EventParams as EParams, FunctionArguments, FunctionReturn } from '@subsquid/evm-abi' - -export const events = { - GovernorshipTransferred: event("0xc7c0c772add429241571afb3805861fb3cfa2af374534088b76cdb4325a87e9a", "GovernorshipTransferred(address,address)", {"previousGovernor": indexed(p.address), "newGovernor": indexed(p.address)}), - OperatorChanged: event("0xd58299b712891143e76310d5e664c4203c940a67db37cf856bdaa3c5c76a802c", "OperatorChanged(address,address)", {"oldOperator": p.address, "newOperator": p.address}), - PendingGovernorshipTransfer: event("0xa39cc5eb22d0f34d8beaefee8a3f17cc229c1a1d1ef87a5ad47313487b1c4f0d", "PendingGovernorshipTransfer(address,address)", {"previousGovernor": indexed(p.address), "newGovernor": indexed(p.address)}), - RewardTokenSwapped: event("0xa861903141bc68b536d5048a576afcc645630e1b18a4296ef34cbd4d1407f709", "RewardTokenSwapped(address,address,uint8,uint256,uint256)", {"rewardToken": indexed(p.address), "swappedInto": indexed(p.address), "swapPlatform": p.uint8, "amountIn": p.uint256, "amountOut": p.uint256}), - YieldSent: event("0x4c70885488a444f9f6af8660e35d1c356100677dff981e92b57e4be32d6619d1", "YieldSent(address,uint256,uint256)", {"recipient": p.address, "yield": p.uint256, "fee": p.uint256}), -} - -export const functions = { - aero: viewFun("0x26837eda", "aero()", {}, p.address), - amoStrategy: viewFun("0xf6aa085d", "amoStrategy()", {}, p.address), - claimGovernance: fun("0x5d36b190", "claimGovernance()", {}, ), - governor: viewFun("0x0c340a24", "governor()", {}, p.address), - harvest: fun("0x4641257d", "harvest()", {}, ), - harvestAndSwap: fun("0x859e4b81", "harvestAndSwap(uint256,uint256,uint256,bool)", {"aeroToSwap": p.uint256, "minWETHExpected": p.uint256, "feeBps": p.uint256, "sendYieldToDripper": p.bool}, ), - isGovernor: viewFun("0xc7af3352", "isGovernor()", {}, p.bool), - operatorAddr: viewFun("0xf3f18c37", "operatorAddr()", {}, p.address), - setOperatorAddr: fun("0x9e428552", "setOperatorAddr(address)", {"_operatorAddr": p.address}, ), - swapRouter: viewFun("0xc31c9c07", "swapRouter()", {}, p.address), - transferGovernance: fun("0xd38bfff4", "transferGovernance(address)", {"_newGovernor": p.address}, ), - transferToken: fun("0x1072cbea", "transferToken(address,uint256)", {"_asset": p.address, "_amount": p.uint256}, ), - vault: viewFun("0xfbfa77cf", "vault()", {}, p.address), - weth: viewFun("0x3fc8cef3", "weth()", {}, p.address), -} - -export class Contract extends ContractBase { - - aero() { - return this.eth_call(functions.aero, {}) - } - - amoStrategy() { - return this.eth_call(functions.amoStrategy, {}) - } - - governor() { - return this.eth_call(functions.governor, {}) - } - - isGovernor() { - return this.eth_call(functions.isGovernor, {}) - } - - operatorAddr() { - return this.eth_call(functions.operatorAddr, {}) - } - - swapRouter() { - return this.eth_call(functions.swapRouter, {}) - } - - vault() { - return this.eth_call(functions.vault, {}) - } - - weth() { - return this.eth_call(functions.weth, {}) - } -} - -/// Event types -export type GovernorshipTransferredEventArgs = EParams -export type OperatorChangedEventArgs = EParams -export type PendingGovernorshipTransferEventArgs = EParams -export type RewardTokenSwappedEventArgs = EParams -export type YieldSentEventArgs = EParams - -/// Function types -export type AeroParams = FunctionArguments -export type AeroReturn = FunctionReturn - -export type AmoStrategyParams = FunctionArguments -export type AmoStrategyReturn = FunctionReturn - -export type ClaimGovernanceParams = FunctionArguments -export type ClaimGovernanceReturn = FunctionReturn - -export type GovernorParams = FunctionArguments -export type GovernorReturn = FunctionReturn - -export type HarvestParams = FunctionArguments -export type HarvestReturn = FunctionReturn - -export type HarvestAndSwapParams = FunctionArguments -export type HarvestAndSwapReturn = FunctionReturn - -export type IsGovernorParams = FunctionArguments -export type IsGovernorReturn = FunctionReturn - -export type OperatorAddrParams = FunctionArguments -export type OperatorAddrReturn = FunctionReturn - -export type SetOperatorAddrParams = FunctionArguments -export type SetOperatorAddrReturn = FunctionReturn - -export type SwapRouterParams = FunctionArguments -export type SwapRouterReturn = FunctionReturn - -export type TransferGovernanceParams = FunctionArguments -export type TransferGovernanceReturn = FunctionReturn - -export type TransferTokenParams = FunctionArguments -export type TransferTokenReturn = FunctionReturn - -export type VaultParams = FunctionArguments -export type VaultReturn = FunctionReturn - -export type WethParams = FunctionArguments -export type WethReturn = FunctionReturn - diff --git a/src/abi/otoken-base-harvester/contract.ts b/src/abi/otoken-base-harvester/contract.ts new file mode 100644 index 00000000..f1029a06 --- /dev/null +++ b/src/abi/otoken-base-harvester/contract.ts @@ -0,0 +1,36 @@ +import { ContractBase } from '../abi.support.js' +import { aero, amoStrategy, governor, isGovernor, operatorAddr, swapRouter, vault, weth } from './functions.js' + +export class Contract extends ContractBase { + aero() { + return this.eth_call(aero, {}) + } + + amoStrategy() { + return this.eth_call(amoStrategy, {}) + } + + governor() { + return this.eth_call(governor, {}) + } + + isGovernor() { + return this.eth_call(isGovernor, {}) + } + + operatorAddr() { + return this.eth_call(operatorAddr, {}) + } + + swapRouter() { + return this.eth_call(swapRouter, {}) + } + + vault() { + return this.eth_call(vault, {}) + } + + weth() { + return this.eth_call(weth, {}) + } +} diff --git a/src/abi/otoken-base-harvester/events.ts b/src/abi/otoken-base-harvester/events.ts new file mode 100644 index 00000000..5c2e3e4c --- /dev/null +++ b/src/abi/otoken-base-harvester/events.ts @@ -0,0 +1,42 @@ +import { address, uint256, uint8 } from '@subsquid/evm-codec' +import { event, indexed } from '../abi.support.js' +import type { EventParams as EParams } from '../abi.support.js' + +/** GovernorshipTransferred(address,address) */ +export const GovernorshipTransferred = event('0xc7c0c772add429241571afb3805861fb3cfa2af374534088b76cdb4325a87e9a', { + previousGovernor: indexed(address), + newGovernor: indexed(address), +}) +export type GovernorshipTransferredEventArgs = EParams + +/** OperatorChanged(address,address) */ +export const OperatorChanged = event('0xd58299b712891143e76310d5e664c4203c940a67db37cf856bdaa3c5c76a802c', { + oldOperator: address, + newOperator: address, +}) +export type OperatorChangedEventArgs = EParams + +/** PendingGovernorshipTransfer(address,address) */ +export const PendingGovernorshipTransfer = event('0xa39cc5eb22d0f34d8beaefee8a3f17cc229c1a1d1ef87a5ad47313487b1c4f0d', { + previousGovernor: indexed(address), + newGovernor: indexed(address), +}) +export type PendingGovernorshipTransferEventArgs = EParams + +/** RewardTokenSwapped(address,address,uint8,uint256,uint256) */ +export const RewardTokenSwapped = event('0xa861903141bc68b536d5048a576afcc645630e1b18a4296ef34cbd4d1407f709', { + rewardToken: indexed(address), + swappedInto: indexed(address), + swapPlatform: uint8, + amountIn: uint256, + amountOut: uint256, +}) +export type RewardTokenSwappedEventArgs = EParams + +/** YieldSent(address,uint256,uint256) */ +export const YieldSent = event('0x4c70885488a444f9f6af8660e35d1c356100677dff981e92b57e4be32d6619d1', { + recipient: address, + yield: uint256, + fee: uint256, +}) +export type YieldSentEventArgs = EParams diff --git a/src/abi/otoken-base-harvester/functions.ts b/src/abi/otoken-base-harvester/functions.ts new file mode 100644 index 00000000..7421bd29 --- /dev/null +++ b/src/abi/otoken-base-harvester/functions.ts @@ -0,0 +1,85 @@ +import { address, bool, uint256 } from '@subsquid/evm-codec' +import { func } from '../abi.support.js' +import type { FunctionArguments, FunctionReturn } from '../abi.support.js' + +/** aero() */ +export const aero = func('0x26837eda', {}, address) +export type AeroParams = FunctionArguments +export type AeroReturn = FunctionReturn + +/** amoStrategy() */ +export const amoStrategy = func('0xf6aa085d', {}, address) +export type AmoStrategyParams = FunctionArguments +export type AmoStrategyReturn = FunctionReturn + +/** claimGovernance() */ +export const claimGovernance = func('0x5d36b190', {}) +export type ClaimGovernanceParams = FunctionArguments +export type ClaimGovernanceReturn = FunctionReturn + +/** governor() */ +export const governor = func('0x0c340a24', {}, address) +export type GovernorParams = FunctionArguments +export type GovernorReturn = FunctionReturn + +/** harvest() */ +export const harvest = func('0x4641257d', {}) +export type HarvestParams = FunctionArguments +export type HarvestReturn = FunctionReturn + +/** harvestAndSwap(uint256,uint256,uint256,bool) */ +export const harvestAndSwap = func('0x859e4b81', { + aeroToSwap: uint256, + minWETHExpected: uint256, + feeBps: uint256, + sendYieldToDripper: bool, +}) +export type HarvestAndSwapParams = FunctionArguments +export type HarvestAndSwapReturn = FunctionReturn + +/** isGovernor() */ +export const isGovernor = func('0xc7af3352', {}, bool) +export type IsGovernorParams = FunctionArguments +export type IsGovernorReturn = FunctionReturn + +/** operatorAddr() */ +export const operatorAddr = func('0xf3f18c37', {}, address) +export type OperatorAddrParams = FunctionArguments +export type OperatorAddrReturn = FunctionReturn + +/** setOperatorAddr(address) */ +export const setOperatorAddr = func('0x9e428552', { + _operatorAddr: address, +}) +export type SetOperatorAddrParams = FunctionArguments +export type SetOperatorAddrReturn = FunctionReturn + +/** swapRouter() */ +export const swapRouter = func('0xc31c9c07', {}, address) +export type SwapRouterParams = FunctionArguments +export type SwapRouterReturn = FunctionReturn + +/** transferGovernance(address) */ +export const transferGovernance = func('0xd38bfff4', { + _newGovernor: address, +}) +export type TransferGovernanceParams = FunctionArguments +export type TransferGovernanceReturn = FunctionReturn + +/** transferToken(address,uint256) */ +export const transferToken = func('0x1072cbea', { + _asset: address, + _amount: uint256, +}) +export type TransferTokenParams = FunctionArguments +export type TransferTokenReturn = FunctionReturn + +/** vault() */ +export const vault = func('0xfbfa77cf', {}, address) +export type VaultParams = FunctionArguments +export type VaultReturn = FunctionReturn + +/** weth() */ +export const weth = func('0x3fc8cef3', {}, address) +export type WethParams = FunctionArguments +export type WethReturn = FunctionReturn diff --git a/src/abi/otoken-base-harvester/index.ts b/src/abi/otoken-base-harvester/index.ts new file mode 100644 index 00000000..11829d6e --- /dev/null +++ b/src/abi/otoken-base-harvester/index.ts @@ -0,0 +1,4 @@ +export * as events from './events.js' +export * as functions from './functions.js' + +export { Contract } from './contract.js' diff --git a/src/abi/otoken-dripper.ts b/src/abi/otoken-dripper.ts deleted file mode 100644 index b3712803..00000000 --- a/src/abi/otoken-dripper.ts +++ /dev/null @@ -1,84 +0,0 @@ -import * as p from '@subsquid/evm-codec' -import { event, fun, viewFun, indexed, ContractBase } from '@subsquid/evm-abi' -import type { EventParams as EParams, FunctionArguments, FunctionReturn } from '@subsquid/evm-abi' - -export const events = { - GovernorshipTransferred: event("0xc7c0c772add429241571afb3805861fb3cfa2af374534088b76cdb4325a87e9a", "GovernorshipTransferred(address,address)", {"previousGovernor": indexed(p.address), "newGovernor": indexed(p.address)}), - PendingGovernorshipTransfer: event("0xa39cc5eb22d0f34d8beaefee8a3f17cc229c1a1d1ef87a5ad47313487b1c4f0d", "PendingGovernorshipTransfer(address,address)", {"previousGovernor": indexed(p.address), "newGovernor": indexed(p.address)}), -} - -export const functions = { - availableFunds: viewFun("0x46fcff4c", "availableFunds()", {}, p.uint256), - claimGovernance: fun("0x5d36b190", "claimGovernance()", {}, ), - collect: fun("0xe5225381", "collect()", {}, ), - collectAndRebase: fun("0x73796297", "collectAndRebase()", {}, ), - drip: viewFun("0x9f678cca", "drip()", {}, {"lastCollect": p.uint64, "perSecond": p.uint192}), - dripDuration: viewFun("0xbb7a632e", "dripDuration()", {}, p.uint256), - governor: viewFun("0x0c340a24", "governor()", {}, p.address), - isGovernor: viewFun("0xc7af3352", "isGovernor()", {}, p.bool), - setDripDuration: fun("0x0493a0fa", "setDripDuration(uint256)", {"_durationSeconds": p.uint256}, ), - transferGovernance: fun("0xd38bfff4", "transferGovernance(address)", {"_newGovernor": p.address}, ), - transferToken: fun("0x1072cbea", "transferToken(address,uint256)", {"_asset": p.address, "_amount": p.uint256}, ), -} - -export class Contract extends ContractBase { - - availableFunds() { - return this.eth_call(functions.availableFunds, {}) - } - - drip() { - return this.eth_call(functions.drip, {}) - } - - dripDuration() { - return this.eth_call(functions.dripDuration, {}) - } - - governor() { - return this.eth_call(functions.governor, {}) - } - - isGovernor() { - return this.eth_call(functions.isGovernor, {}) - } -} - -/// Event types -export type GovernorshipTransferredEventArgs = EParams -export type PendingGovernorshipTransferEventArgs = EParams - -/// Function types -export type AvailableFundsParams = FunctionArguments -export type AvailableFundsReturn = FunctionReturn - -export type ClaimGovernanceParams = FunctionArguments -export type ClaimGovernanceReturn = FunctionReturn - -export type CollectParams = FunctionArguments -export type CollectReturn = FunctionReturn - -export type CollectAndRebaseParams = FunctionArguments -export type CollectAndRebaseReturn = FunctionReturn - -export type DripParams = FunctionArguments -export type DripReturn = FunctionReturn - -export type DripDurationParams = FunctionArguments -export type DripDurationReturn = FunctionReturn - -export type GovernorParams = FunctionArguments -export type GovernorReturn = FunctionReturn - -export type IsGovernorParams = FunctionArguments -export type IsGovernorReturn = FunctionReturn - -export type SetDripDurationParams = FunctionArguments -export type SetDripDurationReturn = FunctionReturn - -export type TransferGovernanceParams = FunctionArguments -export type TransferGovernanceReturn = FunctionReturn - -export type TransferTokenParams = FunctionArguments -export type TransferTokenReturn = FunctionReturn - diff --git a/src/abi/otoken-dripper/contract.ts b/src/abi/otoken-dripper/contract.ts new file mode 100644 index 00000000..339cb97a --- /dev/null +++ b/src/abi/otoken-dripper/contract.ts @@ -0,0 +1,24 @@ +import { ContractBase } from '../abi.support.js' +import { availableFunds, drip, dripDuration, governor, isGovernor } from './functions.js' + +export class Contract extends ContractBase { + availableFunds() { + return this.eth_call(availableFunds, {}) + } + + drip() { + return this.eth_call(drip, {}) + } + + dripDuration() { + return this.eth_call(dripDuration, {}) + } + + governor() { + return this.eth_call(governor, {}) + } + + isGovernor() { + return this.eth_call(isGovernor, {}) + } +} diff --git a/src/abi/otoken-dripper/events.ts b/src/abi/otoken-dripper/events.ts new file mode 100644 index 00000000..d2042b0e --- /dev/null +++ b/src/abi/otoken-dripper/events.ts @@ -0,0 +1,17 @@ +import { address } from '@subsquid/evm-codec' +import { event, indexed } from '../abi.support.js' +import type { EventParams as EParams } from '../abi.support.js' + +/** GovernorshipTransferred(address,address) */ +export const GovernorshipTransferred = event('0xc7c0c772add429241571afb3805861fb3cfa2af374534088b76cdb4325a87e9a', { + previousGovernor: indexed(address), + newGovernor: indexed(address), +}) +export type GovernorshipTransferredEventArgs = EParams + +/** PendingGovernorshipTransfer(address,address) */ +export const PendingGovernorshipTransfer = event('0xa39cc5eb22d0f34d8beaefee8a3f17cc229c1a1d1ef87a5ad47313487b1c4f0d', { + previousGovernor: indexed(address), + newGovernor: indexed(address), +}) +export type PendingGovernorshipTransferEventArgs = EParams diff --git a/src/abi/otoken-dripper/functions.ts b/src/abi/otoken-dripper/functions.ts new file mode 100644 index 00000000..158e4e2d --- /dev/null +++ b/src/abi/otoken-dripper/functions.ts @@ -0,0 +1,68 @@ +import { address, bool, struct, uint192, uint256, uint64 } from '@subsquid/evm-codec' +import { func } from '../abi.support.js' +import type { FunctionArguments, FunctionReturn } from '../abi.support.js' + +/** availableFunds() */ +export const availableFunds = func('0x46fcff4c', {}, uint256) +export type AvailableFundsParams = FunctionArguments +export type AvailableFundsReturn = FunctionReturn + +/** claimGovernance() */ +export const claimGovernance = func('0x5d36b190', {}) +export type ClaimGovernanceParams = FunctionArguments +export type ClaimGovernanceReturn = FunctionReturn + +/** collect() */ +export const collect = func('0xe5225381', {}) +export type CollectParams = FunctionArguments +export type CollectReturn = FunctionReturn + +/** collectAndRebase() */ +export const collectAndRebase = func('0x73796297', {}) +export type CollectAndRebaseParams = FunctionArguments +export type CollectAndRebaseReturn = FunctionReturn + +/** drip() */ +export const drip = func('0x9f678cca', {}, struct({ + lastCollect: uint64, + perSecond: uint192, +})) +export type DripParams = FunctionArguments +export type DripReturn = FunctionReturn + +/** dripDuration() */ +export const dripDuration = func('0xbb7a632e', {}, uint256) +export type DripDurationParams = FunctionArguments +export type DripDurationReturn = FunctionReturn + +/** governor() */ +export const governor = func('0x0c340a24', {}, address) +export type GovernorParams = FunctionArguments +export type GovernorReturn = FunctionReturn + +/** isGovernor() */ +export const isGovernor = func('0xc7af3352', {}, bool) +export type IsGovernorParams = FunctionArguments +export type IsGovernorReturn = FunctionReturn + +/** setDripDuration(uint256) */ +export const setDripDuration = func('0x0493a0fa', { + _durationSeconds: uint256, +}) +export type SetDripDurationParams = FunctionArguments +export type SetDripDurationReturn = FunctionReturn + +/** transferGovernance(address) */ +export const transferGovernance = func('0xd38bfff4', { + _newGovernor: address, +}) +export type TransferGovernanceParams = FunctionArguments +export type TransferGovernanceReturn = FunctionReturn + +/** transferToken(address,uint256) */ +export const transferToken = func('0x1072cbea', { + _asset: address, + _amount: uint256, +}) +export type TransferTokenParams = FunctionArguments +export type TransferTokenReturn = FunctionReturn diff --git a/src/abi/otoken-dripper/index.ts b/src/abi/otoken-dripper/index.ts new file mode 100644 index 00000000..11829d6e --- /dev/null +++ b/src/abi/otoken-dripper/index.ts @@ -0,0 +1,4 @@ +export * as events from './events.js' +export * as functions from './functions.js' + +export { Contract } from './contract.js' diff --git a/src/abi/otoken-upgradeAccounts.abi.ts b/src/abi/otoken-upgradeAccounts.abi.ts new file mode 100644 index 00000000..14251cf4 --- /dev/null +++ b/src/abi/otoken-upgradeAccounts.abi.ts @@ -0,0 +1,15 @@ +export const ABI_JSON = [ + { + "type": "function", + "name": "upgradeAccounts", + "stateMutability": "nonpayable", + "inputs": [ + { + "name": "accounts", + "type": "address[]", + "internalType": "address[]" + } + ], + "outputs": [] + } +] as const diff --git a/src/abi/otoken-upgradeAccounts.ts b/src/abi/otoken-upgradeAccounts.ts deleted file mode 100644 index 330c7c83..00000000 --- a/src/abi/otoken-upgradeAccounts.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { fun } from '@subsquid/evm-abi' -import * as p from '@subsquid/evm-codec' - -export const functions = { - upgradeAccounts: fun("0xeec037f6", "upgradeAccounts(address[])", {"accounts": p.array(p.address)}, ), -} diff --git a/src/abi/otoken-upgradeAccounts/contract.ts b/src/abi/otoken-upgradeAccounts/contract.ts new file mode 100644 index 00000000..f07fbdea --- /dev/null +++ b/src/abi/otoken-upgradeAccounts/contract.ts @@ -0,0 +1,4 @@ +import { ContractBase } from '../abi.support.js' + +export class Contract extends ContractBase { +} diff --git a/src/abi/otoken-upgradeAccounts/functions.ts b/src/abi/otoken-upgradeAccounts/functions.ts new file mode 100644 index 00000000..51068c0e --- /dev/null +++ b/src/abi/otoken-upgradeAccounts/functions.ts @@ -0,0 +1,10 @@ +import { address, array } from '@subsquid/evm-codec' +import { func } from '../abi.support.js' +import type { FunctionArguments, FunctionReturn } from '../abi.support.js' + +/** upgradeAccounts(address[]) */ +export const upgradeAccounts = func('0xeec037f6', { + accounts: array(address), +}) +export type UpgradeAccountsParams = FunctionArguments +export type UpgradeAccountsReturn = FunctionReturn diff --git a/src/abi/otoken-upgradeAccounts/index.ts b/src/abi/otoken-upgradeAccounts/index.ts new file mode 100644 index 00000000..ed5306bd --- /dev/null +++ b/src/abi/otoken-upgradeAccounts/index.ts @@ -0,0 +1,3 @@ +export * as functions from './functions.js' + +export { Contract } from './contract.js' diff --git a/src/abi/otoken-vault.ts b/src/abi/otoken-vault.ts deleted file mode 100644 index 9bfd95f9..00000000 --- a/src/abi/otoken-vault.ts +++ /dev/null @@ -1,506 +0,0 @@ -import * as p from '@subsquid/evm-codec' -import { event, fun, viewFun, indexed, ContractBase } from '@subsquid/evm-abi' -import type { EventParams as EParams, FunctionArguments, FunctionReturn } from '@subsquid/evm-abi' - -export const events = { - AllocateThresholdUpdated: event("0x2ec5fb5a3d2703edc461252d92ccd2799c3c74f01d97212b20388207fa17ae45", "AllocateThresholdUpdated(uint256)", {"_threshold": p.uint256}), - AssetAllocated: event("0x41b99659f6ba0803f444aff29e5bf6e26dd86a3219aff92119d69710a956ba8d", "AssetAllocated(address,address,uint256)", {"_asset": p.address, "_strategy": p.address, "_amount": p.uint256}), - AssetDefaultStrategyUpdated: event("0xba58ce12801c949fa65f41c46ed108671c219baf945fa48d21026cea99ff252a", "AssetDefaultStrategyUpdated(address,address)", {"_asset": p.address, "_strategy": p.address}), - AssetRemoved: event("0x37803e2125c48ee96c38ddf04e826daf335b0e1603579040fd275aba6d06b6fc", "AssetRemoved(address)", {"_asset": p.address}), - AssetSupported: event("0x4f1ac48525e50059cc1cc6e0e1940ece0dd653a4db4841538d6aef036be2fb7b", "AssetSupported(address)", {"_asset": p.address}), - CapitalPaused: event("0x71f0e5b62f846a22e0b4d159e516e62fa9c2b8eb570be15f83e67d98a2ee51e0", "CapitalPaused()", {}), - CapitalUnpaused: event("0x891ebab18da80ebeeea06b1b1cede098329c4c008906a98370c2ac7a80b571cb", "CapitalUnpaused()", {}), - DripDurationChanged: event("0x406e15fbca1d8ded2dbb06765fea3a54f18395c54125a4c9916dd00ea14ee15e", "DripDurationChanged(uint256)", {"dripDuration": p.uint256}), - DripperChanged: event("0xaf2910d9759321733de15af1827a49830692912adeb2b3646334861f2cd2eed4", "DripperChanged(address)", {"_dripper": indexed(p.address)}), - GovernorshipTransferred: event("0xc7c0c772add429241571afb3805861fb3cfa2af374534088b76cdb4325a87e9a", "GovernorshipTransferred(address,address)", {"previousGovernor": indexed(p.address), "newGovernor": indexed(p.address)}), - MaxSupplyDiffChanged: event("0x95201f9c21f26877223b1ff4073936a6484c35495649e60e55730497aeb60d93", "MaxSupplyDiffChanged(uint256)", {"maxSupplyDiff": p.uint256}), - Mint: event("0x0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885", "Mint(address,uint256)", {"_addr": p.address, "_value": p.uint256}), - NetOusdMintForStrategyThresholdChanged: event("0xc29d6fedbc6bdf267a08166c2b976fbd72aca5d6a769528616f8b9224c8f197f", "NetOusdMintForStrategyThresholdChanged(uint256)", {"_threshold": p.uint256}), - OusdMetaStrategyUpdated: event("0xa12850fb726e0b2b7b3c9a9342031e1268a8148d0eb06b4bea8613204ffcd2b8", "OusdMetaStrategyUpdated(address)", {"_ousdMetaStrategy": p.address}), - PendingGovernorshipTransfer: event("0xa39cc5eb22d0f34d8beaefee8a3f17cc229c1a1d1ef87a5ad47313487b1c4f0d", "PendingGovernorshipTransfer(address,address)", {"previousGovernor": indexed(p.address), "newGovernor": indexed(p.address)}), - PriceProviderUpdated: event("0xb266add5f3044b17d27db796af992cecbe413921b4e8aaaee03c719e16b9806a", "PriceProviderUpdated(address)", {"_priceProvider": p.address}), - RebasePaused: event("0x8cff26a5985614b3d30629cc4ab83824bf115aec971b718d8f2f99562032e972", "RebasePaused()", {}), - RebasePerSecondMaxChanged: event("0xef46f143af5fead0010484fe7d6ec2e2972420faa76157f5a6075aa72e614cb5", "RebasePerSecondMaxChanged(uint256)", {"rebaseRatePerSecond": p.uint256}), - RebaseThresholdUpdated: event("0x39367850377ac04920a9a670f2180e7a94d83b15ad302e59875ec58fd10bd37d", "RebaseThresholdUpdated(uint256)", {"_threshold": p.uint256}), - RebaseUnpaused: event("0xbc044409505c95b6b851433df96e1beae715c909d8e7c1d6d7ab783300d4e3b9", "RebaseUnpaused()", {}), - Redeem: event("0x222838db2794d11532d940e8dec38ae307ed0b63cd97c233322e221f998767a6", "Redeem(address,uint256)", {"_addr": p.address, "_value": p.uint256}), - RedeemFeeUpdated: event("0xd6c7508d6658ccee36b7b7d7fd72e5cbaeefb40c64eff24e9ae7470e846304ee", "RedeemFeeUpdated(uint256)", {"_redeemFeeBps": p.uint256}), - StrategistUpdated: event("0x869e0abd13cc3a975de7b93be3df1cb2255c802b1cead85963cc79d99f131bee", "StrategistUpdated(address)", {"_address": p.address}), - StrategyAddedToMintWhitelist: event("0x47c8c96a5942f094264111c5fe7f6a4fe86efe63254a6fa7afa5fc84f07d58e8", "StrategyAddedToMintWhitelist(address)", {"strategy": indexed(p.address)}), - StrategyApproved: event("0x960dd94cbb79169f09a4e445d58b895df2d9bffa5b31055d0932d801724a20d1", "StrategyApproved(address)", {"_addr": p.address}), - StrategyRemoved: event("0x09a1db4b80c32706328728508c941a6b954f31eb5affd32f236c1fd405f8fea4", "StrategyRemoved(address)", {"_addr": p.address}), - StrategyRemovedFromMintWhitelist: event("0x0ec40967a61509853550658e51d0e4297f7cba244fe4adc8ba18b5631ac20e2f", "StrategyRemovedFromMintWhitelist(address)", {"strategy": indexed(p.address)}), - SwapAllowedUndervalueChanged: event("0xf12c00256bee2b6facb111a88a9b1cff86e79132939b44f1353212d6f7469557", "SwapAllowedUndervalueChanged(uint256)", {"_basis": p.uint256}), - SwapSlippageChanged: event("0x8d22e9d2cbe8bb65a3c4412bd8970743864512a1a0e004e8d00fb96277b78b94", "SwapSlippageChanged(address,uint256)", {"_asset": p.address, "_basis": p.uint256}), - Swapped: event("0xa078c4190abe07940190effc1846be0ccf03ad6007bc9e93f9697d0b460befbb", "Swapped(address,address,uint256,uint256)", {"_fromAsset": indexed(p.address), "_toAsset": indexed(p.address), "_fromAssetAmount": p.uint256, "_toAssetAmount": p.uint256}), - SwapperChanged: event("0x7d7719313229e558c5a3893cad2eb86a86a049156d1d9ebd5c63a8eedefd1c03", "SwapperChanged(address)", {"_address": p.address}), - TrusteeAddressChanged: event("0x1e4af5ac389e8cde1bdaa6830881b6c987c62a45cfb3b33d27d805cde3b57750", "TrusteeAddressChanged(address)", {"_address": p.address}), - TrusteeFeeBpsChanged: event("0x56287a45051933ea374811b3d5d165033047be5572cac676f7c28b8be4f746c7", "TrusteeFeeBpsChanged(uint256)", {"_basis": p.uint256}), - VaultBufferUpdated: event("0x41ecb23a0e7865b25f38c268b7c3012220d822929e9edff07326e89d5bb822b5", "VaultBufferUpdated(uint256)", {"_vaultBuffer": p.uint256}), - WithdrawalClaimDelayUpdated: event("0xc59f5e32049abab44ddea11021f5abb89422a2f550837afcf25df9fc8d0db6b0", "WithdrawalClaimDelayUpdated(uint256)", {"_newDelay": p.uint256}), - WithdrawalClaimable: event("0xee79a0c43d3993055690b54e074b5153e8bae8d1a872b656dedb64aa8f463333", "WithdrawalClaimable(uint256,uint256)", {"_claimable": p.uint256, "_newClaimable": p.uint256}), - WithdrawalClaimed: event("0x2d43eb174787155132b52ddb6b346e2dca99302eac3df4466dbeff953d3c84d1", "WithdrawalClaimed(address,uint256,uint256)", {"_withdrawer": indexed(p.address), "_requestId": indexed(p.uint256), "_amount": p.uint256}), - WithdrawalRequested: event("0x38e3d972947cfef94205163d483d6287ef27eb312e20cb8e0b13a49989db232e", "WithdrawalRequested(address,uint256,uint256,uint256)", {"_withdrawer": indexed(p.address), "_requestId": indexed(p.uint256), "_amount": p.uint256, "_queued": p.uint256}), - YieldDistribution: event("0x09516ecf4a8a86e59780a9befc6dee948bc9e60a36e3be68d31ea817ee8d2c80", "YieldDistribution(address,uint256,uint256)", {"_to": p.address, "_yield": p.uint256, "_fee": p.uint256}), -} - -export const functions = { - ADMIN_IMPLEMENTATION: viewFun("0xcc2fe94b", "ADMIN_IMPLEMENTATION()", {}, p.address), - addWithdrawalQueueLiquidity: fun("0xb9b17f9f", "addWithdrawalQueueLiquidity()", {}, ), - adminImplPosition: viewFun("0xef08edc2", "adminImplPosition()", {}, p.bytes32), - allocate: fun("0xabaa9916", "allocate()", {}, ), - assetDefaultStrategies: viewFun("0xa403e4d5", "assetDefaultStrategies(address)", {"_0": p.address}, p.address), - autoAllocateThreshold: viewFun("0x9fa1826e", "autoAllocateThreshold()", {}, p.uint256), - burnForStrategy: fun("0x6217f3ea", "burnForStrategy(uint256)", {"amount": p.uint256}, ), - cacheWETHAssetIndex: fun("0x44c54707", "cacheWETHAssetIndex()", {}, ), - calculateRedeemOutputs: viewFun("0x67bd7ba3", "calculateRedeemOutputs(uint256)", {"_amount": p.uint256}, p.array(p.uint256)), - capitalPaused: viewFun("0xe6cc5432", "capitalPaused()", {}, p.bool), - checkBalance: viewFun("0x5f515226", "checkBalance(address)", {"_asset": p.address}, p.uint256), - claimGovernance: fun("0x5d36b190", "claimGovernance()", {}, ), - claimWithdrawal: fun("0xf8444436", "claimWithdrawal(uint256)", {"_requestId": p.uint256}, p.uint256), - claimWithdrawals: fun("0x48e30f54", "claimWithdrawals(uint256[])", {"_requestIds": p.array(p.uint256)}, {"amounts": p.array(p.uint256), "totalAmount": p.uint256}), - dripDuration: viewFun("0xbb7a632e", "dripDuration()", {}, p.uint64), - dripper: viewFun("0x603ea03b", "dripper()", {}, p.address), - getAllAssets: viewFun("0x2acada4d", "getAllAssets()", {}, p.array(p.address)), - getAllStrategies: viewFun("0xc3b28864", "getAllStrategies()", {}, p.array(p.address)), - getAssetConfig: viewFun("0x6ec3ab67", "getAssetConfig(address)", {"_asset": p.address}, p.struct({"isSupported": p.bool, "unitConversion": p.uint8, "decimals": p.uint8, "allowedOracleSlippageBps": p.uint16})), - getAssetCount: viewFun("0xa0aead4d", "getAssetCount()", {}, p.uint256), - getStrategyCount: viewFun("0x31e19cfa", "getStrategyCount()", {}, p.uint256), - governor: viewFun("0x0c340a24", "governor()", {}, p.address), - initialize: fun("0x485cc955", "initialize(address,address)", {"_priceProvider": p.address, "_oToken": p.address}, ), - isGovernor: viewFun("0xc7af3352", "isGovernor()", {}, p.bool), - isMintWhitelistedStrategy: viewFun("0x4530820a", "isMintWhitelistedStrategy(address)", {"_0": p.address}, p.bool), - isSupportedAsset: viewFun("0x9be918e6", "isSupportedAsset(address)", {"_asset": p.address}, p.bool), - lastRebase: viewFun("0x78f353a1", "lastRebase()", {}, p.uint64), - maxSupplyDiff: viewFun("0x8e510b52", "maxSupplyDiff()", {}, p.uint256), - mint: fun("0x156e29f6", "mint(address,uint256,uint256)", {"_asset": p.address, "_amount": p.uint256, "_minimumOusdAmount": p.uint256}, ), - mintForStrategy: fun("0xab80dafb", "mintForStrategy(uint256)", {"amount": p.uint256}, ), - netOusdMintForStrategyThreshold: viewFun("0x7a2202f3", "netOusdMintForStrategyThreshold()", {}, p.uint256), - netOusdMintedForStrategy: viewFun("0xe45cc9f0", "netOusdMintedForStrategy()", {}, p.int256), - oUSD: viewFun("0x5802a172", "oUSD()", {}, p.address), - ousdMetaStrategy: viewFun("0x18ce56bd", "ousdMetaStrategy()", {}, p.address), - previewYield: viewFun("0xea33b8e4", "previewYield()", {}, p.uint256), - priceProvider: viewFun("0xb888879e", "priceProvider()", {}, p.address), - priceUnitMint: viewFun("0x3b8fe28d", "priceUnitMint(address)", {"asset": p.address}, p.uint256), - priceUnitRedeem: viewFun("0x5b60f9fc", "priceUnitRedeem(address)", {"asset": p.address}, p.uint256), - rebase: fun("0xaf14052c", "rebase()", {}, ), - rebasePaused: viewFun("0x53ca9f24", "rebasePaused()", {}, p.bool), - rebasePerSecondMax: viewFun("0x527e83a8", "rebasePerSecondMax()", {}, p.uint64), - rebasePerSecondTarget: viewFun("0x4d5f4629", "rebasePerSecondTarget()", {}, p.uint64), - rebaseThreshold: viewFun("0x52d38e5d", "rebaseThreshold()", {}, p.uint256), - redeem: fun("0x7cbc2373", "redeem(uint256,uint256)", {"_amount": p.uint256, "_minimumUnitAmount": p.uint256}, ), - redeemFeeBps: viewFun("0x09f6442c", "redeemFeeBps()", {}, p.uint256), - requestWithdrawal: fun("0x9ee679e8", "requestWithdrawal(uint256)", {"_amount": p.uint256}, {"requestId": p.uint256, "queued": p.uint256}), - setAdminImpl: fun("0xfc0cfeee", "setAdminImpl(address)", {"newImpl": p.address}, ), - strategies: viewFun("0x39ebf823", "strategies(address)", {"_0": p.address}, {"isSupported": p.bool, "_deprecated": p.uint256}), - strategistAddr: viewFun("0x570d8e1d", "strategistAddr()", {}, p.address), - totalValue: viewFun("0xd4c3eea0", "totalValue()", {}, p.uint256), - transferGovernance: fun("0xd38bfff4", "transferGovernance(address)", {"_newGovernor": p.address}, ), - trusteeAddress: viewFun("0x49c1d54d", "trusteeAddress()", {}, p.address), - trusteeFeeBps: viewFun("0x207134b0", "trusteeFeeBps()", {}, p.uint256), - vaultBuffer: viewFun("0x1edfe3da", "vaultBuffer()", {}, p.uint256), - weth: viewFun("0x3fc8cef3", "weth()", {}, p.address), - wethAssetIndex: viewFun("0x54c6d858", "wethAssetIndex()", {}, p.uint256), - withdrawalClaimDelay: viewFun("0x45e4213b", "withdrawalClaimDelay()", {}, p.uint256), - withdrawalQueueMetadata: viewFun("0x362bd1a3", "withdrawalQueueMetadata()", {}, {"queued": p.uint128, "claimable": p.uint128, "claimed": p.uint128, "nextWithdrawalIndex": p.uint128}), - withdrawalRequests: viewFun("0x937b2581", "withdrawalRequests(uint256)", {"_0": p.uint256}, {"withdrawer": p.address, "claimed": p.bool, "timestamp": p.uint40, "amount": p.uint128, "queued": p.uint128}), -} - -export class Contract extends ContractBase { - - ADMIN_IMPLEMENTATION() { - return this.eth_call(functions.ADMIN_IMPLEMENTATION, {}) - } - - adminImplPosition() { - return this.eth_call(functions.adminImplPosition, {}) - } - - assetDefaultStrategies(_0: AssetDefaultStrategiesParams["_0"]) { - return this.eth_call(functions.assetDefaultStrategies, {_0}) - } - - autoAllocateThreshold() { - return this.eth_call(functions.autoAllocateThreshold, {}) - } - - calculateRedeemOutputs(_amount: CalculateRedeemOutputsParams["_amount"]) { - return this.eth_call(functions.calculateRedeemOutputs, {_amount}) - } - - capitalPaused() { - return this.eth_call(functions.capitalPaused, {}) - } - - checkBalance(_asset: CheckBalanceParams["_asset"]) { - return this.eth_call(functions.checkBalance, {_asset}) - } - - dripDuration() { - return this.eth_call(functions.dripDuration, {}) - } - - dripper() { - return this.eth_call(functions.dripper, {}) - } - - getAllAssets() { - return this.eth_call(functions.getAllAssets, {}) - } - - getAllStrategies() { - return this.eth_call(functions.getAllStrategies, {}) - } - - getAssetConfig(_asset: GetAssetConfigParams["_asset"]) { - return this.eth_call(functions.getAssetConfig, {_asset}) - } - - getAssetCount() { - return this.eth_call(functions.getAssetCount, {}) - } - - getStrategyCount() { - return this.eth_call(functions.getStrategyCount, {}) - } - - governor() { - return this.eth_call(functions.governor, {}) - } - - isGovernor() { - return this.eth_call(functions.isGovernor, {}) - } - - isMintWhitelistedStrategy(_0: IsMintWhitelistedStrategyParams["_0"]) { - return this.eth_call(functions.isMintWhitelistedStrategy, {_0}) - } - - isSupportedAsset(_asset: IsSupportedAssetParams["_asset"]) { - return this.eth_call(functions.isSupportedAsset, {_asset}) - } - - lastRebase() { - return this.eth_call(functions.lastRebase, {}) - } - - maxSupplyDiff() { - return this.eth_call(functions.maxSupplyDiff, {}) - } - - netOusdMintForStrategyThreshold() { - return this.eth_call(functions.netOusdMintForStrategyThreshold, {}) - } - - netOusdMintedForStrategy() { - return this.eth_call(functions.netOusdMintedForStrategy, {}) - } - - oUSD() { - return this.eth_call(functions.oUSD, {}) - } - - ousdMetaStrategy() { - return this.eth_call(functions.ousdMetaStrategy, {}) - } - - previewYield() { - return this.eth_call(functions.previewYield, {}) - } - - priceProvider() { - return this.eth_call(functions.priceProvider, {}) - } - - priceUnitMint(asset: PriceUnitMintParams["asset"]) { - return this.eth_call(functions.priceUnitMint, {asset}) - } - - priceUnitRedeem(asset: PriceUnitRedeemParams["asset"]) { - return this.eth_call(functions.priceUnitRedeem, {asset}) - } - - rebasePaused() { - return this.eth_call(functions.rebasePaused, {}) - } - - rebasePerSecondMax() { - return this.eth_call(functions.rebasePerSecondMax, {}) - } - - rebasePerSecondTarget() { - return this.eth_call(functions.rebasePerSecondTarget, {}) - } - - rebaseThreshold() { - return this.eth_call(functions.rebaseThreshold, {}) - } - - redeemFeeBps() { - return this.eth_call(functions.redeemFeeBps, {}) - } - - strategies(_0: StrategiesParams["_0"]) { - return this.eth_call(functions.strategies, {_0}) - } - - strategistAddr() { - return this.eth_call(functions.strategistAddr, {}) - } - - totalValue() { - return this.eth_call(functions.totalValue, {}) - } - - trusteeAddress() { - return this.eth_call(functions.trusteeAddress, {}) - } - - trusteeFeeBps() { - return this.eth_call(functions.trusteeFeeBps, {}) - } - - vaultBuffer() { - return this.eth_call(functions.vaultBuffer, {}) - } - - weth() { - return this.eth_call(functions.weth, {}) - } - - wethAssetIndex() { - return this.eth_call(functions.wethAssetIndex, {}) - } - - withdrawalClaimDelay() { - return this.eth_call(functions.withdrawalClaimDelay, {}) - } - - withdrawalQueueMetadata() { - return this.eth_call(functions.withdrawalQueueMetadata, {}) - } - - withdrawalRequests(_0: WithdrawalRequestsParams["_0"]) { - return this.eth_call(functions.withdrawalRequests, {_0}) - } -} - -/// Event types -export type AllocateThresholdUpdatedEventArgs = EParams -export type AssetAllocatedEventArgs = EParams -export type AssetDefaultStrategyUpdatedEventArgs = EParams -export type AssetRemovedEventArgs = EParams -export type AssetSupportedEventArgs = EParams -export type CapitalPausedEventArgs = EParams -export type CapitalUnpausedEventArgs = EParams -export type DripDurationChangedEventArgs = EParams -export type DripperChangedEventArgs = EParams -export type GovernorshipTransferredEventArgs = EParams -export type MaxSupplyDiffChangedEventArgs = EParams -export type MintEventArgs = EParams -export type NetOusdMintForStrategyThresholdChangedEventArgs = EParams -export type OusdMetaStrategyUpdatedEventArgs = EParams -export type PendingGovernorshipTransferEventArgs = EParams -export type PriceProviderUpdatedEventArgs = EParams -export type RebasePausedEventArgs = EParams -export type RebasePerSecondMaxChangedEventArgs = EParams -export type RebaseThresholdUpdatedEventArgs = EParams -export type RebaseUnpausedEventArgs = EParams -export type RedeemEventArgs = EParams -export type RedeemFeeUpdatedEventArgs = EParams -export type StrategistUpdatedEventArgs = EParams -export type StrategyAddedToMintWhitelistEventArgs = EParams -export type StrategyApprovedEventArgs = EParams -export type StrategyRemovedEventArgs = EParams -export type StrategyRemovedFromMintWhitelistEventArgs = EParams -export type SwapAllowedUndervalueChangedEventArgs = EParams -export type SwapSlippageChangedEventArgs = EParams -export type SwappedEventArgs = EParams -export type SwapperChangedEventArgs = EParams -export type TrusteeAddressChangedEventArgs = EParams -export type TrusteeFeeBpsChangedEventArgs = EParams -export type VaultBufferUpdatedEventArgs = EParams -export type WithdrawalClaimDelayUpdatedEventArgs = EParams -export type WithdrawalClaimableEventArgs = EParams -export type WithdrawalClaimedEventArgs = EParams -export type WithdrawalRequestedEventArgs = EParams -export type YieldDistributionEventArgs = EParams - -/// Function types -export type ADMIN_IMPLEMENTATIONParams = FunctionArguments -export type ADMIN_IMPLEMENTATIONReturn = FunctionReturn - -export type AddWithdrawalQueueLiquidityParams = FunctionArguments -export type AddWithdrawalQueueLiquidityReturn = FunctionReturn - -export type AdminImplPositionParams = FunctionArguments -export type AdminImplPositionReturn = FunctionReturn - -export type AllocateParams = FunctionArguments -export type AllocateReturn = FunctionReturn - -export type AssetDefaultStrategiesParams = FunctionArguments -export type AssetDefaultStrategiesReturn = FunctionReturn - -export type AutoAllocateThresholdParams = FunctionArguments -export type AutoAllocateThresholdReturn = FunctionReturn - -export type BurnForStrategyParams = FunctionArguments -export type BurnForStrategyReturn = FunctionReturn - -export type CacheWETHAssetIndexParams = FunctionArguments -export type CacheWETHAssetIndexReturn = FunctionReturn - -export type CalculateRedeemOutputsParams = FunctionArguments -export type CalculateRedeemOutputsReturn = FunctionReturn - -export type CapitalPausedParams = FunctionArguments -export type CapitalPausedReturn = FunctionReturn - -export type CheckBalanceParams = FunctionArguments -export type CheckBalanceReturn = FunctionReturn - -export type ClaimGovernanceParams = FunctionArguments -export type ClaimGovernanceReturn = FunctionReturn - -export type ClaimWithdrawalParams = FunctionArguments -export type ClaimWithdrawalReturn = FunctionReturn - -export type ClaimWithdrawalsParams = FunctionArguments -export type ClaimWithdrawalsReturn = FunctionReturn - -export type DripDurationParams = FunctionArguments -export type DripDurationReturn = FunctionReturn - -export type DripperParams = FunctionArguments -export type DripperReturn = FunctionReturn - -export type GetAllAssetsParams = FunctionArguments -export type GetAllAssetsReturn = FunctionReturn - -export type GetAllStrategiesParams = FunctionArguments -export type GetAllStrategiesReturn = FunctionReturn - -export type GetAssetConfigParams = FunctionArguments -export type GetAssetConfigReturn = FunctionReturn - -export type GetAssetCountParams = FunctionArguments -export type GetAssetCountReturn = FunctionReturn - -export type GetStrategyCountParams = FunctionArguments -export type GetStrategyCountReturn = FunctionReturn - -export type GovernorParams = FunctionArguments -export type GovernorReturn = FunctionReturn - -export type InitializeParams = FunctionArguments -export type InitializeReturn = FunctionReturn - -export type IsGovernorParams = FunctionArguments -export type IsGovernorReturn = FunctionReturn - -export type IsMintWhitelistedStrategyParams = FunctionArguments -export type IsMintWhitelistedStrategyReturn = FunctionReturn - -export type IsSupportedAssetParams = FunctionArguments -export type IsSupportedAssetReturn = FunctionReturn - -export type LastRebaseParams = FunctionArguments -export type LastRebaseReturn = FunctionReturn - -export type MaxSupplyDiffParams = FunctionArguments -export type MaxSupplyDiffReturn = FunctionReturn - -export type MintParams = FunctionArguments -export type MintReturn = FunctionReturn - -export type MintForStrategyParams = FunctionArguments -export type MintForStrategyReturn = FunctionReturn - -export type NetOusdMintForStrategyThresholdParams = FunctionArguments -export type NetOusdMintForStrategyThresholdReturn = FunctionReturn - -export type NetOusdMintedForStrategyParams = FunctionArguments -export type NetOusdMintedForStrategyReturn = FunctionReturn - -export type OUSDParams = FunctionArguments -export type OUSDReturn = FunctionReturn - -export type OusdMetaStrategyParams = FunctionArguments -export type OusdMetaStrategyReturn = FunctionReturn - -export type PreviewYieldParams = FunctionArguments -export type PreviewYieldReturn = FunctionReturn - -export type PriceProviderParams = FunctionArguments -export type PriceProviderReturn = FunctionReturn - -export type PriceUnitMintParams = FunctionArguments -export type PriceUnitMintReturn = FunctionReturn - -export type PriceUnitRedeemParams = FunctionArguments -export type PriceUnitRedeemReturn = FunctionReturn - -export type RebaseParams = FunctionArguments -export type RebaseReturn = FunctionReturn - -export type RebasePausedParams = FunctionArguments -export type RebasePausedReturn = FunctionReturn - -export type RebasePerSecondMaxParams = FunctionArguments -export type RebasePerSecondMaxReturn = FunctionReturn - -export type RebasePerSecondTargetParams = FunctionArguments -export type RebasePerSecondTargetReturn = FunctionReturn - -export type RebaseThresholdParams = FunctionArguments -export type RebaseThresholdReturn = FunctionReturn - -export type RedeemParams = FunctionArguments -export type RedeemReturn = FunctionReturn - -export type RedeemFeeBpsParams = FunctionArguments -export type RedeemFeeBpsReturn = FunctionReturn - -export type RequestWithdrawalParams = FunctionArguments -export type RequestWithdrawalReturn = FunctionReturn - -export type SetAdminImplParams = FunctionArguments -export type SetAdminImplReturn = FunctionReturn - -export type StrategiesParams = FunctionArguments -export type StrategiesReturn = FunctionReturn - -export type StrategistAddrParams = FunctionArguments -export type StrategistAddrReturn = FunctionReturn - -export type TotalValueParams = FunctionArguments -export type TotalValueReturn = FunctionReturn - -export type TransferGovernanceParams = FunctionArguments -export type TransferGovernanceReturn = FunctionReturn - -export type TrusteeAddressParams = FunctionArguments -export type TrusteeAddressReturn = FunctionReturn - -export type TrusteeFeeBpsParams = FunctionArguments -export type TrusteeFeeBpsReturn = FunctionReturn - -export type VaultBufferParams = FunctionArguments -export type VaultBufferReturn = FunctionReturn - -export type WethParams = FunctionArguments -export type WethReturn = FunctionReturn - -export type WethAssetIndexParams = FunctionArguments -export type WethAssetIndexReturn = FunctionReturn - -export type WithdrawalClaimDelayParams = FunctionArguments -export type WithdrawalClaimDelayReturn = FunctionReturn - -export type WithdrawalQueueMetadataParams = FunctionArguments -export type WithdrawalQueueMetadataReturn = FunctionReturn - -export type WithdrawalRequestsParams = FunctionArguments -export type WithdrawalRequestsReturn = FunctionReturn - diff --git a/src/abi/otoken-vault/contract.ts b/src/abi/otoken-vault/contract.ts new file mode 100644 index 00000000..696f87bb --- /dev/null +++ b/src/abi/otoken-vault/contract.ts @@ -0,0 +1,193 @@ +import { ContractBase } from '../abi.support.js' +import { ADMIN_IMPLEMENTATION, adminImplPosition, assetDefaultStrategies, autoAllocateThreshold, calculateRedeemOutputs, capitalPaused, checkBalance, claimWithdrawal, claimWithdrawals, dripDuration, dripper, getAllAssets, getAllStrategies, getAssetConfig, getAssetCount, getStrategyCount, governor, isGovernor, isMintWhitelistedStrategy, isSupportedAsset, lastRebase, maxSupplyDiff, netOusdMintForStrategyThreshold, netOusdMintedForStrategy, oUSD, ousdMetaStrategy, previewYield, priceProvider, priceUnitMint, priceUnitRedeem, rebasePaused, rebasePerSecondMax, rebasePerSecondTarget, rebaseThreshold, redeemFeeBps, requestWithdrawal, strategies, strategistAddr, totalValue, trusteeAddress, trusteeFeeBps, vaultBuffer, weth, wethAssetIndex, withdrawalClaimDelay, withdrawalQueueMetadata, withdrawalRequests } from './functions.js' +import type { AssetDefaultStrategiesParams, CalculateRedeemOutputsParams, CheckBalanceParams, ClaimWithdrawalParams, ClaimWithdrawalsParams, GetAssetConfigParams, IsMintWhitelistedStrategyParams, IsSupportedAssetParams, PriceUnitMintParams, PriceUnitRedeemParams, RequestWithdrawalParams, StrategiesParams, WithdrawalRequestsParams } from './functions.js' + +export class Contract extends ContractBase { + ADMIN_IMPLEMENTATION() { + return this.eth_call(ADMIN_IMPLEMENTATION, {}) + } + + adminImplPosition() { + return this.eth_call(adminImplPosition, {}) + } + + assetDefaultStrategies(_0: AssetDefaultStrategiesParams["_0"]) { + return this.eth_call(assetDefaultStrategies, {_0}) + } + + autoAllocateThreshold() { + return this.eth_call(autoAllocateThreshold, {}) + } + + calculateRedeemOutputs(_amount: CalculateRedeemOutputsParams["_amount"]) { + return this.eth_call(calculateRedeemOutputs, {_amount}) + } + + capitalPaused() { + return this.eth_call(capitalPaused, {}) + } + + checkBalance(_asset: CheckBalanceParams["_asset"]) { + return this.eth_call(checkBalance, {_asset}) + } + + claimWithdrawal(_requestId: ClaimWithdrawalParams["_requestId"]) { + return this.eth_call(claimWithdrawal, {_requestId}) + } + + claimWithdrawals(_requestIds: ClaimWithdrawalsParams["_requestIds"]) { + return this.eth_call(claimWithdrawals, {_requestIds}) + } + + dripDuration() { + return this.eth_call(dripDuration, {}) + } + + dripper() { + return this.eth_call(dripper, {}) + } + + getAllAssets() { + return this.eth_call(getAllAssets, {}) + } + + getAllStrategies() { + return this.eth_call(getAllStrategies, {}) + } + + getAssetConfig(_asset: GetAssetConfigParams["_asset"]) { + return this.eth_call(getAssetConfig, {_asset}) + } + + getAssetCount() { + return this.eth_call(getAssetCount, {}) + } + + getStrategyCount() { + return this.eth_call(getStrategyCount, {}) + } + + governor() { + return this.eth_call(governor, {}) + } + + isGovernor() { + return this.eth_call(isGovernor, {}) + } + + isMintWhitelistedStrategy(_0: IsMintWhitelistedStrategyParams["_0"]) { + return this.eth_call(isMintWhitelistedStrategy, {_0}) + } + + isSupportedAsset(_asset: IsSupportedAssetParams["_asset"]) { + return this.eth_call(isSupportedAsset, {_asset}) + } + + lastRebase() { + return this.eth_call(lastRebase, {}) + } + + maxSupplyDiff() { + return this.eth_call(maxSupplyDiff, {}) + } + + netOusdMintForStrategyThreshold() { + return this.eth_call(netOusdMintForStrategyThreshold, {}) + } + + netOusdMintedForStrategy() { + return this.eth_call(netOusdMintedForStrategy, {}) + } + + oUSD() { + return this.eth_call(oUSD, {}) + } + + ousdMetaStrategy() { + return this.eth_call(ousdMetaStrategy, {}) + } + + previewYield() { + return this.eth_call(previewYield, {}) + } + + priceProvider() { + return this.eth_call(priceProvider, {}) + } + + priceUnitMint(asset: PriceUnitMintParams["asset"]) { + return this.eth_call(priceUnitMint, {asset}) + } + + priceUnitRedeem(asset: PriceUnitRedeemParams["asset"]) { + return this.eth_call(priceUnitRedeem, {asset}) + } + + rebasePaused() { + return this.eth_call(rebasePaused, {}) + } + + rebasePerSecondMax() { + return this.eth_call(rebasePerSecondMax, {}) + } + + rebasePerSecondTarget() { + return this.eth_call(rebasePerSecondTarget, {}) + } + + rebaseThreshold() { + return this.eth_call(rebaseThreshold, {}) + } + + redeemFeeBps() { + return this.eth_call(redeemFeeBps, {}) + } + + requestWithdrawal(_amount: RequestWithdrawalParams["_amount"]) { + return this.eth_call(requestWithdrawal, {_amount}) + } + + strategies(_0: StrategiesParams["_0"]) { + return this.eth_call(strategies, {_0}) + } + + strategistAddr() { + return this.eth_call(strategistAddr, {}) + } + + totalValue() { + return this.eth_call(totalValue, {}) + } + + trusteeAddress() { + return this.eth_call(trusteeAddress, {}) + } + + trusteeFeeBps() { + return this.eth_call(trusteeFeeBps, {}) + } + + vaultBuffer() { + return this.eth_call(vaultBuffer, {}) + } + + weth() { + return this.eth_call(weth, {}) + } + + wethAssetIndex() { + return this.eth_call(wethAssetIndex, {}) + } + + withdrawalClaimDelay() { + return this.eth_call(withdrawalClaimDelay, {}) + } + + withdrawalQueueMetadata() { + return this.eth_call(withdrawalQueueMetadata, {}) + } + + withdrawalRequests(_0: WithdrawalRequestsParams["_0"]) { + return this.eth_call(withdrawalRequests, {_0}) + } +} diff --git a/src/abi/otoken-vault/events.ts b/src/abi/otoken-vault/events.ts new file mode 100644 index 00000000..13837a5b --- /dev/null +++ b/src/abi/otoken-vault/events.ts @@ -0,0 +1,248 @@ +import { address, uint256 } from '@subsquid/evm-codec' +import { event, indexed } from '../abi.support.js' +import type { EventParams as EParams } from '../abi.support.js' + +/** AllocateThresholdUpdated(uint256) */ +export const AllocateThresholdUpdated = event('0x2ec5fb5a3d2703edc461252d92ccd2799c3c74f01d97212b20388207fa17ae45', { + _threshold: uint256, +}) +export type AllocateThresholdUpdatedEventArgs = EParams + +/** AssetAllocated(address,address,uint256) */ +export const AssetAllocated = event('0x41b99659f6ba0803f444aff29e5bf6e26dd86a3219aff92119d69710a956ba8d', { + _asset: address, + _strategy: address, + _amount: uint256, +}) +export type AssetAllocatedEventArgs = EParams + +/** AssetDefaultStrategyUpdated(address,address) */ +export const AssetDefaultStrategyUpdated = event('0xba58ce12801c949fa65f41c46ed108671c219baf945fa48d21026cea99ff252a', { + _asset: address, + _strategy: address, +}) +export type AssetDefaultStrategyUpdatedEventArgs = EParams + +/** AssetRemoved(address) */ +export const AssetRemoved = event('0x37803e2125c48ee96c38ddf04e826daf335b0e1603579040fd275aba6d06b6fc', { + _asset: address, +}) +export type AssetRemovedEventArgs = EParams + +/** AssetSupported(address) */ +export const AssetSupported = event('0x4f1ac48525e50059cc1cc6e0e1940ece0dd653a4db4841538d6aef036be2fb7b', { + _asset: address, +}) +export type AssetSupportedEventArgs = EParams + +/** CapitalPaused() */ +export const CapitalPaused = event('0x71f0e5b62f846a22e0b4d159e516e62fa9c2b8eb570be15f83e67d98a2ee51e0', {}) +export type CapitalPausedEventArgs = EParams + +/** CapitalUnpaused() */ +export const CapitalUnpaused = event('0x891ebab18da80ebeeea06b1b1cede098329c4c008906a98370c2ac7a80b571cb', {}) +export type CapitalUnpausedEventArgs = EParams + +/** DripDurationChanged(uint256) */ +export const DripDurationChanged = event('0x406e15fbca1d8ded2dbb06765fea3a54f18395c54125a4c9916dd00ea14ee15e', { + dripDuration: uint256, +}) +export type DripDurationChangedEventArgs = EParams + +/** DripperChanged(address) */ +export const DripperChanged = event('0xaf2910d9759321733de15af1827a49830692912adeb2b3646334861f2cd2eed4', { + _dripper: indexed(address), +}) +export type DripperChangedEventArgs = EParams + +/** GovernorshipTransferred(address,address) */ +export const GovernorshipTransferred = event('0xc7c0c772add429241571afb3805861fb3cfa2af374534088b76cdb4325a87e9a', { + previousGovernor: indexed(address), + newGovernor: indexed(address), +}) +export type GovernorshipTransferredEventArgs = EParams + +/** MaxSupplyDiffChanged(uint256) */ +export const MaxSupplyDiffChanged = event('0x95201f9c21f26877223b1ff4073936a6484c35495649e60e55730497aeb60d93', { + maxSupplyDiff: uint256, +}) +export type MaxSupplyDiffChangedEventArgs = EParams + +/** Mint(address,uint256) */ +export const Mint = event('0x0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885', { + _addr: address, + _value: uint256, +}) +export type MintEventArgs = EParams + +/** NetOusdMintForStrategyThresholdChanged(uint256) */ +export const NetOusdMintForStrategyThresholdChanged = event('0xc29d6fedbc6bdf267a08166c2b976fbd72aca5d6a769528616f8b9224c8f197f', { + _threshold: uint256, +}) +export type NetOusdMintForStrategyThresholdChangedEventArgs = EParams + +/** OusdMetaStrategyUpdated(address) */ +export const OusdMetaStrategyUpdated = event('0xa12850fb726e0b2b7b3c9a9342031e1268a8148d0eb06b4bea8613204ffcd2b8', { + _ousdMetaStrategy: address, +}) +export type OusdMetaStrategyUpdatedEventArgs = EParams + +/** PendingGovernorshipTransfer(address,address) */ +export const PendingGovernorshipTransfer = event('0xa39cc5eb22d0f34d8beaefee8a3f17cc229c1a1d1ef87a5ad47313487b1c4f0d', { + previousGovernor: indexed(address), + newGovernor: indexed(address), +}) +export type PendingGovernorshipTransferEventArgs = EParams + +/** PriceProviderUpdated(address) */ +export const PriceProviderUpdated = event('0xb266add5f3044b17d27db796af992cecbe413921b4e8aaaee03c719e16b9806a', { + _priceProvider: address, +}) +export type PriceProviderUpdatedEventArgs = EParams + +/** RebasePaused() */ +export const RebasePaused = event('0x8cff26a5985614b3d30629cc4ab83824bf115aec971b718d8f2f99562032e972', {}) +export type RebasePausedEventArgs = EParams + +/** RebasePerSecondMaxChanged(uint256) */ +export const RebasePerSecondMaxChanged = event('0xef46f143af5fead0010484fe7d6ec2e2972420faa76157f5a6075aa72e614cb5', { + rebaseRatePerSecond: uint256, +}) +export type RebasePerSecondMaxChangedEventArgs = EParams + +/** RebaseThresholdUpdated(uint256) */ +export const RebaseThresholdUpdated = event('0x39367850377ac04920a9a670f2180e7a94d83b15ad302e59875ec58fd10bd37d', { + _threshold: uint256, +}) +export type RebaseThresholdUpdatedEventArgs = EParams + +/** RebaseUnpaused() */ +export const RebaseUnpaused = event('0xbc044409505c95b6b851433df96e1beae715c909d8e7c1d6d7ab783300d4e3b9', {}) +export type RebaseUnpausedEventArgs = EParams + +/** Redeem(address,uint256) */ +export const Redeem = event('0x222838db2794d11532d940e8dec38ae307ed0b63cd97c233322e221f998767a6', { + _addr: address, + _value: uint256, +}) +export type RedeemEventArgs = EParams + +/** RedeemFeeUpdated(uint256) */ +export const RedeemFeeUpdated = event('0xd6c7508d6658ccee36b7b7d7fd72e5cbaeefb40c64eff24e9ae7470e846304ee', { + _redeemFeeBps: uint256, +}) +export type RedeemFeeUpdatedEventArgs = EParams + +/** StrategistUpdated(address) */ +export const StrategistUpdated = event('0x869e0abd13cc3a975de7b93be3df1cb2255c802b1cead85963cc79d99f131bee', { + _address: address, +}) +export type StrategistUpdatedEventArgs = EParams + +/** StrategyAddedToMintWhitelist(address) */ +export const StrategyAddedToMintWhitelist = event('0x47c8c96a5942f094264111c5fe7f6a4fe86efe63254a6fa7afa5fc84f07d58e8', { + strategy: indexed(address), +}) +export type StrategyAddedToMintWhitelistEventArgs = EParams + +/** StrategyApproved(address) */ +export const StrategyApproved = event('0x960dd94cbb79169f09a4e445d58b895df2d9bffa5b31055d0932d801724a20d1', { + _addr: address, +}) +export type StrategyApprovedEventArgs = EParams + +/** StrategyRemoved(address) */ +export const StrategyRemoved = event('0x09a1db4b80c32706328728508c941a6b954f31eb5affd32f236c1fd405f8fea4', { + _addr: address, +}) +export type StrategyRemovedEventArgs = EParams + +/** StrategyRemovedFromMintWhitelist(address) */ +export const StrategyRemovedFromMintWhitelist = event('0x0ec40967a61509853550658e51d0e4297f7cba244fe4adc8ba18b5631ac20e2f', { + strategy: indexed(address), +}) +export type StrategyRemovedFromMintWhitelistEventArgs = EParams + +/** SwapAllowedUndervalueChanged(uint256) */ +export const SwapAllowedUndervalueChanged = event('0xf12c00256bee2b6facb111a88a9b1cff86e79132939b44f1353212d6f7469557', { + _basis: uint256, +}) +export type SwapAllowedUndervalueChangedEventArgs = EParams + +/** SwapSlippageChanged(address,uint256) */ +export const SwapSlippageChanged = event('0x8d22e9d2cbe8bb65a3c4412bd8970743864512a1a0e004e8d00fb96277b78b94', { + _asset: address, + _basis: uint256, +}) +export type SwapSlippageChangedEventArgs = EParams + +/** Swapped(address,address,uint256,uint256) */ +export const Swapped = event('0xa078c4190abe07940190effc1846be0ccf03ad6007bc9e93f9697d0b460befbb', { + _fromAsset: indexed(address), + _toAsset: indexed(address), + _fromAssetAmount: uint256, + _toAssetAmount: uint256, +}) +export type SwappedEventArgs = EParams + +/** SwapperChanged(address) */ +export const SwapperChanged = event('0x7d7719313229e558c5a3893cad2eb86a86a049156d1d9ebd5c63a8eedefd1c03', { + _address: address, +}) +export type SwapperChangedEventArgs = EParams + +/** TrusteeAddressChanged(address) */ +export const TrusteeAddressChanged = event('0x1e4af5ac389e8cde1bdaa6830881b6c987c62a45cfb3b33d27d805cde3b57750', { + _address: address, +}) +export type TrusteeAddressChangedEventArgs = EParams + +/** TrusteeFeeBpsChanged(uint256) */ +export const TrusteeFeeBpsChanged = event('0x56287a45051933ea374811b3d5d165033047be5572cac676f7c28b8be4f746c7', { + _basis: uint256, +}) +export type TrusteeFeeBpsChangedEventArgs = EParams + +/** VaultBufferUpdated(uint256) */ +export const VaultBufferUpdated = event('0x41ecb23a0e7865b25f38c268b7c3012220d822929e9edff07326e89d5bb822b5', { + _vaultBuffer: uint256, +}) +export type VaultBufferUpdatedEventArgs = EParams + +/** WithdrawalClaimDelayUpdated(uint256) */ +export const WithdrawalClaimDelayUpdated = event('0xc59f5e32049abab44ddea11021f5abb89422a2f550837afcf25df9fc8d0db6b0', { + _newDelay: uint256, +}) +export type WithdrawalClaimDelayUpdatedEventArgs = EParams + +/** WithdrawalClaimable(uint256,uint256) */ +export const WithdrawalClaimable = event('0xee79a0c43d3993055690b54e074b5153e8bae8d1a872b656dedb64aa8f463333', { + _claimable: uint256, + _newClaimable: uint256, +}) +export type WithdrawalClaimableEventArgs = EParams + +/** WithdrawalClaimed(address,uint256,uint256) */ +export const WithdrawalClaimed = event('0x2d43eb174787155132b52ddb6b346e2dca99302eac3df4466dbeff953d3c84d1', { + _withdrawer: indexed(address), + _requestId: indexed(uint256), + _amount: uint256, +}) +export type WithdrawalClaimedEventArgs = EParams + +/** WithdrawalRequested(address,uint256,uint256,uint256) */ +export const WithdrawalRequested = event('0x38e3d972947cfef94205163d483d6287ef27eb312e20cb8e0b13a49989db232e', { + _withdrawer: indexed(address), + _requestId: indexed(uint256), + _amount: uint256, + _queued: uint256, +}) +export type WithdrawalRequestedEventArgs = EParams + +/** YieldDistribution(address,uint256,uint256) */ +export const YieldDistribution = event('0x09516ecf4a8a86e59780a9befc6dee948bc9e60a36e3be68d31ea817ee8d2c80', { + _to: address, + _yield: uint256, + _fee: uint256, +}) +export type YieldDistributionEventArgs = EParams diff --git a/src/abi/otoken-vault/functions.ts b/src/abi/otoken-vault/functions.ts new file mode 100644 index 00000000..64cc1755 --- /dev/null +++ b/src/abi/otoken-vault/functions.ts @@ -0,0 +1,367 @@ +import { address, array, bool, bytes32, int256, struct, uint128, uint16, uint256, uint40, uint64, uint8 } from '@subsquid/evm-codec' +import { func } from '../abi.support.js' +import type { FunctionArguments, FunctionReturn } from '../abi.support.js' + +/** ADMIN_IMPLEMENTATION() */ +export const ADMIN_IMPLEMENTATION = func('0xcc2fe94b', {}, address) +export type ADMIN_IMPLEMENTATIONParams = FunctionArguments +export type ADMIN_IMPLEMENTATIONReturn = FunctionReturn + +/** addWithdrawalQueueLiquidity() */ +export const addWithdrawalQueueLiquidity = func('0xb9b17f9f', {}) +export type AddWithdrawalQueueLiquidityParams = FunctionArguments +export type AddWithdrawalQueueLiquidityReturn = FunctionReturn + +/** adminImplPosition() */ +export const adminImplPosition = func('0xef08edc2', {}, bytes32) +export type AdminImplPositionParams = FunctionArguments +export type AdminImplPositionReturn = FunctionReturn + +/** allocate() */ +export const allocate = func('0xabaa9916', {}) +export type AllocateParams = FunctionArguments +export type AllocateReturn = FunctionReturn + +/** assetDefaultStrategies(address) */ +export const assetDefaultStrategies = func('0xa403e4d5', { + _0: address, +}, address) +export type AssetDefaultStrategiesParams = FunctionArguments +export type AssetDefaultStrategiesReturn = FunctionReturn + +/** autoAllocateThreshold() */ +export const autoAllocateThreshold = func('0x9fa1826e', {}, uint256) +export type AutoAllocateThresholdParams = FunctionArguments +export type AutoAllocateThresholdReturn = FunctionReturn + +/** burnForStrategy(uint256) */ +export const burnForStrategy = func('0x6217f3ea', { + amount: uint256, +}) +export type BurnForStrategyParams = FunctionArguments +export type BurnForStrategyReturn = FunctionReturn + +/** cacheWETHAssetIndex() */ +export const cacheWETHAssetIndex = func('0x44c54707', {}) +export type CacheWETHAssetIndexParams = FunctionArguments +export type CacheWETHAssetIndexReturn = FunctionReturn + +/** calculateRedeemOutputs(uint256) */ +export const calculateRedeemOutputs = func('0x67bd7ba3', { + _amount: uint256, +}, array(uint256)) +export type CalculateRedeemOutputsParams = FunctionArguments +export type CalculateRedeemOutputsReturn = FunctionReturn + +/** capitalPaused() */ +export const capitalPaused = func('0xe6cc5432', {}, bool) +export type CapitalPausedParams = FunctionArguments +export type CapitalPausedReturn = FunctionReturn + +/** checkBalance(address) */ +export const checkBalance = func('0x5f515226', { + _asset: address, +}, uint256) +export type CheckBalanceParams = FunctionArguments +export type CheckBalanceReturn = FunctionReturn + +/** claimGovernance() */ +export const claimGovernance = func('0x5d36b190', {}) +export type ClaimGovernanceParams = FunctionArguments +export type ClaimGovernanceReturn = FunctionReturn + +/** claimWithdrawal(uint256) */ +export const claimWithdrawal = func('0xf8444436', { + _requestId: uint256, +}, uint256) +export type ClaimWithdrawalParams = FunctionArguments +export type ClaimWithdrawalReturn = FunctionReturn + +/** claimWithdrawals(uint256[]) */ +export const claimWithdrawals = func('0x48e30f54', { + _requestIds: array(uint256), +}, struct({ + amounts: array(uint256), + totalAmount: uint256, +})) +export type ClaimWithdrawalsParams = FunctionArguments +export type ClaimWithdrawalsReturn = FunctionReturn + +/** dripDuration() */ +export const dripDuration = func('0xbb7a632e', {}, uint64) +export type DripDurationParams = FunctionArguments +export type DripDurationReturn = FunctionReturn + +/** dripper() */ +export const dripper = func('0x603ea03b', {}, address) +export type DripperParams = FunctionArguments +export type DripperReturn = FunctionReturn + +/** getAllAssets() */ +export const getAllAssets = func('0x2acada4d', {}, array(address)) +export type GetAllAssetsParams = FunctionArguments +export type GetAllAssetsReturn = FunctionReturn + +/** getAllStrategies() */ +export const getAllStrategies = func('0xc3b28864', {}, array(address)) +export type GetAllStrategiesParams = FunctionArguments +export type GetAllStrategiesReturn = FunctionReturn + +/** getAssetConfig(address) */ +export const getAssetConfig = func('0x6ec3ab67', { + _asset: address, +}, struct({ + isSupported: bool, + unitConversion: uint8, + decimals: uint8, + allowedOracleSlippageBps: uint16, +})) +export type GetAssetConfigParams = FunctionArguments +export type GetAssetConfigReturn = FunctionReturn + +/** getAssetCount() */ +export const getAssetCount = func('0xa0aead4d', {}, uint256) +export type GetAssetCountParams = FunctionArguments +export type GetAssetCountReturn = FunctionReturn + +/** getStrategyCount() */ +export const getStrategyCount = func('0x31e19cfa', {}, uint256) +export type GetStrategyCountParams = FunctionArguments +export type GetStrategyCountReturn = FunctionReturn + +/** governor() */ +export const governor = func('0x0c340a24', {}, address) +export type GovernorParams = FunctionArguments +export type GovernorReturn = FunctionReturn + +/** initialize(address,address) */ +export const initialize = func('0x485cc955', { + _priceProvider: address, + _oToken: address, +}) +export type InitializeParams = FunctionArguments +export type InitializeReturn = FunctionReturn + +/** isGovernor() */ +export const isGovernor = func('0xc7af3352', {}, bool) +export type IsGovernorParams = FunctionArguments +export type IsGovernorReturn = FunctionReturn + +/** isMintWhitelistedStrategy(address) */ +export const isMintWhitelistedStrategy = func('0x4530820a', { + _0: address, +}, bool) +export type IsMintWhitelistedStrategyParams = FunctionArguments +export type IsMintWhitelistedStrategyReturn = FunctionReturn + +/** isSupportedAsset(address) */ +export const isSupportedAsset = func('0x9be918e6', { + _asset: address, +}, bool) +export type IsSupportedAssetParams = FunctionArguments +export type IsSupportedAssetReturn = FunctionReturn + +/** lastRebase() */ +export const lastRebase = func('0x78f353a1', {}, uint64) +export type LastRebaseParams = FunctionArguments +export type LastRebaseReturn = FunctionReturn + +/** maxSupplyDiff() */ +export const maxSupplyDiff = func('0x8e510b52', {}, uint256) +export type MaxSupplyDiffParams = FunctionArguments +export type MaxSupplyDiffReturn = FunctionReturn + +/** mint(address,uint256,uint256) */ +export const mint = func('0x156e29f6', { + _asset: address, + _amount: uint256, + _minimumOusdAmount: uint256, +}) +export type MintParams = FunctionArguments +export type MintReturn = FunctionReturn + +/** mintForStrategy(uint256) */ +export const mintForStrategy = func('0xab80dafb', { + amount: uint256, +}) +export type MintForStrategyParams = FunctionArguments +export type MintForStrategyReturn = FunctionReturn + +/** netOusdMintForStrategyThreshold() */ +export const netOusdMintForStrategyThreshold = func('0x7a2202f3', {}, uint256) +export type NetOusdMintForStrategyThresholdParams = FunctionArguments +export type NetOusdMintForStrategyThresholdReturn = FunctionReturn + +/** netOusdMintedForStrategy() */ +export const netOusdMintedForStrategy = func('0xe45cc9f0', {}, int256) +export type NetOusdMintedForStrategyParams = FunctionArguments +export type NetOusdMintedForStrategyReturn = FunctionReturn + +/** oUSD() */ +export const oUSD = func('0x5802a172', {}, address) +export type OUSDParams = FunctionArguments +export type OUSDReturn = FunctionReturn + +/** ousdMetaStrategy() */ +export const ousdMetaStrategy = func('0x18ce56bd', {}, address) +export type OusdMetaStrategyParams = FunctionArguments +export type OusdMetaStrategyReturn = FunctionReturn + +/** previewYield() */ +export const previewYield = func('0xea33b8e4', {}, uint256) +export type PreviewYieldParams = FunctionArguments +export type PreviewYieldReturn = FunctionReturn + +/** priceProvider() */ +export const priceProvider = func('0xb888879e', {}, address) +export type PriceProviderParams = FunctionArguments +export type PriceProviderReturn = FunctionReturn + +/** priceUnitMint(address) */ +export const priceUnitMint = func('0x3b8fe28d', { + asset: address, +}, uint256) +export type PriceUnitMintParams = FunctionArguments +export type PriceUnitMintReturn = FunctionReturn + +/** priceUnitRedeem(address) */ +export const priceUnitRedeem = func('0x5b60f9fc', { + asset: address, +}, uint256) +export type PriceUnitRedeemParams = FunctionArguments +export type PriceUnitRedeemReturn = FunctionReturn + +/** rebase() */ +export const rebase = func('0xaf14052c', {}) +export type RebaseParams = FunctionArguments +export type RebaseReturn = FunctionReturn + +/** rebasePaused() */ +export const rebasePaused = func('0x53ca9f24', {}, bool) +export type RebasePausedParams = FunctionArguments +export type RebasePausedReturn = FunctionReturn + +/** rebasePerSecondMax() */ +export const rebasePerSecondMax = func('0x527e83a8', {}, uint64) +export type RebasePerSecondMaxParams = FunctionArguments +export type RebasePerSecondMaxReturn = FunctionReturn + +/** rebasePerSecondTarget() */ +export const rebasePerSecondTarget = func('0x4d5f4629', {}, uint64) +export type RebasePerSecondTargetParams = FunctionArguments +export type RebasePerSecondTargetReturn = FunctionReturn + +/** rebaseThreshold() */ +export const rebaseThreshold = func('0x52d38e5d', {}, uint256) +export type RebaseThresholdParams = FunctionArguments +export type RebaseThresholdReturn = FunctionReturn + +/** redeem(uint256,uint256) */ +export const redeem = func('0x7cbc2373', { + _amount: uint256, + _minimumUnitAmount: uint256, +}) +export type RedeemParams = FunctionArguments +export type RedeemReturn = FunctionReturn + +/** redeemFeeBps() */ +export const redeemFeeBps = func('0x09f6442c', {}, uint256) +export type RedeemFeeBpsParams = FunctionArguments +export type RedeemFeeBpsReturn = FunctionReturn + +/** requestWithdrawal(uint256) */ +export const requestWithdrawal = func('0x9ee679e8', { + _amount: uint256, +}, struct({ + requestId: uint256, + queued: uint256, +})) +export type RequestWithdrawalParams = FunctionArguments +export type RequestWithdrawalReturn = FunctionReturn + +/** setAdminImpl(address) */ +export const setAdminImpl = func('0xfc0cfeee', { + newImpl: address, +}) +export type SetAdminImplParams = FunctionArguments +export type SetAdminImplReturn = FunctionReturn + +/** strategies(address) */ +export const strategies = func('0x39ebf823', { + _0: address, +}, struct({ + isSupported: bool, + _deprecated: uint256, +})) +export type StrategiesParams = FunctionArguments +export type StrategiesReturn = FunctionReturn + +/** strategistAddr() */ +export const strategistAddr = func('0x570d8e1d', {}, address) +export type StrategistAddrParams = FunctionArguments +export type StrategistAddrReturn = FunctionReturn + +/** totalValue() */ +export const totalValue = func('0xd4c3eea0', {}, uint256) +export type TotalValueParams = FunctionArguments +export type TotalValueReturn = FunctionReturn + +/** transferGovernance(address) */ +export const transferGovernance = func('0xd38bfff4', { + _newGovernor: address, +}) +export type TransferGovernanceParams = FunctionArguments +export type TransferGovernanceReturn = FunctionReturn + +/** trusteeAddress() */ +export const trusteeAddress = func('0x49c1d54d', {}, address) +export type TrusteeAddressParams = FunctionArguments +export type TrusteeAddressReturn = FunctionReturn + +/** trusteeFeeBps() */ +export const trusteeFeeBps = func('0x207134b0', {}, uint256) +export type TrusteeFeeBpsParams = FunctionArguments +export type TrusteeFeeBpsReturn = FunctionReturn + +/** vaultBuffer() */ +export const vaultBuffer = func('0x1edfe3da', {}, uint256) +export type VaultBufferParams = FunctionArguments +export type VaultBufferReturn = FunctionReturn + +/** weth() */ +export const weth = func('0x3fc8cef3', {}, address) +export type WethParams = FunctionArguments +export type WethReturn = FunctionReturn + +/** wethAssetIndex() */ +export const wethAssetIndex = func('0x54c6d858', {}, uint256) +export type WethAssetIndexParams = FunctionArguments +export type WethAssetIndexReturn = FunctionReturn + +/** withdrawalClaimDelay() */ +export const withdrawalClaimDelay = func('0x45e4213b', {}, uint256) +export type WithdrawalClaimDelayParams = FunctionArguments +export type WithdrawalClaimDelayReturn = FunctionReturn + +/** withdrawalQueueMetadata() */ +export const withdrawalQueueMetadata = func('0x362bd1a3', {}, struct({ + queued: uint128, + claimable: uint128, + claimed: uint128, + nextWithdrawalIndex: uint128, +})) +export type WithdrawalQueueMetadataParams = FunctionArguments +export type WithdrawalQueueMetadataReturn = FunctionReturn + +/** withdrawalRequests(uint256) */ +export const withdrawalRequests = func('0x937b2581', { + _0: uint256, +}, struct({ + withdrawer: address, + claimed: bool, + timestamp: uint40, + amount: uint128, + queued: uint128, +})) +export type WithdrawalRequestsParams = FunctionArguments +export type WithdrawalRequestsReturn = FunctionReturn diff --git a/src/abi/otoken-vault/index.ts b/src/abi/otoken-vault/index.ts new file mode 100644 index 00000000..11829d6e --- /dev/null +++ b/src/abi/otoken-vault/index.ts @@ -0,0 +1,4 @@ +export * as events from './events.js' +export * as functions from './functions.js' + +export { Contract } from './contract.js' diff --git a/src/abi/otoken.ts b/src/abi/otoken.ts deleted file mode 100644 index 1fe1abce..00000000 --- a/src/abi/otoken.ts +++ /dev/null @@ -1,250 +0,0 @@ -import * as p from '@subsquid/evm-codec' -import { event, fun, viewFun, indexed, ContractBase } from '@subsquid/evm-abi' -import type { EventParams as EParams, FunctionArguments, FunctionReturn } from '@subsquid/evm-abi' - -export const events = { - AccountRebasingDisabled: event("0x201ace89ad3f5ab7428b91989f6a50d1998791c7b94a0fa812fd64a57687165e", "AccountRebasingDisabled(address)", {"account": p.address}), - AccountRebasingEnabled: event("0x19a249fa2050bac8314ac10e3ad420bd9825574bf750f58810c3c7adfc7b1c6f", "AccountRebasingEnabled(address)", {"account": p.address}), - Approval: event("0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925", "Approval(address,address,uint256)", {"owner": indexed(p.address), "spender": indexed(p.address), "value": p.uint256}), - GovernorshipTransferred: event("0xc7c0c772add429241571afb3805861fb3cfa2af374534088b76cdb4325a87e9a", "GovernorshipTransferred(address,address)", {"previousGovernor": indexed(p.address), "newGovernor": indexed(p.address)}), - PendingGovernorshipTransfer: event("0xa39cc5eb22d0f34d8beaefee8a3f17cc229c1a1d1ef87a5ad47313487b1c4f0d", "PendingGovernorshipTransfer(address,address)", {"previousGovernor": indexed(p.address), "newGovernor": indexed(p.address)}), - TotalSupplyUpdatedHighres: event("0x41645eb819d3011b13f97696a8109d14bfcddfaca7d063ec0564d62a3e257235", "TotalSupplyUpdatedHighres(uint256,uint256,uint256)", {"totalSupply": p.uint256, "rebasingCredits": p.uint256, "rebasingCreditsPerToken": p.uint256}), - Transfer: event("0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", "Transfer(address,address,uint256)", {"from": indexed(p.address), "to": indexed(p.address), "value": p.uint256}), - YieldDelegated: event("0x31e39e4bb9df9d4143551c8a3a4798fc19b0854768570ce84d966f6adffd01a3", "YieldDelegated(address,address)", {"source": p.address, "target": p.address}), - YieldUndelegated: event("0xa4fa89dd14422a509261a2d4d459f93abdc84c6e92c5e7ae5448243713967bd3", "YieldUndelegated(address,address)", {"source": p.address, "target": p.address}), -} - -export const functions = { - allowance: viewFun("0xdd62ed3e", "allowance(address,address)", {"_owner": p.address, "_spender": p.address}, p.uint256), - approve: fun("0x095ea7b3", "approve(address,uint256)", {"_spender": p.address, "_value": p.uint256}, p.bool), - balanceOf: viewFun("0x70a08231", "balanceOf(address)", {"_account": p.address}, p.uint256), - burn: fun("0x9dc29fac", "burn(address,uint256)", {"_account": p.address, "_amount": p.uint256}, ), - changeSupply: fun("0x39a7919f", "changeSupply(uint256)", {"_newTotalSupply": p.uint256}, ), - claimGovernance: fun("0x5d36b190", "claimGovernance()", {}, ), - creditsBalanceOf: viewFun("0xf9854bfc", "creditsBalanceOf(address)", {"_account": p.address}, {"_0": p.uint256, "_1": p.uint256}), - creditsBalanceOfHighres: viewFun("0xe5c4fffe", "creditsBalanceOfHighres(address)", {"_account": p.address}, {"_0": p.uint256, "_1": p.uint256, "_2": p.bool}), - decimals: viewFun("0x313ce567", "decimals()", {}, p.uint8), - delegateYield: fun("0x9d01fc72", "delegateYield(address,address)", {"_from": p.address, "_to": p.address}, ), - governanceRebaseOptIn: fun("0xbaa9c9db", "governanceRebaseOptIn(address)", {"_account": p.address}, ), - governor: viewFun("0x0c340a24", "governor()", {}, p.address), - initialize: fun("0xcd6dc687", "initialize(address,uint256)", {"_vaultAddress": p.address, "_initialCreditsPerToken": p.uint256}, ), - isGovernor: viewFun("0xc7af3352", "isGovernor()", {}, p.bool), - mint: fun("0x40c10f19", "mint(address,uint256)", {"_account": p.address, "_amount": p.uint256}, ), - name: viewFun("0x06fdde03", "name()", {}, p.string), - nonRebasingCreditsPerToken: viewFun("0x609350cd", "nonRebasingCreditsPerToken(address)", {"_account": p.address}, p.uint256), - nonRebasingSupply: viewFun("0xe696393a", "nonRebasingSupply()", {}, p.uint256), - rebaseOptIn: fun("0xf51b0fd4", "rebaseOptIn()", {}, ), - rebaseOptOut: fun("0xc2376dff", "rebaseOptOut()", {}, ), - rebaseState: viewFun("0x456ee286", "rebaseState(address)", {"_0": p.address}, p.uint8), - rebasingCredits: viewFun("0x077f22b7", "rebasingCredits()", {}, p.uint256), - rebasingCreditsHighres: viewFun("0x7d0d66ff", "rebasingCreditsHighres()", {}, p.uint256), - rebasingCreditsPerToken: viewFun("0x6691cb3d", "rebasingCreditsPerToken()", {}, p.uint256), - rebasingCreditsPerTokenHighres: viewFun("0x7a46a9c5", "rebasingCreditsPerTokenHighres()", {}, p.uint256), - symbol: viewFun("0x95d89b41", "symbol()", {}, p.string), - totalSupply: viewFun("0x18160ddd", "totalSupply()", {}, p.uint256), - transfer: fun("0xa9059cbb", "transfer(address,uint256)", {"_to": p.address, "_value": p.uint256}, p.bool), - transferFrom: fun("0x23b872dd", "transferFrom(address,address,uint256)", {"_from": p.address, "_to": p.address, "_value": p.uint256}, p.bool), - transferGovernance: fun("0xd38bfff4", "transferGovernance(address)", {"_newGovernor": p.address}, ), - undelegateYield: fun("0x06a2da3d", "undelegateYield(address)", {"_from": p.address}, ), - vaultAddress: viewFun("0x430bf08a", "vaultAddress()", {}, p.address), - yieldFrom: viewFun("0x6b96be39", "yieldFrom(address)", {"_0": p.address}, p.address), - yieldTo: viewFun("0x5f5a8577", "yieldTo(address)", {"_0": p.address}, p.address), -} - -export class Contract extends ContractBase { - - allowance(_owner: AllowanceParams["_owner"], _spender: AllowanceParams["_spender"]) { - return this.eth_call(functions.allowance, {_owner, _spender}) - } - - balanceOf(_account: BalanceOfParams["_account"]) { - return this.eth_call(functions.balanceOf, {_account}) - } - - creditsBalanceOf(_account: CreditsBalanceOfParams["_account"]) { - return this.eth_call(functions.creditsBalanceOf, {_account}) - } - - creditsBalanceOfHighres(_account: CreditsBalanceOfHighresParams["_account"]) { - return this.eth_call(functions.creditsBalanceOfHighres, {_account}) - } - - decimals() { - return this.eth_call(functions.decimals, {}) - } - - governor() { - return this.eth_call(functions.governor, {}) - } - - isGovernor() { - return this.eth_call(functions.isGovernor, {}) - } - - name() { - return this.eth_call(functions.name, {}) - } - - nonRebasingCreditsPerToken(_account: NonRebasingCreditsPerTokenParams["_account"]) { - return this.eth_call(functions.nonRebasingCreditsPerToken, {_account}) - } - - nonRebasingSupply() { - return this.eth_call(functions.nonRebasingSupply, {}) - } - - rebaseState(_0: RebaseStateParams["_0"]) { - return this.eth_call(functions.rebaseState, {_0}) - } - - rebasingCredits() { - return this.eth_call(functions.rebasingCredits, {}) - } - - rebasingCreditsHighres() { - return this.eth_call(functions.rebasingCreditsHighres, {}) - } - - rebasingCreditsPerToken() { - return this.eth_call(functions.rebasingCreditsPerToken, {}) - } - - rebasingCreditsPerTokenHighres() { - return this.eth_call(functions.rebasingCreditsPerTokenHighres, {}) - } - - symbol() { - return this.eth_call(functions.symbol, {}) - } - - totalSupply() { - return this.eth_call(functions.totalSupply, {}) - } - - vaultAddress() { - return this.eth_call(functions.vaultAddress, {}) - } - - yieldFrom(_0: YieldFromParams["_0"]) { - return this.eth_call(functions.yieldFrom, {_0}) - } - - yieldTo(_0: YieldToParams["_0"]) { - return this.eth_call(functions.yieldTo, {_0}) - } -} - -/// Event types -export type AccountRebasingDisabledEventArgs = EParams -export type AccountRebasingEnabledEventArgs = EParams -export type ApprovalEventArgs = EParams -export type GovernorshipTransferredEventArgs = EParams -export type PendingGovernorshipTransferEventArgs = EParams -export type TotalSupplyUpdatedHighresEventArgs = EParams -export type TransferEventArgs = EParams -export type YieldDelegatedEventArgs = EParams -export type YieldUndelegatedEventArgs = EParams - -/// Function types -export type AllowanceParams = FunctionArguments -export type AllowanceReturn = FunctionReturn - -export type ApproveParams = FunctionArguments -export type ApproveReturn = FunctionReturn - -export type BalanceOfParams = FunctionArguments -export type BalanceOfReturn = FunctionReturn - -export type BurnParams = FunctionArguments -export type BurnReturn = FunctionReturn - -export type ChangeSupplyParams = FunctionArguments -export type ChangeSupplyReturn = FunctionReturn - -export type ClaimGovernanceParams = FunctionArguments -export type ClaimGovernanceReturn = FunctionReturn - -export type CreditsBalanceOfParams = FunctionArguments -export type CreditsBalanceOfReturn = FunctionReturn - -export type CreditsBalanceOfHighresParams = FunctionArguments -export type CreditsBalanceOfHighresReturn = FunctionReturn - -export type DecimalsParams = FunctionArguments -export type DecimalsReturn = FunctionReturn - -export type DelegateYieldParams = FunctionArguments -export type DelegateYieldReturn = FunctionReturn - -export type GovernanceRebaseOptInParams = FunctionArguments -export type GovernanceRebaseOptInReturn = FunctionReturn - -export type GovernorParams = FunctionArguments -export type GovernorReturn = FunctionReturn - -export type InitializeParams = FunctionArguments -export type InitializeReturn = FunctionReturn - -export type IsGovernorParams = FunctionArguments -export type IsGovernorReturn = FunctionReturn - -export type MintParams = FunctionArguments -export type MintReturn = FunctionReturn - -export type NameParams = FunctionArguments -export type NameReturn = FunctionReturn - -export type NonRebasingCreditsPerTokenParams = FunctionArguments -export type NonRebasingCreditsPerTokenReturn = FunctionReturn - -export type NonRebasingSupplyParams = FunctionArguments -export type NonRebasingSupplyReturn = FunctionReturn - -export type RebaseOptInParams = FunctionArguments -export type RebaseOptInReturn = FunctionReturn - -export type RebaseOptOutParams = FunctionArguments -export type RebaseOptOutReturn = FunctionReturn - -export type RebaseStateParams = FunctionArguments -export type RebaseStateReturn = FunctionReturn - -export type RebasingCreditsParams = FunctionArguments -export type RebasingCreditsReturn = FunctionReturn - -export type RebasingCreditsHighresParams = FunctionArguments -export type RebasingCreditsHighresReturn = FunctionReturn - -export type RebasingCreditsPerTokenParams = FunctionArguments -export type RebasingCreditsPerTokenReturn = FunctionReturn - -export type RebasingCreditsPerTokenHighresParams = FunctionArguments -export type RebasingCreditsPerTokenHighresReturn = FunctionReturn - -export type SymbolParams = FunctionArguments -export type SymbolReturn = FunctionReturn - -export type TotalSupplyParams = FunctionArguments -export type TotalSupplyReturn = FunctionReturn - -export type TransferParams = FunctionArguments -export type TransferReturn = FunctionReturn - -export type TransferFromParams = FunctionArguments -export type TransferFromReturn = FunctionReturn - -export type TransferGovernanceParams = FunctionArguments -export type TransferGovernanceReturn = FunctionReturn - -export type UndelegateYieldParams = FunctionArguments -export type UndelegateYieldReturn = FunctionReturn - -export type VaultAddressParams = FunctionArguments -export type VaultAddressReturn = FunctionReturn - -export type YieldFromParams = FunctionArguments -export type YieldFromReturn = FunctionReturn - -export type YieldToParams = FunctionArguments -export type YieldToReturn = FunctionReturn - diff --git a/src/abi/otoken/contract.ts b/src/abi/otoken/contract.ts new file mode 100644 index 00000000..9780df0b --- /dev/null +++ b/src/abi/otoken/contract.ts @@ -0,0 +1,97 @@ +import { ContractBase } from '../abi.support.js' +import { allowance, approve, balanceOf, creditsBalanceOf, creditsBalanceOfHighres, decimals, governor, isGovernor, name, nonRebasingCreditsPerToken, nonRebasingSupply, rebaseState, rebasingCredits, rebasingCreditsHighres, rebasingCreditsPerToken, rebasingCreditsPerTokenHighres, symbol, totalSupply, transfer, transferFrom, vaultAddress, yieldFrom, yieldTo } from './functions.js' +import type { AllowanceParams, ApproveParams, BalanceOfParams, CreditsBalanceOfHighresParams, CreditsBalanceOfParams, NonRebasingCreditsPerTokenParams, RebaseStateParams, TransferFromParams, TransferParams, YieldFromParams, YieldToParams } from './functions.js' + +export class Contract extends ContractBase { + allowance(_owner: AllowanceParams["_owner"], _spender: AllowanceParams["_spender"]) { + return this.eth_call(allowance, {_owner, _spender}) + } + + approve(_spender: ApproveParams["_spender"], _value: ApproveParams["_value"]) { + return this.eth_call(approve, {_spender, _value}) + } + + balanceOf(_account: BalanceOfParams["_account"]) { + return this.eth_call(balanceOf, {_account}) + } + + creditsBalanceOf(_account: CreditsBalanceOfParams["_account"]) { + return this.eth_call(creditsBalanceOf, {_account}) + } + + creditsBalanceOfHighres(_account: CreditsBalanceOfHighresParams["_account"]) { + return this.eth_call(creditsBalanceOfHighres, {_account}) + } + + decimals() { + return this.eth_call(decimals, {}) + } + + governor() { + return this.eth_call(governor, {}) + } + + isGovernor() { + return this.eth_call(isGovernor, {}) + } + + name() { + return this.eth_call(name, {}) + } + + nonRebasingCreditsPerToken(_account: NonRebasingCreditsPerTokenParams["_account"]) { + return this.eth_call(nonRebasingCreditsPerToken, {_account}) + } + + nonRebasingSupply() { + return this.eth_call(nonRebasingSupply, {}) + } + + rebaseState(_0: RebaseStateParams["_0"]) { + return this.eth_call(rebaseState, {_0}) + } + + rebasingCredits() { + return this.eth_call(rebasingCredits, {}) + } + + rebasingCreditsHighres() { + return this.eth_call(rebasingCreditsHighres, {}) + } + + rebasingCreditsPerToken() { + return this.eth_call(rebasingCreditsPerToken, {}) + } + + rebasingCreditsPerTokenHighres() { + return this.eth_call(rebasingCreditsPerTokenHighres, {}) + } + + symbol() { + return this.eth_call(symbol, {}) + } + + totalSupply() { + return this.eth_call(totalSupply, {}) + } + + transfer(_to: TransferParams["_to"], _value: TransferParams["_value"]) { + return this.eth_call(transfer, {_to, _value}) + } + + transferFrom(_from: TransferFromParams["_from"], _to: TransferFromParams["_to"], _value: TransferFromParams["_value"]) { + return this.eth_call(transferFrom, {_from, _to, _value}) + } + + vaultAddress() { + return this.eth_call(vaultAddress, {}) + } + + yieldFrom(_0: YieldFromParams["_0"]) { + return this.eth_call(yieldFrom, {_0}) + } + + yieldTo(_0: YieldToParams["_0"]) { + return this.eth_call(yieldTo, {_0}) + } +} diff --git a/src/abi/otoken/events.ts b/src/abi/otoken/events.ts new file mode 100644 index 00000000..be1e1f07 --- /dev/null +++ b/src/abi/otoken/events.ts @@ -0,0 +1,67 @@ +import { address, uint256 } from '@subsquid/evm-codec' +import { event, indexed } from '../abi.support.js' +import type { EventParams as EParams } from '../abi.support.js' + +/** AccountRebasingDisabled(address) */ +export const AccountRebasingDisabled = event('0x201ace89ad3f5ab7428b91989f6a50d1998791c7b94a0fa812fd64a57687165e', { + account: address, +}) +export type AccountRebasingDisabledEventArgs = EParams + +/** AccountRebasingEnabled(address) */ +export const AccountRebasingEnabled = event('0x19a249fa2050bac8314ac10e3ad420bd9825574bf750f58810c3c7adfc7b1c6f', { + account: address, +}) +export type AccountRebasingEnabledEventArgs = EParams + +/** Approval(address,address,uint256) */ +export const Approval = event('0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925', { + owner: indexed(address), + spender: indexed(address), + value: uint256, +}) +export type ApprovalEventArgs = EParams + +/** GovernorshipTransferred(address,address) */ +export const GovernorshipTransferred = event('0xc7c0c772add429241571afb3805861fb3cfa2af374534088b76cdb4325a87e9a', { + previousGovernor: indexed(address), + newGovernor: indexed(address), +}) +export type GovernorshipTransferredEventArgs = EParams + +/** PendingGovernorshipTransfer(address,address) */ +export const PendingGovernorshipTransfer = event('0xa39cc5eb22d0f34d8beaefee8a3f17cc229c1a1d1ef87a5ad47313487b1c4f0d', { + previousGovernor: indexed(address), + newGovernor: indexed(address), +}) +export type PendingGovernorshipTransferEventArgs = EParams + +/** TotalSupplyUpdatedHighres(uint256,uint256,uint256) */ +export const TotalSupplyUpdatedHighres = event('0x41645eb819d3011b13f97696a8109d14bfcddfaca7d063ec0564d62a3e257235', { + totalSupply: uint256, + rebasingCredits: uint256, + rebasingCreditsPerToken: uint256, +}) +export type TotalSupplyUpdatedHighresEventArgs = EParams + +/** Transfer(address,address,uint256) */ +export const Transfer = event('0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', { + from: indexed(address), + to: indexed(address), + value: uint256, +}) +export type TransferEventArgs = EParams + +/** YieldDelegated(address,address) */ +export const YieldDelegated = event('0x31e39e4bb9df9d4143551c8a3a4798fc19b0854768570ce84d966f6adffd01a3', { + source: address, + target: address, +}) +export type YieldDelegatedEventArgs = EParams + +/** YieldUndelegated(address,address) */ +export const YieldUndelegated = event('0xa4fa89dd14422a509261a2d4d459f93abdc84c6e92c5e7ae5448243713967bd3', { + source: address, + target: address, +}) +export type YieldUndelegatedEventArgs = EParams diff --git a/src/abi/otoken/functions.ts b/src/abi/otoken/functions.ts new file mode 100644 index 00000000..c88d1196 --- /dev/null +++ b/src/abi/otoken/functions.ts @@ -0,0 +1,227 @@ +import { address, bool, string, struct, uint256, uint8 } from '@subsquid/evm-codec' +import { func } from '../abi.support.js' +import type { FunctionArguments, FunctionReturn } from '../abi.support.js' + +/** allowance(address,address) */ +export const allowance = func('0xdd62ed3e', { + _owner: address, + _spender: address, +}, uint256) +export type AllowanceParams = FunctionArguments +export type AllowanceReturn = FunctionReturn + +/** approve(address,uint256) */ +export const approve = func('0x095ea7b3', { + _spender: address, + _value: uint256, +}, bool) +export type ApproveParams = FunctionArguments +export type ApproveReturn = FunctionReturn + +/** balanceOf(address) */ +export const balanceOf = func('0x70a08231', { + _account: address, +}, uint256) +export type BalanceOfParams = FunctionArguments +export type BalanceOfReturn = FunctionReturn + +/** burn(address,uint256) */ +export const burn = func('0x9dc29fac', { + _account: address, + _amount: uint256, +}) +export type BurnParams = FunctionArguments +export type BurnReturn = FunctionReturn + +/** changeSupply(uint256) */ +export const changeSupply = func('0x39a7919f', { + _newTotalSupply: uint256, +}) +export type ChangeSupplyParams = FunctionArguments +export type ChangeSupplyReturn = FunctionReturn + +/** claimGovernance() */ +export const claimGovernance = func('0x5d36b190', {}) +export type ClaimGovernanceParams = FunctionArguments +export type ClaimGovernanceReturn = FunctionReturn + +/** creditsBalanceOf(address) */ +export const creditsBalanceOf = func('0xf9854bfc', { + _account: address, +}, struct({ + _0: uint256, + _1: uint256, +})) +export type CreditsBalanceOfParams = FunctionArguments +export type CreditsBalanceOfReturn = FunctionReturn + +/** creditsBalanceOfHighres(address) */ +export const creditsBalanceOfHighres = func('0xe5c4fffe', { + _account: address, +}, struct({ + _0: uint256, + _1: uint256, + _2: bool, +})) +export type CreditsBalanceOfHighresParams = FunctionArguments +export type CreditsBalanceOfHighresReturn = FunctionReturn + +/** decimals() */ +export const decimals = func('0x313ce567', {}, uint8) +export type DecimalsParams = FunctionArguments +export type DecimalsReturn = FunctionReturn + +/** delegateYield(address,address) */ +export const delegateYield = func('0x9d01fc72', { + _from: address, + _to: address, +}) +export type DelegateYieldParams = FunctionArguments +export type DelegateYieldReturn = FunctionReturn + +/** governanceRebaseOptIn(address) */ +export const governanceRebaseOptIn = func('0xbaa9c9db', { + _account: address, +}) +export type GovernanceRebaseOptInParams = FunctionArguments +export type GovernanceRebaseOptInReturn = FunctionReturn + +/** governor() */ +export const governor = func('0x0c340a24', {}, address) +export type GovernorParams = FunctionArguments +export type GovernorReturn = FunctionReturn + +/** initialize(address,uint256) */ +export const initialize = func('0xcd6dc687', { + _vaultAddress: address, + _initialCreditsPerToken: uint256, +}) +export type InitializeParams = FunctionArguments +export type InitializeReturn = FunctionReturn + +/** isGovernor() */ +export const isGovernor = func('0xc7af3352', {}, bool) +export type IsGovernorParams = FunctionArguments +export type IsGovernorReturn = FunctionReturn + +/** mint(address,uint256) */ +export const mint = func('0x40c10f19', { + _account: address, + _amount: uint256, +}) +export type MintParams = FunctionArguments +export type MintReturn = FunctionReturn + +/** name() */ +export const name = func('0x06fdde03', {}, string) +export type NameParams = FunctionArguments +export type NameReturn = FunctionReturn + +/** nonRebasingCreditsPerToken(address) */ +export const nonRebasingCreditsPerToken = func('0x609350cd', { + _account: address, +}, uint256) +export type NonRebasingCreditsPerTokenParams = FunctionArguments +export type NonRebasingCreditsPerTokenReturn = FunctionReturn + +/** nonRebasingSupply() */ +export const nonRebasingSupply = func('0xe696393a', {}, uint256) +export type NonRebasingSupplyParams = FunctionArguments +export type NonRebasingSupplyReturn = FunctionReturn + +/** rebaseOptIn() */ +export const rebaseOptIn = func('0xf51b0fd4', {}) +export type RebaseOptInParams = FunctionArguments +export type RebaseOptInReturn = FunctionReturn + +/** rebaseOptOut() */ +export const rebaseOptOut = func('0xc2376dff', {}) +export type RebaseOptOutParams = FunctionArguments +export type RebaseOptOutReturn = FunctionReturn + +/** rebaseState(address) */ +export const rebaseState = func('0x456ee286', { + _0: address, +}, uint8) +export type RebaseStateParams = FunctionArguments +export type RebaseStateReturn = FunctionReturn + +/** rebasingCredits() */ +export const rebasingCredits = func('0x077f22b7', {}, uint256) +export type RebasingCreditsParams = FunctionArguments +export type RebasingCreditsReturn = FunctionReturn + +/** rebasingCreditsHighres() */ +export const rebasingCreditsHighres = func('0x7d0d66ff', {}, uint256) +export type RebasingCreditsHighresParams = FunctionArguments +export type RebasingCreditsHighresReturn = FunctionReturn + +/** rebasingCreditsPerToken() */ +export const rebasingCreditsPerToken = func('0x6691cb3d', {}, uint256) +export type RebasingCreditsPerTokenParams = FunctionArguments +export type RebasingCreditsPerTokenReturn = FunctionReturn + +/** rebasingCreditsPerTokenHighres() */ +export const rebasingCreditsPerTokenHighres = func('0x7a46a9c5', {}, uint256) +export type RebasingCreditsPerTokenHighresParams = FunctionArguments +export type RebasingCreditsPerTokenHighresReturn = FunctionReturn + +/** symbol() */ +export const symbol = func('0x95d89b41', {}, string) +export type SymbolParams = FunctionArguments +export type SymbolReturn = FunctionReturn + +/** totalSupply() */ +export const totalSupply = func('0x18160ddd', {}, uint256) +export type TotalSupplyParams = FunctionArguments +export type TotalSupplyReturn = FunctionReturn + +/** transfer(address,uint256) */ +export const transfer = func('0xa9059cbb', { + _to: address, + _value: uint256, +}, bool) +export type TransferParams = FunctionArguments +export type TransferReturn = FunctionReturn + +/** transferFrom(address,address,uint256) */ +export const transferFrom = func('0x23b872dd', { + _from: address, + _to: address, + _value: uint256, +}, bool) +export type TransferFromParams = FunctionArguments +export type TransferFromReturn = FunctionReturn + +/** transferGovernance(address) */ +export const transferGovernance = func('0xd38bfff4', { + _newGovernor: address, +}) +export type TransferGovernanceParams = FunctionArguments +export type TransferGovernanceReturn = FunctionReturn + +/** undelegateYield(address) */ +export const undelegateYield = func('0x06a2da3d', { + _from: address, +}) +export type UndelegateYieldParams = FunctionArguments +export type UndelegateYieldReturn = FunctionReturn + +/** vaultAddress() */ +export const vaultAddress = func('0x430bf08a', {}, address) +export type VaultAddressParams = FunctionArguments +export type VaultAddressReturn = FunctionReturn + +/** yieldFrom(address) */ +export const yieldFrom = func('0x6b96be39', { + _0: address, +}, address) +export type YieldFromParams = FunctionArguments +export type YieldFromReturn = FunctionReturn + +/** yieldTo(address) */ +export const yieldTo = func('0x5f5a8577', { + _0: address, +}, address) +export type YieldToParams = FunctionArguments +export type YieldToReturn = FunctionReturn diff --git a/src/abi/otoken/index.ts b/src/abi/otoken/index.ts new file mode 100644 index 00000000..11829d6e --- /dev/null +++ b/src/abi/otoken/index.ts @@ -0,0 +1,4 @@ +export * as events from './events.js' +export * as functions from './functions.js' + +export { Contract } from './contract.js' diff --git a/src/abi/pool-booster-central-registry.ts b/src/abi/pool-booster-central-registry.ts deleted file mode 100644 index 4d86313f..00000000 --- a/src/abi/pool-booster-central-registry.ts +++ /dev/null @@ -1,92 +0,0 @@ -import * as p from '@subsquid/evm-codec' -import { event, fun, viewFun, indexed, ContractBase } from '@subsquid/evm-abi' -import type { EventParams as EParams, FunctionArguments, FunctionReturn } from '@subsquid/evm-abi' - -export const events = { - FactoryApproved: event("0x4378f1462a48772813c3eb384aaee78cca44eb9a24b228a0118c8f4a8e5e3fd5", "FactoryApproved(address)", {"factoryAddress": p.address}), - FactoryRemoved: event("0xafa2737b2090fa39c66b7348625f0c03726240f724defbc6216d679506f94441", "FactoryRemoved(address)", {"factoryAddress": p.address}), - GovernorshipTransferred: event("0xc7c0c772add429241571afb3805861fb3cfa2af374534088b76cdb4325a87e9a", "GovernorshipTransferred(address,address)", {"previousGovernor": indexed(p.address), "newGovernor": indexed(p.address)}), - PendingGovernorshipTransfer: event("0xa39cc5eb22d0f34d8beaefee8a3f17cc229c1a1d1ef87a5ad47313487b1c4f0d", "PendingGovernorshipTransfer(address,address)", {"previousGovernor": indexed(p.address), "newGovernor": indexed(p.address)}), - PoolBoosterCreated: event("0x815a468ae1c240cd4e701cd11d7b89454db9d1c3e96c3ddda0b075e7612d5d68", "PoolBoosterCreated(address,address,uint8,address)", {"poolBoosterAddress": p.address, "ammPoolAddress": p.address, "poolBoosterType": p.uint8, "factoryAddress": p.address}), - PoolBoosterRemoved: event("0xa6267ed4a9ecad83a4813a850e7214f9a7fdf6995314c1c5efa359123d99b67b", "PoolBoosterRemoved(address)", {"poolBoosterAddress": p.address}), -} - -export const functions = { - approveFactory: fun("0xadda33c5", "approveFactory(address)", {"_factoryAddress": p.address}, ), - claimGovernance: fun("0x5d36b190", "claimGovernance()", {}, ), - emitPoolBoosterCreated: fun("0x591290e8", "emitPoolBoosterCreated(address,address,uint8)", {"_poolBoosterAddress": p.address, "_ammPoolAddress": p.address, "_boosterType": p.uint8}, ), - emitPoolBoosterRemoved: fun("0x07025229", "emitPoolBoosterRemoved(address)", {"_poolBoosterAddress": p.address}, ), - factories: viewFun("0x672383c4", "factories(uint256)", {"_0": p.uint256}, p.address), - getAllFactories: viewFun("0xa0750598", "getAllFactories()", {}, p.array(p.address)), - governor: viewFun("0x0c340a24", "governor()", {}, p.address), - isApprovedFactory: viewFun("0x26cf3739", "isApprovedFactory(address)", {"_factoryAddress": p.address}, p.bool), - isGovernor: viewFun("0xc7af3352", "isGovernor()", {}, p.bool), - removeFactory: fun("0x4b37c73f", "removeFactory(address)", {"_factoryAddress": p.address}, ), - transferGovernance: fun("0xd38bfff4", "transferGovernance(address)", {"_newGovernor": p.address}, ), -} - -export class Contract extends ContractBase { - - factories(_0: FactoriesParams["_0"]) { - return this.eth_call(functions.factories, {_0}) - } - - getAllFactories() { - return this.eth_call(functions.getAllFactories, {}) - } - - governor() { - return this.eth_call(functions.governor, {}) - } - - isApprovedFactory(_factoryAddress: IsApprovedFactoryParams["_factoryAddress"]) { - return this.eth_call(functions.isApprovedFactory, {_factoryAddress}) - } - - isGovernor() { - return this.eth_call(functions.isGovernor, {}) - } -} - -/// Event types -export type FactoryApprovedEventArgs = EParams -export type FactoryRemovedEventArgs = EParams -export type GovernorshipTransferredEventArgs = EParams -export type PendingGovernorshipTransferEventArgs = EParams -export type PoolBoosterCreatedEventArgs = EParams -export type PoolBoosterRemovedEventArgs = EParams - -/// Function types -export type ApproveFactoryParams = FunctionArguments -export type ApproveFactoryReturn = FunctionReturn - -export type ClaimGovernanceParams = FunctionArguments -export type ClaimGovernanceReturn = FunctionReturn - -export type EmitPoolBoosterCreatedParams = FunctionArguments -export type EmitPoolBoosterCreatedReturn = FunctionReturn - -export type EmitPoolBoosterRemovedParams = FunctionArguments -export type EmitPoolBoosterRemovedReturn = FunctionReturn - -export type FactoriesParams = FunctionArguments -export type FactoriesReturn = FunctionReturn - -export type GetAllFactoriesParams = FunctionArguments -export type GetAllFactoriesReturn = FunctionReturn - -export type GovernorParams = FunctionArguments -export type GovernorReturn = FunctionReturn - -export type IsApprovedFactoryParams = FunctionArguments -export type IsApprovedFactoryReturn = FunctionReturn - -export type IsGovernorParams = FunctionArguments -export type IsGovernorReturn = FunctionReturn - -export type RemoveFactoryParams = FunctionArguments -export type RemoveFactoryReturn = FunctionReturn - -export type TransferGovernanceParams = FunctionArguments -export type TransferGovernanceReturn = FunctionReturn - diff --git a/src/abi/pool-booster-central-registry/contract.ts b/src/abi/pool-booster-central-registry/contract.ts new file mode 100644 index 00000000..d3c47319 --- /dev/null +++ b/src/abi/pool-booster-central-registry/contract.ts @@ -0,0 +1,25 @@ +import { ContractBase } from '../abi.support.js' +import { factories, getAllFactories, governor, isApprovedFactory, isGovernor } from './functions.js' +import type { FactoriesParams, IsApprovedFactoryParams } from './functions.js' + +export class Contract extends ContractBase { + factories(_0: FactoriesParams["_0"]) { + return this.eth_call(factories, {_0}) + } + + getAllFactories() { + return this.eth_call(getAllFactories, {}) + } + + governor() { + return this.eth_call(governor, {}) + } + + isApprovedFactory(_factoryAddress: IsApprovedFactoryParams["_factoryAddress"]) { + return this.eth_call(isApprovedFactory, {_factoryAddress}) + } + + isGovernor() { + return this.eth_call(isGovernor, {}) + } +} diff --git a/src/abi/pool-booster-central-registry/events.ts b/src/abi/pool-booster-central-registry/events.ts new file mode 100644 index 00000000..d225e1c9 --- /dev/null +++ b/src/abi/pool-booster-central-registry/events.ts @@ -0,0 +1,44 @@ +import { address, uint8 } from '@subsquid/evm-codec' +import { event, indexed } from '../abi.support.js' +import type { EventParams as EParams } from '../abi.support.js' + +/** FactoryApproved(address) */ +export const FactoryApproved = event('0x4378f1462a48772813c3eb384aaee78cca44eb9a24b228a0118c8f4a8e5e3fd5', { + factoryAddress: address, +}) +export type FactoryApprovedEventArgs = EParams + +/** FactoryRemoved(address) */ +export const FactoryRemoved = event('0xafa2737b2090fa39c66b7348625f0c03726240f724defbc6216d679506f94441', { + factoryAddress: address, +}) +export type FactoryRemovedEventArgs = EParams + +/** GovernorshipTransferred(address,address) */ +export const GovernorshipTransferred = event('0xc7c0c772add429241571afb3805861fb3cfa2af374534088b76cdb4325a87e9a', { + previousGovernor: indexed(address), + newGovernor: indexed(address), +}) +export type GovernorshipTransferredEventArgs = EParams + +/** PendingGovernorshipTransfer(address,address) */ +export const PendingGovernorshipTransfer = event('0xa39cc5eb22d0f34d8beaefee8a3f17cc229c1a1d1ef87a5ad47313487b1c4f0d', { + previousGovernor: indexed(address), + newGovernor: indexed(address), +}) +export type PendingGovernorshipTransferEventArgs = EParams + +/** PoolBoosterCreated(address,address,uint8,address) */ +export const PoolBoosterCreated = event('0x815a468ae1c240cd4e701cd11d7b89454db9d1c3e96c3ddda0b075e7612d5d68', { + poolBoosterAddress: address, + ammPoolAddress: address, + poolBoosterType: uint8, + factoryAddress: address, +}) +export type PoolBoosterCreatedEventArgs = EParams + +/** PoolBoosterRemoved(address) */ +export const PoolBoosterRemoved = event('0xa6267ed4a9ecad83a4813a850e7214f9a7fdf6995314c1c5efa359123d99b67b', { + poolBoosterAddress: address, +}) +export type PoolBoosterRemovedEventArgs = EParams diff --git a/src/abi/pool-booster-central-registry/functions.ts b/src/abi/pool-booster-central-registry/functions.ts new file mode 100644 index 00000000..1ba88a5b --- /dev/null +++ b/src/abi/pool-booster-central-registry/functions.ts @@ -0,0 +1,74 @@ +import { address, array, bool, uint256, uint8 } from '@subsquid/evm-codec' +import { func } from '../abi.support.js' +import type { FunctionArguments, FunctionReturn } from '../abi.support.js' + +/** approveFactory(address) */ +export const approveFactory = func('0xadda33c5', { + _factoryAddress: address, +}) +export type ApproveFactoryParams = FunctionArguments +export type ApproveFactoryReturn = FunctionReturn + +/** claimGovernance() */ +export const claimGovernance = func('0x5d36b190', {}) +export type ClaimGovernanceParams = FunctionArguments +export type ClaimGovernanceReturn = FunctionReturn + +/** emitPoolBoosterCreated(address,address,uint8) */ +export const emitPoolBoosterCreated = func('0x591290e8', { + _poolBoosterAddress: address, + _ammPoolAddress: address, + _boosterType: uint8, +}) +export type EmitPoolBoosterCreatedParams = FunctionArguments +export type EmitPoolBoosterCreatedReturn = FunctionReturn + +/** emitPoolBoosterRemoved(address) */ +export const emitPoolBoosterRemoved = func('0x07025229', { + _poolBoosterAddress: address, +}) +export type EmitPoolBoosterRemovedParams = FunctionArguments +export type EmitPoolBoosterRemovedReturn = FunctionReturn + +/** factories(uint256) */ +export const factories = func('0x672383c4', { + _0: uint256, +}, address) +export type FactoriesParams = FunctionArguments +export type FactoriesReturn = FunctionReturn + +/** getAllFactories() */ +export const getAllFactories = func('0xa0750598', {}, array(address)) +export type GetAllFactoriesParams = FunctionArguments +export type GetAllFactoriesReturn = FunctionReturn + +/** governor() */ +export const governor = func('0x0c340a24', {}, address) +export type GovernorParams = FunctionArguments +export type GovernorReturn = FunctionReturn + +/** isApprovedFactory(address) */ +export const isApprovedFactory = func('0x26cf3739', { + _factoryAddress: address, +}, bool) +export type IsApprovedFactoryParams = FunctionArguments +export type IsApprovedFactoryReturn = FunctionReturn + +/** isGovernor() */ +export const isGovernor = func('0xc7af3352', {}, bool) +export type IsGovernorParams = FunctionArguments +export type IsGovernorReturn = FunctionReturn + +/** removeFactory(address) */ +export const removeFactory = func('0x4b37c73f', { + _factoryAddress: address, +}) +export type RemoveFactoryParams = FunctionArguments +export type RemoveFactoryReturn = FunctionReturn + +/** transferGovernance(address) */ +export const transferGovernance = func('0xd38bfff4', { + _newGovernor: address, +}) +export type TransferGovernanceParams = FunctionArguments +export type TransferGovernanceReturn = FunctionReturn diff --git a/src/abi/pool-booster-central-registry/index.ts b/src/abi/pool-booster-central-registry/index.ts new file mode 100644 index 00000000..11829d6e --- /dev/null +++ b/src/abi/pool-booster-central-registry/index.ts @@ -0,0 +1,4 @@ +export * as events from './events.js' +export * as functions from './functions.js' + +export { Contract } from './contract.js' diff --git a/src/abi/pool-booster.ts b/src/abi/pool-booster.ts deleted file mode 100644 index a16e1896..00000000 --- a/src/abi/pool-booster.ts +++ /dev/null @@ -1,62 +0,0 @@ -import * as p from '@subsquid/evm-codec' -import { event, fun, viewFun, indexed, ContractBase } from '@subsquid/evm-abi' -import type { EventParams as EParams, FunctionArguments, FunctionReturn } from '@subsquid/evm-abi' - -export const events = { - BribeExecuted: event("0x1424c3a24f9b1f30558ab0a7b48e07ce9f7d85b293a69a90356e1478504232eb", "BribeExecuted(uint256)", {"amount": p.uint256}), -} - -export const functions = { - MIN_BRIBE_AMOUNT: viewFun("0x3978033f", "MIN_BRIBE_AMOUNT()", {}, p.uint256), - bribe: fun("0x37d0208c", "bribe()", {}, ), - bribeContractOS: viewFun("0xecdb9ea1", "bribeContractOS()", {}, p.address), - bribeContractOther: viewFun("0x840841d4", "bribeContractOther()", {}, p.address), - osToken: viewFun("0x12c587c5", "osToken()", {}, p.address), - split: viewFun("0xf7654176", "split()", {}, p.uint256), -} - -export class Contract extends ContractBase { - - MIN_BRIBE_AMOUNT() { - return this.eth_call(functions.MIN_BRIBE_AMOUNT, {}) - } - - bribeContractOS() { - return this.eth_call(functions.bribeContractOS, {}) - } - - bribeContractOther() { - return this.eth_call(functions.bribeContractOther, {}) - } - - osToken() { - return this.eth_call(functions.osToken, {}) - } - - split() { - return this.eth_call(functions.split, {}) - } -} - -/// Event types -export type BribeExecutedEventArgs = EParams - -/// Function types -export type MIN_BRIBE_AMOUNTParams = FunctionArguments -export type MIN_BRIBE_AMOUNTReturn = FunctionReturn - -export type BribeParams = FunctionArguments -export type BribeReturn = FunctionReturn - -export type BribeContractOSParams = FunctionArguments -export type BribeContractOSReturn = FunctionReturn - -export type BribeContractOtherParams = FunctionArguments -export type BribeContractOtherReturn = FunctionReturn - -export type OsTokenParams = FunctionArguments -export type OsTokenReturn = FunctionReturn - -export type SplitParams = FunctionArguments -export type SplitReturn = FunctionReturn - diff --git a/src/abi/pool-booster/contract.ts b/src/abi/pool-booster/contract.ts new file mode 100644 index 00000000..b36a7f67 --- /dev/null +++ b/src/abi/pool-booster/contract.ts @@ -0,0 +1,24 @@ +import { ContractBase } from '../abi.support.js' +import { MIN_BRIBE_AMOUNT, bribeContractOS, bribeContractOther, osToken, split } from './functions.js' + +export class Contract extends ContractBase { + MIN_BRIBE_AMOUNT() { + return this.eth_call(MIN_BRIBE_AMOUNT, {}) + } + + bribeContractOS() { + return this.eth_call(bribeContractOS, {}) + } + + bribeContractOther() { + return this.eth_call(bribeContractOther, {}) + } + + osToken() { + return this.eth_call(osToken, {}) + } + + split() { + return this.eth_call(split, {}) + } +} diff --git a/src/abi/pool-booster/events.ts b/src/abi/pool-booster/events.ts new file mode 100644 index 00000000..d94fe6e3 --- /dev/null +++ b/src/abi/pool-booster/events.ts @@ -0,0 +1,9 @@ +import { uint256 } from '@subsquid/evm-codec' +import { event } from '../abi.support.js' +import type { EventParams as EParams } from '../abi.support.js' + +/** BribeExecuted(uint256) */ +export const BribeExecuted = event('0x1424c3a24f9b1f30558ab0a7b48e07ce9f7d85b293a69a90356e1478504232eb', { + amount: uint256, +}) +export type BribeExecutedEventArgs = EParams diff --git a/src/abi/pool-booster/functions.ts b/src/abi/pool-booster/functions.ts new file mode 100644 index 00000000..1a46e29e --- /dev/null +++ b/src/abi/pool-booster/functions.ts @@ -0,0 +1,33 @@ +import { address, uint256 } from '@subsquid/evm-codec' +import { func } from '../abi.support.js' +import type { FunctionArguments, FunctionReturn } from '../abi.support.js' + +/** MIN_BRIBE_AMOUNT() */ +export const MIN_BRIBE_AMOUNT = func('0x3978033f', {}, uint256) +export type MIN_BRIBE_AMOUNTParams = FunctionArguments +export type MIN_BRIBE_AMOUNTReturn = FunctionReturn + +/** bribe() */ +export const bribe = func('0x37d0208c', {}) +export type BribeParams = FunctionArguments +export type BribeReturn = FunctionReturn + +/** bribeContractOS() */ +export const bribeContractOS = func('0xecdb9ea1', {}, address) +export type BribeContractOSParams = FunctionArguments +export type BribeContractOSReturn = FunctionReturn + +/** bribeContractOther() */ +export const bribeContractOther = func('0x840841d4', {}, address) +export type BribeContractOtherParams = FunctionArguments +export type BribeContractOtherReturn = FunctionReturn + +/** osToken() */ +export const osToken = func('0x12c587c5', {}, address) +export type OsTokenParams = FunctionArguments +export type OsTokenReturn = FunctionReturn + +/** split() */ +export const split = func('0xf7654176', {}, uint256) +export type SplitParams = FunctionArguments +export type SplitReturn = FunctionReturn diff --git a/src/abi/pool-booster/index.ts b/src/abi/pool-booster/index.ts new file mode 100644 index 00000000..11829d6e --- /dev/null +++ b/src/abi/pool-booster/index.ts @@ -0,0 +1,4 @@ +export * as events from './events.js' +export * as functions from './functions.js' + +export { Contract } from './contract.js' diff --git a/src/abi/sfrx-eth.abi.ts b/src/abi/sfrx-eth.abi.ts index 60b5caff..c89b91eb 100644 --- a/src/abi/sfrx-eth.abi.ts +++ b/src/abi/sfrx-eth.abi.ts @@ -1,814 +1,850 @@ export const ABI_JSON = [ { - "type": "constructor", - "stateMutability": "undefined", - "payable": false, "inputs": [ { - "type": "address", - "name": "_underlying" + "internalType": "contract ERC20", + "name": "_underlying", + "type": "address" }, { - "type": "uint32", - "name": "_rewardsCycleLength" + "internalType": "uint32", + "name": "_rewardsCycleLength", + "type": "uint32" } - ] + ], + "stateMutability": "nonpayable", + "type": "constructor" }, { - "type": "error", + "inputs": [], "name": "SyncError", - "inputs": [] + "type": "error" }, { - "type": "event", "anonymous": false, - "name": "Approval", "inputs": [ { - "type": "address", + "indexed": true, + "internalType": "address", "name": "owner", - "indexed": true + "type": "address" }, { - "type": "address", + "indexed": true, + "internalType": "address", "name": "spender", - "indexed": true + "type": "address" }, { - "type": "uint256", + "indexed": false, + "internalType": "uint256", "name": "amount", - "indexed": false + "type": "uint256" } - ] + ], + "name": "Approval", + "type": "event" }, { - "type": "event", "anonymous": false, - "name": "Deposit", "inputs": [ { - "type": "address", + "indexed": true, + "internalType": "address", "name": "caller", - "indexed": true + "type": "address" }, { - "type": "address", + "indexed": true, + "internalType": "address", "name": "owner", - "indexed": true + "type": "address" }, { - "type": "uint256", + "indexed": false, + "internalType": "uint256", "name": "assets", - "indexed": false + "type": "uint256" }, { - "type": "uint256", + "indexed": false, + "internalType": "uint256", "name": "shares", - "indexed": false + "type": "uint256" } - ] + ], + "name": "Deposit", + "type": "event" }, { - "type": "event", "anonymous": false, - "name": "NewRewardsCycle", "inputs": [ { - "type": "uint32", + "indexed": true, + "internalType": "uint32", "name": "cycleEnd", - "indexed": true + "type": "uint32" }, { - "type": "uint256", + "indexed": false, + "internalType": "uint256", "name": "rewardAmount", - "indexed": false + "type": "uint256" } - ] + ], + "name": "NewRewardsCycle", + "type": "event" }, { - "type": "event", "anonymous": false, - "name": "Transfer", "inputs": [ { - "type": "address", + "indexed": true, + "internalType": "address", "name": "from", - "indexed": true + "type": "address" }, { - "type": "address", + "indexed": true, + "internalType": "address", "name": "to", - "indexed": true + "type": "address" }, { - "type": "uint256", + "indexed": false, + "internalType": "uint256", "name": "amount", - "indexed": false + "type": "uint256" } - ] + ], + "name": "Transfer", + "type": "event" }, { - "type": "event", "anonymous": false, - "name": "Withdraw", "inputs": [ { - "type": "address", + "indexed": true, + "internalType": "address", "name": "caller", - "indexed": true + "type": "address" }, { - "type": "address", + "indexed": true, + "internalType": "address", "name": "receiver", - "indexed": true + "type": "address" }, { - "type": "address", + "indexed": true, + "internalType": "address", "name": "owner", - "indexed": true + "type": "address" }, { - "type": "uint256", + "indexed": false, + "internalType": "uint256", "name": "assets", - "indexed": false + "type": "uint256" }, { - "type": "uint256", + "indexed": false, + "internalType": "uint256", "name": "shares", - "indexed": false + "type": "uint256" } - ] + ], + "name": "Withdraw", + "type": "event" }, { - "type": "function", - "name": "DOMAIN_SEPARATOR", - "constant": true, - "stateMutability": "view", - "payable": false, "inputs": [], + "name": "DOMAIN_SEPARATOR", "outputs": [ { - "type": "bytes32", - "name": "" + "internalType": "bytes32", + "name": "", + "type": "bytes32" } - ] + ], + "stateMutability": "view", + "type": "function" }, { - "type": "function", - "name": "allowance", - "constant": true, - "stateMutability": "view", - "payable": false, "inputs": [ { - "type": "address", - "name": "" + "internalType": "address", + "name": "", + "type": "address" }, { - "type": "address", - "name": "" + "internalType": "address", + "name": "", + "type": "address" } ], + "name": "allowance", "outputs": [ { - "type": "uint256", - "name": "" + "internalType": "uint256", + "name": "", + "type": "uint256" } - ] + ], + "stateMutability": "view", + "type": "function" }, { - "type": "function", - "name": "approve", - "constant": false, - "payable": false, "inputs": [ { - "type": "address", - "name": "spender" + "internalType": "address", + "name": "spender", + "type": "address" }, { - "type": "uint256", - "name": "amount" + "internalType": "uint256", + "name": "amount", + "type": "uint256" } ], + "name": "approve", "outputs": [ { - "type": "bool", - "name": "" + "internalType": "bool", + "name": "", + "type": "bool" } - ] + ], + "stateMutability": "nonpayable", + "type": "function" }, { - "type": "function", - "name": "asset", - "constant": true, - "stateMutability": "view", - "payable": false, "inputs": [], + "name": "asset", "outputs": [ { - "type": "address", - "name": "" + "internalType": "contract ERC20", + "name": "", + "type": "address" } - ] + ], + "stateMutability": "view", + "type": "function" }, { - "type": "function", - "name": "balanceOf", - "constant": true, - "stateMutability": "view", - "payable": false, "inputs": [ { - "type": "address", - "name": "" + "internalType": "address", + "name": "", + "type": "address" } ], + "name": "balanceOf", "outputs": [ { - "type": "uint256", - "name": "" + "internalType": "uint256", + "name": "", + "type": "uint256" } - ] + ], + "stateMutability": "view", + "type": "function" }, { - "type": "function", - "name": "convertToAssets", - "constant": true, - "stateMutability": "view", - "payable": false, "inputs": [ { - "type": "uint256", - "name": "shares" + "internalType": "uint256", + "name": "shares", + "type": "uint256" } ], + "name": "convertToAssets", "outputs": [ { - "type": "uint256", - "name": "" + "internalType": "uint256", + "name": "", + "type": "uint256" } - ] + ], + "stateMutability": "view", + "type": "function" }, { - "type": "function", - "name": "convertToShares", - "constant": true, - "stateMutability": "view", - "payable": false, "inputs": [ { - "type": "uint256", - "name": "assets" + "internalType": "uint256", + "name": "assets", + "type": "uint256" } ], + "name": "convertToShares", "outputs": [ { - "type": "uint256", - "name": "" + "internalType": "uint256", + "name": "", + "type": "uint256" } - ] + ], + "stateMutability": "view", + "type": "function" }, { - "type": "function", - "name": "decimals", - "constant": true, - "stateMutability": "view", - "payable": false, "inputs": [], + "name": "decimals", "outputs": [ { - "type": "uint8", - "name": "" + "internalType": "uint8", + "name": "", + "type": "uint8" } - ] + ], + "stateMutability": "view", + "type": "function" }, { - "type": "function", - "name": "deposit", - "constant": false, - "payable": false, "inputs": [ { - "type": "uint256", - "name": "assets" + "internalType": "uint256", + "name": "assets", + "type": "uint256" }, { - "type": "address", - "name": "receiver" + "internalType": "address", + "name": "receiver", + "type": "address" } ], + "name": "deposit", "outputs": [ { - "type": "uint256", - "name": "shares" + "internalType": "uint256", + "name": "shares", + "type": "uint256" } - ] + ], + "stateMutability": "nonpayable", + "type": "function" }, { - "type": "function", - "name": "depositWithSignature", - "constant": false, - "payable": false, "inputs": [ { - "type": "uint256", - "name": "assets" + "internalType": "uint256", + "name": "assets", + "type": "uint256" }, { - "type": "address", - "name": "receiver" + "internalType": "address", + "name": "receiver", + "type": "address" }, { - "type": "uint256", - "name": "deadline" + "internalType": "uint256", + "name": "deadline", + "type": "uint256" }, { - "type": "bool", - "name": "approveMax" + "internalType": "bool", + "name": "approveMax", + "type": "bool" }, { - "type": "uint8", - "name": "v" + "internalType": "uint8", + "name": "v", + "type": "uint8" }, { - "type": "bytes32", - "name": "r" + "internalType": "bytes32", + "name": "r", + "type": "bytes32" }, { - "type": "bytes32", - "name": "s" + "internalType": "bytes32", + "name": "s", + "type": "bytes32" } ], + "name": "depositWithSignature", "outputs": [ { - "type": "uint256", - "name": "shares" + "internalType": "uint256", + "name": "shares", + "type": "uint256" } - ] + ], + "stateMutability": "nonpayable", + "type": "function" }, { - "type": "function", - "name": "lastRewardAmount", - "constant": true, - "stateMutability": "view", - "payable": false, "inputs": [], + "name": "lastRewardAmount", "outputs": [ { - "type": "uint192", - "name": "" + "internalType": "uint192", + "name": "", + "type": "uint192" } - ] + ], + "stateMutability": "view", + "type": "function" }, { - "type": "function", - "name": "lastSync", - "constant": true, - "stateMutability": "view", - "payable": false, "inputs": [], + "name": "lastSync", "outputs": [ { - "type": "uint32", - "name": "" + "internalType": "uint32", + "name": "", + "type": "uint32" } - ] + ], + "stateMutability": "view", + "type": "function" }, { - "type": "function", - "name": "maxDeposit", - "constant": true, - "stateMutability": "view", - "payable": false, "inputs": [ { - "type": "address", - "name": "" + "internalType": "address", + "name": "", + "type": "address" } ], + "name": "maxDeposit", "outputs": [ { - "type": "uint256", - "name": "" + "internalType": "uint256", + "name": "", + "type": "uint256" } - ] + ], + "stateMutability": "view", + "type": "function" }, { - "type": "function", - "name": "maxMint", - "constant": true, - "stateMutability": "view", - "payable": false, "inputs": [ { - "type": "address", - "name": "" + "internalType": "address", + "name": "", + "type": "address" } ], + "name": "maxMint", "outputs": [ { - "type": "uint256", - "name": "" + "internalType": "uint256", + "name": "", + "type": "uint256" } - ] + ], + "stateMutability": "view", + "type": "function" }, { - "type": "function", - "name": "maxRedeem", - "constant": true, - "stateMutability": "view", - "payable": false, "inputs": [ { - "type": "address", - "name": "owner" + "internalType": "address", + "name": "owner", + "type": "address" } ], + "name": "maxRedeem", "outputs": [ { - "type": "uint256", - "name": "" + "internalType": "uint256", + "name": "", + "type": "uint256" } - ] + ], + "stateMutability": "view", + "type": "function" }, { - "type": "function", - "name": "maxWithdraw", - "constant": true, - "stateMutability": "view", - "payable": false, "inputs": [ { - "type": "address", - "name": "owner" + "internalType": "address", + "name": "owner", + "type": "address" } ], + "name": "maxWithdraw", "outputs": [ { - "type": "uint256", - "name": "" + "internalType": "uint256", + "name": "", + "type": "uint256" } - ] + ], + "stateMutability": "view", + "type": "function" }, { - "type": "function", - "name": "mint", - "constant": false, - "payable": false, "inputs": [ { - "type": "uint256", - "name": "shares" + "internalType": "uint256", + "name": "shares", + "type": "uint256" }, { - "type": "address", - "name": "receiver" + "internalType": "address", + "name": "receiver", + "type": "address" } ], + "name": "mint", "outputs": [ { - "type": "uint256", - "name": "assets" + "internalType": "uint256", + "name": "assets", + "type": "uint256" } - ] + ], + "stateMutability": "nonpayable", + "type": "function" }, { - "type": "function", - "name": "name", - "constant": true, - "stateMutability": "view", - "payable": false, "inputs": [], + "name": "name", "outputs": [ { - "type": "string", - "name": "" + "internalType": "string", + "name": "", + "type": "string" } - ] + ], + "stateMutability": "view", + "type": "function" }, { - "type": "function", - "name": "nonces", - "constant": true, - "stateMutability": "view", - "payable": false, "inputs": [ { - "type": "address", - "name": "" + "internalType": "address", + "name": "", + "type": "address" } ], + "name": "nonces", "outputs": [ { - "type": "uint256", - "name": "" + "internalType": "uint256", + "name": "", + "type": "uint256" } - ] + ], + "stateMutability": "view", + "type": "function" }, { - "type": "function", - "name": "permit", - "constant": false, - "payable": false, "inputs": [ { - "type": "address", - "name": "owner" + "internalType": "address", + "name": "owner", + "type": "address" }, { - "type": "address", - "name": "spender" + "internalType": "address", + "name": "spender", + "type": "address" }, { - "type": "uint256", - "name": "value" + "internalType": "uint256", + "name": "value", + "type": "uint256" }, { - "type": "uint256", - "name": "deadline" + "internalType": "uint256", + "name": "deadline", + "type": "uint256" }, { - "type": "uint8", - "name": "v" + "internalType": "uint8", + "name": "v", + "type": "uint8" }, { - "type": "bytes32", - "name": "r" + "internalType": "bytes32", + "name": "r", + "type": "bytes32" }, { - "type": "bytes32", - "name": "s" + "internalType": "bytes32", + "name": "s", + "type": "bytes32" } ], - "outputs": [] + "name": "permit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" }, { - "type": "function", - "name": "previewDeposit", - "constant": true, - "stateMutability": "view", - "payable": false, "inputs": [ { - "type": "uint256", - "name": "assets" + "internalType": "uint256", + "name": "assets", + "type": "uint256" } ], + "name": "previewDeposit", "outputs": [ { - "type": "uint256", - "name": "" + "internalType": "uint256", + "name": "", + "type": "uint256" } - ] + ], + "stateMutability": "view", + "type": "function" }, { - "type": "function", - "name": "previewMint", - "constant": true, - "stateMutability": "view", - "payable": false, "inputs": [ { - "type": "uint256", - "name": "shares" + "internalType": "uint256", + "name": "shares", + "type": "uint256" } ], + "name": "previewMint", "outputs": [ { - "type": "uint256", - "name": "" + "internalType": "uint256", + "name": "", + "type": "uint256" } - ] + ], + "stateMutability": "view", + "type": "function" }, { - "type": "function", - "name": "previewRedeem", - "constant": true, - "stateMutability": "view", - "payable": false, "inputs": [ { - "type": "uint256", - "name": "shares" + "internalType": "uint256", + "name": "shares", + "type": "uint256" } ], + "name": "previewRedeem", "outputs": [ { - "type": "uint256", - "name": "" + "internalType": "uint256", + "name": "", + "type": "uint256" } - ] + ], + "stateMutability": "view", + "type": "function" }, { - "type": "function", - "name": "previewWithdraw", - "constant": true, - "stateMutability": "view", - "payable": false, "inputs": [ { - "type": "uint256", - "name": "assets" + "internalType": "uint256", + "name": "assets", + "type": "uint256" } ], + "name": "previewWithdraw", "outputs": [ { - "type": "uint256", - "name": "" + "internalType": "uint256", + "name": "", + "type": "uint256" } - ] + ], + "stateMutability": "view", + "type": "function" }, { - "type": "function", - "name": "pricePerShare", - "constant": true, - "stateMutability": "view", - "payable": false, "inputs": [], + "name": "pricePerShare", "outputs": [ { - "type": "uint256", - "name": "" + "internalType": "uint256", + "name": "", + "type": "uint256" } - ] + ], + "stateMutability": "view", + "type": "function" }, { - "type": "function", - "name": "redeem", - "constant": false, - "payable": false, "inputs": [ { - "type": "uint256", - "name": "shares" + "internalType": "uint256", + "name": "shares", + "type": "uint256" }, { - "type": "address", - "name": "receiver" + "internalType": "address", + "name": "receiver", + "type": "address" }, { - "type": "address", - "name": "owner" + "internalType": "address", + "name": "owner", + "type": "address" } ], + "name": "redeem", "outputs": [ { - "type": "uint256", - "name": "assets" + "internalType": "uint256", + "name": "assets", + "type": "uint256" } - ] + ], + "stateMutability": "nonpayable", + "type": "function" }, { - "type": "function", - "name": "rewardsCycleEnd", - "constant": true, - "stateMutability": "view", - "payable": false, "inputs": [], + "name": "rewardsCycleEnd", "outputs": [ { - "type": "uint32", - "name": "" + "internalType": "uint32", + "name": "", + "type": "uint32" } - ] + ], + "stateMutability": "view", + "type": "function" }, { - "type": "function", - "name": "rewardsCycleLength", - "constant": true, - "stateMutability": "view", - "payable": false, "inputs": [], + "name": "rewardsCycleLength", "outputs": [ { - "type": "uint32", - "name": "" + "internalType": "uint32", + "name": "", + "type": "uint32" } - ] + ], + "stateMutability": "view", + "type": "function" }, { - "type": "function", - "name": "symbol", - "constant": true, - "stateMutability": "view", - "payable": false, "inputs": [], + "name": "symbol", "outputs": [ { - "type": "string", - "name": "" + "internalType": "string", + "name": "", + "type": "string" } - ] + ], + "stateMutability": "view", + "type": "function" }, { - "type": "function", - "name": "syncRewards", - "constant": false, - "payable": false, "inputs": [], - "outputs": [] + "name": "syncRewards", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" }, { - "type": "function", - "name": "totalAssets", - "constant": true, - "stateMutability": "view", - "payable": false, "inputs": [], + "name": "totalAssets", "outputs": [ { - "type": "uint256", - "name": "" + "internalType": "uint256", + "name": "", + "type": "uint256" } - ] + ], + "stateMutability": "view", + "type": "function" }, { - "type": "function", - "name": "totalSupply", - "constant": true, - "stateMutability": "view", - "payable": false, "inputs": [], + "name": "totalSupply", "outputs": [ { - "type": "uint256", - "name": "" + "internalType": "uint256", + "name": "", + "type": "uint256" } - ] + ], + "stateMutability": "view", + "type": "function" }, { - "type": "function", - "name": "transfer", - "constant": false, - "payable": false, "inputs": [ { - "type": "address", - "name": "to" + "internalType": "address", + "name": "to", + "type": "address" }, { - "type": "uint256", - "name": "amount" + "internalType": "uint256", + "name": "amount", + "type": "uint256" } ], + "name": "transfer", "outputs": [ { - "type": "bool", - "name": "" + "internalType": "bool", + "name": "", + "type": "bool" } - ] + ], + "stateMutability": "nonpayable", + "type": "function" }, { - "type": "function", - "name": "transferFrom", - "constant": false, - "payable": false, "inputs": [ { - "type": "address", - "name": "from" + "internalType": "address", + "name": "from", + "type": "address" }, { - "type": "address", - "name": "to" + "internalType": "address", + "name": "to", + "type": "address" }, { - "type": "uint256", - "name": "amount" + "internalType": "uint256", + "name": "amount", + "type": "uint256" } ], + "name": "transferFrom", "outputs": [ { - "type": "bool", - "name": "" + "internalType": "bool", + "name": "", + "type": "bool" } - ] + ], + "stateMutability": "nonpayable", + "type": "function" }, { - "type": "function", - "name": "withdraw", - "constant": false, - "payable": false, "inputs": [ { - "type": "uint256", - "name": "assets" + "internalType": "uint256", + "name": "assets", + "type": "uint256" }, { - "type": "address", - "name": "receiver" + "internalType": "address", + "name": "receiver", + "type": "address" }, { - "type": "address", - "name": "owner" + "internalType": "address", + "name": "owner", + "type": "address" } ], + "name": "withdraw", "outputs": [ { - "type": "uint256", - "name": "shares" + "internalType": "uint256", + "name": "shares", + "type": "uint256" } - ] + ], + "stateMutability": "nonpayable", + "type": "function" } ] as const diff --git a/src/abi/sfrx-eth.ts b/src/abi/sfrx-eth.ts deleted file mode 100644 index 796ba8d1..00000000 --- a/src/abi/sfrx-eth.ts +++ /dev/null @@ -1,266 +0,0 @@ -import type { EventParams as EParams, FunctionArguments, FunctionReturn } from '@subsquid/evm-abi' -import { ContractBase, event, fun, indexed, viewFun } from '@subsquid/evm-abi' -import * as p from '@subsquid/evm-codec' - -export const events = { - Approval: event("0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925", "Approval(address,address,uint256)", {"owner": indexed(p.address), "spender": indexed(p.address), "amount": p.uint256}), - Deposit: event("0xdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d7", "Deposit(address,address,uint256,uint256)", {"caller": indexed(p.address), "owner": indexed(p.address), "assets": p.uint256, "shares": p.uint256}), - NewRewardsCycle: event("0x2fa39aac60d1c94cda4ab0e86ae9c0ffab5b926e5b827a4ccba1d9b5b2ef596e", "NewRewardsCycle(uint32,uint256)", {"cycleEnd": indexed(p.uint32), "rewardAmount": p.uint256}), - Transfer: event("0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", "Transfer(address,address,uint256)", {"from": indexed(p.address), "to": indexed(p.address), "amount": p.uint256}), - Withdraw: event("0xfbde797d201c681b91056529119e0b02407c7bb96a4a2c75c01fc9667232c8db", "Withdraw(address,address,address,uint256,uint256)", {"caller": indexed(p.address), "receiver": indexed(p.address), "owner": indexed(p.address), "assets": p.uint256, "shares": p.uint256}), -} - -export const functions = { - DOMAIN_SEPARATOR: viewFun("0x3644e515", "DOMAIN_SEPARATOR()", {}, p.bytes32), - allowance: viewFun("0xdd62ed3e", "allowance(address,address)", {"_0": p.address, "_1": p.address}, p.uint256), - approve: fun("0x095ea7b3", "approve(address,uint256)", {"spender": p.address, "amount": p.uint256}, p.bool), - asset: viewFun("0x38d52e0f", "asset()", {}, p.address), - balanceOf: viewFun("0x70a08231", "balanceOf(address)", {"_0": p.address}, p.uint256), - convertToAssets: viewFun("0x07a2d13a", "convertToAssets(uint256)", {"shares": p.uint256}, p.uint256), - convertToShares: viewFun("0xc6e6f592", "convertToShares(uint256)", {"assets": p.uint256}, p.uint256), - decimals: viewFun("0x313ce567", "decimals()", {}, p.uint8), - deposit: fun("0x6e553f65", "deposit(uint256,address)", {"assets": p.uint256, "receiver": p.address}, p.uint256), - depositWithSignature: fun("0x75e077c3", "depositWithSignature(uint256,address,uint256,bool,uint8,bytes32,bytes32)", {"assets": p.uint256, "receiver": p.address, "deadline": p.uint256, "approveMax": p.bool, "v": p.uint8, "r": p.bytes32, "s": p.bytes32}, p.uint256), - lastRewardAmount: viewFun("0xbafedcaa", "lastRewardAmount()", {}, p.uint192), - lastSync: viewFun("0x6917516b", "lastSync()", {}, p.uint32), - maxDeposit: viewFun("0x402d267d", "maxDeposit(address)", {"_0": p.address}, p.uint256), - maxMint: viewFun("0xc63d75b6", "maxMint(address)", {"_0": p.address}, p.uint256), - maxRedeem: viewFun("0xd905777e", "maxRedeem(address)", {"owner": p.address}, p.uint256), - maxWithdraw: viewFun("0xce96cb77", "maxWithdraw(address)", {"owner": p.address}, p.uint256), - mint: fun("0x94bf804d", "mint(uint256,address)", {"shares": p.uint256, "receiver": p.address}, p.uint256), - name: viewFun("0x06fdde03", "name()", {}, p.string), - nonces: viewFun("0x7ecebe00", "nonces(address)", {"_0": p.address}, p.uint256), - permit: fun("0xd505accf", "permit(address,address,uint256,uint256,uint8,bytes32,bytes32)", {"owner": p.address, "spender": p.address, "value": p.uint256, "deadline": p.uint256, "v": p.uint8, "r": p.bytes32, "s": p.bytes32}, ), - previewDeposit: viewFun("0xef8b30f7", "previewDeposit(uint256)", {"assets": p.uint256}, p.uint256), - previewMint: viewFun("0xb3d7f6b9", "previewMint(uint256)", {"shares": p.uint256}, p.uint256), - previewRedeem: viewFun("0x4cdad506", "previewRedeem(uint256)", {"shares": p.uint256}, p.uint256), - previewWithdraw: viewFun("0x0a28a477", "previewWithdraw(uint256)", {"assets": p.uint256}, p.uint256), - pricePerShare: viewFun("0x99530b06", "pricePerShare()", {}, p.uint256), - redeem: fun("0xba087652", "redeem(uint256,address,address)", {"shares": p.uint256, "receiver": p.address, "owner": p.address}, p.uint256), - rewardsCycleEnd: viewFun("0xe7ff69f1", "rewardsCycleEnd()", {}, p.uint32), - rewardsCycleLength: viewFun("0x6fcf5e5f", "rewardsCycleLength()", {}, p.uint32), - symbol: viewFun("0x95d89b41", "symbol()", {}, p.string), - syncRewards: fun("0x72c0c211", "syncRewards()", {}, ), - totalAssets: viewFun("0x01e1d114", "totalAssets()", {}, p.uint256), - totalSupply: viewFun("0x18160ddd", "totalSupply()", {}, p.uint256), - transfer: fun("0xa9059cbb", "transfer(address,uint256)", {"to": p.address, "amount": p.uint256}, p.bool), - transferFrom: fun("0x23b872dd", "transferFrom(address,address,uint256)", {"from": p.address, "to": p.address, "amount": p.uint256}, p.bool), - withdraw: fun("0xb460af94", "withdraw(uint256,address,address)", {"assets": p.uint256, "receiver": p.address, "owner": p.address}, p.uint256), -} - -export class Contract extends ContractBase { - - DOMAIN_SEPARATOR() { - return this.eth_call(functions.DOMAIN_SEPARATOR, {}) - } - - allowance(_0: AllowanceParams["_0"], _1: AllowanceParams["_1"]) { - return this.eth_call(functions.allowance, {_0, _1}) - } - - asset() { - return this.eth_call(functions.asset, {}) - } - - balanceOf(_0: BalanceOfParams["_0"]) { - return this.eth_call(functions.balanceOf, {_0}) - } - - convertToAssets(shares: ConvertToAssetsParams["shares"]) { - return this.eth_call(functions.convertToAssets, {shares}) - } - - convertToShares(assets: ConvertToSharesParams["assets"]) { - return this.eth_call(functions.convertToShares, {assets}) - } - - decimals() { - return this.eth_call(functions.decimals, {}) - } - - lastRewardAmount() { - return this.eth_call(functions.lastRewardAmount, {}) - } - - lastSync() { - return this.eth_call(functions.lastSync, {}) - } - - maxDeposit(_0: MaxDepositParams["_0"]) { - return this.eth_call(functions.maxDeposit, {_0}) - } - - maxMint(_0: MaxMintParams["_0"]) { - return this.eth_call(functions.maxMint, {_0}) - } - - maxRedeem(owner: MaxRedeemParams["owner"]) { - return this.eth_call(functions.maxRedeem, {owner}) - } - - maxWithdraw(owner: MaxWithdrawParams["owner"]) { - return this.eth_call(functions.maxWithdraw, {owner}) - } - - name() { - return this.eth_call(functions.name, {}) - } - - nonces(_0: NoncesParams["_0"]) { - return this.eth_call(functions.nonces, {_0}) - } - - previewDeposit(assets: PreviewDepositParams["assets"]) { - return this.eth_call(functions.previewDeposit, {assets}) - } - - previewMint(shares: PreviewMintParams["shares"]) { - return this.eth_call(functions.previewMint, {shares}) - } - - previewRedeem(shares: PreviewRedeemParams["shares"]) { - return this.eth_call(functions.previewRedeem, {shares}) - } - - previewWithdraw(assets: PreviewWithdrawParams["assets"]) { - return this.eth_call(functions.previewWithdraw, {assets}) - } - - pricePerShare() { - return this.eth_call(functions.pricePerShare, {}) - } - - rewardsCycleEnd() { - return this.eth_call(functions.rewardsCycleEnd, {}) - } - - rewardsCycleLength() { - return this.eth_call(functions.rewardsCycleLength, {}) - } - - symbol() { - return this.eth_call(functions.symbol, {}) - } - - totalAssets() { - return this.eth_call(functions.totalAssets, {}) - } - - totalSupply() { - return this.eth_call(functions.totalSupply, {}) - } -} - -/// Event types -export type ApprovalEventArgs = EParams -export type DepositEventArgs = EParams -export type NewRewardsCycleEventArgs = EParams -export type TransferEventArgs = EParams -export type WithdrawEventArgs = EParams - -/// Function types -export type DOMAIN_SEPARATORParams = FunctionArguments -export type DOMAIN_SEPARATORReturn = FunctionReturn - -export type AllowanceParams = FunctionArguments -export type AllowanceReturn = FunctionReturn - -export type ApproveParams = FunctionArguments -export type ApproveReturn = FunctionReturn - -export type AssetParams = FunctionArguments -export type AssetReturn = FunctionReturn - -export type BalanceOfParams = FunctionArguments -export type BalanceOfReturn = FunctionReturn - -export type ConvertToAssetsParams = FunctionArguments -export type ConvertToAssetsReturn = FunctionReturn - -export type ConvertToSharesParams = FunctionArguments -export type ConvertToSharesReturn = FunctionReturn - -export type DecimalsParams = FunctionArguments -export type DecimalsReturn = FunctionReturn - -export type DepositParams = FunctionArguments -export type DepositReturn = FunctionReturn - -export type DepositWithSignatureParams = FunctionArguments -export type DepositWithSignatureReturn = FunctionReturn - -export type LastRewardAmountParams = FunctionArguments -export type LastRewardAmountReturn = FunctionReturn - -export type LastSyncParams = FunctionArguments -export type LastSyncReturn = FunctionReturn - -export type MaxDepositParams = FunctionArguments -export type MaxDepositReturn = FunctionReturn - -export type MaxMintParams = FunctionArguments -export type MaxMintReturn = FunctionReturn - -export type MaxRedeemParams = FunctionArguments -export type MaxRedeemReturn = FunctionReturn - -export type MaxWithdrawParams = FunctionArguments -export type MaxWithdrawReturn = FunctionReturn - -export type MintParams = FunctionArguments -export type MintReturn = FunctionReturn - -export type NameParams = FunctionArguments -export type NameReturn = FunctionReturn - -export type NoncesParams = FunctionArguments -export type NoncesReturn = FunctionReturn - -export type PermitParams = FunctionArguments -export type PermitReturn = FunctionReturn - -export type PreviewDepositParams = FunctionArguments -export type PreviewDepositReturn = FunctionReturn - -export type PreviewMintParams = FunctionArguments -export type PreviewMintReturn = FunctionReturn - -export type PreviewRedeemParams = FunctionArguments -export type PreviewRedeemReturn = FunctionReturn - -export type PreviewWithdrawParams = FunctionArguments -export type PreviewWithdrawReturn = FunctionReturn - -export type PricePerShareParams = FunctionArguments -export type PricePerShareReturn = FunctionReturn - -export type RedeemParams = FunctionArguments -export type RedeemReturn = FunctionReturn - -export type RewardsCycleEndParams = FunctionArguments -export type RewardsCycleEndReturn = FunctionReturn - -export type RewardsCycleLengthParams = FunctionArguments -export type RewardsCycleLengthReturn = FunctionReturn - -export type SymbolParams = FunctionArguments -export type SymbolReturn = FunctionReturn - -export type SyncRewardsParams = FunctionArguments -export type SyncRewardsReturn = FunctionReturn - -export type TotalAssetsParams = FunctionArguments -export type TotalAssetsReturn = FunctionReturn - -export type TotalSupplyParams = FunctionArguments -export type TotalSupplyReturn = FunctionReturn - -export type TransferParams = FunctionArguments -export type TransferReturn = FunctionReturn - -export type TransferFromParams = FunctionArguments -export type TransferFromReturn = FunctionReturn - -export type WithdrawParams = FunctionArguments -export type WithdrawReturn = FunctionReturn - diff --git a/src/abi/sfrx-eth/contract.ts b/src/abi/sfrx-eth/contract.ts new file mode 100644 index 00000000..b8110fe4 --- /dev/null +++ b/src/abi/sfrx-eth/contract.ts @@ -0,0 +1,137 @@ +import { ContractBase } from '../abi.support.js' +import { DOMAIN_SEPARATOR, allowance, approve, asset, balanceOf, convertToAssets, convertToShares, decimals, deposit, depositWithSignature, lastRewardAmount, lastSync, maxDeposit, maxMint, maxRedeem, maxWithdraw, mint, name, nonces, previewDeposit, previewMint, previewRedeem, previewWithdraw, pricePerShare, redeem, rewardsCycleEnd, rewardsCycleLength, symbol, totalAssets, totalSupply, transfer, transferFrom, withdraw } from './functions.js' +import type { AllowanceParams, ApproveParams, BalanceOfParams, ConvertToAssetsParams, ConvertToSharesParams, DepositParams, DepositWithSignatureParams, MaxDepositParams, MaxMintParams, MaxRedeemParams, MaxWithdrawParams, MintParams, NoncesParams, PreviewDepositParams, PreviewMintParams, PreviewRedeemParams, PreviewWithdrawParams, RedeemParams, TransferFromParams, TransferParams, WithdrawParams } from './functions.js' + +export class Contract extends ContractBase { + DOMAIN_SEPARATOR() { + return this.eth_call(DOMAIN_SEPARATOR, {}) + } + + allowance(_0: AllowanceParams["_0"], _1: AllowanceParams["_1"]) { + return this.eth_call(allowance, {_0, _1}) + } + + approve(spender: ApproveParams["spender"], amount: ApproveParams["amount"]) { + return this.eth_call(approve, {spender, amount}) + } + + asset() { + return this.eth_call(asset, {}) + } + + balanceOf(_0: BalanceOfParams["_0"]) { + return this.eth_call(balanceOf, {_0}) + } + + convertToAssets(shares: ConvertToAssetsParams["shares"]) { + return this.eth_call(convertToAssets, {shares}) + } + + convertToShares(assets: ConvertToSharesParams["assets"]) { + return this.eth_call(convertToShares, {assets}) + } + + decimals() { + return this.eth_call(decimals, {}) + } + + deposit(assets: DepositParams["assets"], receiver: DepositParams["receiver"]) { + return this.eth_call(deposit, {assets, receiver}) + } + + depositWithSignature(assets: DepositWithSignatureParams["assets"], receiver: DepositWithSignatureParams["receiver"], deadline: DepositWithSignatureParams["deadline"], approveMax: DepositWithSignatureParams["approveMax"], v: DepositWithSignatureParams["v"], r: DepositWithSignatureParams["r"], s: DepositWithSignatureParams["s"]) { + return this.eth_call(depositWithSignature, {assets, receiver, deadline, approveMax, v, r, s}) + } + + lastRewardAmount() { + return this.eth_call(lastRewardAmount, {}) + } + + lastSync() { + return this.eth_call(lastSync, {}) + } + + maxDeposit(_0: MaxDepositParams["_0"]) { + return this.eth_call(maxDeposit, {_0}) + } + + maxMint(_0: MaxMintParams["_0"]) { + return this.eth_call(maxMint, {_0}) + } + + maxRedeem(owner: MaxRedeemParams["owner"]) { + return this.eth_call(maxRedeem, {owner}) + } + + maxWithdraw(owner: MaxWithdrawParams["owner"]) { + return this.eth_call(maxWithdraw, {owner}) + } + + mint(shares: MintParams["shares"], receiver: MintParams["receiver"]) { + return this.eth_call(mint, {shares, receiver}) + } + + name() { + return this.eth_call(name, {}) + } + + nonces(_0: NoncesParams["_0"]) { + return this.eth_call(nonces, {_0}) + } + + previewDeposit(assets: PreviewDepositParams["assets"]) { + return this.eth_call(previewDeposit, {assets}) + } + + previewMint(shares: PreviewMintParams["shares"]) { + return this.eth_call(previewMint, {shares}) + } + + previewRedeem(shares: PreviewRedeemParams["shares"]) { + return this.eth_call(previewRedeem, {shares}) + } + + previewWithdraw(assets: PreviewWithdrawParams["assets"]) { + return this.eth_call(previewWithdraw, {assets}) + } + + pricePerShare() { + return this.eth_call(pricePerShare, {}) + } + + redeem(shares: RedeemParams["shares"], receiver: RedeemParams["receiver"], owner: RedeemParams["owner"]) { + return this.eth_call(redeem, {shares, receiver, owner}) + } + + rewardsCycleEnd() { + return this.eth_call(rewardsCycleEnd, {}) + } + + rewardsCycleLength() { + return this.eth_call(rewardsCycleLength, {}) + } + + symbol() { + return this.eth_call(symbol, {}) + } + + totalAssets() { + return this.eth_call(totalAssets, {}) + } + + totalSupply() { + return this.eth_call(totalSupply, {}) + } + + transfer(to: TransferParams["to"], amount: TransferParams["amount"]) { + return this.eth_call(transfer, {to, amount}) + } + + transferFrom(from: TransferFromParams["from"], to: TransferFromParams["to"], amount: TransferFromParams["amount"]) { + return this.eth_call(transferFrom, {from, to, amount}) + } + + withdraw(assets: WithdrawParams["assets"], receiver: WithdrawParams["receiver"], owner: WithdrawParams["owner"]) { + return this.eth_call(withdraw, {assets, receiver, owner}) + } +} diff --git a/src/abi/sfrx-eth/events.ts b/src/abi/sfrx-eth/events.ts new file mode 100644 index 00000000..a060b4c8 --- /dev/null +++ b/src/abi/sfrx-eth/events.ts @@ -0,0 +1,45 @@ +import { address, uint256, uint32 } from '@subsquid/evm-codec' +import { event, indexed } from '../abi.support.js' +import type { EventParams as EParams } from '../abi.support.js' + +/** Approval(address,address,uint256) */ +export const Approval = event('0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925', { + owner: indexed(address), + spender: indexed(address), + amount: uint256, +}) +export type ApprovalEventArgs = EParams + +/** Deposit(address,address,uint256,uint256) */ +export const Deposit = event('0xdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d7', { + caller: indexed(address), + owner: indexed(address), + assets: uint256, + shares: uint256, +}) +export type DepositEventArgs = EParams + +/** NewRewardsCycle(uint32,uint256) */ +export const NewRewardsCycle = event('0x2fa39aac60d1c94cda4ab0e86ae9c0ffab5b926e5b827a4ccba1d9b5b2ef596e', { + cycleEnd: indexed(uint32), + rewardAmount: uint256, +}) +export type NewRewardsCycleEventArgs = EParams + +/** Transfer(address,address,uint256) */ +export const Transfer = event('0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', { + from: indexed(address), + to: indexed(address), + amount: uint256, +}) +export type TransferEventArgs = EParams + +/** Withdraw(address,address,address,uint256,uint256) */ +export const Withdraw = event('0xfbde797d201c681b91056529119e0b02407c7bb96a4a2c75c01fc9667232c8db', { + caller: indexed(address), + receiver: indexed(address), + owner: indexed(address), + assets: uint256, + shares: uint256, +}) +export type WithdrawEventArgs = EParams diff --git a/src/abi/sfrx-eth/functions.ts b/src/abi/sfrx-eth/functions.ts new file mode 100644 index 00000000..1d03c26e --- /dev/null +++ b/src/abi/sfrx-eth/functions.ts @@ -0,0 +1,245 @@ +import { address, bool, bytes32, string, uint192, uint256, uint32, uint8 } from '@subsquid/evm-codec' +import { func } from '../abi.support.js' +import type { FunctionArguments, FunctionReturn } from '../abi.support.js' + +/** DOMAIN_SEPARATOR() */ +export const DOMAIN_SEPARATOR = func('0x3644e515', {}, bytes32) +export type DOMAIN_SEPARATORParams = FunctionArguments +export type DOMAIN_SEPARATORReturn = FunctionReturn + +/** allowance(address,address) */ +export const allowance = func('0xdd62ed3e', { + _0: address, + _1: address, +}, uint256) +export type AllowanceParams = FunctionArguments +export type AllowanceReturn = FunctionReturn + +/** approve(address,uint256) */ +export const approve = func('0x095ea7b3', { + spender: address, + amount: uint256, +}, bool) +export type ApproveParams = FunctionArguments +export type ApproveReturn = FunctionReturn + +/** asset() */ +export const asset = func('0x38d52e0f', {}, address) +export type AssetParams = FunctionArguments +export type AssetReturn = FunctionReturn + +/** balanceOf(address) */ +export const balanceOf = func('0x70a08231', { + _0: address, +}, uint256) +export type BalanceOfParams = FunctionArguments +export type BalanceOfReturn = FunctionReturn + +/** convertToAssets(uint256) */ +export const convertToAssets = func('0x07a2d13a', { + shares: uint256, +}, uint256) +export type ConvertToAssetsParams = FunctionArguments +export type ConvertToAssetsReturn = FunctionReturn + +/** convertToShares(uint256) */ +export const convertToShares = func('0xc6e6f592', { + assets: uint256, +}, uint256) +export type ConvertToSharesParams = FunctionArguments +export type ConvertToSharesReturn = FunctionReturn + +/** decimals() */ +export const decimals = func('0x313ce567', {}, uint8) +export type DecimalsParams = FunctionArguments +export type DecimalsReturn = FunctionReturn + +/** deposit(uint256,address) */ +export const deposit = func('0x6e553f65', { + assets: uint256, + receiver: address, +}, uint256) +export type DepositParams = FunctionArguments +export type DepositReturn = FunctionReturn + +/** depositWithSignature(uint256,address,uint256,bool,uint8,bytes32,bytes32) */ +export const depositWithSignature = func('0x75e077c3', { + assets: uint256, + receiver: address, + deadline: uint256, + approveMax: bool, + v: uint8, + r: bytes32, + s: bytes32, +}, uint256) +export type DepositWithSignatureParams = FunctionArguments +export type DepositWithSignatureReturn = FunctionReturn + +/** lastRewardAmount() */ +export const lastRewardAmount = func('0xbafedcaa', {}, uint192) +export type LastRewardAmountParams = FunctionArguments +export type LastRewardAmountReturn = FunctionReturn + +/** lastSync() */ +export const lastSync = func('0x6917516b', {}, uint32) +export type LastSyncParams = FunctionArguments +export type LastSyncReturn = FunctionReturn + +/** maxDeposit(address) */ +export const maxDeposit = func('0x402d267d', { + _0: address, +}, uint256) +export type MaxDepositParams = FunctionArguments +export type MaxDepositReturn = FunctionReturn + +/** maxMint(address) */ +export const maxMint = func('0xc63d75b6', { + _0: address, +}, uint256) +export type MaxMintParams = FunctionArguments +export type MaxMintReturn = FunctionReturn + +/** maxRedeem(address) */ +export const maxRedeem = func('0xd905777e', { + owner: address, +}, uint256) +export type MaxRedeemParams = FunctionArguments +export type MaxRedeemReturn = FunctionReturn + +/** maxWithdraw(address) */ +export const maxWithdraw = func('0xce96cb77', { + owner: address, +}, uint256) +export type MaxWithdrawParams = FunctionArguments +export type MaxWithdrawReturn = FunctionReturn + +/** mint(uint256,address) */ +export const mint = func('0x94bf804d', { + shares: uint256, + receiver: address, +}, uint256) +export type MintParams = FunctionArguments +export type MintReturn = FunctionReturn + +/** name() */ +export const name = func('0x06fdde03', {}, string) +export type NameParams = FunctionArguments +export type NameReturn = FunctionReturn + +/** nonces(address) */ +export const nonces = func('0x7ecebe00', { + _0: address, +}, uint256) +export type NoncesParams = FunctionArguments +export type NoncesReturn = FunctionReturn + +/** permit(address,address,uint256,uint256,uint8,bytes32,bytes32) */ +export const permit = func('0xd505accf', { + owner: address, + spender: address, + value: uint256, + deadline: uint256, + v: uint8, + r: bytes32, + s: bytes32, +}) +export type PermitParams = FunctionArguments +export type PermitReturn = FunctionReturn + +/** previewDeposit(uint256) */ +export const previewDeposit = func('0xef8b30f7', { + assets: uint256, +}, uint256) +export type PreviewDepositParams = FunctionArguments +export type PreviewDepositReturn = FunctionReturn + +/** previewMint(uint256) */ +export const previewMint = func('0xb3d7f6b9', { + shares: uint256, +}, uint256) +export type PreviewMintParams = FunctionArguments +export type PreviewMintReturn = FunctionReturn + +/** previewRedeem(uint256) */ +export const previewRedeem = func('0x4cdad506', { + shares: uint256, +}, uint256) +export type PreviewRedeemParams = FunctionArguments +export type PreviewRedeemReturn = FunctionReturn + +/** previewWithdraw(uint256) */ +export const previewWithdraw = func('0x0a28a477', { + assets: uint256, +}, uint256) +export type PreviewWithdrawParams = FunctionArguments +export type PreviewWithdrawReturn = FunctionReturn + +/** pricePerShare() */ +export const pricePerShare = func('0x99530b06', {}, uint256) +export type PricePerShareParams = FunctionArguments +export type PricePerShareReturn = FunctionReturn + +/** redeem(uint256,address,address) */ +export const redeem = func('0xba087652', { + shares: uint256, + receiver: address, + owner: address, +}, uint256) +export type RedeemParams = FunctionArguments +export type RedeemReturn = FunctionReturn + +/** rewardsCycleEnd() */ +export const rewardsCycleEnd = func('0xe7ff69f1', {}, uint32) +export type RewardsCycleEndParams = FunctionArguments +export type RewardsCycleEndReturn = FunctionReturn + +/** rewardsCycleLength() */ +export const rewardsCycleLength = func('0x6fcf5e5f', {}, uint32) +export type RewardsCycleLengthParams = FunctionArguments +export type RewardsCycleLengthReturn = FunctionReturn + +/** symbol() */ +export const symbol = func('0x95d89b41', {}, string) +export type SymbolParams = FunctionArguments +export type SymbolReturn = FunctionReturn + +/** syncRewards() */ +export const syncRewards = func('0x72c0c211', {}) +export type SyncRewardsParams = FunctionArguments +export type SyncRewardsReturn = FunctionReturn + +/** totalAssets() */ +export const totalAssets = func('0x01e1d114', {}, uint256) +export type TotalAssetsParams = FunctionArguments +export type TotalAssetsReturn = FunctionReturn + +/** totalSupply() */ +export const totalSupply = func('0x18160ddd', {}, uint256) +export type TotalSupplyParams = FunctionArguments +export type TotalSupplyReturn = FunctionReturn + +/** transfer(address,uint256) */ +export const transfer = func('0xa9059cbb', { + to: address, + amount: uint256, +}, bool) +export type TransferParams = FunctionArguments +export type TransferReturn = FunctionReturn + +/** transferFrom(address,address,uint256) */ +export const transferFrom = func('0x23b872dd', { + from: address, + to: address, + amount: uint256, +}, bool) +export type TransferFromParams = FunctionArguments +export type TransferFromReturn = FunctionReturn + +/** withdraw(uint256,address,address) */ +export const withdraw = func('0xb460af94', { + assets: uint256, + receiver: address, + owner: address, +}, uint256) +export type WithdrawParams = FunctionArguments +export type WithdrawReturn = FunctionReturn diff --git a/src/abi/sfrx-eth/index.ts b/src/abi/sfrx-eth/index.ts new file mode 100644 index 00000000..11829d6e --- /dev/null +++ b/src/abi/sfrx-eth/index.ts @@ -0,0 +1,4 @@ +export * as events from './events.js' +export * as functions from './functions.js' + +export { Contract } from './contract.js' diff --git a/src/abi/shadow-pair-factory.ts b/src/abi/shadow-pair-factory.ts deleted file mode 100644 index f813d354..00000000 --- a/src/abi/shadow-pair-factory.ts +++ /dev/null @@ -1,190 +0,0 @@ -import * as p from '@subsquid/evm-codec' -import { event, fun, viewFun, indexed, ContractBase } from '@subsquid/evm-abi' -import type { EventParams as EParams, FunctionArguments, FunctionReturn } from '@subsquid/evm-abi' - -export const events = { - FeeSplitWhenNoGauge: event("0x09f29919de9bbce805ed8b6088457163a7508940470e70a1c67a8d58a70b433d", "FeeSplitWhenNoGauge(address,bool)", {"_caller": indexed(p.address), "_status": indexed(p.bool)}), - NewTreasury: event("0x567657fa3f286518b318f4a29870674f433f622fdfc819691acb13105b228225", "NewTreasury(address,address)", {"_caller": indexed(p.address), "_newTreasury": indexed(p.address)}), - PairCreated: event("0x0d3648bd0f6ba80134a33ba9275ac585d9d315f0ad8355cddefde31afa28d0e9", "PairCreated(address,address,address,uint256)", {"token0": indexed(p.address), "token1": indexed(p.address), "pair": p.address, "_3": p.uint256}), - SetFee: event("0x00172ddfc5ae88d08b3de01a5a187667c37a5a53989e8c175055cb6c993792a7", "SetFee(uint256)", {"fee": indexed(p.uint256)}), - SetFeeRecipient: event("0xd9d6b85b6d670cd443496fc6d03390f739bbff47f96a8e33fb0cdd52ad26f5c2", "SetFeeRecipient(address,address)", {"pair": indexed(p.address), "feeRecipient": indexed(p.address)}), - SetFeeSplit: event("0x2b29780fbcadbddb5194d8c2c6a834e1cd71e5a38456738fb1c9d39c7821066b", "SetFeeSplit(uint256)", {"_feeSplit": indexed(p.uint256)}), - SetPairFee: event("0xc792b1e9d2b63c63a75f8146a0b5bd7f568bdd6a0b97b9c31d585398718d4c46", "SetPairFee(address,uint256)", {"pair": indexed(p.address), "fee": indexed(p.uint256)}), - SetPairFeeSplit: event("0x40c433a8082166fcd8218fba9d4247bb08e03016d0056fc857d6363673ded031", "SetPairFeeSplit(address,uint256)", {"pair": indexed(p.address), "_feeSplit": indexed(p.uint256)}), - SkimStatus: event("0x13af6400168c56d7a03760d35e1d3d7e60d3f86c654d857e5c77ed8a83ffc119", "SkimStatus(address,bool)", {"_pair": indexed(p.address), "_status": indexed(p.bool)}), -} - -export const functions = { - MAX_FEE: viewFun("0xbc063e1a", "MAX_FEE()", {}, p.uint256), - accessHub: viewFun("0xe7589b39", "accessHub()", {}, p.address), - allPairs: viewFun("0x1e3dd18b", "allPairs(uint256)", {"_0": p.uint256}, p.address), - allPairsLength: viewFun("0x574f2ba3", "allPairsLength()", {}, p.uint256), - createPair: fun("0x82dfdce4", "createPair(address,address,bool)", {"tokenA": p.address, "tokenB": p.address, "stable": p.bool}, p.address), - fee: viewFun("0xddca3f43", "fee()", {}, p.uint256), - feeRecipientFactory: viewFun("0xd32af6c1", "feeRecipientFactory()", {}, p.address), - feeSplit: viewFun("0x6373ea69", "feeSplit()", {}, p.uint256), - feeSplitWhenNoGauge: viewFun("0x83b274f2", "feeSplitWhenNoGauge()", {}, p.bool), - getPair: viewFun("0x6801cc30", "getPair(address,address,bool)", {"token0": p.address, "token1": p.address, "stable": p.bool}, p.address), - isPair: viewFun("0xe5e31b13", "isPair(address)", {"pair": p.address}, p.bool), - pairCodeHash: viewFun("0x9aab9248", "pairCodeHash()", {}, p.bytes32), - pairFee: viewFun("0x841fa66b", "pairFee(address)", {"_pair": p.address}, p.uint256), - setFee: fun("0x69fe0e2d", "setFee(uint256)", {"_fee": p.uint256}, ), - setFeeRecipient: fun("0x270401cb", "setFeeRecipient(address,address)", {"_pair": p.address, "_feeRecipient": p.address}, ), - setFeeSplit: fun("0xcd962a06", "setFeeSplit(uint256)", {"_feeSplit": p.uint256}, ), - setFeeSplitWhenNoGauge: fun("0x90291058", "setFeeSplitWhenNoGauge(bool)", {"status": p.bool}, ), - setPairFee: fun("0xa93a897d", "setPairFee(address,uint256)", {"_pair": p.address, "_fee": p.uint256}, ), - setPairFeeSplit: fun("0x407c301e", "setPairFeeSplit(address,uint256)", {"_pair": p.address, "_feeSplit": p.uint256}, ), - setSkimEnabled: fun("0xe0bd111d", "setSkimEnabled(address,bool)", {"_pair": p.address, "_status": p.bool}, ), - setTreasury: fun("0xf0f44260", "setTreasury(address)", {"_treasury": p.address}, ), - skimEnabled: viewFun("0xd2b66384", "skimEnabled(address)", {"pair": p.address}, p.bool), - treasury: viewFun("0x61d027b3", "treasury()", {}, p.address), - voter: viewFun("0x46c96aac", "voter()", {}, p.address), -} - -export class Contract extends ContractBase { - - MAX_FEE() { - return this.eth_call(functions.MAX_FEE, {}) - } - - accessHub() { - return this.eth_call(functions.accessHub, {}) - } - - allPairs(_0: AllPairsParams["_0"]) { - return this.eth_call(functions.allPairs, {_0}) - } - - allPairsLength() { - return this.eth_call(functions.allPairsLength, {}) - } - - fee() { - return this.eth_call(functions.fee, {}) - } - - feeRecipientFactory() { - return this.eth_call(functions.feeRecipientFactory, {}) - } - - feeSplit() { - return this.eth_call(functions.feeSplit, {}) - } - - feeSplitWhenNoGauge() { - return this.eth_call(functions.feeSplitWhenNoGauge, {}) - } - - getPair(token0: GetPairParams["token0"], token1: GetPairParams["token1"], stable: GetPairParams["stable"]) { - return this.eth_call(functions.getPair, {token0, token1, stable}) - } - - isPair(pair: IsPairParams["pair"]) { - return this.eth_call(functions.isPair, {pair}) - } - - pairCodeHash() { - return this.eth_call(functions.pairCodeHash, {}) - } - - pairFee(_pair: PairFeeParams["_pair"]) { - return this.eth_call(functions.pairFee, {_pair}) - } - - skimEnabled(pair: SkimEnabledParams["pair"]) { - return this.eth_call(functions.skimEnabled, {pair}) - } - - treasury() { - return this.eth_call(functions.treasury, {}) - } - - voter() { - return this.eth_call(functions.voter, {}) - } -} - -/// Event types -export type FeeSplitWhenNoGaugeEventArgs = EParams -export type NewTreasuryEventArgs = EParams -export type PairCreatedEventArgs = EParams -export type SetFeeEventArgs = EParams -export type SetFeeRecipientEventArgs = EParams -export type SetFeeSplitEventArgs = EParams -export type SetPairFeeEventArgs = EParams -export type SetPairFeeSplitEventArgs = EParams -export type SkimStatusEventArgs = EParams - -/// Function types -export type MAX_FEEParams = FunctionArguments -export type MAX_FEEReturn = FunctionReturn - -export type AccessHubParams = FunctionArguments -export type AccessHubReturn = FunctionReturn - -export type AllPairsParams = FunctionArguments -export type AllPairsReturn = FunctionReturn - -export type AllPairsLengthParams = FunctionArguments -export type AllPairsLengthReturn = FunctionReturn - -export type CreatePairParams = FunctionArguments -export type CreatePairReturn = FunctionReturn - -export type FeeParams = FunctionArguments -export type FeeReturn = FunctionReturn - -export type FeeRecipientFactoryParams = FunctionArguments -export type FeeRecipientFactoryReturn = FunctionReturn - -export type FeeSplitParams = FunctionArguments -export type FeeSplitReturn = FunctionReturn - -export type FeeSplitWhenNoGaugeParams = FunctionArguments -export type FeeSplitWhenNoGaugeReturn = FunctionReturn - -export type GetPairParams = FunctionArguments -export type GetPairReturn = FunctionReturn - -export type IsPairParams = FunctionArguments -export type IsPairReturn = FunctionReturn - -export type PairCodeHashParams = FunctionArguments -export type PairCodeHashReturn = FunctionReturn - -export type PairFeeParams = FunctionArguments -export type PairFeeReturn = FunctionReturn - -export type SetFeeParams = FunctionArguments -export type SetFeeReturn = FunctionReturn - -export type SetFeeRecipientParams = FunctionArguments -export type SetFeeRecipientReturn = FunctionReturn - -export type SetFeeSplitParams = FunctionArguments -export type SetFeeSplitReturn = FunctionReturn - -export type SetFeeSplitWhenNoGaugeParams = FunctionArguments -export type SetFeeSplitWhenNoGaugeReturn = FunctionReturn - -export type SetPairFeeParams = FunctionArguments -export type SetPairFeeReturn = FunctionReturn - -export type SetPairFeeSplitParams = FunctionArguments -export type SetPairFeeSplitReturn = FunctionReturn - -export type SetSkimEnabledParams = FunctionArguments -export type SetSkimEnabledReturn = FunctionReturn - -export type SetTreasuryParams = FunctionArguments -export type SetTreasuryReturn = FunctionReturn - -export type SkimEnabledParams = FunctionArguments -export type SkimEnabledReturn = FunctionReturn - -export type TreasuryParams = FunctionArguments -export type TreasuryReturn = FunctionReturn - -export type VoterParams = FunctionArguments -export type VoterReturn = FunctionReturn - diff --git a/src/abi/shadow-pair-factory/contract.ts b/src/abi/shadow-pair-factory/contract.ts new file mode 100644 index 00000000..43167ef6 --- /dev/null +++ b/src/abi/shadow-pair-factory/contract.ts @@ -0,0 +1,69 @@ +import { ContractBase } from '../abi.support.js' +import { MAX_FEE, accessHub, allPairs, allPairsLength, createPair, fee, feeRecipientFactory, feeSplit, feeSplitWhenNoGauge, getPair, isPair, pairCodeHash, pairFee, skimEnabled, treasury, voter } from './functions.js' +import type { AllPairsParams, CreatePairParams, GetPairParams, IsPairParams, PairFeeParams, SkimEnabledParams } from './functions.js' + +export class Contract extends ContractBase { + MAX_FEE() { + return this.eth_call(MAX_FEE, {}) + } + + accessHub() { + return this.eth_call(accessHub, {}) + } + + allPairs(_0: AllPairsParams["_0"]) { + return this.eth_call(allPairs, {_0}) + } + + allPairsLength() { + return this.eth_call(allPairsLength, {}) + } + + createPair(tokenA: CreatePairParams["tokenA"], tokenB: CreatePairParams["tokenB"], stable: CreatePairParams["stable"]) { + return this.eth_call(createPair, {tokenA, tokenB, stable}) + } + + fee() { + return this.eth_call(fee, {}) + } + + feeRecipientFactory() { + return this.eth_call(feeRecipientFactory, {}) + } + + feeSplit() { + return this.eth_call(feeSplit, {}) + } + + feeSplitWhenNoGauge() { + return this.eth_call(feeSplitWhenNoGauge, {}) + } + + getPair(token0: GetPairParams["token0"], token1: GetPairParams["token1"], stable: GetPairParams["stable"]) { + return this.eth_call(getPair, {token0, token1, stable}) + } + + isPair(pair: IsPairParams["pair"]) { + return this.eth_call(isPair, {pair}) + } + + pairCodeHash() { + return this.eth_call(pairCodeHash, {}) + } + + pairFee(_pair: PairFeeParams["_pair"]) { + return this.eth_call(pairFee, {_pair}) + } + + skimEnabled(pair: SkimEnabledParams["pair"]) { + return this.eth_call(skimEnabled, {pair}) + } + + treasury() { + return this.eth_call(treasury, {}) + } + + voter() { + return this.eth_call(voter, {}) + } +} diff --git a/src/abi/shadow-pair-factory/events.ts b/src/abi/shadow-pair-factory/events.ts new file mode 100644 index 00000000..e8daffe5 --- /dev/null +++ b/src/abi/shadow-pair-factory/events.ts @@ -0,0 +1,66 @@ +import { address, bool, uint256 } from '@subsquid/evm-codec' +import { event, indexed } from '../abi.support.js' +import type { EventParams as EParams } from '../abi.support.js' + +/** FeeSplitWhenNoGauge(address,bool) */ +export const FeeSplitWhenNoGauge = event('0x09f29919de9bbce805ed8b6088457163a7508940470e70a1c67a8d58a70b433d', { + _caller: indexed(address), + _status: indexed(bool), +}) +export type FeeSplitWhenNoGaugeEventArgs = EParams + +/** NewTreasury(address,address) */ +export const NewTreasury = event('0x567657fa3f286518b318f4a29870674f433f622fdfc819691acb13105b228225', { + _caller: indexed(address), + _newTreasury: indexed(address), +}) +export type NewTreasuryEventArgs = EParams + +/** PairCreated(address,address,address,uint256) */ +export const PairCreated = event('0x0d3648bd0f6ba80134a33ba9275ac585d9d315f0ad8355cddefde31afa28d0e9', { + token0: indexed(address), + token1: indexed(address), + pair: address, + _3: uint256, +}) +export type PairCreatedEventArgs = EParams + +/** SetFee(uint256) */ +export const SetFee = event('0x00172ddfc5ae88d08b3de01a5a187667c37a5a53989e8c175055cb6c993792a7', { + fee: indexed(uint256), +}) +export type SetFeeEventArgs = EParams + +/** SetFeeRecipient(address,address) */ +export const SetFeeRecipient = event('0xd9d6b85b6d670cd443496fc6d03390f739bbff47f96a8e33fb0cdd52ad26f5c2', { + pair: indexed(address), + feeRecipient: indexed(address), +}) +export type SetFeeRecipientEventArgs = EParams + +/** SetFeeSplit(uint256) */ +export const SetFeeSplit = event('0x2b29780fbcadbddb5194d8c2c6a834e1cd71e5a38456738fb1c9d39c7821066b', { + _feeSplit: indexed(uint256), +}) +export type SetFeeSplitEventArgs = EParams + +/** SetPairFee(address,uint256) */ +export const SetPairFee = event('0xc792b1e9d2b63c63a75f8146a0b5bd7f568bdd6a0b97b9c31d585398718d4c46', { + pair: indexed(address), + fee: indexed(uint256), +}) +export type SetPairFeeEventArgs = EParams + +/** SetPairFeeSplit(address,uint256) */ +export const SetPairFeeSplit = event('0x40c433a8082166fcd8218fba9d4247bb08e03016d0056fc857d6363673ded031', { + pair: indexed(address), + _feeSplit: indexed(uint256), +}) +export type SetPairFeeSplitEventArgs = EParams + +/** SkimStatus(address,bool) */ +export const SkimStatus = event('0x13af6400168c56d7a03760d35e1d3d7e60d3f86c654d857e5c77ed8a83ffc119', { + _pair: indexed(address), + _status: indexed(bool), +}) +export type SkimStatusEventArgs = EParams diff --git a/src/abi/shadow-pair-factory/functions.ts b/src/abi/shadow-pair-factory/functions.ts new file mode 100644 index 00000000..e7e6a165 --- /dev/null +++ b/src/abi/shadow-pair-factory/functions.ts @@ -0,0 +1,159 @@ +import { address, bool, bytes32, uint256 } from '@subsquid/evm-codec' +import { func } from '../abi.support.js' +import type { FunctionArguments, FunctionReturn } from '../abi.support.js' + +/** MAX_FEE() */ +export const MAX_FEE = func('0xbc063e1a', {}, uint256) +export type MAX_FEEParams = FunctionArguments +export type MAX_FEEReturn = FunctionReturn + +/** accessHub() */ +export const accessHub = func('0xe7589b39', {}, address) +export type AccessHubParams = FunctionArguments +export type AccessHubReturn = FunctionReturn + +/** allPairs(uint256) */ +export const allPairs = func('0x1e3dd18b', { + _0: uint256, +}, address) +export type AllPairsParams = FunctionArguments +export type AllPairsReturn = FunctionReturn + +/** allPairsLength() */ +export const allPairsLength = func('0x574f2ba3', {}, uint256) +export type AllPairsLengthParams = FunctionArguments +export type AllPairsLengthReturn = FunctionReturn + +/** createPair(address,address,bool) */ +export const createPair = func('0x82dfdce4', { + tokenA: address, + tokenB: address, + stable: bool, +}, address) +export type CreatePairParams = FunctionArguments +export type CreatePairReturn = FunctionReturn + +/** fee() */ +export const fee = func('0xddca3f43', {}, uint256) +export type FeeParams = FunctionArguments +export type FeeReturn = FunctionReturn + +/** feeRecipientFactory() */ +export const feeRecipientFactory = func('0xd32af6c1', {}, address) +export type FeeRecipientFactoryParams = FunctionArguments +export type FeeRecipientFactoryReturn = FunctionReturn + +/** feeSplit() */ +export const feeSplit = func('0x6373ea69', {}, uint256) +export type FeeSplitParams = FunctionArguments +export type FeeSplitReturn = FunctionReturn + +/** feeSplitWhenNoGauge() */ +export const feeSplitWhenNoGauge = func('0x83b274f2', {}, bool) +export type FeeSplitWhenNoGaugeParams = FunctionArguments +export type FeeSplitWhenNoGaugeReturn = FunctionReturn + +/** getPair(address,address,bool) */ +export const getPair = func('0x6801cc30', { + token0: address, + token1: address, + stable: bool, +}, address) +export type GetPairParams = FunctionArguments +export type GetPairReturn = FunctionReturn + +/** isPair(address) */ +export const isPair = func('0xe5e31b13', { + pair: address, +}, bool) +export type IsPairParams = FunctionArguments +export type IsPairReturn = FunctionReturn + +/** pairCodeHash() */ +export const pairCodeHash = func('0x9aab9248', {}, bytes32) +export type PairCodeHashParams = FunctionArguments +export type PairCodeHashReturn = FunctionReturn + +/** pairFee(address) */ +export const pairFee = func('0x841fa66b', { + _pair: address, +}, uint256) +export type PairFeeParams = FunctionArguments +export type PairFeeReturn = FunctionReturn + +/** setFee(uint256) */ +export const setFee = func('0x69fe0e2d', { + _fee: uint256, +}) +export type SetFeeParams = FunctionArguments +export type SetFeeReturn = FunctionReturn + +/** setFeeRecipient(address,address) */ +export const setFeeRecipient = func('0x270401cb', { + _pair: address, + _feeRecipient: address, +}) +export type SetFeeRecipientParams = FunctionArguments +export type SetFeeRecipientReturn = FunctionReturn + +/** setFeeSplit(uint256) */ +export const setFeeSplit = func('0xcd962a06', { + _feeSplit: uint256, +}) +export type SetFeeSplitParams = FunctionArguments +export type SetFeeSplitReturn = FunctionReturn + +/** setFeeSplitWhenNoGauge(bool) */ +export const setFeeSplitWhenNoGauge = func('0x90291058', { + status: bool, +}) +export type SetFeeSplitWhenNoGaugeParams = FunctionArguments +export type SetFeeSplitWhenNoGaugeReturn = FunctionReturn + +/** setPairFee(address,uint256) */ +export const setPairFee = func('0xa93a897d', { + _pair: address, + _fee: uint256, +}) +export type SetPairFeeParams = FunctionArguments +export type SetPairFeeReturn = FunctionReturn + +/** setPairFeeSplit(address,uint256) */ +export const setPairFeeSplit = func('0x407c301e', { + _pair: address, + _feeSplit: uint256, +}) +export type SetPairFeeSplitParams = FunctionArguments +export type SetPairFeeSplitReturn = FunctionReturn + +/** setSkimEnabled(address,bool) */ +export const setSkimEnabled = func('0xe0bd111d', { + _pair: address, + _status: bool, +}) +export type SetSkimEnabledParams = FunctionArguments +export type SetSkimEnabledReturn = FunctionReturn + +/** setTreasury(address) */ +export const setTreasury = func('0xf0f44260', { + _treasury: address, +}) +export type SetTreasuryParams = FunctionArguments +export type SetTreasuryReturn = FunctionReturn + +/** skimEnabled(address) */ +export const skimEnabled = func('0xd2b66384', { + pair: address, +}, bool) +export type SkimEnabledParams = FunctionArguments +export type SkimEnabledReturn = FunctionReturn + +/** treasury() */ +export const treasury = func('0x61d027b3', {}, address) +export type TreasuryParams = FunctionArguments +export type TreasuryReturn = FunctionReturn + +/** voter() */ +export const voter = func('0x46c96aac', {}, address) +export type VoterParams = FunctionArguments +export type VoterReturn = FunctionReturn diff --git a/src/abi/shadow-pair-factory/index.ts b/src/abi/shadow-pair-factory/index.ts new file mode 100644 index 00000000..11829d6e --- /dev/null +++ b/src/abi/shadow-pair-factory/index.ts @@ -0,0 +1,4 @@ +export * as events from './events.js' +export * as functions from './functions.js' + +export { Contract } from './contract.js' diff --git a/src/abi/shadow-v3-factory.ts b/src/abi/shadow-v3-factory.ts deleted file mode 100644 index 54154c0f..00000000 --- a/src/abi/shadow-v3-factory.ts +++ /dev/null @@ -1,136 +0,0 @@ -import * as p from '@subsquid/evm-codec' -import { event, fun, viewFun, indexed, ContractBase } from '@subsquid/evm-abi' -import type { EventParams as EParams, FunctionArguments, FunctionReturn } from '@subsquid/evm-abi' - -export const events = { - FeeAdjustment: event("0xe4accbaee82fb833ac207d4c4454c5a04e85f5e1e9a20a9e2c98e54e8706ff2b", "FeeAdjustment(address,uint24)", {"pool": p.address, "newFee": p.uint24}), - FeeCollectorChanged: event("0x649c5e3d0ed183894196148e193af316452b0037e77d2ff0fef23b7dc722bed0", "FeeCollectorChanged(address,address)", {"oldFeeCollector": indexed(p.address), "newFeeCollector": indexed(p.address)}), - PoolCreated: event("0x783cca1c0412dd0d695e784568c96da2e9c22ff989357a2e8b1d9b2b4e6b7118", "PoolCreated(address,address,uint24,int24,address)", {"token0": indexed(p.address), "token1": indexed(p.address), "fee": indexed(p.uint24), "tickSpacing": p.int24, "pool": p.address}), - SetFeeProtocol: event("0x7a8f5b6a3fe6312faf94330e829a331301dbd2ce6947e915be63bf67b473ed5f", "SetFeeProtocol(uint8,uint8)", {"feeProtocolOld": p.uint8, "feeProtocolNew": p.uint8}), - SetPoolFeeProtocol: event("0xa667945ce175575f1ba112f8598cad43210716077bdcabd4d73f2397a81e59bd", "SetPoolFeeProtocol(address,uint8,uint8)", {"pool": p.address, "feeProtocolOld": p.uint8, "feeProtocolNew": p.uint8}), - TickSpacingEnabled: event("0xebafae466a4a780a1d87f5fab2f52fad33be9151a7f69d099e8934c8de85b747", "TickSpacingEnabled(int24,uint24)", {"tickSpacing": indexed(p.int24), "fee": indexed(p.uint24)}), -} - -export const functions = { - accessHub: viewFun("0xe7589b39", "accessHub()", {}, p.address), - createPool: fun("0x232aa5ac", "createPool(address,address,int24,uint160)", {"tokenA": p.address, "tokenB": p.address, "tickSpacing": p.int24, "sqrtPriceX96": p.uint160}, p.address), - enableTickSpacing: fun("0xeee0fdb4", "enableTickSpacing(int24,uint24)", {"tickSpacing": p.int24, "initialFee": p.uint24}, ), - feeCollector: viewFun("0xc415b95c", "feeCollector()", {}, p.address), - feeProtocol: viewFun("0x527eb4bc", "feeProtocol()", {}, p.uint8), - gaugeFeeSplitEnable: fun("0x3cb08b53", "gaugeFeeSplitEnable(address)", {"pool": p.address}, ), - getPool: viewFun("0x28af8d0b", "getPool(address,address,int24)", {"tokenA": p.address, "tokenB": p.address, "tickSpacing": p.int24}, p.address), - initialize: fun("0xc4d66de8", "initialize(address)", {"_ramsesV3PoolDeployer": p.address}, ), - parameters: viewFun("0x89035730", "parameters()", {}, {"factory": p.address, "token0": p.address, "token1": p.address, "fee": p.uint24, "tickSpacing": p.int24}), - poolFeeProtocol: viewFun("0xebb0d9f7", "poolFeeProtocol(address)", {"pool": p.address}, p.uint8), - ramsesV3PoolDeployer: viewFun("0xbf49a292", "ramsesV3PoolDeployer()", {}, p.address), - setFee: fun("0xba364c3d", "setFee(address,uint24)", {"_pool": p.address, "_fee": p.uint24}, ), - setFeeCollector: fun("0xa42dce80", "setFeeCollector(address)", {"_feeCollector": p.address}, ), - setFeeProtocol: fun("0xb613a141", "setFeeProtocol(uint8)", {"_feeProtocol": p.uint8}, ), - setPoolFeeProtocol: fun("0x76734e3e", "setPoolFeeProtocol(address,uint8)", {"pool": p.address, "_feeProtocol": p.uint8}, ), - setVoter: fun("0x4bc2a657", "setVoter(address)", {"_voter": p.address}, ), - tickSpacingInitialFee: viewFun("0xcf3a52a6", "tickSpacingInitialFee(int24)", {"tickSpacing": p.int24}, p.uint24), - voter: viewFun("0x46c96aac", "voter()", {}, p.address), -} - -export class Contract extends ContractBase { - - accessHub() { - return this.eth_call(functions.accessHub, {}) - } - - feeCollector() { - return this.eth_call(functions.feeCollector, {}) - } - - feeProtocol() { - return this.eth_call(functions.feeProtocol, {}) - } - - getPool(tokenA: GetPoolParams["tokenA"], tokenB: GetPoolParams["tokenB"], tickSpacing: GetPoolParams["tickSpacing"]) { - return this.eth_call(functions.getPool, {tokenA, tokenB, tickSpacing}) - } - - parameters() { - return this.eth_call(functions.parameters, {}) - } - - poolFeeProtocol(pool: PoolFeeProtocolParams["pool"]) { - return this.eth_call(functions.poolFeeProtocol, {pool}) - } - - ramsesV3PoolDeployer() { - return this.eth_call(functions.ramsesV3PoolDeployer, {}) - } - - tickSpacingInitialFee(tickSpacing: TickSpacingInitialFeeParams["tickSpacing"]) { - return this.eth_call(functions.tickSpacingInitialFee, {tickSpacing}) - } - - voter() { - return this.eth_call(functions.voter, {}) - } -} - -/// Event types -export type FeeAdjustmentEventArgs = EParams -export type FeeCollectorChangedEventArgs = EParams -export type PoolCreatedEventArgs = EParams -export type SetFeeProtocolEventArgs = EParams -export type SetPoolFeeProtocolEventArgs = EParams -export type TickSpacingEnabledEventArgs = EParams - -/// Function types -export type AccessHubParams = FunctionArguments -export type AccessHubReturn = FunctionReturn - -export type CreatePoolParams = FunctionArguments -export type CreatePoolReturn = FunctionReturn - -export type EnableTickSpacingParams = FunctionArguments -export type EnableTickSpacingReturn = FunctionReturn - -export type FeeCollectorParams = FunctionArguments -export type FeeCollectorReturn = FunctionReturn - -export type FeeProtocolParams = FunctionArguments -export type FeeProtocolReturn = FunctionReturn - -export type GaugeFeeSplitEnableParams = FunctionArguments -export type GaugeFeeSplitEnableReturn = FunctionReturn - -export type GetPoolParams = FunctionArguments -export type GetPoolReturn = FunctionReturn - -export type InitializeParams = FunctionArguments -export type InitializeReturn = FunctionReturn - -export type ParametersParams = FunctionArguments -export type ParametersReturn = FunctionReturn - -export type PoolFeeProtocolParams = FunctionArguments -export type PoolFeeProtocolReturn = FunctionReturn - -export type RamsesV3PoolDeployerParams = FunctionArguments -export type RamsesV3PoolDeployerReturn = FunctionReturn - -export type SetFeeParams = FunctionArguments -export type SetFeeReturn = FunctionReturn - -export type SetFeeCollectorParams = FunctionArguments -export type SetFeeCollectorReturn = FunctionReturn - -export type SetFeeProtocolParams = FunctionArguments -export type SetFeeProtocolReturn = FunctionReturn - -export type SetPoolFeeProtocolParams = FunctionArguments -export type SetPoolFeeProtocolReturn = FunctionReturn - -export type SetVoterParams = FunctionArguments -export type SetVoterReturn = FunctionReturn - -export type TickSpacingInitialFeeParams = FunctionArguments -export type TickSpacingInitialFeeReturn = FunctionReturn - -export type VoterParams = FunctionArguments -export type VoterReturn = FunctionReturn - diff --git a/src/abi/shadow-v3-factory/contract.ts b/src/abi/shadow-v3-factory/contract.ts new file mode 100644 index 00000000..9ea5168b --- /dev/null +++ b/src/abi/shadow-v3-factory/contract.ts @@ -0,0 +1,45 @@ +import { ContractBase } from '../abi.support.js' +import { accessHub, createPool, feeCollector, feeProtocol, getPool, parameters, poolFeeProtocol, ramsesV3PoolDeployer, tickSpacingInitialFee, voter } from './functions.js' +import type { CreatePoolParams, GetPoolParams, PoolFeeProtocolParams, TickSpacingInitialFeeParams } from './functions.js' + +export class Contract extends ContractBase { + accessHub() { + return this.eth_call(accessHub, {}) + } + + createPool(tokenA: CreatePoolParams["tokenA"], tokenB: CreatePoolParams["tokenB"], tickSpacing: CreatePoolParams["tickSpacing"], sqrtPriceX96: CreatePoolParams["sqrtPriceX96"]) { + return this.eth_call(createPool, {tokenA, tokenB, tickSpacing, sqrtPriceX96}) + } + + feeCollector() { + return this.eth_call(feeCollector, {}) + } + + feeProtocol() { + return this.eth_call(feeProtocol, {}) + } + + getPool(tokenA: GetPoolParams["tokenA"], tokenB: GetPoolParams["tokenB"], tickSpacing: GetPoolParams["tickSpacing"]) { + return this.eth_call(getPool, {tokenA, tokenB, tickSpacing}) + } + + parameters() { + return this.eth_call(parameters, {}) + } + + poolFeeProtocol(pool: PoolFeeProtocolParams["pool"]) { + return this.eth_call(poolFeeProtocol, {pool}) + } + + ramsesV3PoolDeployer() { + return this.eth_call(ramsesV3PoolDeployer, {}) + } + + tickSpacingInitialFee(tickSpacing: TickSpacingInitialFeeParams["tickSpacing"]) { + return this.eth_call(tickSpacingInitialFee, {tickSpacing}) + } + + voter() { + return this.eth_call(voter, {}) + } +} diff --git a/src/abi/shadow-v3-factory/events.ts b/src/abi/shadow-v3-factory/events.ts new file mode 100644 index 00000000..7e0db3de --- /dev/null +++ b/src/abi/shadow-v3-factory/events.ts @@ -0,0 +1,49 @@ +import { address, int24, uint24, uint8 } from '@subsquid/evm-codec' +import { event, indexed } from '../abi.support.js' +import type { EventParams as EParams } from '../abi.support.js' + +/** FeeAdjustment(address,uint24) */ +export const FeeAdjustment = event('0xe4accbaee82fb833ac207d4c4454c5a04e85f5e1e9a20a9e2c98e54e8706ff2b', { + pool: address, + newFee: uint24, +}) +export type FeeAdjustmentEventArgs = EParams + +/** FeeCollectorChanged(address,address) */ +export const FeeCollectorChanged = event('0x649c5e3d0ed183894196148e193af316452b0037e77d2ff0fef23b7dc722bed0', { + oldFeeCollector: indexed(address), + newFeeCollector: indexed(address), +}) +export type FeeCollectorChangedEventArgs = EParams + +/** PoolCreated(address,address,uint24,int24,address) */ +export const PoolCreated = event('0x783cca1c0412dd0d695e784568c96da2e9c22ff989357a2e8b1d9b2b4e6b7118', { + token0: indexed(address), + token1: indexed(address), + fee: indexed(uint24), + tickSpacing: int24, + pool: address, +}) +export type PoolCreatedEventArgs = EParams + +/** SetFeeProtocol(uint8,uint8) */ +export const SetFeeProtocol = event('0x7a8f5b6a3fe6312faf94330e829a331301dbd2ce6947e915be63bf67b473ed5f', { + feeProtocolOld: uint8, + feeProtocolNew: uint8, +}) +export type SetFeeProtocolEventArgs = EParams + +/** SetPoolFeeProtocol(address,uint8,uint8) */ +export const SetPoolFeeProtocol = event('0xa667945ce175575f1ba112f8598cad43210716077bdcabd4d73f2397a81e59bd', { + pool: address, + feeProtocolOld: uint8, + feeProtocolNew: uint8, +}) +export type SetPoolFeeProtocolEventArgs = EParams + +/** TickSpacingEnabled(int24,uint24) */ +export const TickSpacingEnabled = event('0xebafae466a4a780a1d87f5fab2f52fad33be9151a7f69d099e8934c8de85b747', { + tickSpacing: indexed(int24), + fee: indexed(uint24), +}) +export type TickSpacingEnabledEventArgs = EParams diff --git a/src/abi/shadow-v3-factory/functions.ts b/src/abi/shadow-v3-factory/functions.ts new file mode 100644 index 00000000..3db46d40 --- /dev/null +++ b/src/abi/shadow-v3-factory/functions.ts @@ -0,0 +1,131 @@ +import { address, int24, struct, uint160, uint24, uint8 } from '@subsquid/evm-codec' +import { func } from '../abi.support.js' +import type { FunctionArguments, FunctionReturn } from '../abi.support.js' + +/** accessHub() */ +export const accessHub = func('0xe7589b39', {}, address) +export type AccessHubParams = FunctionArguments +export type AccessHubReturn = FunctionReturn + +/** createPool(address,address,int24,uint160) */ +export const createPool = func('0x232aa5ac', { + tokenA: address, + tokenB: address, + tickSpacing: int24, + sqrtPriceX96: uint160, +}, address) +export type CreatePoolParams = FunctionArguments +export type CreatePoolReturn = FunctionReturn + +/** enableTickSpacing(int24,uint24) */ +export const enableTickSpacing = func('0xeee0fdb4', { + tickSpacing: int24, + initialFee: uint24, +}) +export type EnableTickSpacingParams = FunctionArguments +export type EnableTickSpacingReturn = FunctionReturn + +/** feeCollector() */ +export const feeCollector = func('0xc415b95c', {}, address) +export type FeeCollectorParams = FunctionArguments +export type FeeCollectorReturn = FunctionReturn + +/** feeProtocol() */ +export const feeProtocol = func('0x527eb4bc', {}, uint8) +export type FeeProtocolParams = FunctionArguments +export type FeeProtocolReturn = FunctionReturn + +/** gaugeFeeSplitEnable(address) */ +export const gaugeFeeSplitEnable = func('0x3cb08b53', { + pool: address, +}) +export type GaugeFeeSplitEnableParams = FunctionArguments +export type GaugeFeeSplitEnableReturn = FunctionReturn + +/** getPool(address,address,int24) */ +export const getPool = func('0x28af8d0b', { + tokenA: address, + tokenB: address, + tickSpacing: int24, +}, address) +export type GetPoolParams = FunctionArguments +export type GetPoolReturn = FunctionReturn + +/** initialize(address) */ +export const initialize = func('0xc4d66de8', { + _ramsesV3PoolDeployer: address, +}) +export type InitializeParams = FunctionArguments +export type InitializeReturn = FunctionReturn + +/** parameters() */ +export const parameters = func('0x89035730', {}, struct({ + factory: address, + token0: address, + token1: address, + fee: uint24, + tickSpacing: int24, +})) +export type ParametersParams = FunctionArguments +export type ParametersReturn = FunctionReturn + +/** poolFeeProtocol(address) */ +export const poolFeeProtocol = func('0xebb0d9f7', { + pool: address, +}, uint8) +export type PoolFeeProtocolParams = FunctionArguments +export type PoolFeeProtocolReturn = FunctionReturn + +/** ramsesV3PoolDeployer() */ +export const ramsesV3PoolDeployer = func('0xbf49a292', {}, address) +export type RamsesV3PoolDeployerParams = FunctionArguments +export type RamsesV3PoolDeployerReturn = FunctionReturn + +/** setFee(address,uint24) */ +export const setFee = func('0xba364c3d', { + _pool: address, + _fee: uint24, +}) +export type SetFeeParams = FunctionArguments +export type SetFeeReturn = FunctionReturn + +/** setFeeCollector(address) */ +export const setFeeCollector = func('0xa42dce80', { + _feeCollector: address, +}) +export type SetFeeCollectorParams = FunctionArguments +export type SetFeeCollectorReturn = FunctionReturn + +/** setFeeProtocol(uint8) */ +export const setFeeProtocol = func('0xb613a141', { + _feeProtocol: uint8, +}) +export type SetFeeProtocolParams = FunctionArguments +export type SetFeeProtocolReturn = FunctionReturn + +/** setPoolFeeProtocol(address,uint8) */ +export const setPoolFeeProtocol = func('0x76734e3e', { + pool: address, + _feeProtocol: uint8, +}) +export type SetPoolFeeProtocolParams = FunctionArguments +export type SetPoolFeeProtocolReturn = FunctionReturn + +/** setVoter(address) */ +export const setVoter = func('0x4bc2a657', { + _voter: address, +}) +export type SetVoterParams = FunctionArguments +export type SetVoterReturn = FunctionReturn + +/** tickSpacingInitialFee(int24) */ +export const tickSpacingInitialFee = func('0xcf3a52a6', { + tickSpacing: int24, +}, uint24) +export type TickSpacingInitialFeeParams = FunctionArguments +export type TickSpacingInitialFeeReturn = FunctionReturn + +/** voter() */ +export const voter = func('0x46c96aac', {}, address) +export type VoterParams = FunctionArguments +export type VoterReturn = FunctionReturn diff --git a/src/abi/shadow-v3-factory/index.ts b/src/abi/shadow-v3-factory/index.ts new file mode 100644 index 00000000..11829d6e --- /dev/null +++ b/src/abi/shadow-v3-factory/index.ts @@ -0,0 +1,4 @@ +export * as events from './events.js' +export * as functions from './functions.js' + +export { Contract } from './contract.js' diff --git a/src/abi/sonic-sfc.ts b/src/abi/sonic-sfc.ts deleted file mode 100644 index 7fe402c9..00000000 --- a/src/abi/sonic-sfc.ts +++ /dev/null @@ -1,472 +0,0 @@ -import * as p from '@subsquid/evm-codec' -import { event, fun, viewFun, indexed, ContractBase } from '@subsquid/evm-abi' -import type { EventParams as EParams, FunctionArguments, FunctionReturn } from '@subsquid/evm-abi' - -export const events = { - AnnouncedRedirection: event("0x857125196131cfcd709c738c6d1fd2701ce70f2a03785aeadae6f4b47fe73c1d", "AnnouncedRedirection(address,address)", {"from": indexed(p.address), "to": indexed(p.address)}), - BurntNativeTokens: event("0x66ac49f046ee1185a59a920bbdfe95faba2bba02afc4b64a97ac35d5d14acc47", "BurntNativeTokens(uint256)", {"amount": p.uint256}), - ChangedValidatorStatus: event("0xcd35267e7654194727477d6c78b541a553483cff7f92a055d17868d3da6e953e", "ChangedValidatorStatus(uint256,uint256)", {"validatorID": indexed(p.uint256), "status": p.uint256}), - ClaimedRewards: event("0x70de20a533702af05c8faf1637846c4586a021bbc71b6928b089b6d555e4fbc2", "ClaimedRewards(address,uint256,uint256)", {"delegator": indexed(p.address), "toValidatorID": indexed(p.uint256), "rewards": p.uint256}), - CreatedValidator: event("0x49bca1ed2666922f9f1690c26a569e1299c2a715fe57647d77e81adfabbf25bf", "CreatedValidator(uint256,address,uint256,uint256)", {"validatorID": indexed(p.uint256), "auth": indexed(p.address), "createdEpoch": p.uint256, "createdTime": p.uint256}), - DeactivatedValidator: event("0xac4801c32a6067ff757446524ee4e7a373797278ac3c883eac5c693b4ad72e47", "DeactivatedValidator(uint256,uint256,uint256)", {"validatorID": indexed(p.uint256), "deactivatedEpoch": p.uint256, "deactivatedTime": p.uint256}), - Delegated: event("0x9a8f44850296624dadfd9c246d17e47171d35727a181bd090aa14bbbe00238bb", "Delegated(address,uint256,uint256)", {"delegator": indexed(p.address), "toValidatorID": indexed(p.uint256), "amount": p.uint256}), - Initialized: event("0xc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2", "Initialized(uint64)", {"version": p.uint64}), - OwnershipTransferred: event("0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", "OwnershipTransferred(address,address)", {"previousOwner": indexed(p.address), "newOwner": indexed(p.address)}), - RefundedSlashedLegacyDelegation: event("0x172fdfaf5222519d28d2794b7617be033f46d954f9b6c3896e7d2611ff444252", "RefundedSlashedLegacyDelegation(address,uint256,uint256)", {"delegator": indexed(p.address), "validatorID": indexed(p.uint256), "amount": p.uint256}), - RestakedRewards: event("0x663e0f63f4fc6b01be195c4b56111fd6f14b947d6264497119b08daf77e26da5", "RestakedRewards(address,uint256,uint256)", {"delegator": indexed(p.address), "toValidatorID": indexed(p.uint256), "rewards": p.uint256}), - TreasuryFeesResolved: event("0x6dd5bb8ebf4cfb647c1cc0e9364ed9ecbf56202f7d3c9f058473df82664478d8", "TreasuryFeesResolved(uint256)", {"amount": p.uint256}), - Undelegated: event("0xd3bb4e423fbea695d16b982f9f682dc5f35152e5411646a8a5a79a6b02ba8d57", "Undelegated(address,uint256,uint256,uint256)", {"delegator": indexed(p.address), "toValidatorID": indexed(p.uint256), "wrID": indexed(p.uint256), "amount": p.uint256}), - UpdatedSlashingRefundRatio: event("0x047575f43f09a7a093d94ec483064acfc61b7e25c0de28017da442abf99cb917", "UpdatedSlashingRefundRatio(uint256,uint256)", {"validatorID": indexed(p.uint256), "refundRatio": p.uint256}), - Upgraded: event("0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", "Upgraded(address)", {"implementation": indexed(p.address)}), - Withdrawn: event("0x94ffd6b85c71b847775c89ef6496b93cee961bdc6ff827fd117f174f06f745ae", "Withdrawn(address,uint256,uint256,uint256,uint256)", {"delegator": indexed(p.address), "toValidatorID": indexed(p.uint256), "wrID": indexed(p.uint256), "amount": p.uint256, "penalty": p.uint256}), -} - -export const functions = { - UPGRADE_INTERFACE_VERSION: viewFun("0xad3cb1cc", "UPGRADE_INTERFACE_VERSION()", {}, p.string), - _syncValidator: fun("0xcc8343aa", "_syncValidator(uint256,bool)", {"validatorID": p.uint256, "syncPubkey": p.bool}, ), - announceRedirection: fun("0x46f1ca35", "announceRedirection(address)", {"to": p.address}, ), - burnNativeTokens: fun("0x850a10c0", "burnNativeTokens()", {}, ), - claimRewards: fun("0x0962ef79", "claimRewards(uint256)", {"toValidatorID": p.uint256}, ), - constsAddress: viewFun("0xd46fa518", "constsAddress()", {}, p.address), - createValidator: fun("0xa5a470ad", "createValidator(bytes)", {"pubkey": p.bytes}, ), - currentEpoch: viewFun("0x76671808", "currentEpoch()", {}, p.uint256), - currentSealedEpoch: viewFun("0x7cacb1d6", "currentSealedEpoch()", {}, p.uint256), - deactivateValidator: fun("0x1e702f83", "deactivateValidator(uint256,uint256)", {"validatorID": p.uint256, "status": p.uint256}, ), - delegate: fun("0x9fa6dd35", "delegate(uint256)", {"toValidatorID": p.uint256}, ), - getEpochAccumulatedOriginatedTxsFee: viewFun("0xdc31e1af", "getEpochAccumulatedOriginatedTxsFee(uint256,uint256)", {"epoch": p.uint256, "validatorID": p.uint256}, p.uint256), - getEpochAccumulatedRewardPerToken: viewFun("0x61e53fcc", "getEpochAccumulatedRewardPerToken(uint256,uint256)", {"epoch": p.uint256, "validatorID": p.uint256}, p.uint256), - getEpochAccumulatedUptime: viewFun("0xdf00c922", "getEpochAccumulatedUptime(uint256,uint256)", {"epoch": p.uint256, "validatorID": p.uint256}, p.uint256), - getEpochAverageUptime: viewFun("0xaa5d8292", "getEpochAverageUptime(uint256,uint256)", {"epoch": p.uint256, "validatorID": p.uint256}, p.uint64), - getEpochEndBlock: viewFun("0xdb5ca3e5", "getEpochEndBlock(uint256)", {"epoch": p.uint256}, p.uint256), - getEpochOfflineBlocks: viewFun("0xa198d229", "getEpochOfflineBlocks(uint256,uint256)", {"epoch": p.uint256, "validatorID": p.uint256}, p.uint256), - getEpochOfflineTime: viewFun("0xe261641a", "getEpochOfflineTime(uint256,uint256)", {"epoch": p.uint256, "validatorID": p.uint256}, p.uint256), - getEpochReceivedStake: viewFun("0x58f95b80", "getEpochReceivedStake(uint256,uint256)", {"epoch": p.uint256, "validatorID": p.uint256}, p.uint256), - getEpochSnapshot: viewFun("0x39b80c00", "getEpochSnapshot(uint256)", {"epoch": p.uint256}, {"endTime": p.uint256, "endBlock": p.uint256, "epochFee": p.uint256, "baseRewardPerSecond": p.uint256, "totalStake": p.uint256, "totalSupply": p.uint256}), - getEpochValidatorIDs: viewFun("0xb88a37e2", "getEpochValidatorIDs(uint256)", {"epoch": p.uint256}, p.array(p.uint256)), - getRedirection: viewFun("0x736de9ae", "getRedirection(address)", {"delegator": p.address}, p.address), - getRedirectionRequest: viewFun("0x468f35ee", "getRedirectionRequest(address)", {"delegator": p.address}, p.address), - getSelfStake: viewFun("0x5601fe01", "getSelfStake(uint256)", {"validatorID": p.uint256}, p.uint256), - getStake: viewFun("0xcfd47663", "getStake(address,uint256)", {"delegator": p.address, "validatorID": p.uint256}, p.uint256), - getValidator: viewFun("0xb5d89627", "getValidator(uint256)", {"validatorID": p.uint256}, {"status": p.uint256, "receivedStake": p.uint256, "auth": p.address, "createdEpoch": p.uint256, "createdTime": p.uint256, "deactivatedTime": p.uint256, "deactivatedEpoch": p.uint256}), - getValidatorID: viewFun("0x0135b1db", "getValidatorID(address)", {"auth": p.address}, p.uint256), - getValidatorPubkey: viewFun("0x854873e1", "getValidatorPubkey(uint256)", {"validatorID": p.uint256}, p.bytes), - getWithdrawalRequest: viewFun("0x1f270152", "getWithdrawalRequest(address,uint256,uint256)", {"delegator": p.address, "validatorID": p.uint256, "wrID": p.uint256}, {"epoch": p.uint256, "time": p.uint256, "amount": p.uint256}), - initialize: fun("0x3fbfd4df", "initialize(uint256,uint256,address,address,address)", {"sealedEpoch": p.uint256, "_totalSupply": p.uint256, "nodeDriver": p.address, "_c": p.address, "owner": p.address}, ), - initiateRedirection: fun("0xcc172784", "initiateRedirection(address,address)", {"from": p.address, "to": p.address}, ), - isSlashed: viewFun("0xc3de580e", "isSlashed(uint256)", {"validatorID": p.uint256}, p.bool), - issueTokens: fun("0xa5820daa", "issueTokens(uint256)", {"amount": p.uint256}, ), - lastValidatorID: viewFun("0xc7be95de", "lastValidatorID()", {}, p.uint256), - owner: viewFun("0x8da5cb5b", "owner()", {}, p.address), - pendingRewards: viewFun("0x6099ecb2", "pendingRewards(address,uint256)", {"delegator": p.address, "toValidatorID": p.uint256}, p.uint256), - proxiableUUID: viewFun("0x52d1902d", "proxiableUUID()", {}, p.bytes32), - pubkeyAddressToValidatorID: viewFun("0xfb36025f", "pubkeyAddressToValidatorID(address)", {"pubkeyAddress": p.address}, p.uint256), - redirect: fun("0xd725e91f", "redirect(address)", {"to": p.address}, ), - redirectionAuthorizer: viewFun("0xe9a505a7", "redirectionAuthorizer()", {}, p.address), - renounceOwnership: fun("0x715018a6", "renounceOwnership()", {}, ), - resolveTreasuryFees: fun("0x84b863e0", "resolveTreasuryFees()", {}, ), - restakeRewards: fun("0x08c36874", "restakeRewards(uint256)", {"toValidatorID": p.uint256}, ), - rewardsStash: viewFun("0x6f498663", "rewardsStash(address,uint256)", {"delegator": p.address, "validatorID": p.uint256}, p.uint256), - sealEpoch: fun("0xebdf104c", "sealEpoch(uint256[],uint256[],uint256[],uint256[])", {"offlineTime": p.array(p.uint256), "offlineBlocks": p.array(p.uint256), "uptimes": p.array(p.uint256), "originatedTxsFee": p.array(p.uint256)}, ), - sealEpochValidators: fun("0xe08d7e66", "sealEpochValidators(uint256[])", {"nextValidatorIDs": p.array(p.uint256)}, ), - setGenesisDelegation: fun("0xa8ab09ba", "setGenesisDelegation(address,uint256,uint256)", {"delegator": p.address, "toValidatorID": p.uint256, "stake": p.uint256}, ), - setGenesisValidator: fun("0x76fed43a", "setGenesisValidator(address,uint256,bytes,uint256)", {"auth": p.address, "validatorID": p.uint256, "pubkey": p.bytes, "createdTime": p.uint256}, ), - setRedirectionAuthorizer: fun("0xb0ef386c", "setRedirectionAuthorizer(address)", {"v": p.address}, ), - slashingRefundRatio: viewFun("0xc65ee0e1", "slashingRefundRatio(uint256)", {"validatorID": p.uint256}, p.uint256), - stakeSubscriberAddress: viewFun("0x093b41d0", "stakeSubscriberAddress()", {}, p.address), - stashRewards: fun("0x8cddb015", "stashRewards(address,uint256)", {"delegator": p.address, "toValidatorID": p.uint256}, ), - stashedRewardsUntilEpoch: viewFun("0xa86a056f", "stashedRewardsUntilEpoch(address,uint256)", {"delegator": p.address, "validatorID": p.uint256}, p.uint256), - totalActiveStake: viewFun("0x28f73148", "totalActiveStake()", {}, p.uint256), - totalStake: viewFun("0x8b0e9f3f", "totalStake()", {}, p.uint256), - totalSupply: viewFun("0x18160ddd", "totalSupply()", {}, p.uint256), - transferOwnership: fun("0xf2fde38b", "transferOwnership(address)", {"newOwner": p.address}, ), - treasuryAddress: viewFun("0xc5f956af", "treasuryAddress()", {}, p.address), - undelegate: fun("0x4f864df4", "undelegate(uint256,uint256,uint256)", {"toValidatorID": p.uint256, "wrID": p.uint256, "amount": p.uint256}, ), - unresolvedTreasuryFees: viewFun("0x8d2da32e", "unresolvedTreasuryFees()", {}, p.uint256), - updateConstsAddress: fun("0x860c2750", "updateConstsAddress(address)", {"v": p.address}, ), - updateSlashingRefundRatio: fun("0x4f7c4efb", "updateSlashingRefundRatio(uint256,uint256)", {"validatorID": p.uint256, "refundRatio": p.uint256}, ), - updateStakeSubscriberAddress: fun("0xe880a159", "updateStakeSubscriberAddress(address)", {"v": p.address}, ), - updateTreasuryAddress: fun("0x841e4561", "updateTreasuryAddress(address)", {"v": p.address}, ), - upgradeToAndCall: fun("0x4f1ef286", "upgradeToAndCall(address,bytes)", {"newImplementation": p.address, "data": p.bytes}, ), - version: viewFun("0x54fd4d50", "version()", {}, p.bytes3), - withdraw: fun("0x441a3e70", "withdraw(uint256,uint256)", {"toValidatorID": p.uint256, "wrID": p.uint256}, ), -} - -export class Contract extends ContractBase { - - UPGRADE_INTERFACE_VERSION() { - return this.eth_call(functions.UPGRADE_INTERFACE_VERSION, {}) - } - - constsAddress() { - return this.eth_call(functions.constsAddress, {}) - } - - currentEpoch() { - return this.eth_call(functions.currentEpoch, {}) - } - - currentSealedEpoch() { - return this.eth_call(functions.currentSealedEpoch, {}) - } - - getEpochAccumulatedOriginatedTxsFee(epoch: GetEpochAccumulatedOriginatedTxsFeeParams["epoch"], validatorID: GetEpochAccumulatedOriginatedTxsFeeParams["validatorID"]) { - return this.eth_call(functions.getEpochAccumulatedOriginatedTxsFee, {epoch, validatorID}) - } - - getEpochAccumulatedRewardPerToken(epoch: GetEpochAccumulatedRewardPerTokenParams["epoch"], validatorID: GetEpochAccumulatedRewardPerTokenParams["validatorID"]) { - return this.eth_call(functions.getEpochAccumulatedRewardPerToken, {epoch, validatorID}) - } - - getEpochAccumulatedUptime(epoch: GetEpochAccumulatedUptimeParams["epoch"], validatorID: GetEpochAccumulatedUptimeParams["validatorID"]) { - return this.eth_call(functions.getEpochAccumulatedUptime, {epoch, validatorID}) - } - - getEpochAverageUptime(epoch: GetEpochAverageUptimeParams["epoch"], validatorID: GetEpochAverageUptimeParams["validatorID"]) { - return this.eth_call(functions.getEpochAverageUptime, {epoch, validatorID}) - } - - getEpochEndBlock(epoch: GetEpochEndBlockParams["epoch"]) { - return this.eth_call(functions.getEpochEndBlock, {epoch}) - } - - getEpochOfflineBlocks(epoch: GetEpochOfflineBlocksParams["epoch"], validatorID: GetEpochOfflineBlocksParams["validatorID"]) { - return this.eth_call(functions.getEpochOfflineBlocks, {epoch, validatorID}) - } - - getEpochOfflineTime(epoch: GetEpochOfflineTimeParams["epoch"], validatorID: GetEpochOfflineTimeParams["validatorID"]) { - return this.eth_call(functions.getEpochOfflineTime, {epoch, validatorID}) - } - - getEpochReceivedStake(epoch: GetEpochReceivedStakeParams["epoch"], validatorID: GetEpochReceivedStakeParams["validatorID"]) { - return this.eth_call(functions.getEpochReceivedStake, {epoch, validatorID}) - } - - getEpochSnapshot(epoch: GetEpochSnapshotParams["epoch"]) { - return this.eth_call(functions.getEpochSnapshot, {epoch}) - } - - getEpochValidatorIDs(epoch: GetEpochValidatorIDsParams["epoch"]) { - return this.eth_call(functions.getEpochValidatorIDs, {epoch}) - } - - getRedirection(delegator: GetRedirectionParams["delegator"]) { - return this.eth_call(functions.getRedirection, {delegator}) - } - - getRedirectionRequest(delegator: GetRedirectionRequestParams["delegator"]) { - return this.eth_call(functions.getRedirectionRequest, {delegator}) - } - - getSelfStake(validatorID: GetSelfStakeParams["validatorID"]) { - return this.eth_call(functions.getSelfStake, {validatorID}) - } - - getStake(delegator: GetStakeParams["delegator"], validatorID: GetStakeParams["validatorID"]) { - return this.eth_call(functions.getStake, {delegator, validatorID}) - } - - getValidator(validatorID: GetValidatorParams["validatorID"]) { - return this.eth_call(functions.getValidator, {validatorID}) - } - - getValidatorID(auth: GetValidatorIDParams["auth"]) { - return this.eth_call(functions.getValidatorID, {auth}) - } - - getValidatorPubkey(validatorID: GetValidatorPubkeyParams["validatorID"]) { - return this.eth_call(functions.getValidatorPubkey, {validatorID}) - } - - getWithdrawalRequest(delegator: GetWithdrawalRequestParams["delegator"], validatorID: GetWithdrawalRequestParams["validatorID"], wrID: GetWithdrawalRequestParams["wrID"]) { - return this.eth_call(functions.getWithdrawalRequest, {delegator, validatorID, wrID}) - } - - isSlashed(validatorID: IsSlashedParams["validatorID"]) { - return this.eth_call(functions.isSlashed, {validatorID}) - } - - lastValidatorID() { - return this.eth_call(functions.lastValidatorID, {}) - } - - owner() { - return this.eth_call(functions.owner, {}) - } - - pendingRewards(delegator: PendingRewardsParams["delegator"], toValidatorID: PendingRewardsParams["toValidatorID"]) { - return this.eth_call(functions.pendingRewards, {delegator, toValidatorID}) - } - - proxiableUUID() { - return this.eth_call(functions.proxiableUUID, {}) - } - - pubkeyAddressToValidatorID(pubkeyAddress: PubkeyAddressToValidatorIDParams["pubkeyAddress"]) { - return this.eth_call(functions.pubkeyAddressToValidatorID, {pubkeyAddress}) - } - - redirectionAuthorizer() { - return this.eth_call(functions.redirectionAuthorizer, {}) - } - - rewardsStash(delegator: RewardsStashParams["delegator"], validatorID: RewardsStashParams["validatorID"]) { - return this.eth_call(functions.rewardsStash, {delegator, validatorID}) - } - - slashingRefundRatio(validatorID: SlashingRefundRatioParams["validatorID"]) { - return this.eth_call(functions.slashingRefundRatio, {validatorID}) - } - - stakeSubscriberAddress() { - return this.eth_call(functions.stakeSubscriberAddress, {}) - } - - stashedRewardsUntilEpoch(delegator: StashedRewardsUntilEpochParams["delegator"], validatorID: StashedRewardsUntilEpochParams["validatorID"]) { - return this.eth_call(functions.stashedRewardsUntilEpoch, {delegator, validatorID}) - } - - totalActiveStake() { - return this.eth_call(functions.totalActiveStake, {}) - } - - totalStake() { - return this.eth_call(functions.totalStake, {}) - } - - totalSupply() { - return this.eth_call(functions.totalSupply, {}) - } - - treasuryAddress() { - return this.eth_call(functions.treasuryAddress, {}) - } - - unresolvedTreasuryFees() { - return this.eth_call(functions.unresolvedTreasuryFees, {}) - } - - version() { - return this.eth_call(functions.version, {}) - } -} - -/// Event types -export type AnnouncedRedirectionEventArgs = EParams -export type BurntNativeTokensEventArgs = EParams -export type ChangedValidatorStatusEventArgs = EParams -export type ClaimedRewardsEventArgs = EParams -export type CreatedValidatorEventArgs = EParams -export type DeactivatedValidatorEventArgs = EParams -export type DelegatedEventArgs = EParams -export type InitializedEventArgs = EParams -export type OwnershipTransferredEventArgs = EParams -export type RefundedSlashedLegacyDelegationEventArgs = EParams -export type RestakedRewardsEventArgs = EParams -export type TreasuryFeesResolvedEventArgs = EParams -export type UndelegatedEventArgs = EParams -export type UpdatedSlashingRefundRatioEventArgs = EParams -export type UpgradedEventArgs = EParams -export type WithdrawnEventArgs = EParams - -/// Function types -export type UPGRADE_INTERFACE_VERSIONParams = FunctionArguments -export type UPGRADE_INTERFACE_VERSIONReturn = FunctionReturn - -export type _syncValidatorParams = FunctionArguments -export type _syncValidatorReturn = FunctionReturn - -export type AnnounceRedirectionParams = FunctionArguments -export type AnnounceRedirectionReturn = FunctionReturn - -export type BurnNativeTokensParams = FunctionArguments -export type BurnNativeTokensReturn = FunctionReturn - -export type ClaimRewardsParams = FunctionArguments -export type ClaimRewardsReturn = FunctionReturn - -export type ConstsAddressParams = FunctionArguments -export type ConstsAddressReturn = FunctionReturn - -export type CreateValidatorParams = FunctionArguments -export type CreateValidatorReturn = FunctionReturn - -export type CurrentEpochParams = FunctionArguments -export type CurrentEpochReturn = FunctionReturn - -export type CurrentSealedEpochParams = FunctionArguments -export type CurrentSealedEpochReturn = FunctionReturn - -export type DeactivateValidatorParams = FunctionArguments -export type DeactivateValidatorReturn = FunctionReturn - -export type DelegateParams = FunctionArguments -export type DelegateReturn = FunctionReturn - -export type GetEpochAccumulatedOriginatedTxsFeeParams = FunctionArguments -export type GetEpochAccumulatedOriginatedTxsFeeReturn = FunctionReturn - -export type GetEpochAccumulatedRewardPerTokenParams = FunctionArguments -export type GetEpochAccumulatedRewardPerTokenReturn = FunctionReturn - -export type GetEpochAccumulatedUptimeParams = FunctionArguments -export type GetEpochAccumulatedUptimeReturn = FunctionReturn - -export type GetEpochAverageUptimeParams = FunctionArguments -export type GetEpochAverageUptimeReturn = FunctionReturn - -export type GetEpochEndBlockParams = FunctionArguments -export type GetEpochEndBlockReturn = FunctionReturn - -export type GetEpochOfflineBlocksParams = FunctionArguments -export type GetEpochOfflineBlocksReturn = FunctionReturn - -export type GetEpochOfflineTimeParams = FunctionArguments -export type GetEpochOfflineTimeReturn = FunctionReturn - -export type GetEpochReceivedStakeParams = FunctionArguments -export type GetEpochReceivedStakeReturn = FunctionReturn - -export type GetEpochSnapshotParams = FunctionArguments -export type GetEpochSnapshotReturn = FunctionReturn - -export type GetEpochValidatorIDsParams = FunctionArguments -export type GetEpochValidatorIDsReturn = FunctionReturn - -export type GetRedirectionParams = FunctionArguments -export type GetRedirectionReturn = FunctionReturn - -export type GetRedirectionRequestParams = FunctionArguments -export type GetRedirectionRequestReturn = FunctionReturn - -export type GetSelfStakeParams = FunctionArguments -export type GetSelfStakeReturn = FunctionReturn - -export type GetStakeParams = FunctionArguments -export type GetStakeReturn = FunctionReturn - -export type GetValidatorParams = FunctionArguments -export type GetValidatorReturn = FunctionReturn - -export type GetValidatorIDParams = FunctionArguments -export type GetValidatorIDReturn = FunctionReturn - -export type GetValidatorPubkeyParams = FunctionArguments -export type GetValidatorPubkeyReturn = FunctionReturn - -export type GetWithdrawalRequestParams = FunctionArguments -export type GetWithdrawalRequestReturn = FunctionReturn - -export type InitializeParams = FunctionArguments -export type InitializeReturn = FunctionReturn - -export type InitiateRedirectionParams = FunctionArguments -export type InitiateRedirectionReturn = FunctionReturn - -export type IsSlashedParams = FunctionArguments -export type IsSlashedReturn = FunctionReturn - -export type IssueTokensParams = FunctionArguments -export type IssueTokensReturn = FunctionReturn - -export type LastValidatorIDParams = FunctionArguments -export type LastValidatorIDReturn = FunctionReturn - -export type OwnerParams = FunctionArguments -export type OwnerReturn = FunctionReturn - -export type PendingRewardsParams = FunctionArguments -export type PendingRewardsReturn = FunctionReturn - -export type ProxiableUUIDParams = FunctionArguments -export type ProxiableUUIDReturn = FunctionReturn - -export type PubkeyAddressToValidatorIDParams = FunctionArguments -export type PubkeyAddressToValidatorIDReturn = FunctionReturn - -export type RedirectParams = FunctionArguments -export type RedirectReturn = FunctionReturn - -export type RedirectionAuthorizerParams = FunctionArguments -export type RedirectionAuthorizerReturn = FunctionReturn - -export type RenounceOwnershipParams = FunctionArguments -export type RenounceOwnershipReturn = FunctionReturn - -export type ResolveTreasuryFeesParams = FunctionArguments -export type ResolveTreasuryFeesReturn = FunctionReturn - -export type RestakeRewardsParams = FunctionArguments -export type RestakeRewardsReturn = FunctionReturn - -export type RewardsStashParams = FunctionArguments -export type RewardsStashReturn = FunctionReturn - -export type SealEpochParams = FunctionArguments -export type SealEpochReturn = FunctionReturn - -export type SealEpochValidatorsParams = FunctionArguments -export type SealEpochValidatorsReturn = FunctionReturn - -export type SetGenesisDelegationParams = FunctionArguments -export type SetGenesisDelegationReturn = FunctionReturn - -export type SetGenesisValidatorParams = FunctionArguments -export type SetGenesisValidatorReturn = FunctionReturn - -export type SetRedirectionAuthorizerParams = FunctionArguments -export type SetRedirectionAuthorizerReturn = FunctionReturn - -export type SlashingRefundRatioParams = FunctionArguments -export type SlashingRefundRatioReturn = FunctionReturn - -export type StakeSubscriberAddressParams = FunctionArguments -export type StakeSubscriberAddressReturn = FunctionReturn - -export type StashRewardsParams = FunctionArguments -export type StashRewardsReturn = FunctionReturn - -export type StashedRewardsUntilEpochParams = FunctionArguments -export type StashedRewardsUntilEpochReturn = FunctionReturn - -export type TotalActiveStakeParams = FunctionArguments -export type TotalActiveStakeReturn = FunctionReturn - -export type TotalStakeParams = FunctionArguments -export type TotalStakeReturn = FunctionReturn - -export type TotalSupplyParams = FunctionArguments -export type TotalSupplyReturn = FunctionReturn - -export type TransferOwnershipParams = FunctionArguments -export type TransferOwnershipReturn = FunctionReturn - -export type TreasuryAddressParams = FunctionArguments -export type TreasuryAddressReturn = FunctionReturn - -export type UndelegateParams = FunctionArguments -export type UndelegateReturn = FunctionReturn - -export type UnresolvedTreasuryFeesParams = FunctionArguments -export type UnresolvedTreasuryFeesReturn = FunctionReturn - -export type UpdateConstsAddressParams = FunctionArguments -export type UpdateConstsAddressReturn = FunctionReturn - -export type UpdateSlashingRefundRatioParams = FunctionArguments -export type UpdateSlashingRefundRatioReturn = FunctionReturn - -export type UpdateStakeSubscriberAddressParams = FunctionArguments -export type UpdateStakeSubscriberAddressReturn = FunctionReturn - -export type UpdateTreasuryAddressParams = FunctionArguments -export type UpdateTreasuryAddressReturn = FunctionReturn - -export type UpgradeToAndCallParams = FunctionArguments -export type UpgradeToAndCallReturn = FunctionReturn - -export type VersionParams = FunctionArguments -export type VersionReturn = FunctionReturn - -export type WithdrawParams = FunctionArguments -export type WithdrawReturn = FunctionReturn - diff --git a/src/abi/sonic-sfc/contract.ts b/src/abi/sonic-sfc/contract.ts new file mode 100644 index 00000000..add3030f --- /dev/null +++ b/src/abi/sonic-sfc/contract.ts @@ -0,0 +1,161 @@ +import { ContractBase } from '../abi.support.js' +import { UPGRADE_INTERFACE_VERSION, constsAddress, currentEpoch, currentSealedEpoch, getEpochAccumulatedOriginatedTxsFee, getEpochAccumulatedRewardPerToken, getEpochAccumulatedUptime, getEpochAverageUptime, getEpochEndBlock, getEpochOfflineBlocks, getEpochOfflineTime, getEpochReceivedStake, getEpochSnapshot, getEpochValidatorIDs, getRedirection, getRedirectionRequest, getSelfStake, getStake, getValidator, getValidatorID, getValidatorPubkey, getWithdrawalRequest, isSlashed, lastValidatorID, owner, pendingRewards, proxiableUUID, pubkeyAddressToValidatorID, redirectionAuthorizer, rewardsStash, slashingRefundRatio, stakeSubscriberAddress, stashedRewardsUntilEpoch, totalActiveStake, totalStake, totalSupply, treasuryAddress, unresolvedTreasuryFees, version } from './functions.js' +import type { GetEpochAccumulatedOriginatedTxsFeeParams, GetEpochAccumulatedRewardPerTokenParams, GetEpochAccumulatedUptimeParams, GetEpochAverageUptimeParams, GetEpochEndBlockParams, GetEpochOfflineBlocksParams, GetEpochOfflineTimeParams, GetEpochReceivedStakeParams, GetEpochSnapshotParams, GetEpochValidatorIDsParams, GetRedirectionParams, GetRedirectionRequestParams, GetSelfStakeParams, GetStakeParams, GetValidatorIDParams, GetValidatorParams, GetValidatorPubkeyParams, GetWithdrawalRequestParams, IsSlashedParams, PendingRewardsParams, PubkeyAddressToValidatorIDParams, RewardsStashParams, SlashingRefundRatioParams, StashedRewardsUntilEpochParams } from './functions.js' + +export class Contract extends ContractBase { + UPGRADE_INTERFACE_VERSION() { + return this.eth_call(UPGRADE_INTERFACE_VERSION, {}) + } + + constsAddress() { + return this.eth_call(constsAddress, {}) + } + + currentEpoch() { + return this.eth_call(currentEpoch, {}) + } + + currentSealedEpoch() { + return this.eth_call(currentSealedEpoch, {}) + } + + getEpochAccumulatedOriginatedTxsFee(epoch: GetEpochAccumulatedOriginatedTxsFeeParams["epoch"], validatorID: GetEpochAccumulatedOriginatedTxsFeeParams["validatorID"]) { + return this.eth_call(getEpochAccumulatedOriginatedTxsFee, {epoch, validatorID}) + } + + getEpochAccumulatedRewardPerToken(epoch: GetEpochAccumulatedRewardPerTokenParams["epoch"], validatorID: GetEpochAccumulatedRewardPerTokenParams["validatorID"]) { + return this.eth_call(getEpochAccumulatedRewardPerToken, {epoch, validatorID}) + } + + getEpochAccumulatedUptime(epoch: GetEpochAccumulatedUptimeParams["epoch"], validatorID: GetEpochAccumulatedUptimeParams["validatorID"]) { + return this.eth_call(getEpochAccumulatedUptime, {epoch, validatorID}) + } + + getEpochAverageUptime(epoch: GetEpochAverageUptimeParams["epoch"], validatorID: GetEpochAverageUptimeParams["validatorID"]) { + return this.eth_call(getEpochAverageUptime, {epoch, validatorID}) + } + + getEpochEndBlock(epoch: GetEpochEndBlockParams["epoch"]) { + return this.eth_call(getEpochEndBlock, {epoch}) + } + + getEpochOfflineBlocks(epoch: GetEpochOfflineBlocksParams["epoch"], validatorID: GetEpochOfflineBlocksParams["validatorID"]) { + return this.eth_call(getEpochOfflineBlocks, {epoch, validatorID}) + } + + getEpochOfflineTime(epoch: GetEpochOfflineTimeParams["epoch"], validatorID: GetEpochOfflineTimeParams["validatorID"]) { + return this.eth_call(getEpochOfflineTime, {epoch, validatorID}) + } + + getEpochReceivedStake(epoch: GetEpochReceivedStakeParams["epoch"], validatorID: GetEpochReceivedStakeParams["validatorID"]) { + return this.eth_call(getEpochReceivedStake, {epoch, validatorID}) + } + + getEpochSnapshot(epoch: GetEpochSnapshotParams["epoch"]) { + return this.eth_call(getEpochSnapshot, {epoch}) + } + + getEpochValidatorIDs(epoch: GetEpochValidatorIDsParams["epoch"]) { + return this.eth_call(getEpochValidatorIDs, {epoch}) + } + + getRedirection(delegator: GetRedirectionParams["delegator"]) { + return this.eth_call(getRedirection, {delegator}) + } + + getRedirectionRequest(delegator: GetRedirectionRequestParams["delegator"]) { + return this.eth_call(getRedirectionRequest, {delegator}) + } + + getSelfStake(validatorID: GetSelfStakeParams["validatorID"]) { + return this.eth_call(getSelfStake, {validatorID}) + } + + getStake(delegator: GetStakeParams["delegator"], validatorID: GetStakeParams["validatorID"]) { + return this.eth_call(getStake, {delegator, validatorID}) + } + + getValidator(validatorID: GetValidatorParams["validatorID"]) { + return this.eth_call(getValidator, {validatorID}) + } + + getValidatorID(auth: GetValidatorIDParams["auth"]) { + return this.eth_call(getValidatorID, {auth}) + } + + getValidatorPubkey(validatorID: GetValidatorPubkeyParams["validatorID"]) { + return this.eth_call(getValidatorPubkey, {validatorID}) + } + + getWithdrawalRequest(delegator: GetWithdrawalRequestParams["delegator"], validatorID: GetWithdrawalRequestParams["validatorID"], wrID: GetWithdrawalRequestParams["wrID"]) { + return this.eth_call(getWithdrawalRequest, {delegator, validatorID, wrID}) + } + + isSlashed(validatorID: IsSlashedParams["validatorID"]) { + return this.eth_call(isSlashed, {validatorID}) + } + + lastValidatorID() { + return this.eth_call(lastValidatorID, {}) + } + + owner() { + return this.eth_call(owner, {}) + } + + pendingRewards(delegator: PendingRewardsParams["delegator"], toValidatorID: PendingRewardsParams["toValidatorID"]) { + return this.eth_call(pendingRewards, {delegator, toValidatorID}) + } + + proxiableUUID() { + return this.eth_call(proxiableUUID, {}) + } + + pubkeyAddressToValidatorID(pubkeyAddress: PubkeyAddressToValidatorIDParams["pubkeyAddress"]) { + return this.eth_call(pubkeyAddressToValidatorID, {pubkeyAddress}) + } + + redirectionAuthorizer() { + return this.eth_call(redirectionAuthorizer, {}) + } + + rewardsStash(delegator: RewardsStashParams["delegator"], validatorID: RewardsStashParams["validatorID"]) { + return this.eth_call(rewardsStash, {delegator, validatorID}) + } + + slashingRefundRatio(validatorID: SlashingRefundRatioParams["validatorID"]) { + return this.eth_call(slashingRefundRatio, {validatorID}) + } + + stakeSubscriberAddress() { + return this.eth_call(stakeSubscriberAddress, {}) + } + + stashedRewardsUntilEpoch(delegator: StashedRewardsUntilEpochParams["delegator"], validatorID: StashedRewardsUntilEpochParams["validatorID"]) { + return this.eth_call(stashedRewardsUntilEpoch, {delegator, validatorID}) + } + + totalActiveStake() { + return this.eth_call(totalActiveStake, {}) + } + + totalStake() { + return this.eth_call(totalStake, {}) + } + + totalSupply() { + return this.eth_call(totalSupply, {}) + } + + treasuryAddress() { + return this.eth_call(treasuryAddress, {}) + } + + unresolvedTreasuryFees() { + return this.eth_call(unresolvedTreasuryFees, {}) + } + + version() { + return this.eth_call(version, {}) + } +} diff --git a/src/abi/sonic-sfc/events.ts b/src/abi/sonic-sfc/events.ts new file mode 100644 index 00000000..2954f91a --- /dev/null +++ b/src/abi/sonic-sfc/events.ts @@ -0,0 +1,123 @@ +import { address, uint256, uint64 } from '@subsquid/evm-codec' +import { event, indexed } from '../abi.support.js' +import type { EventParams as EParams } from '../abi.support.js' + +/** AnnouncedRedirection(address,address) */ +export const AnnouncedRedirection = event('0x857125196131cfcd709c738c6d1fd2701ce70f2a03785aeadae6f4b47fe73c1d', { + from: indexed(address), + to: indexed(address), +}) +export type AnnouncedRedirectionEventArgs = EParams + +/** BurntNativeTokens(uint256) */ +export const BurntNativeTokens = event('0x66ac49f046ee1185a59a920bbdfe95faba2bba02afc4b64a97ac35d5d14acc47', { + amount: uint256, +}) +export type BurntNativeTokensEventArgs = EParams + +/** ChangedValidatorStatus(uint256,uint256) */ +export const ChangedValidatorStatus = event('0xcd35267e7654194727477d6c78b541a553483cff7f92a055d17868d3da6e953e', { + validatorID: indexed(uint256), + status: uint256, +}) +export type ChangedValidatorStatusEventArgs = EParams + +/** ClaimedRewards(address,uint256,uint256) */ +export const ClaimedRewards = event('0x70de20a533702af05c8faf1637846c4586a021bbc71b6928b089b6d555e4fbc2', { + delegator: indexed(address), + toValidatorID: indexed(uint256), + rewards: uint256, +}) +export type ClaimedRewardsEventArgs = EParams + +/** CreatedValidator(uint256,address,uint256,uint256) */ +export const CreatedValidator = event('0x49bca1ed2666922f9f1690c26a569e1299c2a715fe57647d77e81adfabbf25bf', { + validatorID: indexed(uint256), + auth: indexed(address), + createdEpoch: uint256, + createdTime: uint256, +}) +export type CreatedValidatorEventArgs = EParams + +/** DeactivatedValidator(uint256,uint256,uint256) */ +export const DeactivatedValidator = event('0xac4801c32a6067ff757446524ee4e7a373797278ac3c883eac5c693b4ad72e47', { + validatorID: indexed(uint256), + deactivatedEpoch: uint256, + deactivatedTime: uint256, +}) +export type DeactivatedValidatorEventArgs = EParams + +/** Delegated(address,uint256,uint256) */ +export const Delegated = event('0x9a8f44850296624dadfd9c246d17e47171d35727a181bd090aa14bbbe00238bb', { + delegator: indexed(address), + toValidatorID: indexed(uint256), + amount: uint256, +}) +export type DelegatedEventArgs = EParams + +/** Initialized(uint64) */ +export const Initialized = event('0xc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2', { + version: uint64, +}) +export type InitializedEventArgs = EParams + +/** OwnershipTransferred(address,address) */ +export const OwnershipTransferred = event('0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0', { + previousOwner: indexed(address), + newOwner: indexed(address), +}) +export type OwnershipTransferredEventArgs = EParams + +/** RefundedSlashedLegacyDelegation(address,uint256,uint256) */ +export const RefundedSlashedLegacyDelegation = event('0x172fdfaf5222519d28d2794b7617be033f46d954f9b6c3896e7d2611ff444252', { + delegator: indexed(address), + validatorID: indexed(uint256), + amount: uint256, +}) +export type RefundedSlashedLegacyDelegationEventArgs = EParams + +/** RestakedRewards(address,uint256,uint256) */ +export const RestakedRewards = event('0x663e0f63f4fc6b01be195c4b56111fd6f14b947d6264497119b08daf77e26da5', { + delegator: indexed(address), + toValidatorID: indexed(uint256), + rewards: uint256, +}) +export type RestakedRewardsEventArgs = EParams + +/** TreasuryFeesResolved(uint256) */ +export const TreasuryFeesResolved = event('0x6dd5bb8ebf4cfb647c1cc0e9364ed9ecbf56202f7d3c9f058473df82664478d8', { + amount: uint256, +}) +export type TreasuryFeesResolvedEventArgs = EParams + +/** Undelegated(address,uint256,uint256,uint256) */ +export const Undelegated = event('0xd3bb4e423fbea695d16b982f9f682dc5f35152e5411646a8a5a79a6b02ba8d57', { + delegator: indexed(address), + toValidatorID: indexed(uint256), + wrID: indexed(uint256), + amount: uint256, +}) +export type UndelegatedEventArgs = EParams + +/** UpdatedSlashingRefundRatio(uint256,uint256) */ +export const UpdatedSlashingRefundRatio = event('0x047575f43f09a7a093d94ec483064acfc61b7e25c0de28017da442abf99cb917', { + validatorID: indexed(uint256), + refundRatio: uint256, +}) +export type UpdatedSlashingRefundRatioEventArgs = EParams + +/** Upgraded(address) */ +export const Upgraded = event('0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b', { + implementation: indexed(address), +}) +export type UpgradedEventArgs = EParams + +/** Withdrawn(address,uint256,uint256,uint256,uint256) */ +export const Withdrawn = event('0x94ffd6b85c71b847775c89ef6496b93cee961bdc6ff827fd117f174f06f745ae', { + delegator: indexed(address), + toValidatorID: indexed(uint256), + wrID: indexed(uint256), + amount: uint256, + penalty: uint256, +}) +export type WithdrawnEventArgs = EParams diff --git a/src/abi/sonic-sfc/functions.ts b/src/abi/sonic-sfc/functions.ts new file mode 100644 index 00000000..b7586498 --- /dev/null +++ b/src/abi/sonic-sfc/functions.ts @@ -0,0 +1,489 @@ +import { address, array, bool, bytes, bytes3, bytes32, string, struct, uint256, uint64 } from '@subsquid/evm-codec' +import { func } from '../abi.support.js' +import type { FunctionArguments, FunctionReturn } from '../abi.support.js' + +/** UPGRADE_INTERFACE_VERSION() */ +export const UPGRADE_INTERFACE_VERSION = func('0xad3cb1cc', {}, string) +export type UPGRADE_INTERFACE_VERSIONParams = FunctionArguments +export type UPGRADE_INTERFACE_VERSIONReturn = FunctionReturn + +/** _syncValidator(uint256,bool) */ +export const _syncValidator = func('0xcc8343aa', { + validatorID: uint256, + syncPubkey: bool, +}) +export type _syncValidatorParams = FunctionArguments +export type _syncValidatorReturn = FunctionReturn + +/** announceRedirection(address) */ +export const announceRedirection = func('0x46f1ca35', { + to: address, +}) +export type AnnounceRedirectionParams = FunctionArguments +export type AnnounceRedirectionReturn = FunctionReturn + +/** burnNativeTokens() */ +export const burnNativeTokens = func('0x850a10c0', {}) +export type BurnNativeTokensParams = FunctionArguments +export type BurnNativeTokensReturn = FunctionReturn + +/** claimRewards(uint256) */ +export const claimRewards = func('0x0962ef79', { + toValidatorID: uint256, +}) +export type ClaimRewardsParams = FunctionArguments +export type ClaimRewardsReturn = FunctionReturn + +/** constsAddress() */ +export const constsAddress = func('0xd46fa518', {}, address) +export type ConstsAddressParams = FunctionArguments +export type ConstsAddressReturn = FunctionReturn + +/** createValidator(bytes) */ +export const createValidator = func('0xa5a470ad', { + pubkey: bytes, +}) +export type CreateValidatorParams = FunctionArguments +export type CreateValidatorReturn = FunctionReturn + +/** currentEpoch() */ +export const currentEpoch = func('0x76671808', {}, uint256) +export type CurrentEpochParams = FunctionArguments +export type CurrentEpochReturn = FunctionReturn + +/** currentSealedEpoch() */ +export const currentSealedEpoch = func('0x7cacb1d6', {}, uint256) +export type CurrentSealedEpochParams = FunctionArguments +export type CurrentSealedEpochReturn = FunctionReturn + +/** deactivateValidator(uint256,uint256) */ +export const deactivateValidator = func('0x1e702f83', { + validatorID: uint256, + status: uint256, +}) +export type DeactivateValidatorParams = FunctionArguments +export type DeactivateValidatorReturn = FunctionReturn + +/** delegate(uint256) */ +export const delegate = func('0x9fa6dd35', { + toValidatorID: uint256, +}) +export type DelegateParams = FunctionArguments +export type DelegateReturn = FunctionReturn + +/** getEpochAccumulatedOriginatedTxsFee(uint256,uint256) */ +export const getEpochAccumulatedOriginatedTxsFee = func('0xdc31e1af', { + epoch: uint256, + validatorID: uint256, +}, uint256) +export type GetEpochAccumulatedOriginatedTxsFeeParams = FunctionArguments +export type GetEpochAccumulatedOriginatedTxsFeeReturn = FunctionReturn + +/** getEpochAccumulatedRewardPerToken(uint256,uint256) */ +export const getEpochAccumulatedRewardPerToken = func('0x61e53fcc', { + epoch: uint256, + validatorID: uint256, +}, uint256) +export type GetEpochAccumulatedRewardPerTokenParams = FunctionArguments +export type GetEpochAccumulatedRewardPerTokenReturn = FunctionReturn + +/** getEpochAccumulatedUptime(uint256,uint256) */ +export const getEpochAccumulatedUptime = func('0xdf00c922', { + epoch: uint256, + validatorID: uint256, +}, uint256) +export type GetEpochAccumulatedUptimeParams = FunctionArguments +export type GetEpochAccumulatedUptimeReturn = FunctionReturn + +/** getEpochAverageUptime(uint256,uint256) */ +export const getEpochAverageUptime = func('0xaa5d8292', { + epoch: uint256, + validatorID: uint256, +}, uint64) +export type GetEpochAverageUptimeParams = FunctionArguments +export type GetEpochAverageUptimeReturn = FunctionReturn + +/** getEpochEndBlock(uint256) */ +export const getEpochEndBlock = func('0xdb5ca3e5', { + epoch: uint256, +}, uint256) +export type GetEpochEndBlockParams = FunctionArguments +export type GetEpochEndBlockReturn = FunctionReturn + +/** getEpochOfflineBlocks(uint256,uint256) */ +export const getEpochOfflineBlocks = func('0xa198d229', { + epoch: uint256, + validatorID: uint256, +}, uint256) +export type GetEpochOfflineBlocksParams = FunctionArguments +export type GetEpochOfflineBlocksReturn = FunctionReturn + +/** getEpochOfflineTime(uint256,uint256) */ +export const getEpochOfflineTime = func('0xe261641a', { + epoch: uint256, + validatorID: uint256, +}, uint256) +export type GetEpochOfflineTimeParams = FunctionArguments +export type GetEpochOfflineTimeReturn = FunctionReturn + +/** getEpochReceivedStake(uint256,uint256) */ +export const getEpochReceivedStake = func('0x58f95b80', { + epoch: uint256, + validatorID: uint256, +}, uint256) +export type GetEpochReceivedStakeParams = FunctionArguments +export type GetEpochReceivedStakeReturn = FunctionReturn + +/** getEpochSnapshot(uint256) */ +export const getEpochSnapshot = func('0x39b80c00', { + epoch: uint256, +}, struct({ + endTime: uint256, + endBlock: uint256, + epochFee: uint256, + baseRewardPerSecond: uint256, + totalStake: uint256, + totalSupply: uint256, +})) +export type GetEpochSnapshotParams = FunctionArguments +export type GetEpochSnapshotReturn = FunctionReturn + +/** getEpochValidatorIDs(uint256) */ +export const getEpochValidatorIDs = func('0xb88a37e2', { + epoch: uint256, +}, array(uint256)) +export type GetEpochValidatorIDsParams = FunctionArguments +export type GetEpochValidatorIDsReturn = FunctionReturn + +/** getRedirection(address) */ +export const getRedirection = func('0x736de9ae', { + delegator: address, +}, address) +export type GetRedirectionParams = FunctionArguments +export type GetRedirectionReturn = FunctionReturn + +/** getRedirectionRequest(address) */ +export const getRedirectionRequest = func('0x468f35ee', { + delegator: address, +}, address) +export type GetRedirectionRequestParams = FunctionArguments +export type GetRedirectionRequestReturn = FunctionReturn + +/** getSelfStake(uint256) */ +export const getSelfStake = func('0x5601fe01', { + validatorID: uint256, +}, uint256) +export type GetSelfStakeParams = FunctionArguments +export type GetSelfStakeReturn = FunctionReturn + +/** getStake(address,uint256) */ +export const getStake = func('0xcfd47663', { + delegator: address, + validatorID: uint256, +}, uint256) +export type GetStakeParams = FunctionArguments +export type GetStakeReturn = FunctionReturn + +/** getValidator(uint256) */ +export const getValidator = func('0xb5d89627', { + validatorID: uint256, +}, struct({ + status: uint256, + receivedStake: uint256, + auth: address, + createdEpoch: uint256, + createdTime: uint256, + deactivatedTime: uint256, + deactivatedEpoch: uint256, +})) +export type GetValidatorParams = FunctionArguments +export type GetValidatorReturn = FunctionReturn + +/** getValidatorID(address) */ +export const getValidatorID = func('0x0135b1db', { + auth: address, +}, uint256) +export type GetValidatorIDParams = FunctionArguments +export type GetValidatorIDReturn = FunctionReturn + +/** getValidatorPubkey(uint256) */ +export const getValidatorPubkey = func('0x854873e1', { + validatorID: uint256, +}, bytes) +export type GetValidatorPubkeyParams = FunctionArguments +export type GetValidatorPubkeyReturn = FunctionReturn + +/** getWithdrawalRequest(address,uint256,uint256) */ +export const getWithdrawalRequest = func('0x1f270152', { + delegator: address, + validatorID: uint256, + wrID: uint256, +}, struct({ + epoch: uint256, + time: uint256, + amount: uint256, +})) +export type GetWithdrawalRequestParams = FunctionArguments +export type GetWithdrawalRequestReturn = FunctionReturn + +/** initialize(uint256,uint256,address,address,address) */ +export const initialize = func('0x3fbfd4df', { + sealedEpoch: uint256, + _totalSupply: uint256, + nodeDriver: address, + _c: address, + owner: address, +}) +export type InitializeParams = FunctionArguments +export type InitializeReturn = FunctionReturn + +/** initiateRedirection(address,address) */ +export const initiateRedirection = func('0xcc172784', { + from: address, + to: address, +}) +export type InitiateRedirectionParams = FunctionArguments +export type InitiateRedirectionReturn = FunctionReturn + +/** isSlashed(uint256) */ +export const isSlashed = func('0xc3de580e', { + validatorID: uint256, +}, bool) +export type IsSlashedParams = FunctionArguments +export type IsSlashedReturn = FunctionReturn + +/** issueTokens(uint256) */ +export const issueTokens = func('0xa5820daa', { + amount: uint256, +}) +export type IssueTokensParams = FunctionArguments +export type IssueTokensReturn = FunctionReturn + +/** lastValidatorID() */ +export const lastValidatorID = func('0xc7be95de', {}, uint256) +export type LastValidatorIDParams = FunctionArguments +export type LastValidatorIDReturn = FunctionReturn + +/** owner() */ +export const owner = func('0x8da5cb5b', {}, address) +export type OwnerParams = FunctionArguments +export type OwnerReturn = FunctionReturn + +/** pendingRewards(address,uint256) */ +export const pendingRewards = func('0x6099ecb2', { + delegator: address, + toValidatorID: uint256, +}, uint256) +export type PendingRewardsParams = FunctionArguments +export type PendingRewardsReturn = FunctionReturn + +/** proxiableUUID() */ +export const proxiableUUID = func('0x52d1902d', {}, bytes32) +export type ProxiableUUIDParams = FunctionArguments +export type ProxiableUUIDReturn = FunctionReturn + +/** pubkeyAddressToValidatorID(address) */ +export const pubkeyAddressToValidatorID = func('0xfb36025f', { + pubkeyAddress: address, +}, uint256) +export type PubkeyAddressToValidatorIDParams = FunctionArguments +export type PubkeyAddressToValidatorIDReturn = FunctionReturn + +/** redirect(address) */ +export const redirect = func('0xd725e91f', { + to: address, +}) +export type RedirectParams = FunctionArguments +export type RedirectReturn = FunctionReturn + +/** redirectionAuthorizer() */ +export const redirectionAuthorizer = func('0xe9a505a7', {}, address) +export type RedirectionAuthorizerParams = FunctionArguments +export type RedirectionAuthorizerReturn = FunctionReturn + +/** renounceOwnership() */ +export const renounceOwnership = func('0x715018a6', {}) +export type RenounceOwnershipParams = FunctionArguments +export type RenounceOwnershipReturn = FunctionReturn + +/** resolveTreasuryFees() */ +export const resolveTreasuryFees = func('0x84b863e0', {}) +export type ResolveTreasuryFeesParams = FunctionArguments +export type ResolveTreasuryFeesReturn = FunctionReturn + +/** restakeRewards(uint256) */ +export const restakeRewards = func('0x08c36874', { + toValidatorID: uint256, +}) +export type RestakeRewardsParams = FunctionArguments +export type RestakeRewardsReturn = FunctionReturn + +/** rewardsStash(address,uint256) */ +export const rewardsStash = func('0x6f498663', { + delegator: address, + validatorID: uint256, +}, uint256) +export type RewardsStashParams = FunctionArguments +export type RewardsStashReturn = FunctionReturn + +/** sealEpoch(uint256[],uint256[],uint256[],uint256[]) */ +export const sealEpoch = func('0xebdf104c', { + offlineTime: array(uint256), + offlineBlocks: array(uint256), + uptimes: array(uint256), + originatedTxsFee: array(uint256), +}) +export type SealEpochParams = FunctionArguments +export type SealEpochReturn = FunctionReturn + +/** sealEpochValidators(uint256[]) */ +export const sealEpochValidators = func('0xe08d7e66', { + nextValidatorIDs: array(uint256), +}) +export type SealEpochValidatorsParams = FunctionArguments +export type SealEpochValidatorsReturn = FunctionReturn + +/** setGenesisDelegation(address,uint256,uint256) */ +export const setGenesisDelegation = func('0xa8ab09ba', { + delegator: address, + toValidatorID: uint256, + stake: uint256, +}) +export type SetGenesisDelegationParams = FunctionArguments +export type SetGenesisDelegationReturn = FunctionReturn + +/** setGenesisValidator(address,uint256,bytes,uint256) */ +export const setGenesisValidator = func('0x76fed43a', { + auth: address, + validatorID: uint256, + pubkey: bytes, + createdTime: uint256, +}) +export type SetGenesisValidatorParams = FunctionArguments +export type SetGenesisValidatorReturn = FunctionReturn + +/** setRedirectionAuthorizer(address) */ +export const setRedirectionAuthorizer = func('0xb0ef386c', { + v: address, +}) +export type SetRedirectionAuthorizerParams = FunctionArguments +export type SetRedirectionAuthorizerReturn = FunctionReturn + +/** slashingRefundRatio(uint256) */ +export const slashingRefundRatio = func('0xc65ee0e1', { + validatorID: uint256, +}, uint256) +export type SlashingRefundRatioParams = FunctionArguments +export type SlashingRefundRatioReturn = FunctionReturn + +/** stakeSubscriberAddress() */ +export const stakeSubscriberAddress = func('0x093b41d0', {}, address) +export type StakeSubscriberAddressParams = FunctionArguments +export type StakeSubscriberAddressReturn = FunctionReturn + +/** stashRewards(address,uint256) */ +export const stashRewards = func('0x8cddb015', { + delegator: address, + toValidatorID: uint256, +}) +export type StashRewardsParams = FunctionArguments +export type StashRewardsReturn = FunctionReturn + +/** stashedRewardsUntilEpoch(address,uint256) */ +export const stashedRewardsUntilEpoch = func('0xa86a056f', { + delegator: address, + validatorID: uint256, +}, uint256) +export type StashedRewardsUntilEpochParams = FunctionArguments +export type StashedRewardsUntilEpochReturn = FunctionReturn + +/** totalActiveStake() */ +export const totalActiveStake = func('0x28f73148', {}, uint256) +export type TotalActiveStakeParams = FunctionArguments +export type TotalActiveStakeReturn = FunctionReturn + +/** totalStake() */ +export const totalStake = func('0x8b0e9f3f', {}, uint256) +export type TotalStakeParams = FunctionArguments +export type TotalStakeReturn = FunctionReturn + +/** totalSupply() */ +export const totalSupply = func('0x18160ddd', {}, uint256) +export type TotalSupplyParams = FunctionArguments +export type TotalSupplyReturn = FunctionReturn + +/** transferOwnership(address) */ +export const transferOwnership = func('0xf2fde38b', { + newOwner: address, +}) +export type TransferOwnershipParams = FunctionArguments +export type TransferOwnershipReturn = FunctionReturn + +/** treasuryAddress() */ +export const treasuryAddress = func('0xc5f956af', {}, address) +export type TreasuryAddressParams = FunctionArguments +export type TreasuryAddressReturn = FunctionReturn + +/** undelegate(uint256,uint256,uint256) */ +export const undelegate = func('0x4f864df4', { + toValidatorID: uint256, + wrID: uint256, + amount: uint256, +}) +export type UndelegateParams = FunctionArguments +export type UndelegateReturn = FunctionReturn + +/** unresolvedTreasuryFees() */ +export const unresolvedTreasuryFees = func('0x8d2da32e', {}, uint256) +export type UnresolvedTreasuryFeesParams = FunctionArguments +export type UnresolvedTreasuryFeesReturn = FunctionReturn + +/** updateConstsAddress(address) */ +export const updateConstsAddress = func('0x860c2750', { + v: address, +}) +export type UpdateConstsAddressParams = FunctionArguments +export type UpdateConstsAddressReturn = FunctionReturn + +/** updateSlashingRefundRatio(uint256,uint256) */ +export const updateSlashingRefundRatio = func('0x4f7c4efb', { + validatorID: uint256, + refundRatio: uint256, +}) +export type UpdateSlashingRefundRatioParams = FunctionArguments +export type UpdateSlashingRefundRatioReturn = FunctionReturn + +/** updateStakeSubscriberAddress(address) */ +export const updateStakeSubscriberAddress = func('0xe880a159', { + v: address, +}) +export type UpdateStakeSubscriberAddressParams = FunctionArguments +export type UpdateStakeSubscriberAddressReturn = FunctionReturn + +/** updateTreasuryAddress(address) */ +export const updateTreasuryAddress = func('0x841e4561', { + v: address, +}) +export type UpdateTreasuryAddressParams = FunctionArguments +export type UpdateTreasuryAddressReturn = FunctionReturn + +/** upgradeToAndCall(address,bytes) */ +export const upgradeToAndCall = func('0x4f1ef286', { + newImplementation: address, + data: bytes, +}) +export type UpgradeToAndCallParams = FunctionArguments +export type UpgradeToAndCallReturn = FunctionReturn + +/** version() */ +export const version = func('0x54fd4d50', {}, bytes3) +export type VersionParams = FunctionArguments +export type VersionReturn = FunctionReturn + +/** withdraw(uint256,uint256) */ +export const withdraw = func('0x441a3e70', { + toValidatorID: uint256, + wrID: uint256, +}) +export type WithdrawParams = FunctionArguments +export type WithdrawReturn = FunctionReturn diff --git a/src/abi/sonic-sfc/index.ts b/src/abi/sonic-sfc/index.ts new file mode 100644 index 00000000..11829d6e --- /dev/null +++ b/src/abi/sonic-sfc/index.ts @@ -0,0 +1,4 @@ +export * as events from './events.js' +export * as functions from './functions.js' + +export { Contract } from './contract.js' diff --git a/src/abi/strategy-bridged-woeth.ts b/src/abi/strategy-bridged-woeth.ts deleted file mode 100644 index 50787d0f..00000000 --- a/src/abi/strategy-bridged-woeth.ts +++ /dev/null @@ -1,246 +0,0 @@ -import * as p from '@subsquid/evm-codec' -import { event, fun, viewFun, indexed, ContractBase } from '@subsquid/evm-abi' -import type { EventParams as EParams, FunctionArguments, FunctionReturn } from '@subsquid/evm-abi' - -export const events = { - Deposit: event("0x5548c837ab068cf56a2c2479df0882a4922fd203edb7517321831d95078c5f62", "Deposit(address,address,uint256)", {"_asset": indexed(p.address), "_pToken": p.address, "_amount": p.uint256}), - GovernorshipTransferred: event("0xc7c0c772add429241571afb3805861fb3cfa2af374534088b76cdb4325a87e9a", "GovernorshipTransferred(address,address)", {"previousGovernor": indexed(p.address), "newGovernor": indexed(p.address)}), - HarvesterAddressesUpdated: event("0xe48386b84419f4d36e0f96c10cc3510b6fb1a33795620c5098b22472bbe90796", "HarvesterAddressesUpdated(address,address)", {"_oldHarvesterAddress": p.address, "_newHarvesterAddress": p.address}), - MaxPriceDiffBpsUpdated: event("0x5066a7b9bf5907d8b921adeaade475273e40a7302cab0e838ef9fa2094b06b7f", "MaxPriceDiffBpsUpdated(uint128,uint128)", {"oldValue": p.uint128, "newValue": p.uint128}), - PTokenAdded: event("0xef6485b84315f9b1483beffa32aae9a0596890395e3d7521f1c5fbb51790e765", "PTokenAdded(address,address)", {"_asset": indexed(p.address), "_pToken": p.address}), - PTokenRemoved: event("0x16b7600acff27e39a8a96056b3d533045298de927507f5c1d97e4accde60488c", "PTokenRemoved(address,address)", {"_asset": indexed(p.address), "_pToken": p.address}), - PendingGovernorshipTransfer: event("0xa39cc5eb22d0f34d8beaefee8a3f17cc229c1a1d1ef87a5ad47313487b1c4f0d", "PendingGovernorshipTransfer(address,address)", {"previousGovernor": indexed(p.address), "newGovernor": indexed(p.address)}), - RewardTokenAddressesUpdated: event("0x04c0b9649497d316554306e53678d5f5f5dbc3a06f97dec13ff4cfe98b986bbc", "RewardTokenAddressesUpdated(address[],address[])", {"_oldAddresses": p.array(p.address), "_newAddresses": p.array(p.address)}), - RewardTokenCollected: event("0xf6c07a063ed4e63808eb8da7112d46dbcd38de2b40a73dbcc9353c5a94c72353", "RewardTokenCollected(address,address,uint256)", {"recipient": p.address, "rewardToken": p.address, "amount": p.uint256}), - WOETHPriceUpdated: event("0x688768fc37ada60fd073f86fafc8d5aa7fe9d86750ddf224bc0366812c086fe8", "WOETHPriceUpdated(uint128,uint128)", {"oldValue": p.uint128, "newValue": p.uint128}), - Withdrawal: event("0x2717ead6b9200dd235aad468c9809ea400fe33ac69b5bfaa6d3e90fc922b6398", "Withdrawal(address,address,uint256)", {"_asset": indexed(p.address), "_pToken": p.address, "_amount": p.uint256}), -} - -export const functions = { - MAX_PRICE_STALENESS: viewFun("0xd6913b32", "MAX_PRICE_STALENESS()", {}, p.uint256), - assetToPToken: viewFun("0x0fc3b4c4", "assetToPToken(address)", {"_0": p.address}, p.address), - bridgedWOETH: viewFun("0xaeaf191b", "bridgedWOETH()", {}, p.address), - checkBalance: viewFun("0x5f515226", "checkBalance(address)", {"_asset": p.address}, p.uint256), - claimGovernance: fun("0x5d36b190", "claimGovernance()", {}, ), - collectRewardTokens: fun("0x5a063f63", "collectRewardTokens()", {}, ), - deposit: fun("0x47e7ef24", "deposit(address,uint256)", {"_0": p.address, "_1": p.uint256}, ), - depositAll: fun("0xde5f6268", "depositAll()", {}, ), - depositBridgedWOETH: fun("0xd6e772a4", "depositBridgedWOETH(uint256)", {"woethAmount": p.uint256}, ), - getBridgedWOETHValue: viewFun("0x7e50ac3f", "getBridgedWOETHValue(uint256)", {"woethAmount": p.uint256}, p.uint256), - getRewardTokenAddresses: viewFun("0xf6ca71b0", "getRewardTokenAddresses()", {}, p.array(p.address)), - governor: viewFun("0x0c340a24", "governor()", {}, p.address), - harvesterAddress: viewFun("0x67c7066c", "harvesterAddress()", {}, p.address), - initialize: fun("0x56db9ef1", "initialize(uint128)", {"_maxPriceDiffBps": p.uint128}, ), - isGovernor: viewFun("0xc7af3352", "isGovernor()", {}, p.bool), - lastOraclePrice: viewFun("0x349f7173", "lastOraclePrice()", {}, p.uint128), - maxPriceDiffBps: viewFun("0x951ba637", "maxPriceDiffBps()", {}, p.uint128), - oethb: viewFun("0x6dea9b19", "oethb()", {}, p.address), - platformAddress: viewFun("0xdbe55e56", "platformAddress()", {}, p.address), - removePToken: fun("0x9136616a", "removePToken(uint256)", {"_0": p.uint256}, ), - rewardTokenAddresses: viewFun("0x7b2d9b2c", "rewardTokenAddresses(uint256)", {"_0": p.uint256}, p.address), - safeApproveAllTokens: fun("0xad1728cb", "safeApproveAllTokens()", {}, ), - setHarvesterAddress: fun("0xc2e1e3f4", "setHarvesterAddress(address)", {"_harvesterAddress": p.address}, ), - setMaxPriceDiffBps: fun("0x3ad12229", "setMaxPriceDiffBps(uint128)", {"_maxPriceDiffBps": p.uint128}, ), - setPTokenAddress: fun("0x0ed57b3a", "setPTokenAddress(address,address)", {"_asset": p.address, "_pToken": p.address}, ), - setRewardTokenAddresses: fun("0x96d538bb", "setRewardTokenAddresses(address[])", {"_rewardTokenAddresses": p.array(p.address)}, ), - supportsAsset: viewFun("0xaa388af6", "supportsAsset(address)", {"_asset": p.address}, p.bool), - transferGovernance: fun("0xd38bfff4", "transferGovernance(address)", {"_newGovernor": p.address}, ), - transferToken: fun("0x1072cbea", "transferToken(address,uint256)", {"_asset": p.address, "_amount": p.uint256}, ), - updateWOETHOraclePrice: fun("0x6c713833", "updateWOETHOraclePrice()", {}, p.uint256), - vaultAddress: viewFun("0x430bf08a", "vaultAddress()", {}, p.address), - weth: viewFun("0x3fc8cef3", "weth()", {}, p.address), - withdraw: fun("0xd9caed12", "withdraw(address,address,uint256)", {"_recipient": p.address, "_asset": p.address, "_amount": p.uint256}, ), - withdrawAll: fun("0x853828b6", "withdrawAll()", {}, ), - withdrawBridgedWOETH: fun("0x2579fe8a", "withdrawBridgedWOETH(uint256)", {"oethToBurn": p.uint256}, ), -} - -export class Contract extends ContractBase { - - MAX_PRICE_STALENESS() { - return this.eth_call(functions.MAX_PRICE_STALENESS, {}) - } - - assetToPToken(_0: AssetToPTokenParams["_0"]) { - return this.eth_call(functions.assetToPToken, {_0}) - } - - bridgedWOETH() { - return this.eth_call(functions.bridgedWOETH, {}) - } - - checkBalance(_asset: CheckBalanceParams["_asset"]) { - return this.eth_call(functions.checkBalance, {_asset}) - } - - getBridgedWOETHValue(woethAmount: GetBridgedWOETHValueParams["woethAmount"]) { - return this.eth_call(functions.getBridgedWOETHValue, {woethAmount}) - } - - getRewardTokenAddresses() { - return this.eth_call(functions.getRewardTokenAddresses, {}) - } - - governor() { - return this.eth_call(functions.governor, {}) - } - - harvesterAddress() { - return this.eth_call(functions.harvesterAddress, {}) - } - - isGovernor() { - return this.eth_call(functions.isGovernor, {}) - } - - lastOraclePrice() { - return this.eth_call(functions.lastOraclePrice, {}) - } - - maxPriceDiffBps() { - return this.eth_call(functions.maxPriceDiffBps, {}) - } - - oethb() { - return this.eth_call(functions.oethb, {}) - } - - platformAddress() { - return this.eth_call(functions.platformAddress, {}) - } - - rewardTokenAddresses(_0: RewardTokenAddressesParams["_0"]) { - return this.eth_call(functions.rewardTokenAddresses, {_0}) - } - - supportsAsset(_asset: SupportsAssetParams["_asset"]) { - return this.eth_call(functions.supportsAsset, {_asset}) - } - - vaultAddress() { - return this.eth_call(functions.vaultAddress, {}) - } - - weth() { - return this.eth_call(functions.weth, {}) - } -} - -/// Event types -export type DepositEventArgs = EParams -export type GovernorshipTransferredEventArgs = EParams -export type HarvesterAddressesUpdatedEventArgs = EParams -export type MaxPriceDiffBpsUpdatedEventArgs = EParams -export type PTokenAddedEventArgs = EParams -export type PTokenRemovedEventArgs = EParams -export type PendingGovernorshipTransferEventArgs = EParams -export type RewardTokenAddressesUpdatedEventArgs = EParams -export type RewardTokenCollectedEventArgs = EParams -export type WOETHPriceUpdatedEventArgs = EParams -export type WithdrawalEventArgs = EParams - -/// Function types -export type MAX_PRICE_STALENESSParams = FunctionArguments -export type MAX_PRICE_STALENESSReturn = FunctionReturn - -export type AssetToPTokenParams = FunctionArguments -export type AssetToPTokenReturn = FunctionReturn - -export type BridgedWOETHParams = FunctionArguments -export type BridgedWOETHReturn = FunctionReturn - -export type CheckBalanceParams = FunctionArguments -export type CheckBalanceReturn = FunctionReturn - -export type ClaimGovernanceParams = FunctionArguments -export type ClaimGovernanceReturn = FunctionReturn - -export type CollectRewardTokensParams = FunctionArguments -export type CollectRewardTokensReturn = FunctionReturn - -export type DepositParams = FunctionArguments -export type DepositReturn = FunctionReturn - -export type DepositAllParams = FunctionArguments -export type DepositAllReturn = FunctionReturn - -export type DepositBridgedWOETHParams = FunctionArguments -export type DepositBridgedWOETHReturn = FunctionReturn - -export type GetBridgedWOETHValueParams = FunctionArguments -export type GetBridgedWOETHValueReturn = FunctionReturn - -export type GetRewardTokenAddressesParams = FunctionArguments -export type GetRewardTokenAddressesReturn = FunctionReturn - -export type GovernorParams = FunctionArguments -export type GovernorReturn = FunctionReturn - -export type HarvesterAddressParams = FunctionArguments -export type HarvesterAddressReturn = FunctionReturn - -export type InitializeParams = FunctionArguments -export type InitializeReturn = FunctionReturn - -export type IsGovernorParams = FunctionArguments -export type IsGovernorReturn = FunctionReturn - -export type LastOraclePriceParams = FunctionArguments -export type LastOraclePriceReturn = FunctionReturn - -export type MaxPriceDiffBpsParams = FunctionArguments -export type MaxPriceDiffBpsReturn = FunctionReturn - -export type OethbParams = FunctionArguments -export type OethbReturn = FunctionReturn - -export type PlatformAddressParams = FunctionArguments -export type PlatformAddressReturn = FunctionReturn - -export type RemovePTokenParams = FunctionArguments -export type RemovePTokenReturn = FunctionReturn - -export type RewardTokenAddressesParams = FunctionArguments -export type RewardTokenAddressesReturn = FunctionReturn - -export type SafeApproveAllTokensParams = FunctionArguments -export type SafeApproveAllTokensReturn = FunctionReturn - -export type SetHarvesterAddressParams = FunctionArguments -export type SetHarvesterAddressReturn = FunctionReturn - -export type SetMaxPriceDiffBpsParams = FunctionArguments -export type SetMaxPriceDiffBpsReturn = FunctionReturn - -export type SetPTokenAddressParams = FunctionArguments -export type SetPTokenAddressReturn = FunctionReturn - -export type SetRewardTokenAddressesParams = FunctionArguments -export type SetRewardTokenAddressesReturn = FunctionReturn - -export type SupportsAssetParams = FunctionArguments -export type SupportsAssetReturn = FunctionReturn - -export type TransferGovernanceParams = FunctionArguments -export type TransferGovernanceReturn = FunctionReturn - -export type TransferTokenParams = FunctionArguments -export type TransferTokenReturn = FunctionReturn - -export type UpdateWOETHOraclePriceParams = FunctionArguments -export type UpdateWOETHOraclePriceReturn = FunctionReturn - -export type VaultAddressParams = FunctionArguments -export type VaultAddressReturn = FunctionReturn - -export type WethParams = FunctionArguments -export type WethReturn = FunctionReturn - -export type WithdrawParams = FunctionArguments -export type WithdrawReturn = FunctionReturn - -export type WithdrawAllParams = FunctionArguments -export type WithdrawAllReturn = FunctionReturn - -export type WithdrawBridgedWOETHParams = FunctionArguments -export type WithdrawBridgedWOETHReturn = FunctionReturn - diff --git a/src/abi/strategy-bridged-woeth/contract.ts b/src/abi/strategy-bridged-woeth/contract.ts new file mode 100644 index 00000000..16624745 --- /dev/null +++ b/src/abi/strategy-bridged-woeth/contract.ts @@ -0,0 +1,77 @@ +import { ContractBase } from '../abi.support.js' +import { MAX_PRICE_STALENESS, assetToPToken, bridgedWOETH, checkBalance, getBridgedWOETHValue, getRewardTokenAddresses, governor, harvesterAddress, isGovernor, lastOraclePrice, maxPriceDiffBps, oethb, platformAddress, rewardTokenAddresses, supportsAsset, updateWOETHOraclePrice, vaultAddress, weth } from './functions.js' +import type { AssetToPTokenParams, CheckBalanceParams, GetBridgedWOETHValueParams, RewardTokenAddressesParams, SupportsAssetParams } from './functions.js' + +export class Contract extends ContractBase { + MAX_PRICE_STALENESS() { + return this.eth_call(MAX_PRICE_STALENESS, {}) + } + + assetToPToken(_0: AssetToPTokenParams["_0"]) { + return this.eth_call(assetToPToken, {_0}) + } + + bridgedWOETH() { + return this.eth_call(bridgedWOETH, {}) + } + + checkBalance(_asset: CheckBalanceParams["_asset"]) { + return this.eth_call(checkBalance, {_asset}) + } + + getBridgedWOETHValue(woethAmount: GetBridgedWOETHValueParams["woethAmount"]) { + return this.eth_call(getBridgedWOETHValue, {woethAmount}) + } + + getRewardTokenAddresses() { + return this.eth_call(getRewardTokenAddresses, {}) + } + + governor() { + return this.eth_call(governor, {}) + } + + harvesterAddress() { + return this.eth_call(harvesterAddress, {}) + } + + isGovernor() { + return this.eth_call(isGovernor, {}) + } + + lastOraclePrice() { + return this.eth_call(lastOraclePrice, {}) + } + + maxPriceDiffBps() { + return this.eth_call(maxPriceDiffBps, {}) + } + + oethb() { + return this.eth_call(oethb, {}) + } + + platformAddress() { + return this.eth_call(platformAddress, {}) + } + + rewardTokenAddresses(_0: RewardTokenAddressesParams["_0"]) { + return this.eth_call(rewardTokenAddresses, {_0}) + } + + supportsAsset(_asset: SupportsAssetParams["_asset"]) { + return this.eth_call(supportsAsset, {_asset}) + } + + updateWOETHOraclePrice() { + return this.eth_call(updateWOETHOraclePrice, {}) + } + + vaultAddress() { + return this.eth_call(vaultAddress, {}) + } + + weth() { + return this.eth_call(weth, {}) + } +} diff --git a/src/abi/strategy-bridged-woeth/events.ts b/src/abi/strategy-bridged-woeth/events.ts new file mode 100644 index 00000000..64736cfc --- /dev/null +++ b/src/abi/strategy-bridged-woeth/events.ts @@ -0,0 +1,83 @@ +import { address, array, uint128, uint256 } from '@subsquid/evm-codec' +import { event, indexed } from '../abi.support.js' +import type { EventParams as EParams } from '../abi.support.js' + +/** Deposit(address,address,uint256) */ +export const Deposit = event('0x5548c837ab068cf56a2c2479df0882a4922fd203edb7517321831d95078c5f62', { + _asset: indexed(address), + _pToken: address, + _amount: uint256, +}) +export type DepositEventArgs = EParams + +/** GovernorshipTransferred(address,address) */ +export const GovernorshipTransferred = event('0xc7c0c772add429241571afb3805861fb3cfa2af374534088b76cdb4325a87e9a', { + previousGovernor: indexed(address), + newGovernor: indexed(address), +}) +export type GovernorshipTransferredEventArgs = EParams + +/** HarvesterAddressesUpdated(address,address) */ +export const HarvesterAddressesUpdated = event('0xe48386b84419f4d36e0f96c10cc3510b6fb1a33795620c5098b22472bbe90796', { + _oldHarvesterAddress: address, + _newHarvesterAddress: address, +}) +export type HarvesterAddressesUpdatedEventArgs = EParams + +/** MaxPriceDiffBpsUpdated(uint128,uint128) */ +export const MaxPriceDiffBpsUpdated = event('0x5066a7b9bf5907d8b921adeaade475273e40a7302cab0e838ef9fa2094b06b7f', { + oldValue: uint128, + newValue: uint128, +}) +export type MaxPriceDiffBpsUpdatedEventArgs = EParams + +/** PTokenAdded(address,address) */ +export const PTokenAdded = event('0xef6485b84315f9b1483beffa32aae9a0596890395e3d7521f1c5fbb51790e765', { + _asset: indexed(address), + _pToken: address, +}) +export type PTokenAddedEventArgs = EParams + +/** PTokenRemoved(address,address) */ +export const PTokenRemoved = event('0x16b7600acff27e39a8a96056b3d533045298de927507f5c1d97e4accde60488c', { + _asset: indexed(address), + _pToken: address, +}) +export type PTokenRemovedEventArgs = EParams + +/** PendingGovernorshipTransfer(address,address) */ +export const PendingGovernorshipTransfer = event('0xa39cc5eb22d0f34d8beaefee8a3f17cc229c1a1d1ef87a5ad47313487b1c4f0d', { + previousGovernor: indexed(address), + newGovernor: indexed(address), +}) +export type PendingGovernorshipTransferEventArgs = EParams + +/** RewardTokenAddressesUpdated(address[],address[]) */ +export const RewardTokenAddressesUpdated = event('0x04c0b9649497d316554306e53678d5f5f5dbc3a06f97dec13ff4cfe98b986bbc', { + _oldAddresses: array(address), + _newAddresses: array(address), +}) +export type RewardTokenAddressesUpdatedEventArgs = EParams + +/** RewardTokenCollected(address,address,uint256) */ +export const RewardTokenCollected = event('0xf6c07a063ed4e63808eb8da7112d46dbcd38de2b40a73dbcc9353c5a94c72353', { + recipient: address, + rewardToken: address, + amount: uint256, +}) +export type RewardTokenCollectedEventArgs = EParams + +/** WOETHPriceUpdated(uint128,uint128) */ +export const WOETHPriceUpdated = event('0x688768fc37ada60fd073f86fafc8d5aa7fe9d86750ddf224bc0366812c086fe8', { + oldValue: uint128, + newValue: uint128, +}) +export type WOETHPriceUpdatedEventArgs = EParams + +/** Withdrawal(address,address,uint256) */ +export const Withdrawal = event('0x2717ead6b9200dd235aad468c9809ea400fe33ac69b5bfaa6d3e90fc922b6398', { + _asset: indexed(address), + _pToken: address, + _amount: uint256, +}) +export type WithdrawalEventArgs = EParams diff --git a/src/abi/strategy-bridged-woeth/functions.ts b/src/abi/strategy-bridged-woeth/functions.ts new file mode 100644 index 00000000..d64cf7cc --- /dev/null +++ b/src/abi/strategy-bridged-woeth/functions.ts @@ -0,0 +1,217 @@ +import { address, array, bool, uint128, uint256 } from '@subsquid/evm-codec' +import { func } from '../abi.support.js' +import type { FunctionArguments, FunctionReturn } from '../abi.support.js' + +/** MAX_PRICE_STALENESS() */ +export const MAX_PRICE_STALENESS = func('0xd6913b32', {}, uint256) +export type MAX_PRICE_STALENESSParams = FunctionArguments +export type MAX_PRICE_STALENESSReturn = FunctionReturn + +/** assetToPToken(address) */ +export const assetToPToken = func('0x0fc3b4c4', { + _0: address, +}, address) +export type AssetToPTokenParams = FunctionArguments +export type AssetToPTokenReturn = FunctionReturn + +/** bridgedWOETH() */ +export const bridgedWOETH = func('0xaeaf191b', {}, address) +export type BridgedWOETHParams = FunctionArguments +export type BridgedWOETHReturn = FunctionReturn + +/** checkBalance(address) */ +export const checkBalance = func('0x5f515226', { + _asset: address, +}, uint256) +export type CheckBalanceParams = FunctionArguments +export type CheckBalanceReturn = FunctionReturn + +/** claimGovernance() */ +export const claimGovernance = func('0x5d36b190', {}) +export type ClaimGovernanceParams = FunctionArguments +export type ClaimGovernanceReturn = FunctionReturn + +/** collectRewardTokens() */ +export const collectRewardTokens = func('0x5a063f63', {}) +export type CollectRewardTokensParams = FunctionArguments +export type CollectRewardTokensReturn = FunctionReturn + +/** deposit(address,uint256) */ +export const deposit = func('0x47e7ef24', { + _0: address, + _1: uint256, +}) +export type DepositParams = FunctionArguments +export type DepositReturn = FunctionReturn + +/** depositAll() */ +export const depositAll = func('0xde5f6268', {}) +export type DepositAllParams = FunctionArguments +export type DepositAllReturn = FunctionReturn + +/** depositBridgedWOETH(uint256) */ +export const depositBridgedWOETH = func('0xd6e772a4', { + woethAmount: uint256, +}) +export type DepositBridgedWOETHParams = FunctionArguments +export type DepositBridgedWOETHReturn = FunctionReturn + +/** getBridgedWOETHValue(uint256) */ +export const getBridgedWOETHValue = func('0x7e50ac3f', { + woethAmount: uint256, +}, uint256) +export type GetBridgedWOETHValueParams = FunctionArguments +export type GetBridgedWOETHValueReturn = FunctionReturn + +/** getRewardTokenAddresses() */ +export const getRewardTokenAddresses = func('0xf6ca71b0', {}, array(address)) +export type GetRewardTokenAddressesParams = FunctionArguments +export type GetRewardTokenAddressesReturn = FunctionReturn + +/** governor() */ +export const governor = func('0x0c340a24', {}, address) +export type GovernorParams = FunctionArguments +export type GovernorReturn = FunctionReturn + +/** harvesterAddress() */ +export const harvesterAddress = func('0x67c7066c', {}, address) +export type HarvesterAddressParams = FunctionArguments +export type HarvesterAddressReturn = FunctionReturn + +/** initialize(uint128) */ +export const initialize = func('0x56db9ef1', { + _maxPriceDiffBps: uint128, +}) +export type InitializeParams = FunctionArguments +export type InitializeReturn = FunctionReturn + +/** isGovernor() */ +export const isGovernor = func('0xc7af3352', {}, bool) +export type IsGovernorParams = FunctionArguments +export type IsGovernorReturn = FunctionReturn + +/** lastOraclePrice() */ +export const lastOraclePrice = func('0x349f7173', {}, uint128) +export type LastOraclePriceParams = FunctionArguments +export type LastOraclePriceReturn = FunctionReturn + +/** maxPriceDiffBps() */ +export const maxPriceDiffBps = func('0x951ba637', {}, uint128) +export type MaxPriceDiffBpsParams = FunctionArguments +export type MaxPriceDiffBpsReturn = FunctionReturn + +/** oethb() */ +export const oethb = func('0x6dea9b19', {}, address) +export type OethbParams = FunctionArguments +export type OethbReturn = FunctionReturn + +/** platformAddress() */ +export const platformAddress = func('0xdbe55e56', {}, address) +export type PlatformAddressParams = FunctionArguments +export type PlatformAddressReturn = FunctionReturn + +/** removePToken(uint256) */ +export const removePToken = func('0x9136616a', { + _0: uint256, +}) +export type RemovePTokenParams = FunctionArguments +export type RemovePTokenReturn = FunctionReturn + +/** rewardTokenAddresses(uint256) */ +export const rewardTokenAddresses = func('0x7b2d9b2c', { + _0: uint256, +}, address) +export type RewardTokenAddressesParams = FunctionArguments +export type RewardTokenAddressesReturn = FunctionReturn + +/** safeApproveAllTokens() */ +export const safeApproveAllTokens = func('0xad1728cb', {}) +export type SafeApproveAllTokensParams = FunctionArguments +export type SafeApproveAllTokensReturn = FunctionReturn + +/** setHarvesterAddress(address) */ +export const setHarvesterAddress = func('0xc2e1e3f4', { + _harvesterAddress: address, +}) +export type SetHarvesterAddressParams = FunctionArguments +export type SetHarvesterAddressReturn = FunctionReturn + +/** setMaxPriceDiffBps(uint128) */ +export const setMaxPriceDiffBps = func('0x3ad12229', { + _maxPriceDiffBps: uint128, +}) +export type SetMaxPriceDiffBpsParams = FunctionArguments +export type SetMaxPriceDiffBpsReturn = FunctionReturn + +/** setPTokenAddress(address,address) */ +export const setPTokenAddress = func('0x0ed57b3a', { + _asset: address, + _pToken: address, +}) +export type SetPTokenAddressParams = FunctionArguments +export type SetPTokenAddressReturn = FunctionReturn + +/** setRewardTokenAddresses(address[]) */ +export const setRewardTokenAddresses = func('0x96d538bb', { + _rewardTokenAddresses: array(address), +}) +export type SetRewardTokenAddressesParams = FunctionArguments +export type SetRewardTokenAddressesReturn = FunctionReturn + +/** supportsAsset(address) */ +export const supportsAsset = func('0xaa388af6', { + _asset: address, +}, bool) +export type SupportsAssetParams = FunctionArguments +export type SupportsAssetReturn = FunctionReturn + +/** transferGovernance(address) */ +export const transferGovernance = func('0xd38bfff4', { + _newGovernor: address, +}) +export type TransferGovernanceParams = FunctionArguments +export type TransferGovernanceReturn = FunctionReturn + +/** transferToken(address,uint256) */ +export const transferToken = func('0x1072cbea', { + _asset: address, + _amount: uint256, +}) +export type TransferTokenParams = FunctionArguments +export type TransferTokenReturn = FunctionReturn + +/** updateWOETHOraclePrice() */ +export const updateWOETHOraclePrice = func('0x6c713833', {}, uint256) +export type UpdateWOETHOraclePriceParams = FunctionArguments +export type UpdateWOETHOraclePriceReturn = FunctionReturn + +/** vaultAddress() */ +export const vaultAddress = func('0x430bf08a', {}, address) +export type VaultAddressParams = FunctionArguments +export type VaultAddressReturn = FunctionReturn + +/** weth() */ +export const weth = func('0x3fc8cef3', {}, address) +export type WethParams = FunctionArguments +export type WethReturn = FunctionReturn + +/** withdraw(address,address,uint256) */ +export const withdraw = func('0xd9caed12', { + _recipient: address, + _asset: address, + _amount: uint256, +}) +export type WithdrawParams = FunctionArguments +export type WithdrawReturn = FunctionReturn + +/** withdrawAll() */ +export const withdrawAll = func('0x853828b6', {}) +export type WithdrawAllParams = FunctionArguments +export type WithdrawAllReturn = FunctionReturn + +/** withdrawBridgedWOETH(uint256) */ +export const withdrawBridgedWOETH = func('0x2579fe8a', { + oethToBurn: uint256, +}) +export type WithdrawBridgedWOETHParams = FunctionArguments +export type WithdrawBridgedWOETHReturn = FunctionReturn diff --git a/src/abi/strategy-bridged-woeth/index.ts b/src/abi/strategy-bridged-woeth/index.ts new file mode 100644 index 00000000..11829d6e --- /dev/null +++ b/src/abi/strategy-bridged-woeth/index.ts @@ -0,0 +1,4 @@ +export * as events from './events.js' +export * as functions from './functions.js' + +export { Contract } from './contract.js' diff --git a/src/abi/strategy-compound-staking-ssv.ts b/src/abi/strategy-compound-staking-ssv.ts deleted file mode 100644 index 5e04ba15..00000000 --- a/src/abi/strategy-compound-staking-ssv.ts +++ /dev/null @@ -1,360 +0,0 @@ -import * as p from '@subsquid/evm-codec' -import { event, fun, viewFun, indexed, ContractBase } from '@subsquid/evm-abi' -import type { EventParams as EParams, FunctionArguments, FunctionReturn } from '@subsquid/evm-abi' - -export const events = { - BalancesSnapped: event("0xb7523e03ed4a74718427c422a01fee1138835adb5bd592240f30bd8b5e1b929a", "BalancesSnapped(bytes32,uint256)", {"blockRoot": indexed(p.bytes32), "ethBalance": p.uint256}), - BalancesVerified: event("0xed2528338eefb63fd1860078b91e35106bc25e3fd528634d180f662582fe5ec1", "BalancesVerified(uint64,uint256,uint256,uint256)", {"timestamp": indexed(p.uint64), "totalDepositsWei": p.uint256, "totalValidatorBalance": p.uint256, "ethBalance": p.uint256}), - Deposit: event("0x5548c837ab068cf56a2c2479df0882a4922fd203edb7517321831d95078c5f62", "Deposit(address,address,uint256)", {"_asset": indexed(p.address), "_pToken": p.address, "_amount": p.uint256}), - DepositVerified: event("0xae0e4f727389efd70d748d667436e0264f370ae498b339b713797dbab57b12ff", "DepositVerified(bytes32,uint256)", {"pendingDepositRoot": indexed(p.bytes32), "amountWei": p.uint256}), - ETHStaked: event("0xaca97428a1d7f2b7c4cee2fbe4feda457e132b404b0c9c3ff73bf7a988d889a8", "ETHStaked(bytes32,bytes32,bytes,uint256)", {"pubKeyHash": indexed(p.bytes32), "pendingDepositRoot": indexed(p.bytes32), "pubKey": p.bytes, "amountWei": p.uint256}), - FirstDepositReset: event("0xce77f85e30b0e6df0d12527ddf038f900fdeda0eeda4284c52be47b05de31a97", "FirstDepositReset()", {}), - GovernorshipTransferred: event("0xc7c0c772add429241571afb3805861fb3cfa2af374534088b76cdb4325a87e9a", "GovernorshipTransferred(address,address)", {"previousGovernor": indexed(p.address), "newGovernor": indexed(p.address)}), - HarvesterAddressesUpdated: event("0xe48386b84419f4d36e0f96c10cc3510b6fb1a33795620c5098b22472bbe90796", "HarvesterAddressesUpdated(address,address)", {"_oldHarvesterAddress": p.address, "_newHarvesterAddress": p.address}), - PTokenAdded: event("0xef6485b84315f9b1483beffa32aae9a0596890395e3d7521f1c5fbb51790e765", "PTokenAdded(address,address)", {"_asset": indexed(p.address), "_pToken": p.address}), - PTokenRemoved: event("0x16b7600acff27e39a8a96056b3d533045298de927507f5c1d97e4accde60488c", "PTokenRemoved(address,address)", {"_asset": indexed(p.address), "_pToken": p.address}), - Paused: event("0x62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258", "Paused(address)", {"account": p.address}), - PendingGovernorshipTransfer: event("0xa39cc5eb22d0f34d8beaefee8a3f17cc229c1a1d1ef87a5ad47313487b1c4f0d", "PendingGovernorshipTransfer(address,address)", {"previousGovernor": indexed(p.address), "newGovernor": indexed(p.address)}), - RegistratorChanged: event("0x83f29c79feb71f8fba9d0fbc4ba5f0982a28b6b1e868b3fc50e6400d100bca0f", "RegistratorChanged(address)", {"newAddress": indexed(p.address)}), - RewardTokenAddressesUpdated: event("0x04c0b9649497d316554306e53678d5f5f5dbc3a06f97dec13ff4cfe98b986bbc", "RewardTokenAddressesUpdated(address[],address[])", {"_oldAddresses": p.array(p.address), "_newAddresses": p.array(p.address)}), - RewardTokenCollected: event("0xf6c07a063ed4e63808eb8da7112d46dbcd38de2b40a73dbcc9353c5a94c72353", "RewardTokenCollected(address,address,uint256)", {"recipient": p.address, "rewardToken": p.address, "amount": p.uint256}), - SSVValidatorRegistered: event("0x50837f89f5e75ae0a7bcc858f53ea15fa398dc007fd52cbfe4683ae9a6c2d722", "SSVValidatorRegistered(bytes32,uint64[])", {"pubKeyHash": indexed(p.bytes32), "operatorIds": p.array(p.uint64)}), - SSVValidatorRemoved: event("0x63d54ea43f163d6e28fc23abec67eb7c3294e7e6f0620955a73cd8d17c7367f4", "SSVValidatorRemoved(bytes32,uint64[])", {"pubKeyHash": indexed(p.bytes32), "operatorIds": p.array(p.uint64)}), - Unpaused: event("0x5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa", "Unpaused(address)", {"account": p.address}), - ValidatorInvalid: event("0xb8318df57b70f6381fb18aaf762e33efa2cc92627aae83d417f6710e1415d8d8", "ValidatorInvalid(bytes32)", {"pubKeyHash": indexed(p.bytes32)}), - ValidatorVerified: event("0x8142f1367675d1a37dc1aa31258c38b05f5348de55b799764472d94ccb4a71f4", "ValidatorVerified(bytes32,uint40)", {"pubKeyHash": indexed(p.bytes32), "validatorIndex": indexed(p.uint40)}), - ValidatorWithdraw: event("0x8dd83105dbd4263d41c76e5d414905babdd3f035bd2031f6ce8895715595979c", "ValidatorWithdraw(bytes32,uint256)", {"pubKeyHash": indexed(p.bytes32), "amountWei": p.uint256}), - Withdrawal: event("0x2717ead6b9200dd235aad468c9809ea400fe33ac69b5bfaa6d3e90fc922b6398", "Withdrawal(address,address,uint256)", {"_asset": indexed(p.address), "_pToken": p.address, "_amount": p.uint256}), -} - -export const functions = { - BEACON_PROOFS: viewFun("0x7da9982a", "BEACON_PROOFS()", {}, p.address), - SNAP_BALANCES_DELAY: viewFun("0x9fb7247d", "SNAP_BALANCES_DELAY()", {}, p.uint64), - assetToPToken: viewFun("0x0fc3b4c4", "assetToPToken(address)", {"_0": p.address}, p.address), - checkBalance: viewFun("0x5f515226", "checkBalance(address)", {"_asset": p.address}, p.uint256), - claimGovernance: fun("0x5d36b190", "claimGovernance()", {}, ), - collectRewardTokens: fun("0x5a063f63", "collectRewardTokens()", {}, ), - deposit: fun("0x47e7ef24", "deposit(address,uint256)", {"_asset": p.address, "_amount": p.uint256}, ), - depositAll: fun("0xde5f6268", "depositAll()", {}, ), - depositList: viewFun("0xb8ec6678", "depositList(uint256)", {"_0": p.uint256}, p.bytes32), - depositListLength: viewFun("0x4896b31a", "depositListLength()", {}, p.uint256), - depositedWethAccountedFor: viewFun("0xd059f6ef", "depositedWethAccountedFor()", {}, p.uint256), - deposits: viewFun("0x3d4dff7b", "deposits(bytes32)", {"_0": p.bytes32}, {"pubKeyHash": p.bytes32, "amountGwei": p.uint64, "slot": p.uint64, "depositIndex": p.uint32, "status": p.uint8}), - firstDeposit: viewFun("0xa5f5be54", "firstDeposit()", {}, p.bool), - getRewardTokenAddresses: viewFun("0xf6ca71b0", "getRewardTokenAddresses()", {}, p.array(p.address)), - governor: viewFun("0x0c340a24", "governor()", {}, p.address), - harvesterAddress: viewFun("0x67c7066c", "harvesterAddress()", {}, p.address), - initialize: fun("0x435356d1", "initialize(address[],address[],address[])", {"_rewardTokenAddresses": p.array(p.address), "_assets": p.array(p.address), "_pTokens": p.array(p.address)}, ), - isGovernor: viewFun("0xc7af3352", "isGovernor()", {}, p.bool), - lastVerifiedEthBalance: viewFun("0x59ff4158", "lastVerifiedEthBalance()", {}, p.uint256), - migrateClusterToETH: fun("0x36e87b12", "migrateClusterToETH(uint64[],(uint32,uint64,uint64,bool,uint256))", {"operatorIds": p.array(p.uint64), "cluster": p.struct({"validatorCount": p.uint32, "networkFeeIndex": p.uint64, "index": p.uint64, "active": p.bool, "balance": p.uint256})}, ), - pause: fun("0x8456cb59", "pause()", {}, ), - paused: viewFun("0x5c975abb", "paused()", {}, p.bool), - platformAddress: viewFun("0xdbe55e56", "platformAddress()", {}, p.address), - registerSsvValidator: fun("0xdaa1e253", "registerSsvValidator(bytes,uint64[],bytes,(uint32,uint64,uint64,bool,uint256))", {"publicKey": p.bytes, "operatorIds": p.array(p.uint64), "sharesData": p.bytes, "cluster": p.struct({"validatorCount": p.uint32, "networkFeeIndex": p.uint64, "index": p.uint64, "active": p.bool, "balance": p.uint256})}, ), - removePToken: viewFun("0x9136616a", "removePToken(uint256)", {"_0": p.uint256}, ), - removeSsvValidator: fun("0x71a735f3", "removeSsvValidator(bytes,uint64[],(uint32,uint64,uint64,bool,uint256))", {"publicKey": p.bytes, "operatorIds": p.array(p.uint64), "cluster": p.struct({"validatorCount": p.uint32, "networkFeeIndex": p.uint64, "index": p.uint64, "active": p.bool, "balance": p.uint256})}, ), - resetFirstDeposit: fun("0x4c84e6f8", "resetFirstDeposit()", {}, ), - rewardTokenAddresses: viewFun("0x7b2d9b2c", "rewardTokenAddresses(uint256)", {"_0": p.uint256}, p.address), - safeApproveAllTokens: fun("0xad1728cb", "safeApproveAllTokens()", {}, ), - setHarvesterAddress: fun("0xc2e1e3f4", "setHarvesterAddress(address)", {"_harvesterAddress": p.address}, ), - setPTokenAddress: viewFun("0x0ed57b3a", "setPTokenAddress(address,address)", {"_0": p.address, "_1": p.address}, ), - setRegistrator: fun("0x6e811d38", "setRegistrator(address)", {"_address": p.address}, ), - setRewardTokenAddresses: fun("0x96d538bb", "setRewardTokenAddresses(address[])", {"_rewardTokenAddresses": p.array(p.address)}, ), - snapBalances: fun("0x6874469d", "snapBalances()", {}, ), - snappedBalance: viewFun("0x25e2e9f3", "snappedBalance()", {}, {"blockRoot": p.bytes32, "timestamp": p.uint64, "ethBalance": p.uint128}), - stakeEth: fun("0x4583ef10", "stakeEth((bytes,bytes,bytes32),uint64)", {"validatorStakeData": p.struct({"pubkey": p.bytes, "signature": p.bytes, "depositDataRoot": p.bytes32}), "depositAmountGwei": p.uint64}, ), - supportsAsset: viewFun("0xaa388af6", "supportsAsset(address)", {"_asset": p.address}, p.bool), - transferGovernance: fun("0xd38bfff4", "transferGovernance(address)", {"_newGovernor": p.address}, ), - transferToken: fun("0x1072cbea", "transferToken(address,uint256)", {"_asset": p.address, "_amount": p.uint256}, ), - unPause: fun("0xf7b188a5", "unPause()", {}, ), - validator: viewFun("0x98245f1b", "validator(bytes32)", {"_0": p.bytes32}, {"state": p.uint8, "index": p.uint40}), - validatorRegistrator: viewFun("0x87bae867", "validatorRegistrator()", {}, p.address), - validatorWithdrawal: fun("0x522e4245", "validatorWithdrawal(bytes,uint64)", {"publicKey": p.bytes, "amountGwei": p.uint64}, ), - vaultAddress: viewFun("0x430bf08a", "vaultAddress()", {}, p.address), - verifiedValidators: viewFun("0x0ef99855", "verifiedValidators(uint256)", {"_0": p.uint256}, p.bytes32), - verifiedValidatorsLength: viewFun("0xd79e4032", "verifiedValidatorsLength()", {}, p.uint256), - verifyBalances: fun("0x1a1a1571", "verifyBalances((bytes32,bytes,bytes32[],bytes[]),(bytes32,bytes,uint32[],bytes[]))", {"balanceProofs": p.struct({"balancesContainerRoot": p.bytes32, "balancesContainerProof": p.bytes, "validatorBalanceLeaves": p.array(p.bytes32), "validatorBalanceProofs": p.array(p.bytes)}), "pendingDepositProofs": p.struct({"pendingDepositContainerRoot": p.bytes32, "pendingDepositContainerProof": p.bytes, "pendingDepositIndexes": p.array(p.uint32), "pendingDepositProofs": p.array(p.bytes)})}, ), - verifyDeposit: fun("0x0d304174", "verifyDeposit(bytes32,uint64,(uint64,bytes),(uint64,bytes))", {"pendingDepositRoot": p.bytes32, "depositProcessedSlot": p.uint64, "firstPendingDeposit": p.struct({"slot": p.uint64, "proof": p.bytes}), "strategyValidatorData": p.struct({"withdrawableEpoch": p.uint64, "withdrawableEpochProof": p.bytes})}, ), - verifyValidator: fun("0x6c341d1a", "verifyValidator(uint64,uint40,bytes32,bytes32,bytes)", {"nextBlockTimestamp": p.uint64, "validatorIndex": p.uint40, "pubKeyHash": p.bytes32, "withdrawalCredentials": p.bytes32, "validatorPubKeyProof": p.bytes}, ), - withdraw: fun("0xd9caed12", "withdraw(address,address,uint256)", {"_recipient": p.address, "_asset": p.address, "_amount": p.uint256}, ), - withdrawAll: fun("0x853828b6", "withdrawAll()", {}, ), -} - -export class Contract extends ContractBase { - - BEACON_PROOFS() { - return this.eth_call(functions.BEACON_PROOFS, {}) - } - - SNAP_BALANCES_DELAY() { - return this.eth_call(functions.SNAP_BALANCES_DELAY, {}) - } - - assetToPToken(_0: AssetToPTokenParams["_0"]) { - return this.eth_call(functions.assetToPToken, {_0}) - } - - checkBalance(_asset: CheckBalanceParams["_asset"]) { - return this.eth_call(functions.checkBalance, {_asset}) - } - - depositList(_0: DepositListParams["_0"]) { - return this.eth_call(functions.depositList, {_0}) - } - - depositListLength() { - return this.eth_call(functions.depositListLength, {}) - } - - depositedWethAccountedFor() { - return this.eth_call(functions.depositedWethAccountedFor, {}) - } - - deposits(_0: DepositsParams["_0"]) { - return this.eth_call(functions.deposits, {_0}) - } - - firstDeposit() { - return this.eth_call(functions.firstDeposit, {}) - } - - getRewardTokenAddresses() { - return this.eth_call(functions.getRewardTokenAddresses, {}) - } - - governor() { - return this.eth_call(functions.governor, {}) - } - - harvesterAddress() { - return this.eth_call(functions.harvesterAddress, {}) - } - - isGovernor() { - return this.eth_call(functions.isGovernor, {}) - } - - lastVerifiedEthBalance() { - return this.eth_call(functions.lastVerifiedEthBalance, {}) - } - - paused() { - return this.eth_call(functions.paused, {}) - } - - platformAddress() { - return this.eth_call(functions.platformAddress, {}) - } - - rewardTokenAddresses(_0: RewardTokenAddressesParams["_0"]) { - return this.eth_call(functions.rewardTokenAddresses, {_0}) - } - - snappedBalance() { - return this.eth_call(functions.snappedBalance, {}) - } - - supportsAsset(_asset: SupportsAssetParams["_asset"]) { - return this.eth_call(functions.supportsAsset, {_asset}) - } - - validator(_0: ValidatorParams["_0"]) { - return this.eth_call(functions.validator, {_0}) - } - - validatorRegistrator() { - return this.eth_call(functions.validatorRegistrator, {}) - } - - vaultAddress() { - return this.eth_call(functions.vaultAddress, {}) - } - - verifiedValidators(_0: VerifiedValidatorsParams["_0"]) { - return this.eth_call(functions.verifiedValidators, {_0}) - } - - verifiedValidatorsLength() { - return this.eth_call(functions.verifiedValidatorsLength, {}) - } -} - -/// Event types -export type BalancesSnappedEventArgs = EParams -export type BalancesVerifiedEventArgs = EParams -export type DepositEventArgs = EParams -export type DepositVerifiedEventArgs = EParams -export type ETHStakedEventArgs = EParams -export type FirstDepositResetEventArgs = EParams -export type GovernorshipTransferredEventArgs = EParams -export type HarvesterAddressesUpdatedEventArgs = EParams -export type PTokenAddedEventArgs = EParams -export type PTokenRemovedEventArgs = EParams -export type PausedEventArgs = EParams -export type PendingGovernorshipTransferEventArgs = EParams -export type RegistratorChangedEventArgs = EParams -export type RewardTokenAddressesUpdatedEventArgs = EParams -export type RewardTokenCollectedEventArgs = EParams -export type SSVValidatorRegisteredEventArgs = EParams -export type SSVValidatorRemovedEventArgs = EParams -export type UnpausedEventArgs = EParams -export type ValidatorInvalidEventArgs = EParams -export type ValidatorVerifiedEventArgs = EParams -export type ValidatorWithdrawEventArgs = EParams -export type WithdrawalEventArgs = EParams - -/// Function types -export type BEACON_PROOFSParams = FunctionArguments -export type BEACON_PROOFSReturn = FunctionReturn - -export type SNAP_BALANCES_DELAYParams = FunctionArguments -export type SNAP_BALANCES_DELAYReturn = FunctionReturn - -export type AssetToPTokenParams = FunctionArguments -export type AssetToPTokenReturn = FunctionReturn - -export type CheckBalanceParams = FunctionArguments -export type CheckBalanceReturn = FunctionReturn - -export type ClaimGovernanceParams = FunctionArguments -export type ClaimGovernanceReturn = FunctionReturn - -export type CollectRewardTokensParams = FunctionArguments -export type CollectRewardTokensReturn = FunctionReturn - -export type DepositParams = FunctionArguments -export type DepositReturn = FunctionReturn - -export type DepositAllParams = FunctionArguments -export type DepositAllReturn = FunctionReturn - -export type DepositListParams = FunctionArguments -export type DepositListReturn = FunctionReturn - -export type DepositListLengthParams = FunctionArguments -export type DepositListLengthReturn = FunctionReturn - -export type DepositedWethAccountedForParams = FunctionArguments -export type DepositedWethAccountedForReturn = FunctionReturn - -export type DepositsParams = FunctionArguments -export type DepositsReturn = FunctionReturn - -export type FirstDepositParams = FunctionArguments -export type FirstDepositReturn = FunctionReturn - -export type GetRewardTokenAddressesParams = FunctionArguments -export type GetRewardTokenAddressesReturn = FunctionReturn - -export type GovernorParams = FunctionArguments -export type GovernorReturn = FunctionReturn - -export type HarvesterAddressParams = FunctionArguments -export type HarvesterAddressReturn = FunctionReturn - -export type InitializeParams = FunctionArguments -export type InitializeReturn = FunctionReturn - -export type IsGovernorParams = FunctionArguments -export type IsGovernorReturn = FunctionReturn - -export type LastVerifiedEthBalanceParams = FunctionArguments -export type LastVerifiedEthBalanceReturn = FunctionReturn - -export type MigrateClusterToETHParams = FunctionArguments -export type MigrateClusterToETHReturn = FunctionReturn - -export type PauseParams = FunctionArguments -export type PauseReturn = FunctionReturn - -export type PausedParams = FunctionArguments -export type PausedReturn = FunctionReturn - -export type PlatformAddressParams = FunctionArguments -export type PlatformAddressReturn = FunctionReturn - -export type RegisterSsvValidatorParams = FunctionArguments -export type RegisterSsvValidatorReturn = FunctionReturn - -export type RemovePTokenParams = FunctionArguments -export type RemovePTokenReturn = FunctionReturn - -export type RemoveSsvValidatorParams = FunctionArguments -export type RemoveSsvValidatorReturn = FunctionReturn - -export type ResetFirstDepositParams = FunctionArguments -export type ResetFirstDepositReturn = FunctionReturn - -export type RewardTokenAddressesParams = FunctionArguments -export type RewardTokenAddressesReturn = FunctionReturn - -export type SafeApproveAllTokensParams = FunctionArguments -export type SafeApproveAllTokensReturn = FunctionReturn - -export type SetHarvesterAddressParams = FunctionArguments -export type SetHarvesterAddressReturn = FunctionReturn - -export type SetPTokenAddressParams = FunctionArguments -export type SetPTokenAddressReturn = FunctionReturn - -export type SetRegistratorParams = FunctionArguments -export type SetRegistratorReturn = FunctionReturn - -export type SetRewardTokenAddressesParams = FunctionArguments -export type SetRewardTokenAddressesReturn = FunctionReturn - -export type SnapBalancesParams = FunctionArguments -export type SnapBalancesReturn = FunctionReturn - -export type SnappedBalanceParams = FunctionArguments -export type SnappedBalanceReturn = FunctionReturn - -export type StakeEthParams = FunctionArguments -export type StakeEthReturn = FunctionReturn - -export type SupportsAssetParams = FunctionArguments -export type SupportsAssetReturn = FunctionReturn - -export type TransferGovernanceParams = FunctionArguments -export type TransferGovernanceReturn = FunctionReturn - -export type TransferTokenParams = FunctionArguments -export type TransferTokenReturn = FunctionReturn - -export type UnPauseParams = FunctionArguments -export type UnPauseReturn = FunctionReturn - -export type ValidatorParams = FunctionArguments -export type ValidatorReturn = FunctionReturn - -export type ValidatorRegistratorParams = FunctionArguments -export type ValidatorRegistratorReturn = FunctionReturn - -export type ValidatorWithdrawalParams = FunctionArguments -export type ValidatorWithdrawalReturn = FunctionReturn - -export type VaultAddressParams = FunctionArguments -export type VaultAddressReturn = FunctionReturn - -export type VerifiedValidatorsParams = FunctionArguments -export type VerifiedValidatorsReturn = FunctionReturn - -export type VerifiedValidatorsLengthParams = FunctionArguments -export type VerifiedValidatorsLengthReturn = FunctionReturn - -export type VerifyBalancesParams = FunctionArguments -export type VerifyBalancesReturn = FunctionReturn - -export type VerifyDepositParams = FunctionArguments -export type VerifyDepositReturn = FunctionReturn - -export type VerifyValidatorParams = FunctionArguments -export type VerifyValidatorReturn = FunctionReturn - -export type WithdrawParams = FunctionArguments -export type WithdrawReturn = FunctionReturn - -export type WithdrawAllParams = FunctionArguments -export type WithdrawAllReturn = FunctionReturn - diff --git a/src/abi/strategy-compound-staking-ssv/contract.ts b/src/abi/strategy-compound-staking-ssv/contract.ts new file mode 100644 index 00000000..f08aa43a --- /dev/null +++ b/src/abi/strategy-compound-staking-ssv/contract.ts @@ -0,0 +1,101 @@ +import { ContractBase } from '../abi.support.js' +import { BEACON_PROOFS, SNAP_BALANCES_DELAY, assetToPToken, checkBalance, depositList, depositListLength, depositedWethAccountedFor, deposits, firstDeposit, getRewardTokenAddresses, governor, harvesterAddress, isGovernor, lastVerifiedEthBalance, paused, platformAddress, rewardTokenAddresses, snappedBalance, supportsAsset, validator, validatorRegistrator, vaultAddress, verifiedValidators, verifiedValidatorsLength } from './functions.js' +import type { AssetToPTokenParams, CheckBalanceParams, DepositListParams, DepositsParams, RewardTokenAddressesParams, SupportsAssetParams, ValidatorParams, VerifiedValidatorsParams } from './functions.js' + +export class Contract extends ContractBase { + BEACON_PROOFS() { + return this.eth_call(BEACON_PROOFS, {}) + } + + SNAP_BALANCES_DELAY() { + return this.eth_call(SNAP_BALANCES_DELAY, {}) + } + + assetToPToken(_0: AssetToPTokenParams["_0"]) { + return this.eth_call(assetToPToken, {_0}) + } + + checkBalance(_asset: CheckBalanceParams["_asset"]) { + return this.eth_call(checkBalance, {_asset}) + } + + depositList(_0: DepositListParams["_0"]) { + return this.eth_call(depositList, {_0}) + } + + depositListLength() { + return this.eth_call(depositListLength, {}) + } + + depositedWethAccountedFor() { + return this.eth_call(depositedWethAccountedFor, {}) + } + + deposits(_0: DepositsParams["_0"]) { + return this.eth_call(deposits, {_0}) + } + + firstDeposit() { + return this.eth_call(firstDeposit, {}) + } + + getRewardTokenAddresses() { + return this.eth_call(getRewardTokenAddresses, {}) + } + + governor() { + return this.eth_call(governor, {}) + } + + harvesterAddress() { + return this.eth_call(harvesterAddress, {}) + } + + isGovernor() { + return this.eth_call(isGovernor, {}) + } + + lastVerifiedEthBalance() { + return this.eth_call(lastVerifiedEthBalance, {}) + } + + paused() { + return this.eth_call(paused, {}) + } + + platformAddress() { + return this.eth_call(platformAddress, {}) + } + + rewardTokenAddresses(_0: RewardTokenAddressesParams["_0"]) { + return this.eth_call(rewardTokenAddresses, {_0}) + } + + snappedBalance() { + return this.eth_call(snappedBalance, {}) + } + + supportsAsset(_asset: SupportsAssetParams["_asset"]) { + return this.eth_call(supportsAsset, {_asset}) + } + + validator(_0: ValidatorParams["_0"]) { + return this.eth_call(validator, {_0}) + } + + validatorRegistrator() { + return this.eth_call(validatorRegistrator, {}) + } + + vaultAddress() { + return this.eth_call(vaultAddress, {}) + } + + verifiedValidators(_0: VerifiedValidatorsParams["_0"]) { + return this.eth_call(verifiedValidators, {_0}) + } + + verifiedValidatorsLength() { + return this.eth_call(verifiedValidatorsLength, {}) + } +} diff --git a/src/abi/strategy-compound-staking-ssv/events.ts b/src/abi/strategy-compound-staking-ssv/events.ts new file mode 100644 index 00000000..605a73a9 --- /dev/null +++ b/src/abi/strategy-compound-staking-ssv/events.ts @@ -0,0 +1,157 @@ +import { address, array, bytes, bytes32, uint256, uint40, uint64 } from '@subsquid/evm-codec' +import { event, indexed } from '../abi.support.js' +import type { EventParams as EParams } from '../abi.support.js' + +/** BalancesSnapped(bytes32,uint256) */ +export const BalancesSnapped = event('0xb7523e03ed4a74718427c422a01fee1138835adb5bd592240f30bd8b5e1b929a', { + blockRoot: indexed(bytes32), + ethBalance: uint256, +}) +export type BalancesSnappedEventArgs = EParams + +/** BalancesVerified(uint64,uint256,uint256,uint256) */ +export const BalancesVerified = event('0xed2528338eefb63fd1860078b91e35106bc25e3fd528634d180f662582fe5ec1', { + timestamp: indexed(uint64), + totalDepositsWei: uint256, + totalValidatorBalance: uint256, + ethBalance: uint256, +}) +export type BalancesVerifiedEventArgs = EParams + +/** Deposit(address,address,uint256) */ +export const Deposit = event('0x5548c837ab068cf56a2c2479df0882a4922fd203edb7517321831d95078c5f62', { + _asset: indexed(address), + _pToken: address, + _amount: uint256, +}) +export type DepositEventArgs = EParams + +/** DepositVerified(bytes32,uint256) */ +export const DepositVerified = event('0xae0e4f727389efd70d748d667436e0264f370ae498b339b713797dbab57b12ff', { + pendingDepositRoot: indexed(bytes32), + amountWei: uint256, +}) +export type DepositVerifiedEventArgs = EParams + +/** ETHStaked(bytes32,bytes32,bytes,uint256) */ +export const ETHStaked = event('0xaca97428a1d7f2b7c4cee2fbe4feda457e132b404b0c9c3ff73bf7a988d889a8', { + pubKeyHash: indexed(bytes32), + pendingDepositRoot: indexed(bytes32), + pubKey: bytes, + amountWei: uint256, +}) +export type ETHStakedEventArgs = EParams + +/** FirstDepositReset() */ +export const FirstDepositReset = event('0xce77f85e30b0e6df0d12527ddf038f900fdeda0eeda4284c52be47b05de31a97', {}) +export type FirstDepositResetEventArgs = EParams + +/** GovernorshipTransferred(address,address) */ +export const GovernorshipTransferred = event('0xc7c0c772add429241571afb3805861fb3cfa2af374534088b76cdb4325a87e9a', { + previousGovernor: indexed(address), + newGovernor: indexed(address), +}) +export type GovernorshipTransferredEventArgs = EParams + +/** HarvesterAddressesUpdated(address,address) */ +export const HarvesterAddressesUpdated = event('0xe48386b84419f4d36e0f96c10cc3510b6fb1a33795620c5098b22472bbe90796', { + _oldHarvesterAddress: address, + _newHarvesterAddress: address, +}) +export type HarvesterAddressesUpdatedEventArgs = EParams + +/** PTokenAdded(address,address) */ +export const PTokenAdded = event('0xef6485b84315f9b1483beffa32aae9a0596890395e3d7521f1c5fbb51790e765', { + _asset: indexed(address), + _pToken: address, +}) +export type PTokenAddedEventArgs = EParams + +/** PTokenRemoved(address,address) */ +export const PTokenRemoved = event('0x16b7600acff27e39a8a96056b3d533045298de927507f5c1d97e4accde60488c', { + _asset: indexed(address), + _pToken: address, +}) +export type PTokenRemovedEventArgs = EParams + +/** Paused(address) */ +export const Paused = event('0x62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258', { + account: address, +}) +export type PausedEventArgs = EParams + +/** PendingGovernorshipTransfer(address,address) */ +export const PendingGovernorshipTransfer = event('0xa39cc5eb22d0f34d8beaefee8a3f17cc229c1a1d1ef87a5ad47313487b1c4f0d', { + previousGovernor: indexed(address), + newGovernor: indexed(address), +}) +export type PendingGovernorshipTransferEventArgs = EParams + +/** RegistratorChanged(address) */ +export const RegistratorChanged = event('0x83f29c79feb71f8fba9d0fbc4ba5f0982a28b6b1e868b3fc50e6400d100bca0f', { + newAddress: indexed(address), +}) +export type RegistratorChangedEventArgs = EParams + +/** RewardTokenAddressesUpdated(address[],address[]) */ +export const RewardTokenAddressesUpdated = event('0x04c0b9649497d316554306e53678d5f5f5dbc3a06f97dec13ff4cfe98b986bbc', { + _oldAddresses: array(address), + _newAddresses: array(address), +}) +export type RewardTokenAddressesUpdatedEventArgs = EParams + +/** RewardTokenCollected(address,address,uint256) */ +export const RewardTokenCollected = event('0xf6c07a063ed4e63808eb8da7112d46dbcd38de2b40a73dbcc9353c5a94c72353', { + recipient: address, + rewardToken: address, + amount: uint256, +}) +export type RewardTokenCollectedEventArgs = EParams + +/** SSVValidatorRegistered(bytes32,uint64[]) */ +export const SSVValidatorRegistered = event('0x50837f89f5e75ae0a7bcc858f53ea15fa398dc007fd52cbfe4683ae9a6c2d722', { + pubKeyHash: indexed(bytes32), + operatorIds: array(uint64), +}) +export type SSVValidatorRegisteredEventArgs = EParams + +/** SSVValidatorRemoved(bytes32,uint64[]) */ +export const SSVValidatorRemoved = event('0x63d54ea43f163d6e28fc23abec67eb7c3294e7e6f0620955a73cd8d17c7367f4', { + pubKeyHash: indexed(bytes32), + operatorIds: array(uint64), +}) +export type SSVValidatorRemovedEventArgs = EParams + +/** Unpaused(address) */ +export const Unpaused = event('0x5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa', { + account: address, +}) +export type UnpausedEventArgs = EParams + +/** ValidatorInvalid(bytes32) */ +export const ValidatorInvalid = event('0xb8318df57b70f6381fb18aaf762e33efa2cc92627aae83d417f6710e1415d8d8', { + pubKeyHash: indexed(bytes32), +}) +export type ValidatorInvalidEventArgs = EParams + +/** ValidatorVerified(bytes32,uint40) */ +export const ValidatorVerified = event('0x8142f1367675d1a37dc1aa31258c38b05f5348de55b799764472d94ccb4a71f4', { + pubKeyHash: indexed(bytes32), + validatorIndex: indexed(uint40), +}) +export type ValidatorVerifiedEventArgs = EParams + +/** ValidatorWithdraw(bytes32,uint256) */ +export const ValidatorWithdraw = event('0x8dd83105dbd4263d41c76e5d414905babdd3f035bd2031f6ce8895715595979c', { + pubKeyHash: indexed(bytes32), + amountWei: uint256, +}) +export type ValidatorWithdrawEventArgs = EParams + +/** Withdrawal(address,address,uint256) */ +export const Withdrawal = event('0x2717ead6b9200dd235aad468c9809ea400fe33ac69b5bfaa6d3e90fc922b6398', { + _asset: indexed(address), + _pToken: address, + _amount: uint256, +}) +export type WithdrawalEventArgs = EParams diff --git a/src/abi/strategy-compound-staking-ssv/functions.ts b/src/abi/strategy-compound-staking-ssv/functions.ts new file mode 100644 index 00000000..3f17f19e --- /dev/null +++ b/src/abi/strategy-compound-staking-ssv/functions.ts @@ -0,0 +1,384 @@ +import { address, array, bool, bytes, bytes32, struct, uint128, uint256, uint32, uint40, uint64, uint8 } from '@subsquid/evm-codec' +import { func } from '../abi.support.js' +import type { FunctionArguments, FunctionReturn } from '../abi.support.js' + +/** BEACON_PROOFS() */ +export const BEACON_PROOFS = func('0x7da9982a', {}, address) +export type BEACON_PROOFSParams = FunctionArguments +export type BEACON_PROOFSReturn = FunctionReturn + +/** SNAP_BALANCES_DELAY() */ +export const SNAP_BALANCES_DELAY = func('0x9fb7247d', {}, uint64) +export type SNAP_BALANCES_DELAYParams = FunctionArguments +export type SNAP_BALANCES_DELAYReturn = FunctionReturn + +/** assetToPToken(address) */ +export const assetToPToken = func('0x0fc3b4c4', { + _0: address, +}, address) +export type AssetToPTokenParams = FunctionArguments +export type AssetToPTokenReturn = FunctionReturn + +/** checkBalance(address) */ +export const checkBalance = func('0x5f515226', { + _asset: address, +}, uint256) +export type CheckBalanceParams = FunctionArguments +export type CheckBalanceReturn = FunctionReturn + +/** claimGovernance() */ +export const claimGovernance = func('0x5d36b190', {}) +export type ClaimGovernanceParams = FunctionArguments +export type ClaimGovernanceReturn = FunctionReturn + +/** collectRewardTokens() */ +export const collectRewardTokens = func('0x5a063f63', {}) +export type CollectRewardTokensParams = FunctionArguments +export type CollectRewardTokensReturn = FunctionReturn + +/** deposit(address,uint256) */ +export const deposit = func('0x47e7ef24', { + _asset: address, + _amount: uint256, +}) +export type DepositParams = FunctionArguments +export type DepositReturn = FunctionReturn + +/** depositAll() */ +export const depositAll = func('0xde5f6268', {}) +export type DepositAllParams = FunctionArguments +export type DepositAllReturn = FunctionReturn + +/** depositList(uint256) */ +export const depositList = func('0xb8ec6678', { + _0: uint256, +}, bytes32) +export type DepositListParams = FunctionArguments +export type DepositListReturn = FunctionReturn + +/** depositListLength() */ +export const depositListLength = func('0x4896b31a', {}, uint256) +export type DepositListLengthParams = FunctionArguments +export type DepositListLengthReturn = FunctionReturn + +/** depositedWethAccountedFor() */ +export const depositedWethAccountedFor = func('0xd059f6ef', {}, uint256) +export type DepositedWethAccountedForParams = FunctionArguments +export type DepositedWethAccountedForReturn = FunctionReturn + +/** deposits(bytes32) */ +export const deposits = func('0x3d4dff7b', { + _0: bytes32, +}, struct({ + pubKeyHash: bytes32, + amountGwei: uint64, + slot: uint64, + depositIndex: uint32, + status: uint8, +})) +export type DepositsParams = FunctionArguments +export type DepositsReturn = FunctionReturn + +/** firstDeposit() */ +export const firstDeposit = func('0xa5f5be54', {}, bool) +export type FirstDepositParams = FunctionArguments +export type FirstDepositReturn = FunctionReturn + +/** getRewardTokenAddresses() */ +export const getRewardTokenAddresses = func('0xf6ca71b0', {}, array(address)) +export type GetRewardTokenAddressesParams = FunctionArguments +export type GetRewardTokenAddressesReturn = FunctionReturn + +/** governor() */ +export const governor = func('0x0c340a24', {}, address) +export type GovernorParams = FunctionArguments +export type GovernorReturn = FunctionReturn + +/** harvesterAddress() */ +export const harvesterAddress = func('0x67c7066c', {}, address) +export type HarvesterAddressParams = FunctionArguments +export type HarvesterAddressReturn = FunctionReturn + +/** initialize(address[],address[],address[]) */ +export const initialize = func('0x435356d1', { + _rewardTokenAddresses: array(address), + _assets: array(address), + _pTokens: array(address), +}) +export type InitializeParams = FunctionArguments +export type InitializeReturn = FunctionReturn + +/** isGovernor() */ +export const isGovernor = func('0xc7af3352', {}, bool) +export type IsGovernorParams = FunctionArguments +export type IsGovernorReturn = FunctionReturn + +/** lastVerifiedEthBalance() */ +export const lastVerifiedEthBalance = func('0x59ff4158', {}, uint256) +export type LastVerifiedEthBalanceParams = FunctionArguments +export type LastVerifiedEthBalanceReturn = FunctionReturn + +/** migrateClusterToETH(uint64[],(uint32,uint64,uint64,bool,uint256)) */ +export const migrateClusterToETH = func('0x36e87b12', { + operatorIds: array(uint64), + cluster: struct({ + validatorCount: uint32, + networkFeeIndex: uint64, + index: uint64, + active: bool, + balance: uint256, + }), +}) +export type MigrateClusterToETHParams = FunctionArguments +export type MigrateClusterToETHReturn = FunctionReturn + +/** pause() */ +export const pause = func('0x8456cb59', {}) +export type PauseParams = FunctionArguments +export type PauseReturn = FunctionReturn + +/** paused() */ +export const paused = func('0x5c975abb', {}, bool) +export type PausedParams = FunctionArguments +export type PausedReturn = FunctionReturn + +/** platformAddress() */ +export const platformAddress = func('0xdbe55e56', {}, address) +export type PlatformAddressParams = FunctionArguments +export type PlatformAddressReturn = FunctionReturn + +/** registerSsvValidator(bytes,uint64[],bytes,(uint32,uint64,uint64,bool,uint256)) */ +export const registerSsvValidator = func('0xdaa1e253', { + publicKey: bytes, + operatorIds: array(uint64), + sharesData: bytes, + cluster: struct({ + validatorCount: uint32, + networkFeeIndex: uint64, + index: uint64, + active: bool, + balance: uint256, + }), +}) +export type RegisterSsvValidatorParams = FunctionArguments +export type RegisterSsvValidatorReturn = FunctionReturn + +/** removePToken(uint256) */ +export const removePToken = func('0x9136616a', { + _0: uint256, +}) +export type RemovePTokenParams = FunctionArguments +export type RemovePTokenReturn = FunctionReturn + +/** removeSsvValidator(bytes,uint64[],(uint32,uint64,uint64,bool,uint256)) */ +export const removeSsvValidator = func('0x71a735f3', { + publicKey: bytes, + operatorIds: array(uint64), + cluster: struct({ + validatorCount: uint32, + networkFeeIndex: uint64, + index: uint64, + active: bool, + balance: uint256, + }), +}) +export type RemoveSsvValidatorParams = FunctionArguments +export type RemoveSsvValidatorReturn = FunctionReturn + +/** resetFirstDeposit() */ +export const resetFirstDeposit = func('0x4c84e6f8', {}) +export type ResetFirstDepositParams = FunctionArguments +export type ResetFirstDepositReturn = FunctionReturn + +/** rewardTokenAddresses(uint256) */ +export const rewardTokenAddresses = func('0x7b2d9b2c', { + _0: uint256, +}, address) +export type RewardTokenAddressesParams = FunctionArguments +export type RewardTokenAddressesReturn = FunctionReturn + +/** safeApproveAllTokens() */ +export const safeApproveAllTokens = func('0xad1728cb', {}) +export type SafeApproveAllTokensParams = FunctionArguments +export type SafeApproveAllTokensReturn = FunctionReturn + +/** setHarvesterAddress(address) */ +export const setHarvesterAddress = func('0xc2e1e3f4', { + _harvesterAddress: address, +}) +export type SetHarvesterAddressParams = FunctionArguments +export type SetHarvesterAddressReturn = FunctionReturn + +/** setPTokenAddress(address,address) */ +export const setPTokenAddress = func('0x0ed57b3a', { + _0: address, + _1: address, +}) +export type SetPTokenAddressParams = FunctionArguments +export type SetPTokenAddressReturn = FunctionReturn + +/** setRegistrator(address) */ +export const setRegistrator = func('0x6e811d38', { + _address: address, +}) +export type SetRegistratorParams = FunctionArguments +export type SetRegistratorReturn = FunctionReturn + +/** setRewardTokenAddresses(address[]) */ +export const setRewardTokenAddresses = func('0x96d538bb', { + _rewardTokenAddresses: array(address), +}) +export type SetRewardTokenAddressesParams = FunctionArguments +export type SetRewardTokenAddressesReturn = FunctionReturn + +/** snapBalances() */ +export const snapBalances = func('0x6874469d', {}) +export type SnapBalancesParams = FunctionArguments +export type SnapBalancesReturn = FunctionReturn + +/** snappedBalance() */ +export const snappedBalance = func('0x25e2e9f3', {}, struct({ + blockRoot: bytes32, + timestamp: uint64, + ethBalance: uint128, +})) +export type SnappedBalanceParams = FunctionArguments +export type SnappedBalanceReturn = FunctionReturn + +/** stakeEth((bytes,bytes,bytes32),uint64) */ +export const stakeEth = func('0x4583ef10', { + validatorStakeData: struct({ + pubkey: bytes, + signature: bytes, + depositDataRoot: bytes32, + }), + depositAmountGwei: uint64, +}) +export type StakeEthParams = FunctionArguments +export type StakeEthReturn = FunctionReturn + +/** supportsAsset(address) */ +export const supportsAsset = func('0xaa388af6', { + _asset: address, +}, bool) +export type SupportsAssetParams = FunctionArguments +export type SupportsAssetReturn = FunctionReturn + +/** transferGovernance(address) */ +export const transferGovernance = func('0xd38bfff4', { + _newGovernor: address, +}) +export type TransferGovernanceParams = FunctionArguments +export type TransferGovernanceReturn = FunctionReturn + +/** transferToken(address,uint256) */ +export const transferToken = func('0x1072cbea', { + _asset: address, + _amount: uint256, +}) +export type TransferTokenParams = FunctionArguments +export type TransferTokenReturn = FunctionReturn + +/** unPause() */ +export const unPause = func('0xf7b188a5', {}) +export type UnPauseParams = FunctionArguments +export type UnPauseReturn = FunctionReturn + +/** validator(bytes32) */ +export const validator = func('0x98245f1b', { + _0: bytes32, +}, struct({ + state: uint8, + index: uint40, +})) +export type ValidatorParams = FunctionArguments +export type ValidatorReturn = FunctionReturn + +/** validatorRegistrator() */ +export const validatorRegistrator = func('0x87bae867', {}, address) +export type ValidatorRegistratorParams = FunctionArguments +export type ValidatorRegistratorReturn = FunctionReturn + +/** validatorWithdrawal(bytes,uint64) */ +export const validatorWithdrawal = func('0x522e4245', { + publicKey: bytes, + amountGwei: uint64, +}) +export type ValidatorWithdrawalParams = FunctionArguments +export type ValidatorWithdrawalReturn = FunctionReturn + +/** vaultAddress() */ +export const vaultAddress = func('0x430bf08a', {}, address) +export type VaultAddressParams = FunctionArguments +export type VaultAddressReturn = FunctionReturn + +/** verifiedValidators(uint256) */ +export const verifiedValidators = func('0x0ef99855', { + _0: uint256, +}, bytes32) +export type VerifiedValidatorsParams = FunctionArguments +export type VerifiedValidatorsReturn = FunctionReturn + +/** verifiedValidatorsLength() */ +export const verifiedValidatorsLength = func('0xd79e4032', {}, uint256) +export type VerifiedValidatorsLengthParams = FunctionArguments +export type VerifiedValidatorsLengthReturn = FunctionReturn + +/** verifyBalances((bytes32,bytes,bytes32[],bytes[]),(bytes32,bytes,uint32[],bytes[])) */ +export const verifyBalances = func('0x1a1a1571', { + balanceProofs: struct({ + balancesContainerRoot: bytes32, + balancesContainerProof: bytes, + validatorBalanceLeaves: array(bytes32), + validatorBalanceProofs: array(bytes), + }), + pendingDepositProofs: struct({ + pendingDepositContainerRoot: bytes32, + pendingDepositContainerProof: bytes, + pendingDepositIndexes: array(uint32), + pendingDepositProofs: array(bytes), + }), +}) +export type VerifyBalancesParams = FunctionArguments +export type VerifyBalancesReturn = FunctionReturn + +/** verifyDeposit(bytes32,uint64,(uint64,bytes),(uint64,bytes)) */ +export const verifyDeposit = func('0x0d304174', { + pendingDepositRoot: bytes32, + depositProcessedSlot: uint64, + firstPendingDeposit: struct({ + slot: uint64, + proof: bytes, + }), + strategyValidatorData: struct({ + withdrawableEpoch: uint64, + withdrawableEpochProof: bytes, + }), +}) +export type VerifyDepositParams = FunctionArguments +export type VerifyDepositReturn = FunctionReturn + +/** verifyValidator(uint64,uint40,bytes32,bytes32,bytes) */ +export const verifyValidator = func('0x6c341d1a', { + nextBlockTimestamp: uint64, + validatorIndex: uint40, + pubKeyHash: bytes32, + withdrawalCredentials: bytes32, + validatorPubKeyProof: bytes, +}) +export type VerifyValidatorParams = FunctionArguments +export type VerifyValidatorReturn = FunctionReturn + +/** withdraw(address,address,uint256) */ +export const withdraw = func('0xd9caed12', { + _recipient: address, + _asset: address, + _amount: uint256, +}) +export type WithdrawParams = FunctionArguments +export type WithdrawReturn = FunctionReturn + +/** withdrawAll() */ +export const withdrawAll = func('0x853828b6', {}) +export type WithdrawAllParams = FunctionArguments +export type WithdrawAllReturn = FunctionReturn diff --git a/src/abi/strategy-compound-staking-ssv/index.ts b/src/abi/strategy-compound-staking-ssv/index.ts new file mode 100644 index 00000000..11829d6e --- /dev/null +++ b/src/abi/strategy-compound-staking-ssv/index.ts @@ -0,0 +1,4 @@ +export * as events from './events.js' +export * as functions from './functions.js' + +export { Contract } from './contract.js' diff --git a/src/abi/strategy-native-staking.ts b/src/abi/strategy-native-staking.ts deleted file mode 100644 index 1de7cd16..00000000 --- a/src/abi/strategy-native-staking.ts +++ /dev/null @@ -1,442 +0,0 @@ -import * as p from '@subsquid/evm-codec' -import { event, fun, viewFun, indexed, ContractBase } from '@subsquid/evm-abi' -import type { EventParams as EParams, FunctionArguments, FunctionReturn } from '@subsquid/evm-abi' - -export const events = { - AccountingConsensusRewards: event("0x7a745a2c63a535068f52ceca27debd5297bbad5f7f37ec53d044a59d0362445d", "AccountingConsensusRewards(uint256)", {"amount": p.uint256}), - AccountingFullyWithdrawnValidator: event("0xbe7040030ff7b347853214bf49820c6d455fedf58f3815f85c7bc5216993682b", "AccountingFullyWithdrawnValidator(uint256,uint256,uint256)", {"noOfValidators": p.uint256, "remainingValidators": p.uint256, "wethSentToVault": p.uint256}), - AccountingManuallyFixed: event("0x80d022717ea022455c5886b8dd8a29c037570aae58aeb4d7b136d7a10ec2e431", "AccountingManuallyFixed(int256,int256,uint256)", {"validatorsDelta": p.int256, "consensusRewardsDelta": p.int256, "wethToVault": p.uint256}), - AccountingValidatorSlashed: event("0x6aa7e30787b26429ced603a7aba8b19c4b5d5bcf29a3257da953c8d53bcaa3a6", "AccountingValidatorSlashed(uint256,uint256)", {"remainingValidators": p.uint256, "wethSentToVault": p.uint256}), - ConsolidationConfirmed: event("0xb7f9b24f2efc7c0499fca5fd498666e42547910efe905fd5c16f835af7781990", "ConsolidationConfirmed(uint256,uint256)", {"consolidationCount": p.uint256, "activeDepositedValidators": p.uint256}), - ConsolidationFailed: event("0x074b3c18e21730a43902b43af97fb84b42b016f1cf86c3e0c829ca01ca8c7b63", "ConsolidationFailed(bytes[],uint256)", {"sourcePubKeys": p.array(p.bytes), "consolidationCount": p.uint256}), - ConsolidationRequested: event("0x4112c6a63b43261097d9a5032ac2fff06997b110d3105de2f2320bb86f27cc58", "ConsolidationRequested(bytes[],bytes,uint256)", {"sourcePubKeys": p.array(p.bytes), "targetPubKey": p.bytes, "consolidationCount": p.uint256}), - Deposit: event("0x5548c837ab068cf56a2c2479df0882a4922fd203edb7517321831d95078c5f62", "Deposit(address,address,uint256)", {"_asset": indexed(p.address), "_pToken": p.address, "_amount": p.uint256}), - ETHStaked: event("0x958934bb53d6b4dc911b6173e586864efbc8076684a31f752c53d5778340b37f", "ETHStaked(bytes32,bytes,uint256)", {"pubKeyHash": indexed(p.bytes32), "pubKey": p.bytes, "amount": p.uint256}), - FuseIntervalUpdated: event("0xcb8d24e46eb3c402bf344ee60a6576cba9ef2f59ea1af3b311520704924e901a", "FuseIntervalUpdated(uint256,uint256)", {"start": p.uint256, "end": p.uint256}), - GovernorshipTransferred: event("0xc7c0c772add429241571afb3805861fb3cfa2af374534088b76cdb4325a87e9a", "GovernorshipTransferred(address,address)", {"previousGovernor": indexed(p.address), "newGovernor": indexed(p.address)}), - HarvesterAddressesUpdated: event("0xe48386b84419f4d36e0f96c10cc3510b6fb1a33795620c5098b22472bbe90796", "HarvesterAddressesUpdated(address,address)", {"_oldHarvesterAddress": p.address, "_newHarvesterAddress": p.address}), - PTokenAdded: event("0xef6485b84315f9b1483beffa32aae9a0596890395e3d7521f1c5fbb51790e765", "PTokenAdded(address,address)", {"_asset": indexed(p.address), "_pToken": p.address}), - PTokenRemoved: event("0x16b7600acff27e39a8a96056b3d533045298de927507f5c1d97e4accde60488c", "PTokenRemoved(address,address)", {"_asset": indexed(p.address), "_pToken": p.address}), - Paused: event("0x62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258", "Paused(address)", {"account": p.address}), - PendingGovernorshipTransfer: event("0xa39cc5eb22d0f34d8beaefee8a3f17cc229c1a1d1ef87a5ad47313487b1c4f0d", "PendingGovernorshipTransfer(address,address)", {"previousGovernor": indexed(p.address), "newGovernor": indexed(p.address)}), - RegistratorChanged: event("0x83f29c79feb71f8fba9d0fbc4ba5f0982a28b6b1e868b3fc50e6400d100bca0f", "RegistratorChanged(address)", {"newAddress": indexed(p.address)}), - RewardTokenAddressesUpdated: event("0x04c0b9649497d316554306e53678d5f5f5dbc3a06f97dec13ff4cfe98b986bbc", "RewardTokenAddressesUpdated(address[],address[])", {"_oldAddresses": p.array(p.address), "_newAddresses": p.array(p.address)}), - RewardTokenCollected: event("0xf6c07a063ed4e63808eb8da7112d46dbcd38de2b40a73dbcc9353c5a94c72353", "RewardTokenCollected(address,address,uint256)", {"recipient": p.address, "rewardToken": p.address, "amount": p.uint256}), - SSVValidatorExitCompleted: event("0x6aecca20726a17c1b81989b2fd09dfdf636bae9e564d4066ca18df62dc1f3dc2", "SSVValidatorExitCompleted(bytes32,bytes,uint64[])", {"pubKeyHash": indexed(p.bytes32), "pubKey": p.bytes, "operatorIds": p.array(p.uint64)}), - SSVValidatorExitInitiated: event("0x8c2e15303eb94e531acc988c2a01d1193bdaaa15eda7f16dda85316ed463578d", "SSVValidatorExitInitiated(bytes32,bytes,uint64[])", {"pubKeyHash": indexed(p.bytes32), "pubKey": p.bytes, "operatorIds": p.array(p.uint64)}), - SSVValidatorRegistered: event("0xacd38e900350661e325d592c959664c0000a306efb2004e7dc283f44e0ea0423", "SSVValidatorRegistered(bytes32,bytes,uint64[])", {"pubKeyHash": indexed(p.bytes32), "pubKey": p.bytes, "operatorIds": p.array(p.uint64)}), - StakeETHTallyReset: event("0xe765a88a37047c5d793dce22b9ceb5a0f5039d276da139b4c7d29613f341f110", "StakeETHTallyReset()", {}), - StakeETHThresholdChanged: event("0xe26b067424903962f951f568e52ec9a3bbe1589526ea54a4e69ca6eaae1a4c77", "StakeETHThresholdChanged(uint256)", {"amount": p.uint256}), - StakingMonitorChanged: event("0x3329861a0008b3348767567d2405492b997abd79a088d0f2cef6b1a09a8e7ff7", "StakingMonitorChanged(address)", {"newAddress": indexed(p.address)}), - Unpaused: event("0x5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa", "Unpaused(address)", {"account": p.address}), - Withdrawal: event("0x2717ead6b9200dd235aad468c9809ea400fe33ac69b5bfaa6d3e90fc922b6398", "Withdrawal(address,address,uint256)", {"_asset": indexed(p.address), "_pToken": p.address, "_amount": p.uint256}), -} - -export const functions = { - BEACON_CHAIN_DEPOSIT_CONTRACT: viewFun("0xcceab750", "BEACON_CHAIN_DEPOSIT_CONTRACT()", {}, p.address), - FEE_ACCUMULATOR_ADDRESS: viewFun("0xdd505df6", "FEE_ACCUMULATOR_ADDRESS()", {}, p.address), - FULL_STAKE: viewFun("0xb16b7d0b", "FULL_STAKE()", {}, p.uint256), - MAX_VALIDATORS: viewFun("0x714897df", "MAX_VALIDATORS()", {}, p.uint256), - MIN_FIX_ACCOUNTING_CADENCE: viewFun("0x63092383", "MIN_FIX_ACCOUNTING_CADENCE()", {}, p.uint256), - SSV_NETWORK: viewFun("0x91649751", "SSV_NETWORK()", {}, p.address), - SSV_TOKEN: viewFun("0x0df1ecfd", "SSV_TOKEN()", {}, p.address), - VAULT_ADDRESS: viewFun("0x9092c31c", "VAULT_ADDRESS()", {}, p.address), - WETH: viewFun("0xad5c4648", "WETH()", {}, p.address), - activeDepositedValidators: viewFun("0x66e3667e", "activeDepositedValidators()", {}, p.uint256), - assetToPToken: viewFun("0x0fc3b4c4", "assetToPToken(address)", {"_0": p.address}, p.address), - checkBalance: viewFun("0x5f515226", "checkBalance(address)", {"_asset": p.address}, p.uint256), - claimGovernance: fun("0x5d36b190", "claimGovernance()", {}, ), - collectRewardTokens: fun("0x5a063f63", "collectRewardTokens()", {}, ), - confirmConsolidation: fun("0x75c20dd1", "confirmConsolidation(uint256)", {"consolidationCount": p.uint256}, ), - consensusRewards: viewFun("0x842f5c46", "consensusRewards()", {}, p.uint256), - deposit: fun("0x47e7ef24", "deposit(address,uint256)", {"_asset": p.address, "_amount": p.uint256}, ), - depositAll: fun("0xde5f6268", "depositAll()", {}, ), - depositedWethAccountedFor: viewFun("0xd059f6ef", "depositedWethAccountedFor()", {}, p.uint256), - doAccounting: fun("0xa4f98af4", "doAccounting()", {}, p.bool), - exitSsvValidator: fun("0xd9f00ec7", "exitSsvValidator(bytes,uint64[])", {"publicKey": p.bytes, "operatorIds": p.array(p.uint64)}, ), - failConsolidation: fun("0x1d622328", "failConsolidation(bytes[])", {"sourcePubKeys": p.array(p.bytes)}, ), - fuseIntervalEnd: viewFun("0x484be812", "fuseIntervalEnd()", {}, p.uint256), - fuseIntervalStart: viewFun("0x3c864959", "fuseIntervalStart()", {}, p.uint256), - getRewardTokenAddresses: viewFun("0xf6ca71b0", "getRewardTokenAddresses()", {}, p.array(p.address)), - governor: viewFun("0x0c340a24", "governor()", {}, p.address), - harvesterAddress: viewFun("0x67c7066c", "harvesterAddress()", {}, p.address), - initialize: fun("0x435356d1", "initialize(address[],address[],address[])", {"_rewardTokenAddresses": p.array(p.address), "_assets": p.array(p.address), "_pTokens": p.array(p.address)}, ), - isGovernor: viewFun("0xc7af3352", "isGovernor()", {}, p.bool), - lastFixAccountingBlockNumber: viewFun("0xe7529239", "lastFixAccountingBlockNumber()", {}, p.uint256), - manuallyFixAccounting: fun("0x8d7c0e46", "manuallyFixAccounting(int256,int256,uint256)", {"_validatorsDelta": p.int256, "_consensusRewardsDelta": p.int256, "_ethToVaultAmount": p.uint256}, ), - migrateClusterToETH: fun("0x36e87b12", "migrateClusterToETH(uint64[],(uint32,uint64,uint64,bool,uint256))", {"operatorIds": p.array(p.uint64), "cluster": p.struct({"validatorCount": p.uint32, "networkFeeIndex": p.uint64, "index": p.uint64, "active": p.bool, "balance": p.uint256})}, ), - pause: fun("0x8456cb59", "pause()", {}, ), - paused: viewFun("0x5c975abb", "paused()", {}, p.bool), - platformAddress: viewFun("0xdbe55e56", "platformAddress()", {}, p.address), - registerSsvValidators: fun("0x31856682", "registerSsvValidators(bytes[],uint64[],bytes[],(uint32,uint64,uint64,bool,uint256))", {"publicKeys": p.array(p.bytes), "operatorIds": p.array(p.uint64), "sharesData": p.array(p.bytes), "cluster": p.struct({"validatorCount": p.uint32, "networkFeeIndex": p.uint64, "index": p.uint64, "active": p.bool, "balance": p.uint256})}, ), - removePToken: fun("0x9136616a", "removePToken(uint256)", {"_assetIndex": p.uint256}, ), - removeSsvValidator: fun("0x71a735f3", "removeSsvValidator(bytes,uint64[],(uint32,uint64,uint64,bool,uint256))", {"publicKey": p.bytes, "operatorIds": p.array(p.uint64), "cluster": p.struct({"validatorCount": p.uint32, "networkFeeIndex": p.uint64, "index": p.uint64, "active": p.bool, "balance": p.uint256})}, ), - requestConsolidation: fun("0x22be1ffd", "requestConsolidation(bytes[],bytes)", {"sourcePubKeys": p.array(p.bytes), "targetPubKey": p.bytes}, ), - resetStakeETHTally: fun("0xee7afe2d", "resetStakeETHTally()", {}, ), - rewardTokenAddresses: viewFun("0x7b2d9b2c", "rewardTokenAddresses(uint256)", {"_0": p.uint256}, p.address), - safeApproveAllTokens: fun("0xad1728cb", "safeApproveAllTokens()", {}, ), - setFeeRecipient: fun("0x13cf69dd", "setFeeRecipient()", {}, ), - setFuseInterval: fun("0xab12edf5", "setFuseInterval(uint256,uint256)", {"_fuseIntervalStart": p.uint256, "_fuseIntervalEnd": p.uint256}, ), - setHarvesterAddress: fun("0xc2e1e3f4", "setHarvesterAddress(address)", {"_harvesterAddress": p.address}, ), - setPTokenAddress: fun("0x0ed57b3a", "setPTokenAddress(address,address)", {"_asset": p.address, "_pToken": p.address}, ), - setRegistrator: fun("0x6e811d38", "setRegistrator(address)", {"_address": p.address}, ), - setRewardTokenAddresses: fun("0x96d538bb", "setRewardTokenAddresses(address[])", {"_rewardTokenAddresses": p.array(p.address)}, ), - setStakeETHThreshold: fun("0x5205c380", "setStakeETHThreshold(uint256)", {"_amount": p.uint256}, ), - setStakingMonitor: fun("0xa3b81e73", "setStakingMonitor(address)", {"_address": p.address}, ), - stakeETHTally: viewFun("0xde34d713", "stakeETHTally()", {}, p.uint256), - stakeETHThreshold: viewFun("0x7b8962f7", "stakeETHThreshold()", {}, p.uint256), - stakeEth: fun("0x6ef38795", "stakeEth((bytes,bytes,bytes32)[])", {"validators": p.array(p.struct({"pubkey": p.bytes, "signature": p.bytes, "depositDataRoot": p.bytes32}))}, ), - stakingMonitor: viewFun("0x7260f826", "stakingMonitor()", {}, p.address), - supportsAsset: viewFun("0xaa388af6", "supportsAsset(address)", {"_asset": p.address}, p.bool), - transferGovernance: fun("0xd38bfff4", "transferGovernance(address)", {"_newGovernor": p.address}, ), - transferToken: fun("0x1072cbea", "transferToken(address,uint256)", {"_asset": p.address, "_amount": p.uint256}, ), - validatorRegistrator: viewFun("0x87bae867", "validatorRegistrator()", {}, p.address), - validatorsStates: viewFun("0x9da0e462", "validatorsStates(bytes32)", {"_0": p.bytes32}, p.uint8), - vaultAddress: viewFun("0x430bf08a", "vaultAddress()", {}, p.address), - withdraw: fun("0xd9caed12", "withdraw(address,address,uint256)", {"_recipient": p.address, "_asset": p.address, "_amount": p.uint256}, ), - withdrawAll: fun("0x853828b6", "withdrawAll()", {}, ), -} - -export class Contract extends ContractBase { - - BEACON_CHAIN_DEPOSIT_CONTRACT() { - return this.eth_call(functions.BEACON_CHAIN_DEPOSIT_CONTRACT, {}) - } - - FEE_ACCUMULATOR_ADDRESS() { - return this.eth_call(functions.FEE_ACCUMULATOR_ADDRESS, {}) - } - - FULL_STAKE() { - return this.eth_call(functions.FULL_STAKE, {}) - } - - MAX_VALIDATORS() { - return this.eth_call(functions.MAX_VALIDATORS, {}) - } - - MIN_FIX_ACCOUNTING_CADENCE() { - return this.eth_call(functions.MIN_FIX_ACCOUNTING_CADENCE, {}) - } - - SSV_NETWORK() { - return this.eth_call(functions.SSV_NETWORK, {}) - } - - SSV_TOKEN() { - return this.eth_call(functions.SSV_TOKEN, {}) - } - - VAULT_ADDRESS() { - return this.eth_call(functions.VAULT_ADDRESS, {}) - } - - WETH() { - return this.eth_call(functions.WETH, {}) - } - - activeDepositedValidators() { - return this.eth_call(functions.activeDepositedValidators, {}) - } - - assetToPToken(_0: AssetToPTokenParams["_0"]) { - return this.eth_call(functions.assetToPToken, {_0}) - } - - checkBalance(_asset: CheckBalanceParams["_asset"]) { - return this.eth_call(functions.checkBalance, {_asset}) - } - - consensusRewards() { - return this.eth_call(functions.consensusRewards, {}) - } - - depositedWethAccountedFor() { - return this.eth_call(functions.depositedWethAccountedFor, {}) - } - - fuseIntervalEnd() { - return this.eth_call(functions.fuseIntervalEnd, {}) - } - - fuseIntervalStart() { - return this.eth_call(functions.fuseIntervalStart, {}) - } - - getRewardTokenAddresses() { - return this.eth_call(functions.getRewardTokenAddresses, {}) - } - - governor() { - return this.eth_call(functions.governor, {}) - } - - harvesterAddress() { - return this.eth_call(functions.harvesterAddress, {}) - } - - isGovernor() { - return this.eth_call(functions.isGovernor, {}) - } - - lastFixAccountingBlockNumber() { - return this.eth_call(functions.lastFixAccountingBlockNumber, {}) - } - - paused() { - return this.eth_call(functions.paused, {}) - } - - platformAddress() { - return this.eth_call(functions.platformAddress, {}) - } - - rewardTokenAddresses(_0: RewardTokenAddressesParams["_0"]) { - return this.eth_call(functions.rewardTokenAddresses, {_0}) - } - - stakeETHTally() { - return this.eth_call(functions.stakeETHTally, {}) - } - - stakeETHThreshold() { - return this.eth_call(functions.stakeETHThreshold, {}) - } - - stakingMonitor() { - return this.eth_call(functions.stakingMonitor, {}) - } - - supportsAsset(_asset: SupportsAssetParams["_asset"]) { - return this.eth_call(functions.supportsAsset, {_asset}) - } - - validatorRegistrator() { - return this.eth_call(functions.validatorRegistrator, {}) - } - - validatorsStates(_0: ValidatorsStatesParams["_0"]) { - return this.eth_call(functions.validatorsStates, {_0}) - } - - vaultAddress() { - return this.eth_call(functions.vaultAddress, {}) - } -} - -/// Event types -export type AccountingConsensusRewardsEventArgs = EParams -export type AccountingFullyWithdrawnValidatorEventArgs = EParams -export type AccountingManuallyFixedEventArgs = EParams -export type AccountingValidatorSlashedEventArgs = EParams -export type ConsolidationConfirmedEventArgs = EParams -export type ConsolidationFailedEventArgs = EParams -export type ConsolidationRequestedEventArgs = EParams -export type DepositEventArgs = EParams -export type ETHStakedEventArgs = EParams -export type FuseIntervalUpdatedEventArgs = EParams -export type GovernorshipTransferredEventArgs = EParams -export type HarvesterAddressesUpdatedEventArgs = EParams -export type PTokenAddedEventArgs = EParams -export type PTokenRemovedEventArgs = EParams -export type PausedEventArgs = EParams -export type PendingGovernorshipTransferEventArgs = EParams -export type RegistratorChangedEventArgs = EParams -export type RewardTokenAddressesUpdatedEventArgs = EParams -export type RewardTokenCollectedEventArgs = EParams -export type SSVValidatorExitCompletedEventArgs = EParams -export type SSVValidatorExitInitiatedEventArgs = EParams -export type SSVValidatorRegisteredEventArgs = EParams -export type StakeETHTallyResetEventArgs = EParams -export type StakeETHThresholdChangedEventArgs = EParams -export type StakingMonitorChangedEventArgs = EParams -export type UnpausedEventArgs = EParams -export type WithdrawalEventArgs = EParams - -/// Function types -export type BEACON_CHAIN_DEPOSIT_CONTRACTParams = FunctionArguments -export type BEACON_CHAIN_DEPOSIT_CONTRACTReturn = FunctionReturn - -export type FEE_ACCUMULATOR_ADDRESSParams = FunctionArguments -export type FEE_ACCUMULATOR_ADDRESSReturn = FunctionReturn - -export type FULL_STAKEParams = FunctionArguments -export type FULL_STAKEReturn = FunctionReturn - -export type MAX_VALIDATORSParams = FunctionArguments -export type MAX_VALIDATORSReturn = FunctionReturn - -export type MIN_FIX_ACCOUNTING_CADENCEParams = FunctionArguments -export type MIN_FIX_ACCOUNTING_CADENCEReturn = FunctionReturn - -export type SSV_NETWORKParams = FunctionArguments -export type SSV_NETWORKReturn = FunctionReturn - -export type SSV_TOKENParams = FunctionArguments -export type SSV_TOKENReturn = FunctionReturn - -export type VAULT_ADDRESSParams = FunctionArguments -export type VAULT_ADDRESSReturn = FunctionReturn - -export type WETHParams = FunctionArguments -export type WETHReturn = FunctionReturn - -export type ActiveDepositedValidatorsParams = FunctionArguments -export type ActiveDepositedValidatorsReturn = FunctionReturn - -export type AssetToPTokenParams = FunctionArguments -export type AssetToPTokenReturn = FunctionReturn - -export type CheckBalanceParams = FunctionArguments -export type CheckBalanceReturn = FunctionReturn - -export type ClaimGovernanceParams = FunctionArguments -export type ClaimGovernanceReturn = FunctionReturn - -export type CollectRewardTokensParams = FunctionArguments -export type CollectRewardTokensReturn = FunctionReturn - -export type ConfirmConsolidationParams = FunctionArguments -export type ConfirmConsolidationReturn = FunctionReturn - -export type ConsensusRewardsParams = FunctionArguments -export type ConsensusRewardsReturn = FunctionReturn - -export type DepositParams = FunctionArguments -export type DepositReturn = FunctionReturn - -export type DepositAllParams = FunctionArguments -export type DepositAllReturn = FunctionReturn - -export type DepositedWethAccountedForParams = FunctionArguments -export type DepositedWethAccountedForReturn = FunctionReturn - -export type DoAccountingParams = FunctionArguments -export type DoAccountingReturn = FunctionReturn - -export type ExitSsvValidatorParams = FunctionArguments -export type ExitSsvValidatorReturn = FunctionReturn - -export type FailConsolidationParams = FunctionArguments -export type FailConsolidationReturn = FunctionReturn - -export type FuseIntervalEndParams = FunctionArguments -export type FuseIntervalEndReturn = FunctionReturn - -export type FuseIntervalStartParams = FunctionArguments -export type FuseIntervalStartReturn = FunctionReturn - -export type GetRewardTokenAddressesParams = FunctionArguments -export type GetRewardTokenAddressesReturn = FunctionReturn - -export type GovernorParams = FunctionArguments -export type GovernorReturn = FunctionReturn - -export type HarvesterAddressParams = FunctionArguments -export type HarvesterAddressReturn = FunctionReturn - -export type InitializeParams = FunctionArguments -export type InitializeReturn = FunctionReturn - -export type IsGovernorParams = FunctionArguments -export type IsGovernorReturn = FunctionReturn - -export type LastFixAccountingBlockNumberParams = FunctionArguments -export type LastFixAccountingBlockNumberReturn = FunctionReturn - -export type ManuallyFixAccountingParams = FunctionArguments -export type ManuallyFixAccountingReturn = FunctionReturn - -export type MigrateClusterToETHParams = FunctionArguments -export type MigrateClusterToETHReturn = FunctionReturn - -export type PauseParams = FunctionArguments -export type PauseReturn = FunctionReturn - -export type PausedParams = FunctionArguments -export type PausedReturn = FunctionReturn - -export type PlatformAddressParams = FunctionArguments -export type PlatformAddressReturn = FunctionReturn - -export type RegisterSsvValidatorsParams = FunctionArguments -export type RegisterSsvValidatorsReturn = FunctionReturn - -export type RemovePTokenParams = FunctionArguments -export type RemovePTokenReturn = FunctionReturn - -export type RemoveSsvValidatorParams = FunctionArguments -export type RemoveSsvValidatorReturn = FunctionReturn - -export type RequestConsolidationParams = FunctionArguments -export type RequestConsolidationReturn = FunctionReturn - -export type ResetStakeETHTallyParams = FunctionArguments -export type ResetStakeETHTallyReturn = FunctionReturn - -export type RewardTokenAddressesParams = FunctionArguments -export type RewardTokenAddressesReturn = FunctionReturn - -export type SafeApproveAllTokensParams = FunctionArguments -export type SafeApproveAllTokensReturn = FunctionReturn - -export type SetFeeRecipientParams = FunctionArguments -export type SetFeeRecipientReturn = FunctionReturn - -export type SetFuseIntervalParams = FunctionArguments -export type SetFuseIntervalReturn = FunctionReturn - -export type SetHarvesterAddressParams = FunctionArguments -export type SetHarvesterAddressReturn = FunctionReturn - -export type SetPTokenAddressParams = FunctionArguments -export type SetPTokenAddressReturn = FunctionReturn - -export type SetRegistratorParams = FunctionArguments -export type SetRegistratorReturn = FunctionReturn - -export type SetRewardTokenAddressesParams = FunctionArguments -export type SetRewardTokenAddressesReturn = FunctionReturn - -export type SetStakeETHThresholdParams = FunctionArguments -export type SetStakeETHThresholdReturn = FunctionReturn - -export type SetStakingMonitorParams = FunctionArguments -export type SetStakingMonitorReturn = FunctionReturn - -export type StakeETHTallyParams = FunctionArguments -export type StakeETHTallyReturn = FunctionReturn - -export type StakeETHThresholdParams = FunctionArguments -export type StakeETHThresholdReturn = FunctionReturn - -export type StakeEthParams = FunctionArguments -export type StakeEthReturn = FunctionReturn - -export type StakingMonitorParams = FunctionArguments -export type StakingMonitorReturn = FunctionReturn - -export type SupportsAssetParams = FunctionArguments -export type SupportsAssetReturn = FunctionReturn - -export type TransferGovernanceParams = FunctionArguments -export type TransferGovernanceReturn = FunctionReturn - -export type TransferTokenParams = FunctionArguments -export type TransferTokenReturn = FunctionReturn - -export type ValidatorRegistratorParams = FunctionArguments -export type ValidatorRegistratorReturn = FunctionReturn - -export type ValidatorsStatesParams = FunctionArguments -export type ValidatorsStatesReturn = FunctionReturn - -export type VaultAddressParams = FunctionArguments -export type VaultAddressReturn = FunctionReturn - -export type WithdrawParams = FunctionArguments -export type WithdrawReturn = FunctionReturn - -export type WithdrawAllParams = FunctionArguments -export type WithdrawAllReturn = FunctionReturn - diff --git a/src/abi/strategy-native-staking/contract.ts b/src/abi/strategy-native-staking/contract.ts new file mode 100644 index 00000000..b17df589 --- /dev/null +++ b/src/abi/strategy-native-staking/contract.ts @@ -0,0 +1,133 @@ +import { ContractBase } from '../abi.support.js' +import { BEACON_CHAIN_DEPOSIT_CONTRACT, FEE_ACCUMULATOR_ADDRESS, FULL_STAKE, MAX_VALIDATORS, MIN_FIX_ACCOUNTING_CADENCE, SSV_NETWORK, SSV_TOKEN, VAULT_ADDRESS, WETH, activeDepositedValidators, assetToPToken, checkBalance, consensusRewards, depositedWethAccountedFor, doAccounting, fuseIntervalEnd, fuseIntervalStart, getRewardTokenAddresses, governor, harvesterAddress, isGovernor, lastFixAccountingBlockNumber, paused, platformAddress, rewardTokenAddresses, stakeETHTally, stakeETHThreshold, stakingMonitor, supportsAsset, validatorRegistrator, validatorsStates, vaultAddress } from './functions.js' +import type { AssetToPTokenParams, CheckBalanceParams, RewardTokenAddressesParams, SupportsAssetParams, ValidatorsStatesParams } from './functions.js' + +export class Contract extends ContractBase { + BEACON_CHAIN_DEPOSIT_CONTRACT() { + return this.eth_call(BEACON_CHAIN_DEPOSIT_CONTRACT, {}) + } + + FEE_ACCUMULATOR_ADDRESS() { + return this.eth_call(FEE_ACCUMULATOR_ADDRESS, {}) + } + + FULL_STAKE() { + return this.eth_call(FULL_STAKE, {}) + } + + MAX_VALIDATORS() { + return this.eth_call(MAX_VALIDATORS, {}) + } + + MIN_FIX_ACCOUNTING_CADENCE() { + return this.eth_call(MIN_FIX_ACCOUNTING_CADENCE, {}) + } + + SSV_NETWORK() { + return this.eth_call(SSV_NETWORK, {}) + } + + SSV_TOKEN() { + return this.eth_call(SSV_TOKEN, {}) + } + + VAULT_ADDRESS() { + return this.eth_call(VAULT_ADDRESS, {}) + } + + WETH() { + return this.eth_call(WETH, {}) + } + + activeDepositedValidators() { + return this.eth_call(activeDepositedValidators, {}) + } + + assetToPToken(_0: AssetToPTokenParams["_0"]) { + return this.eth_call(assetToPToken, {_0}) + } + + checkBalance(_asset: CheckBalanceParams["_asset"]) { + return this.eth_call(checkBalance, {_asset}) + } + + consensusRewards() { + return this.eth_call(consensusRewards, {}) + } + + depositedWethAccountedFor() { + return this.eth_call(depositedWethAccountedFor, {}) + } + + doAccounting() { + return this.eth_call(doAccounting, {}) + } + + fuseIntervalEnd() { + return this.eth_call(fuseIntervalEnd, {}) + } + + fuseIntervalStart() { + return this.eth_call(fuseIntervalStart, {}) + } + + getRewardTokenAddresses() { + return this.eth_call(getRewardTokenAddresses, {}) + } + + governor() { + return this.eth_call(governor, {}) + } + + harvesterAddress() { + return this.eth_call(harvesterAddress, {}) + } + + isGovernor() { + return this.eth_call(isGovernor, {}) + } + + lastFixAccountingBlockNumber() { + return this.eth_call(lastFixAccountingBlockNumber, {}) + } + + paused() { + return this.eth_call(paused, {}) + } + + platformAddress() { + return this.eth_call(platformAddress, {}) + } + + rewardTokenAddresses(_0: RewardTokenAddressesParams["_0"]) { + return this.eth_call(rewardTokenAddresses, {_0}) + } + + stakeETHTally() { + return this.eth_call(stakeETHTally, {}) + } + + stakeETHThreshold() { + return this.eth_call(stakeETHThreshold, {}) + } + + stakingMonitor() { + return this.eth_call(stakingMonitor, {}) + } + + supportsAsset(_asset: SupportsAssetParams["_asset"]) { + return this.eth_call(supportsAsset, {_asset}) + } + + validatorRegistrator() { + return this.eth_call(validatorRegistrator, {}) + } + + validatorsStates(_0: ValidatorsStatesParams["_0"]) { + return this.eth_call(validatorsStates, {_0}) + } + + vaultAddress() { + return this.eth_call(vaultAddress, {}) + } +} diff --git a/src/abi/strategy-native-staking/events.ts b/src/abi/strategy-native-staking/events.ts new file mode 100644 index 00000000..f7026096 --- /dev/null +++ b/src/abi/strategy-native-staking/events.ts @@ -0,0 +1,193 @@ +import { address, array, bytes, bytes32, int256, uint256, uint64 } from '@subsquid/evm-codec' +import { event, indexed } from '../abi.support.js' +import type { EventParams as EParams } from '../abi.support.js' + +/** AccountingConsensusRewards(uint256) */ +export const AccountingConsensusRewards = event('0x7a745a2c63a535068f52ceca27debd5297bbad5f7f37ec53d044a59d0362445d', { + amount: uint256, +}) +export type AccountingConsensusRewardsEventArgs = EParams + +/** AccountingFullyWithdrawnValidator(uint256,uint256,uint256) */ +export const AccountingFullyWithdrawnValidator = event('0xbe7040030ff7b347853214bf49820c6d455fedf58f3815f85c7bc5216993682b', { + noOfValidators: uint256, + remainingValidators: uint256, + wethSentToVault: uint256, +}) +export type AccountingFullyWithdrawnValidatorEventArgs = EParams + +/** AccountingManuallyFixed(int256,int256,uint256) */ +export const AccountingManuallyFixed = event('0x80d022717ea022455c5886b8dd8a29c037570aae58aeb4d7b136d7a10ec2e431', { + validatorsDelta: int256, + consensusRewardsDelta: int256, + wethToVault: uint256, +}) +export type AccountingManuallyFixedEventArgs = EParams + +/** AccountingValidatorSlashed(uint256,uint256) */ +export const AccountingValidatorSlashed = event('0x6aa7e30787b26429ced603a7aba8b19c4b5d5bcf29a3257da953c8d53bcaa3a6', { + remainingValidators: uint256, + wethSentToVault: uint256, +}) +export type AccountingValidatorSlashedEventArgs = EParams + +/** ConsolidationConfirmed(uint256,uint256) */ +export const ConsolidationConfirmed = event('0xb7f9b24f2efc7c0499fca5fd498666e42547910efe905fd5c16f835af7781990', { + consolidationCount: uint256, + activeDepositedValidators: uint256, +}) +export type ConsolidationConfirmedEventArgs = EParams + +/** ConsolidationFailed(bytes[],uint256) */ +export const ConsolidationFailed = event('0x074b3c18e21730a43902b43af97fb84b42b016f1cf86c3e0c829ca01ca8c7b63', { + sourcePubKeys: array(bytes), + consolidationCount: uint256, +}) +export type ConsolidationFailedEventArgs = EParams + +/** ConsolidationRequested(bytes[],bytes,uint256) */ +export const ConsolidationRequested = event('0x4112c6a63b43261097d9a5032ac2fff06997b110d3105de2f2320bb86f27cc58', { + sourcePubKeys: array(bytes), + targetPubKey: bytes, + consolidationCount: uint256, +}) +export type ConsolidationRequestedEventArgs = EParams + +/** Deposit(address,address,uint256) */ +export const Deposit = event('0x5548c837ab068cf56a2c2479df0882a4922fd203edb7517321831d95078c5f62', { + _asset: indexed(address), + _pToken: address, + _amount: uint256, +}) +export type DepositEventArgs = EParams + +/** ETHStaked(bytes32,bytes,uint256) */ +export const ETHStaked = event('0x958934bb53d6b4dc911b6173e586864efbc8076684a31f752c53d5778340b37f', { + pubKeyHash: indexed(bytes32), + pubKey: bytes, + amount: uint256, +}) +export type ETHStakedEventArgs = EParams + +/** FuseIntervalUpdated(uint256,uint256) */ +export const FuseIntervalUpdated = event('0xcb8d24e46eb3c402bf344ee60a6576cba9ef2f59ea1af3b311520704924e901a', { + start: uint256, + end: uint256, +}) +export type FuseIntervalUpdatedEventArgs = EParams + +/** GovernorshipTransferred(address,address) */ +export const GovernorshipTransferred = event('0xc7c0c772add429241571afb3805861fb3cfa2af374534088b76cdb4325a87e9a', { + previousGovernor: indexed(address), + newGovernor: indexed(address), +}) +export type GovernorshipTransferredEventArgs = EParams + +/** HarvesterAddressesUpdated(address,address) */ +export const HarvesterAddressesUpdated = event('0xe48386b84419f4d36e0f96c10cc3510b6fb1a33795620c5098b22472bbe90796', { + _oldHarvesterAddress: address, + _newHarvesterAddress: address, +}) +export type HarvesterAddressesUpdatedEventArgs = EParams + +/** PTokenAdded(address,address) */ +export const PTokenAdded = event('0xef6485b84315f9b1483beffa32aae9a0596890395e3d7521f1c5fbb51790e765', { + _asset: indexed(address), + _pToken: address, +}) +export type PTokenAddedEventArgs = EParams + +/** PTokenRemoved(address,address) */ +export const PTokenRemoved = event('0x16b7600acff27e39a8a96056b3d533045298de927507f5c1d97e4accde60488c', { + _asset: indexed(address), + _pToken: address, +}) +export type PTokenRemovedEventArgs = EParams + +/** Paused(address) */ +export const Paused = event('0x62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258', { + account: address, +}) +export type PausedEventArgs = EParams + +/** PendingGovernorshipTransfer(address,address) */ +export const PendingGovernorshipTransfer = event('0xa39cc5eb22d0f34d8beaefee8a3f17cc229c1a1d1ef87a5ad47313487b1c4f0d', { + previousGovernor: indexed(address), + newGovernor: indexed(address), +}) +export type PendingGovernorshipTransferEventArgs = EParams + +/** RegistratorChanged(address) */ +export const RegistratorChanged = event('0x83f29c79feb71f8fba9d0fbc4ba5f0982a28b6b1e868b3fc50e6400d100bca0f', { + newAddress: indexed(address), +}) +export type RegistratorChangedEventArgs = EParams + +/** RewardTokenAddressesUpdated(address[],address[]) */ +export const RewardTokenAddressesUpdated = event('0x04c0b9649497d316554306e53678d5f5f5dbc3a06f97dec13ff4cfe98b986bbc', { + _oldAddresses: array(address), + _newAddresses: array(address), +}) +export type RewardTokenAddressesUpdatedEventArgs = EParams + +/** RewardTokenCollected(address,address,uint256) */ +export const RewardTokenCollected = event('0xf6c07a063ed4e63808eb8da7112d46dbcd38de2b40a73dbcc9353c5a94c72353', { + recipient: address, + rewardToken: address, + amount: uint256, +}) +export type RewardTokenCollectedEventArgs = EParams + +/** SSVValidatorExitCompleted(bytes32,bytes,uint64[]) */ +export const SSVValidatorExitCompleted = event('0x6aecca20726a17c1b81989b2fd09dfdf636bae9e564d4066ca18df62dc1f3dc2', { + pubKeyHash: indexed(bytes32), + pubKey: bytes, + operatorIds: array(uint64), +}) +export type SSVValidatorExitCompletedEventArgs = EParams + +/** SSVValidatorExitInitiated(bytes32,bytes,uint64[]) */ +export const SSVValidatorExitInitiated = event('0x8c2e15303eb94e531acc988c2a01d1193bdaaa15eda7f16dda85316ed463578d', { + pubKeyHash: indexed(bytes32), + pubKey: bytes, + operatorIds: array(uint64), +}) +export type SSVValidatorExitInitiatedEventArgs = EParams + +/** SSVValidatorRegistered(bytes32,bytes,uint64[]) */ +export const SSVValidatorRegistered = event('0xacd38e900350661e325d592c959664c0000a306efb2004e7dc283f44e0ea0423', { + pubKeyHash: indexed(bytes32), + pubKey: bytes, + operatorIds: array(uint64), +}) +export type SSVValidatorRegisteredEventArgs = EParams + +/** StakeETHTallyReset() */ +export const StakeETHTallyReset = event('0xe765a88a37047c5d793dce22b9ceb5a0f5039d276da139b4c7d29613f341f110', {}) +export type StakeETHTallyResetEventArgs = EParams + +/** StakeETHThresholdChanged(uint256) */ +export const StakeETHThresholdChanged = event('0xe26b067424903962f951f568e52ec9a3bbe1589526ea54a4e69ca6eaae1a4c77', { + amount: uint256, +}) +export type StakeETHThresholdChangedEventArgs = EParams + +/** StakingMonitorChanged(address) */ +export const StakingMonitorChanged = event('0x3329861a0008b3348767567d2405492b997abd79a088d0f2cef6b1a09a8e7ff7', { + newAddress: indexed(address), +}) +export type StakingMonitorChangedEventArgs = EParams + +/** Unpaused(address) */ +export const Unpaused = event('0x5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa', { + account: address, +}) +export type UnpausedEventArgs = EParams + +/** Withdrawal(address,address,uint256) */ +export const Withdrawal = event('0x2717ead6b9200dd235aad468c9809ea400fe33ac69b5bfaa6d3e90fc922b6398', { + _asset: indexed(address), + _pToken: address, + _amount: uint256, +}) +export type WithdrawalEventArgs = EParams diff --git a/src/abi/strategy-native-staking/functions.ts b/src/abi/strategy-native-staking/functions.ts new file mode 100644 index 00000000..8c8f323f --- /dev/null +++ b/src/abi/strategy-native-staking/functions.ts @@ -0,0 +1,407 @@ +import { address, array, bool, bytes, bytes32, int256, struct, uint256, uint32, uint64, uint8 } from '@subsquid/evm-codec' +import { func } from '../abi.support.js' +import type { FunctionArguments, FunctionReturn } from '../abi.support.js' + +/** BEACON_CHAIN_DEPOSIT_CONTRACT() */ +export const BEACON_CHAIN_DEPOSIT_CONTRACT = func('0xcceab750', {}, address) +export type BEACON_CHAIN_DEPOSIT_CONTRACTParams = FunctionArguments +export type BEACON_CHAIN_DEPOSIT_CONTRACTReturn = FunctionReturn + +/** FEE_ACCUMULATOR_ADDRESS() */ +export const FEE_ACCUMULATOR_ADDRESS = func('0xdd505df6', {}, address) +export type FEE_ACCUMULATOR_ADDRESSParams = FunctionArguments +export type FEE_ACCUMULATOR_ADDRESSReturn = FunctionReturn + +/** FULL_STAKE() */ +export const FULL_STAKE = func('0xb16b7d0b', {}, uint256) +export type FULL_STAKEParams = FunctionArguments +export type FULL_STAKEReturn = FunctionReturn + +/** MAX_VALIDATORS() */ +export const MAX_VALIDATORS = func('0x714897df', {}, uint256) +export type MAX_VALIDATORSParams = FunctionArguments +export type MAX_VALIDATORSReturn = FunctionReturn + +/** MIN_FIX_ACCOUNTING_CADENCE() */ +export const MIN_FIX_ACCOUNTING_CADENCE = func('0x63092383', {}, uint256) +export type MIN_FIX_ACCOUNTING_CADENCEParams = FunctionArguments +export type MIN_FIX_ACCOUNTING_CADENCEReturn = FunctionReturn + +/** SSV_NETWORK() */ +export const SSV_NETWORK = func('0x91649751', {}, address) +export type SSV_NETWORKParams = FunctionArguments +export type SSV_NETWORKReturn = FunctionReturn + +/** SSV_TOKEN() */ +export const SSV_TOKEN = func('0x0df1ecfd', {}, address) +export type SSV_TOKENParams = FunctionArguments +export type SSV_TOKENReturn = FunctionReturn + +/** VAULT_ADDRESS() */ +export const VAULT_ADDRESS = func('0x9092c31c', {}, address) +export type VAULT_ADDRESSParams = FunctionArguments +export type VAULT_ADDRESSReturn = FunctionReturn + +/** WETH() */ +export const WETH = func('0xad5c4648', {}, address) +export type WETHParams = FunctionArguments +export type WETHReturn = FunctionReturn + +/** activeDepositedValidators() */ +export const activeDepositedValidators = func('0x66e3667e', {}, uint256) +export type ActiveDepositedValidatorsParams = FunctionArguments +export type ActiveDepositedValidatorsReturn = FunctionReturn + +/** assetToPToken(address) */ +export const assetToPToken = func('0x0fc3b4c4', { + _0: address, +}, address) +export type AssetToPTokenParams = FunctionArguments +export type AssetToPTokenReturn = FunctionReturn + +/** checkBalance(address) */ +export const checkBalance = func('0x5f515226', { + _asset: address, +}, uint256) +export type CheckBalanceParams = FunctionArguments +export type CheckBalanceReturn = FunctionReturn + +/** claimGovernance() */ +export const claimGovernance = func('0x5d36b190', {}) +export type ClaimGovernanceParams = FunctionArguments +export type ClaimGovernanceReturn = FunctionReturn + +/** collectRewardTokens() */ +export const collectRewardTokens = func('0x5a063f63', {}) +export type CollectRewardTokensParams = FunctionArguments +export type CollectRewardTokensReturn = FunctionReturn + +/** confirmConsolidation(uint256) */ +export const confirmConsolidation = func('0x75c20dd1', { + consolidationCount: uint256, +}) +export type ConfirmConsolidationParams = FunctionArguments +export type ConfirmConsolidationReturn = FunctionReturn + +/** consensusRewards() */ +export const consensusRewards = func('0x842f5c46', {}, uint256) +export type ConsensusRewardsParams = FunctionArguments +export type ConsensusRewardsReturn = FunctionReturn + +/** deposit(address,uint256) */ +export const deposit = func('0x47e7ef24', { + _asset: address, + _amount: uint256, +}) +export type DepositParams = FunctionArguments +export type DepositReturn = FunctionReturn + +/** depositAll() */ +export const depositAll = func('0xde5f6268', {}) +export type DepositAllParams = FunctionArguments +export type DepositAllReturn = FunctionReturn + +/** depositedWethAccountedFor() */ +export const depositedWethAccountedFor = func('0xd059f6ef', {}, uint256) +export type DepositedWethAccountedForParams = FunctionArguments +export type DepositedWethAccountedForReturn = FunctionReturn + +/** doAccounting() */ +export const doAccounting = func('0xa4f98af4', {}, bool) +export type DoAccountingParams = FunctionArguments +export type DoAccountingReturn = FunctionReturn + +/** exitSsvValidator(bytes,uint64[]) */ +export const exitSsvValidator = func('0xd9f00ec7', { + publicKey: bytes, + operatorIds: array(uint64), +}) +export type ExitSsvValidatorParams = FunctionArguments +export type ExitSsvValidatorReturn = FunctionReturn + +/** failConsolidation(bytes[]) */ +export const failConsolidation = func('0x1d622328', { + sourcePubKeys: array(bytes), +}) +export type FailConsolidationParams = FunctionArguments +export type FailConsolidationReturn = FunctionReturn + +/** fuseIntervalEnd() */ +export const fuseIntervalEnd = func('0x484be812', {}, uint256) +export type FuseIntervalEndParams = FunctionArguments +export type FuseIntervalEndReturn = FunctionReturn + +/** fuseIntervalStart() */ +export const fuseIntervalStart = func('0x3c864959', {}, uint256) +export type FuseIntervalStartParams = FunctionArguments +export type FuseIntervalStartReturn = FunctionReturn + +/** getRewardTokenAddresses() */ +export const getRewardTokenAddresses = func('0xf6ca71b0', {}, array(address)) +export type GetRewardTokenAddressesParams = FunctionArguments +export type GetRewardTokenAddressesReturn = FunctionReturn + +/** governor() */ +export const governor = func('0x0c340a24', {}, address) +export type GovernorParams = FunctionArguments +export type GovernorReturn = FunctionReturn + +/** harvesterAddress() */ +export const harvesterAddress = func('0x67c7066c', {}, address) +export type HarvesterAddressParams = FunctionArguments +export type HarvesterAddressReturn = FunctionReturn + +/** initialize(address[],address[],address[]) */ +export const initialize = func('0x435356d1', { + _rewardTokenAddresses: array(address), + _assets: array(address), + _pTokens: array(address), +}) +export type InitializeParams = FunctionArguments +export type InitializeReturn = FunctionReturn + +/** isGovernor() */ +export const isGovernor = func('0xc7af3352', {}, bool) +export type IsGovernorParams = FunctionArguments +export type IsGovernorReturn = FunctionReturn + +/** lastFixAccountingBlockNumber() */ +export const lastFixAccountingBlockNumber = func('0xe7529239', {}, uint256) +export type LastFixAccountingBlockNumberParams = FunctionArguments +export type LastFixAccountingBlockNumberReturn = FunctionReturn + +/** manuallyFixAccounting(int256,int256,uint256) */ +export const manuallyFixAccounting = func('0x8d7c0e46', { + _validatorsDelta: int256, + _consensusRewardsDelta: int256, + _ethToVaultAmount: uint256, +}) +export type ManuallyFixAccountingParams = FunctionArguments +export type ManuallyFixAccountingReturn = FunctionReturn + +/** migrateClusterToETH(uint64[],(uint32,uint64,uint64,bool,uint256)) */ +export const migrateClusterToETH = func('0x36e87b12', { + operatorIds: array(uint64), + cluster: struct({ + validatorCount: uint32, + networkFeeIndex: uint64, + index: uint64, + active: bool, + balance: uint256, + }), +}) +export type MigrateClusterToETHParams = FunctionArguments +export type MigrateClusterToETHReturn = FunctionReturn + +/** pause() */ +export const pause = func('0x8456cb59', {}) +export type PauseParams = FunctionArguments +export type PauseReturn = FunctionReturn + +/** paused() */ +export const paused = func('0x5c975abb', {}, bool) +export type PausedParams = FunctionArguments +export type PausedReturn = FunctionReturn + +/** platformAddress() */ +export const platformAddress = func('0xdbe55e56', {}, address) +export type PlatformAddressParams = FunctionArguments +export type PlatformAddressReturn = FunctionReturn + +/** registerSsvValidators(bytes[],uint64[],bytes[],(uint32,uint64,uint64,bool,uint256)) */ +export const registerSsvValidators = func('0x31856682', { + publicKeys: array(bytes), + operatorIds: array(uint64), + sharesData: array(bytes), + cluster: struct({ + validatorCount: uint32, + networkFeeIndex: uint64, + index: uint64, + active: bool, + balance: uint256, + }), +}) +export type RegisterSsvValidatorsParams = FunctionArguments +export type RegisterSsvValidatorsReturn = FunctionReturn + +/** removePToken(uint256) */ +export const removePToken = func('0x9136616a', { + _assetIndex: uint256, +}) +export type RemovePTokenParams = FunctionArguments +export type RemovePTokenReturn = FunctionReturn + +/** removeSsvValidator(bytes,uint64[],(uint32,uint64,uint64,bool,uint256)) */ +export const removeSsvValidator = func('0x71a735f3', { + publicKey: bytes, + operatorIds: array(uint64), + cluster: struct({ + validatorCount: uint32, + networkFeeIndex: uint64, + index: uint64, + active: bool, + balance: uint256, + }), +}) +export type RemoveSsvValidatorParams = FunctionArguments +export type RemoveSsvValidatorReturn = FunctionReturn + +/** requestConsolidation(bytes[],bytes) */ +export const requestConsolidation = func('0x22be1ffd', { + sourcePubKeys: array(bytes), + targetPubKey: bytes, +}) +export type RequestConsolidationParams = FunctionArguments +export type RequestConsolidationReturn = FunctionReturn + +/** resetStakeETHTally() */ +export const resetStakeETHTally = func('0xee7afe2d', {}) +export type ResetStakeETHTallyParams = FunctionArguments +export type ResetStakeETHTallyReturn = FunctionReturn + +/** rewardTokenAddresses(uint256) */ +export const rewardTokenAddresses = func('0x7b2d9b2c', { + _0: uint256, +}, address) +export type RewardTokenAddressesParams = FunctionArguments +export type RewardTokenAddressesReturn = FunctionReturn + +/** safeApproveAllTokens() */ +export const safeApproveAllTokens = func('0xad1728cb', {}) +export type SafeApproveAllTokensParams = FunctionArguments +export type SafeApproveAllTokensReturn = FunctionReturn + +/** setFeeRecipient() */ +export const setFeeRecipient = func('0x13cf69dd', {}) +export type SetFeeRecipientParams = FunctionArguments +export type SetFeeRecipientReturn = FunctionReturn + +/** setFuseInterval(uint256,uint256) */ +export const setFuseInterval = func('0xab12edf5', { + _fuseIntervalStart: uint256, + _fuseIntervalEnd: uint256, +}) +export type SetFuseIntervalParams = FunctionArguments +export type SetFuseIntervalReturn = FunctionReturn + +/** setHarvesterAddress(address) */ +export const setHarvesterAddress = func('0xc2e1e3f4', { + _harvesterAddress: address, +}) +export type SetHarvesterAddressParams = FunctionArguments +export type SetHarvesterAddressReturn = FunctionReturn + +/** setPTokenAddress(address,address) */ +export const setPTokenAddress = func('0x0ed57b3a', { + _asset: address, + _pToken: address, +}) +export type SetPTokenAddressParams = FunctionArguments +export type SetPTokenAddressReturn = FunctionReturn + +/** setRegistrator(address) */ +export const setRegistrator = func('0x6e811d38', { + _address: address, +}) +export type SetRegistratorParams = FunctionArguments +export type SetRegistratorReturn = FunctionReturn + +/** setRewardTokenAddresses(address[]) */ +export const setRewardTokenAddresses = func('0x96d538bb', { + _rewardTokenAddresses: array(address), +}) +export type SetRewardTokenAddressesParams = FunctionArguments +export type SetRewardTokenAddressesReturn = FunctionReturn + +/** setStakeETHThreshold(uint256) */ +export const setStakeETHThreshold = func('0x5205c380', { + _amount: uint256, +}) +export type SetStakeETHThresholdParams = FunctionArguments +export type SetStakeETHThresholdReturn = FunctionReturn + +/** setStakingMonitor(address) */ +export const setStakingMonitor = func('0xa3b81e73', { + _address: address, +}) +export type SetStakingMonitorParams = FunctionArguments +export type SetStakingMonitorReturn = FunctionReturn + +/** stakeETHTally() */ +export const stakeETHTally = func('0xde34d713', {}, uint256) +export type StakeETHTallyParams = FunctionArguments +export type StakeETHTallyReturn = FunctionReturn + +/** stakeETHThreshold() */ +export const stakeETHThreshold = func('0x7b8962f7', {}, uint256) +export type StakeETHThresholdParams = FunctionArguments +export type StakeETHThresholdReturn = FunctionReturn + +/** stakeEth((bytes,bytes,bytes32)[]) */ +export const stakeEth = func('0x6ef38795', { + validators: array(struct({ + pubkey: bytes, + signature: bytes, + depositDataRoot: bytes32, + })), +}) +export type StakeEthParams = FunctionArguments +export type StakeEthReturn = FunctionReturn + +/** stakingMonitor() */ +export const stakingMonitor = func('0x7260f826', {}, address) +export type StakingMonitorParams = FunctionArguments +export type StakingMonitorReturn = FunctionReturn + +/** supportsAsset(address) */ +export const supportsAsset = func('0xaa388af6', { + _asset: address, +}, bool) +export type SupportsAssetParams = FunctionArguments +export type SupportsAssetReturn = FunctionReturn + +/** transferGovernance(address) */ +export const transferGovernance = func('0xd38bfff4', { + _newGovernor: address, +}) +export type TransferGovernanceParams = FunctionArguments +export type TransferGovernanceReturn = FunctionReturn + +/** transferToken(address,uint256) */ +export const transferToken = func('0x1072cbea', { + _asset: address, + _amount: uint256, +}) +export type TransferTokenParams = FunctionArguments +export type TransferTokenReturn = FunctionReturn + +/** validatorRegistrator() */ +export const validatorRegistrator = func('0x87bae867', {}, address) +export type ValidatorRegistratorParams = FunctionArguments +export type ValidatorRegistratorReturn = FunctionReturn + +/** validatorsStates(bytes32) */ +export const validatorsStates = func('0x9da0e462', { + _0: bytes32, +}, uint8) +export type ValidatorsStatesParams = FunctionArguments +export type ValidatorsStatesReturn = FunctionReturn + +/** vaultAddress() */ +export const vaultAddress = func('0x430bf08a', {}, address) +export type VaultAddressParams = FunctionArguments +export type VaultAddressReturn = FunctionReturn + +/** withdraw(address,address,uint256) */ +export const withdraw = func('0xd9caed12', { + _recipient: address, + _asset: address, + _amount: uint256, +}) +export type WithdrawParams = FunctionArguments +export type WithdrawReturn = FunctionReturn + +/** withdrawAll() */ +export const withdrawAll = func('0x853828b6', {}) +export type WithdrawAllParams = FunctionArguments +export type WithdrawAllReturn = FunctionReturn diff --git a/src/abi/strategy-native-staking/index.ts b/src/abi/strategy-native-staking/index.ts new file mode 100644 index 00000000..11829d6e --- /dev/null +++ b/src/abi/strategy-native-staking/index.ts @@ -0,0 +1,4 @@ +export * as events from './events.js' +export * as functions from './functions.js' + +export { Contract } from './contract.js' diff --git a/src/abi/swapx-pair-factory.ts b/src/abi/swapx-pair-factory.ts deleted file mode 100644 index f649cb75..00000000 --- a/src/abi/swapx-pair-factory.ts +++ /dev/null @@ -1,222 +0,0 @@ -import * as p from '@subsquid/evm-codec' -import { event, fun, viewFun, indexed, ContractBase } from '@subsquid/evm-abi' -import type { EventParams as EParams, FunctionArguments, FunctionReturn } from '@subsquid/evm-abi' - -export const events = { - Initialized: event("0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498", "Initialized(uint8)", {"version": p.uint8}), - OwnershipTransferred: event("0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", "OwnershipTransferred(address,address)", {"previousOwner": indexed(p.address), "newOwner": indexed(p.address)}), - PairCreated: event("0xc4805696c66d7cf352fc1d6bb633ad5ee82f6cb577c453024b6e0eb8306c6fc9", "PairCreated(address,address,bool,address,uint256)", {"token0": indexed(p.address), "token1": indexed(p.address), "stable": p.bool, "pair": p.address, "_4": p.uint256}), -} - -export const functions = { - MAX_FEE: viewFun("0xbc063e1a", "MAX_FEE()", {}, p.uint256), - MAX_TREASURY_FEE: viewFun("0xf2b3c809", "MAX_TREASURY_FEE()", {}, p.uint256), - acceptFeeManager: fun("0xf94c53c7", "acceptFeeManager()", {}, ), - allPairs: viewFun("0x1e3dd18b", "allPairs(uint256)", {"_0": p.uint256}, p.address), - allPairsLength: viewFun("0x574f2ba3", "allPairsLength()", {}, p.uint256), - createPair: fun("0x82dfdce4", "createPair(address,address,bool)", {"tokenA": p.address, "tokenB": p.address, "stable": p.bool}, p.address), - dibs: viewFun("0x7be1623e", "dibs()", {}, p.address), - feeManager: viewFun("0xd0fb0203", "feeManager()", {}, p.address), - getFee: viewFun("0x512b45ea", "getFee(bool)", {"_stable": p.bool}, p.uint256), - getInitializable: viewFun("0xeb13c4cf", "getInitializable()", {}, {"_0": p.address, "_1": p.address, "_2": p.bool}), - getPair: viewFun("0x6801cc30", "getPair(address,address,bool)", {"_0": p.address, "_1": p.address, "_2": p.bool}, p.address), - initialize: fun("0x8129fc1c", "initialize()", {}, ), - isPair: viewFun("0xe5e31b13", "isPair(address)", {"_0": p.address}, p.bool), - isPaused: viewFun("0xb187bd26", "isPaused()", {}, p.bool), - owner: viewFun("0x8da5cb5b", "owner()", {}, p.address), - pairCodeHash: viewFun("0x9aab9248", "pairCodeHash()", {}, p.bytes32), - pairs: viewFun("0xffb0a4a0", "pairs()", {}, p.array(p.address)), - pendingFeeManager: viewFun("0x8a4fa0d2", "pendingFeeManager()", {}, p.address), - renounceOwnership: fun("0x715018a6", "renounceOwnership()", {}, ), - setDibs: fun("0x0c74db12", "setDibs(address)", {"_dibs": p.address}, ), - setFee: fun("0xe1f76b44", "setFee(bool,uint256)", {"_stable": p.bool, "_fee": p.uint256}, ), - setFeeManager: fun("0x472d35b9", "setFeeManager(address)", {"_feeManager": p.address}, ), - setPause: fun("0xbedb86fb", "setPause(bool)", {"_state": p.bool}, ), - setStakingFeeAddress: fun("0x4091cb77", "setStakingFeeAddress(address)", {"_feehandler": p.address}, ), - setStakingFees: fun("0x482a8d07", "setStakingFees(uint256)", {"_newFee": p.uint256}, ), - setTreasuryFee: fun("0x77e741c7", "setTreasuryFee(uint256)", {"_tresFee": p.uint256}, ), - stableFee: viewFun("0x40bbd775", "stableFee()", {}, p.uint256), - stakingFeeHandler: viewFun("0xc124a4a2", "stakingFeeHandler()", {}, p.address), - stakingNFTFee: viewFun("0x956f94a1", "stakingNFTFee()", {}, p.uint256), - transferOwnership: fun("0xf2fde38b", "transferOwnership(address)", {"newOwner": p.address}, ), - volatileFee: viewFun("0x5084ed03", "volatileFee()", {}, p.uint256), -} - -export class Contract extends ContractBase { - - MAX_FEE() { - return this.eth_call(functions.MAX_FEE, {}) - } - - MAX_TREASURY_FEE() { - return this.eth_call(functions.MAX_TREASURY_FEE, {}) - } - - allPairs(_0: AllPairsParams["_0"]) { - return this.eth_call(functions.allPairs, {_0}) - } - - allPairsLength() { - return this.eth_call(functions.allPairsLength, {}) - } - - dibs() { - return this.eth_call(functions.dibs, {}) - } - - feeManager() { - return this.eth_call(functions.feeManager, {}) - } - - getFee(_stable: GetFeeParams["_stable"]) { - return this.eth_call(functions.getFee, {_stable}) - } - - getInitializable() { - return this.eth_call(functions.getInitializable, {}) - } - - getPair(_0: GetPairParams["_0"], _1: GetPairParams["_1"], _2: GetPairParams["_2"]) { - return this.eth_call(functions.getPair, {_0, _1, _2}) - } - - isPair(_0: IsPairParams["_0"]) { - return this.eth_call(functions.isPair, {_0}) - } - - isPaused() { - return this.eth_call(functions.isPaused, {}) - } - - owner() { - return this.eth_call(functions.owner, {}) - } - - pairCodeHash() { - return this.eth_call(functions.pairCodeHash, {}) - } - - pairs() { - return this.eth_call(functions.pairs, {}) - } - - pendingFeeManager() { - return this.eth_call(functions.pendingFeeManager, {}) - } - - stableFee() { - return this.eth_call(functions.stableFee, {}) - } - - stakingFeeHandler() { - return this.eth_call(functions.stakingFeeHandler, {}) - } - - stakingNFTFee() { - return this.eth_call(functions.stakingNFTFee, {}) - } - - volatileFee() { - return this.eth_call(functions.volatileFee, {}) - } -} - -/// Event types -export type InitializedEventArgs = EParams -export type OwnershipTransferredEventArgs = EParams -export type PairCreatedEventArgs = EParams - -/// Function types -export type MAX_FEEParams = FunctionArguments -export type MAX_FEEReturn = FunctionReturn - -export type MAX_TREASURY_FEEParams = FunctionArguments -export type MAX_TREASURY_FEEReturn = FunctionReturn - -export type AcceptFeeManagerParams = FunctionArguments -export type AcceptFeeManagerReturn = FunctionReturn - -export type AllPairsParams = FunctionArguments -export type AllPairsReturn = FunctionReturn - -export type AllPairsLengthParams = FunctionArguments -export type AllPairsLengthReturn = FunctionReturn - -export type CreatePairParams = FunctionArguments -export type CreatePairReturn = FunctionReturn - -export type DibsParams = FunctionArguments -export type DibsReturn = FunctionReturn - -export type FeeManagerParams = FunctionArguments -export type FeeManagerReturn = FunctionReturn - -export type GetFeeParams = FunctionArguments -export type GetFeeReturn = FunctionReturn - -export type GetInitializableParams = FunctionArguments -export type GetInitializableReturn = FunctionReturn - -export type GetPairParams = FunctionArguments -export type GetPairReturn = FunctionReturn - -export type InitializeParams = FunctionArguments -export type InitializeReturn = FunctionReturn - -export type IsPairParams = FunctionArguments -export type IsPairReturn = FunctionReturn - -export type IsPausedParams = FunctionArguments -export type IsPausedReturn = FunctionReturn - -export type OwnerParams = FunctionArguments -export type OwnerReturn = FunctionReturn - -export type PairCodeHashParams = FunctionArguments -export type PairCodeHashReturn = FunctionReturn - -export type PairsParams = FunctionArguments -export type PairsReturn = FunctionReturn - -export type PendingFeeManagerParams = FunctionArguments -export type PendingFeeManagerReturn = FunctionReturn - -export type RenounceOwnershipParams = FunctionArguments -export type RenounceOwnershipReturn = FunctionReturn - -export type SetDibsParams = FunctionArguments -export type SetDibsReturn = FunctionReturn - -export type SetFeeParams = FunctionArguments -export type SetFeeReturn = FunctionReturn - -export type SetFeeManagerParams = FunctionArguments -export type SetFeeManagerReturn = FunctionReturn - -export type SetPauseParams = FunctionArguments -export type SetPauseReturn = FunctionReturn - -export type SetStakingFeeAddressParams = FunctionArguments -export type SetStakingFeeAddressReturn = FunctionReturn - -export type SetStakingFeesParams = FunctionArguments -export type SetStakingFeesReturn = FunctionReturn - -export type SetTreasuryFeeParams = FunctionArguments -export type SetTreasuryFeeReturn = FunctionReturn - -export type StableFeeParams = FunctionArguments -export type StableFeeReturn = FunctionReturn - -export type StakingFeeHandlerParams = FunctionArguments -export type StakingFeeHandlerReturn = FunctionReturn - -export type StakingNFTFeeParams = FunctionArguments -export type StakingNFTFeeReturn = FunctionReturn - -export type TransferOwnershipParams = FunctionArguments -export type TransferOwnershipReturn = FunctionReturn - -export type VolatileFeeParams = FunctionArguments -export type VolatileFeeReturn = FunctionReturn - diff --git a/src/abi/swapx-pair-factory/contract.ts b/src/abi/swapx-pair-factory/contract.ts new file mode 100644 index 00000000..3c887765 --- /dev/null +++ b/src/abi/swapx-pair-factory/contract.ts @@ -0,0 +1,85 @@ +import { ContractBase } from '../abi.support.js' +import { MAX_FEE, MAX_TREASURY_FEE, allPairs, allPairsLength, createPair, dibs, feeManager, getFee, getInitializable, getPair, isPair, isPaused, owner, pairCodeHash, pairs, pendingFeeManager, stableFee, stakingFeeHandler, stakingNFTFee, volatileFee } from './functions.js' +import type { AllPairsParams, CreatePairParams, GetFeeParams, GetPairParams, IsPairParams } from './functions.js' + +export class Contract extends ContractBase { + MAX_FEE() { + return this.eth_call(MAX_FEE, {}) + } + + MAX_TREASURY_FEE() { + return this.eth_call(MAX_TREASURY_FEE, {}) + } + + allPairs(_0: AllPairsParams["_0"]) { + return this.eth_call(allPairs, {_0}) + } + + allPairsLength() { + return this.eth_call(allPairsLength, {}) + } + + createPair(tokenA: CreatePairParams["tokenA"], tokenB: CreatePairParams["tokenB"], stable: CreatePairParams["stable"]) { + return this.eth_call(createPair, {tokenA, tokenB, stable}) + } + + dibs() { + return this.eth_call(dibs, {}) + } + + feeManager() { + return this.eth_call(feeManager, {}) + } + + getFee(_stable: GetFeeParams["_stable"]) { + return this.eth_call(getFee, {_stable}) + } + + getInitializable() { + return this.eth_call(getInitializable, {}) + } + + getPair(_0: GetPairParams["_0"], _1: GetPairParams["_1"], _2: GetPairParams["_2"]) { + return this.eth_call(getPair, {_0, _1, _2}) + } + + isPair(_0: IsPairParams["_0"]) { + return this.eth_call(isPair, {_0}) + } + + isPaused() { + return this.eth_call(isPaused, {}) + } + + owner() { + return this.eth_call(owner, {}) + } + + pairCodeHash() { + return this.eth_call(pairCodeHash, {}) + } + + pairs() { + return this.eth_call(pairs, {}) + } + + pendingFeeManager() { + return this.eth_call(pendingFeeManager, {}) + } + + stableFee() { + return this.eth_call(stableFee, {}) + } + + stakingFeeHandler() { + return this.eth_call(stakingFeeHandler, {}) + } + + stakingNFTFee() { + return this.eth_call(stakingNFTFee, {}) + } + + volatileFee() { + return this.eth_call(volatileFee, {}) + } +} diff --git a/src/abi/swapx-pair-factory/events.ts b/src/abi/swapx-pair-factory/events.ts new file mode 100644 index 00000000..3b2a21b7 --- /dev/null +++ b/src/abi/swapx-pair-factory/events.ts @@ -0,0 +1,26 @@ +import { address, bool, uint256, uint8 } from '@subsquid/evm-codec' +import { event, indexed } from '../abi.support.js' +import type { EventParams as EParams } from '../abi.support.js' + +/** Initialized(uint8) */ +export const Initialized = event('0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498', { + version: uint8, +}) +export type InitializedEventArgs = EParams + +/** OwnershipTransferred(address,address) */ +export const OwnershipTransferred = event('0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0', { + previousOwner: indexed(address), + newOwner: indexed(address), +}) +export type OwnershipTransferredEventArgs = EParams + +/** PairCreated(address,address,bool,address,uint256) */ +export const PairCreated = event('0xc4805696c66d7cf352fc1d6bb633ad5ee82f6cb577c453024b6e0eb8306c6fc9', { + token0: indexed(address), + token1: indexed(address), + stable: bool, + pair: address, + _4: uint256, +}) +export type PairCreatedEventArgs = EParams diff --git a/src/abi/swapx-pair-factory/functions.ts b/src/abi/swapx-pair-factory/functions.ts new file mode 100644 index 00000000..67b750df --- /dev/null +++ b/src/abi/swapx-pair-factory/functions.ts @@ -0,0 +1,193 @@ +import { address, array, bool, bytes32, struct, uint256 } from '@subsquid/evm-codec' +import { func } from '../abi.support.js' +import type { FunctionArguments, FunctionReturn } from '../abi.support.js' + +/** MAX_FEE() */ +export const MAX_FEE = func('0xbc063e1a', {}, uint256) +export type MAX_FEEParams = FunctionArguments +export type MAX_FEEReturn = FunctionReturn + +/** MAX_TREASURY_FEE() */ +export const MAX_TREASURY_FEE = func('0xf2b3c809', {}, uint256) +export type MAX_TREASURY_FEEParams = FunctionArguments +export type MAX_TREASURY_FEEReturn = FunctionReturn + +/** acceptFeeManager() */ +export const acceptFeeManager = func('0xf94c53c7', {}) +export type AcceptFeeManagerParams = FunctionArguments +export type AcceptFeeManagerReturn = FunctionReturn + +/** allPairs(uint256) */ +export const allPairs = func('0x1e3dd18b', { + _0: uint256, +}, address) +export type AllPairsParams = FunctionArguments +export type AllPairsReturn = FunctionReturn + +/** allPairsLength() */ +export const allPairsLength = func('0x574f2ba3', {}, uint256) +export type AllPairsLengthParams = FunctionArguments +export type AllPairsLengthReturn = FunctionReturn + +/** createPair(address,address,bool) */ +export const createPair = func('0x82dfdce4', { + tokenA: address, + tokenB: address, + stable: bool, +}, address) +export type CreatePairParams = FunctionArguments +export type CreatePairReturn = FunctionReturn + +/** dibs() */ +export const dibs = func('0x7be1623e', {}, address) +export type DibsParams = FunctionArguments +export type DibsReturn = FunctionReturn + +/** feeManager() */ +export const feeManager = func('0xd0fb0203', {}, address) +export type FeeManagerParams = FunctionArguments +export type FeeManagerReturn = FunctionReturn + +/** getFee(bool) */ +export const getFee = func('0x512b45ea', { + _stable: bool, +}, uint256) +export type GetFeeParams = FunctionArguments +export type GetFeeReturn = FunctionReturn + +/** getInitializable() */ +export const getInitializable = func('0xeb13c4cf', {}, struct({ + _0: address, + _1: address, + _2: bool, +})) +export type GetInitializableParams = FunctionArguments +export type GetInitializableReturn = FunctionReturn + +/** getPair(address,address,bool) */ +export const getPair = func('0x6801cc30', { + _0: address, + _1: address, + _2: bool, +}, address) +export type GetPairParams = FunctionArguments +export type GetPairReturn = FunctionReturn + +/** initialize() */ +export const initialize = func('0x8129fc1c', {}) +export type InitializeParams = FunctionArguments +export type InitializeReturn = FunctionReturn + +/** isPair(address) */ +export const isPair = func('0xe5e31b13', { + _0: address, +}, bool) +export type IsPairParams = FunctionArguments +export type IsPairReturn = FunctionReturn + +/** isPaused() */ +export const isPaused = func('0xb187bd26', {}, bool) +export type IsPausedParams = FunctionArguments +export type IsPausedReturn = FunctionReturn + +/** owner() */ +export const owner = func('0x8da5cb5b', {}, address) +export type OwnerParams = FunctionArguments +export type OwnerReturn = FunctionReturn + +/** pairCodeHash() */ +export const pairCodeHash = func('0x9aab9248', {}, bytes32) +export type PairCodeHashParams = FunctionArguments +export type PairCodeHashReturn = FunctionReturn + +/** pairs() */ +export const pairs = func('0xffb0a4a0', {}, array(address)) +export type PairsParams = FunctionArguments +export type PairsReturn = FunctionReturn + +/** pendingFeeManager() */ +export const pendingFeeManager = func('0x8a4fa0d2', {}, address) +export type PendingFeeManagerParams = FunctionArguments +export type PendingFeeManagerReturn = FunctionReturn + +/** renounceOwnership() */ +export const renounceOwnership = func('0x715018a6', {}) +export type RenounceOwnershipParams = FunctionArguments +export type RenounceOwnershipReturn = FunctionReturn + +/** setDibs(address) */ +export const setDibs = func('0x0c74db12', { + _dibs: address, +}) +export type SetDibsParams = FunctionArguments +export type SetDibsReturn = FunctionReturn + +/** setFee(bool,uint256) */ +export const setFee = func('0xe1f76b44', { + _stable: bool, + _fee: uint256, +}) +export type SetFeeParams = FunctionArguments +export type SetFeeReturn = FunctionReturn + +/** setFeeManager(address) */ +export const setFeeManager = func('0x472d35b9', { + _feeManager: address, +}) +export type SetFeeManagerParams = FunctionArguments +export type SetFeeManagerReturn = FunctionReturn + +/** setPause(bool) */ +export const setPause = func('0xbedb86fb', { + _state: bool, +}) +export type SetPauseParams = FunctionArguments +export type SetPauseReturn = FunctionReturn + +/** setStakingFeeAddress(address) */ +export const setStakingFeeAddress = func('0x4091cb77', { + _feehandler: address, +}) +export type SetStakingFeeAddressParams = FunctionArguments +export type SetStakingFeeAddressReturn = FunctionReturn + +/** setStakingFees(uint256) */ +export const setStakingFees = func('0x482a8d07', { + _newFee: uint256, +}) +export type SetStakingFeesParams = FunctionArguments +export type SetStakingFeesReturn = FunctionReturn + +/** setTreasuryFee(uint256) */ +export const setTreasuryFee = func('0x77e741c7', { + _tresFee: uint256, +}) +export type SetTreasuryFeeParams = FunctionArguments +export type SetTreasuryFeeReturn = FunctionReturn + +/** stableFee() */ +export const stableFee = func('0x40bbd775', {}, uint256) +export type StableFeeParams = FunctionArguments +export type StableFeeReturn = FunctionReturn + +/** stakingFeeHandler() */ +export const stakingFeeHandler = func('0xc124a4a2', {}, address) +export type StakingFeeHandlerParams = FunctionArguments +export type StakingFeeHandlerReturn = FunctionReturn + +/** stakingNFTFee() */ +export const stakingNFTFee = func('0x956f94a1', {}, uint256) +export type StakingNFTFeeParams = FunctionArguments +export type StakingNFTFeeReturn = FunctionReturn + +/** transferOwnership(address) */ +export const transferOwnership = func('0xf2fde38b', { + newOwner: address, +}) +export type TransferOwnershipParams = FunctionArguments +export type TransferOwnershipReturn = FunctionReturn + +/** volatileFee() */ +export const volatileFee = func('0x5084ed03', {}, uint256) +export type VolatileFeeParams = FunctionArguments +export type VolatileFeeReturn = FunctionReturn diff --git a/src/abi/swapx-pair-factory/index.ts b/src/abi/swapx-pair-factory/index.ts new file mode 100644 index 00000000..11829d6e --- /dev/null +++ b/src/abi/swapx-pair-factory/index.ts @@ -0,0 +1,4 @@ +export * as events from './events.js' +export * as functions from './functions.js' + +export { Contract } from './contract.js' diff --git a/src/abi/uniswap-v3.ts b/src/abi/uniswap-v3.ts deleted file mode 100644 index a2dae7ea..00000000 --- a/src/abi/uniswap-v3.ts +++ /dev/null @@ -1,206 +0,0 @@ -import * as p from '@subsquid/evm-codec' -import { event, fun, viewFun, indexed, ContractBase } from '@subsquid/evm-abi' -import type { EventParams as EParams, FunctionArguments, FunctionReturn } from '@subsquid/evm-abi' - -export const events = { - Burn: event("0x0c396cd989a39f4459b5fa1aed6a9a8dcdbc45908acfd67e028cd568da98982c", "Burn(address,int24,int24,uint128,uint256,uint256)", {"owner": indexed(p.address), "tickLower": indexed(p.int24), "tickUpper": indexed(p.int24), "amount": p.uint128, "amount0": p.uint256, "amount1": p.uint256}), - Collect: event("0x70935338e69775456a85ddef226c395fb668b63fa0115f5f20610b388e6ca9c0", "Collect(address,address,int24,int24,uint128,uint128)", {"owner": indexed(p.address), "recipient": p.address, "tickLower": indexed(p.int24), "tickUpper": indexed(p.int24), "amount0": p.uint128, "amount1": p.uint128}), - CollectProtocol: event("0x596b573906218d3411850b26a6b437d6c4522fdb43d2d2386263f86d50b8b151", "CollectProtocol(address,address,uint128,uint128)", {"sender": indexed(p.address), "recipient": indexed(p.address), "amount0": p.uint128, "amount1": p.uint128}), - Flash: event("0xbdbdb71d7860376ba52b25a5028beea23581364a40522f6bcfb86bb1f2dca633", "Flash(address,address,uint256,uint256,uint256,uint256)", {"sender": indexed(p.address), "recipient": indexed(p.address), "amount0": p.uint256, "amount1": p.uint256, "paid0": p.uint256, "paid1": p.uint256}), - IncreaseObservationCardinalityNext: event("0xac49e518f90a358f652e4400164f05a5d8f7e35e7747279bc3a93dbf584e125a", "IncreaseObservationCardinalityNext(uint16,uint16)", {"observationCardinalityNextOld": p.uint16, "observationCardinalityNextNew": p.uint16}), - Initialize: event("0x98636036cb66a9c19a37435efc1e90142190214e8abeb821bdba3f2990dd4c95", "Initialize(uint160,int24)", {"sqrtPriceX96": p.uint160, "tick": p.int24}), - Mint: event("0x7a53080ba414158be7ec69b987b5fb7d07dee101fe85488f0853ae16239d0bde", "Mint(address,address,int24,int24,uint128,uint256,uint256)", {"sender": p.address, "owner": indexed(p.address), "tickLower": indexed(p.int24), "tickUpper": indexed(p.int24), "amount": p.uint128, "amount0": p.uint256, "amount1": p.uint256}), - SetFeeProtocol: event("0x973d8d92bb299f4af6ce49b52a8adb85ae46b9f214c4c4fc06ac77401237b133", "SetFeeProtocol(uint8,uint8,uint8,uint8)", {"feeProtocol0Old": p.uint8, "feeProtocol1Old": p.uint8, "feeProtocol0New": p.uint8, "feeProtocol1New": p.uint8}), - Swap: event("0xc42079f94a6350d7e6235f29174924f928cc2ac818eb64fed8004e115fbcca67", "Swap(address,address,int256,int256,uint160,uint128,int24)", {"sender": indexed(p.address), "recipient": indexed(p.address), "amount0": p.int256, "amount1": p.int256, "sqrtPriceX96": p.uint160, "liquidity": p.uint128, "tick": p.int24}), -} - -export const functions = { - burn: fun("0xa34123a7", "burn(int24,int24,uint128)", {"tickLower": p.int24, "tickUpper": p.int24, "amount": p.uint128}, {"amount0": p.uint256, "amount1": p.uint256}), - collect: fun("0x4f1eb3d8", "collect(address,int24,int24,uint128,uint128)", {"recipient": p.address, "tickLower": p.int24, "tickUpper": p.int24, "amount0Requested": p.uint128, "amount1Requested": p.uint128}, {"amount0": p.uint128, "amount1": p.uint128}), - collectProtocol: fun("0x85b66729", "collectProtocol(address,uint128,uint128)", {"recipient": p.address, "amount0Requested": p.uint128, "amount1Requested": p.uint128}, {"amount0": p.uint128, "amount1": p.uint128}), - factory: viewFun("0xc45a0155", "factory()", {}, p.address), - fee: viewFun("0xddca3f43", "fee()", {}, p.uint24), - feeGrowthGlobal0X128: viewFun("0xf3058399", "feeGrowthGlobal0X128()", {}, p.uint256), - feeGrowthGlobal1X128: viewFun("0x46141319", "feeGrowthGlobal1X128()", {}, p.uint256), - flash: fun("0x490e6cbc", "flash(address,uint256,uint256,bytes)", {"recipient": p.address, "amount0": p.uint256, "amount1": p.uint256, "data": p.bytes}, ), - increaseObservationCardinalityNext: fun("0x32148f67", "increaseObservationCardinalityNext(uint16)", {"observationCardinalityNext": p.uint16}, ), - initialize: fun("0xf637731d", "initialize(uint160)", {"sqrtPriceX96": p.uint160}, ), - liquidity: viewFun("0x1a686502", "liquidity()", {}, p.uint128), - maxLiquidityPerTick: viewFun("0x70cf754a", "maxLiquidityPerTick()", {}, p.uint128), - mint: fun("0x3c8a7d8d", "mint(address,int24,int24,uint128,bytes)", {"recipient": p.address, "tickLower": p.int24, "tickUpper": p.int24, "amount": p.uint128, "data": p.bytes}, {"amount0": p.uint256, "amount1": p.uint256}), - observations: viewFun("0x252c09d7", "observations(uint256)", {"_0": p.uint256}, {"blockTimestamp": p.uint32, "tickCumulative": p.int56, "secondsPerLiquidityCumulativeX128": p.uint160, "initialized": p.bool}), - observe: viewFun("0x883bdbfd", "observe(uint32[])", {"secondsAgos": p.array(p.uint32)}, {"tickCumulatives": p.array(p.int56), "secondsPerLiquidityCumulativeX128s": p.array(p.uint160)}), - positions: viewFun("0x514ea4bf", "positions(bytes32)", {"_0": p.bytes32}, {"liquidity": p.uint128, "feeGrowthInside0LastX128": p.uint256, "feeGrowthInside1LastX128": p.uint256, "tokensOwed0": p.uint128, "tokensOwed1": p.uint128}), - protocolFees: viewFun("0x1ad8b03b", "protocolFees()", {}, {"token0": p.uint128, "token1": p.uint128}), - setFeeProtocol: fun("0x8206a4d1", "setFeeProtocol(uint8,uint8)", {"feeProtocol0": p.uint8, "feeProtocol1": p.uint8}, ), - slot0: viewFun("0x3850c7bd", "slot0()", {}, {"sqrtPriceX96": p.uint160, "tick": p.int24, "observationIndex": p.uint16, "observationCardinality": p.uint16, "observationCardinalityNext": p.uint16, "feeProtocol": p.uint8, "unlocked": p.bool}), - snapshotCumulativesInside: viewFun("0xa38807f2", "snapshotCumulativesInside(int24,int24)", {"tickLower": p.int24, "tickUpper": p.int24}, {"tickCumulativeInside": p.int56, "secondsPerLiquidityInsideX128": p.uint160, "secondsInside": p.uint32}), - swap: fun("0x128acb08", "swap(address,bool,int256,uint160,bytes)", {"recipient": p.address, "zeroForOne": p.bool, "amountSpecified": p.int256, "sqrtPriceLimitX96": p.uint160, "data": p.bytes}, {"amount0": p.int256, "amount1": p.int256}), - tickBitmap: viewFun("0x5339c296", "tickBitmap(int16)", {"_0": p.int16}, p.uint256), - tickSpacing: viewFun("0xd0c93a7c", "tickSpacing()", {}, p.int24), - ticks: viewFun("0xf30dba93", "ticks(int24)", {"_0": p.int24}, {"liquidityGross": p.uint128, "liquidityNet": p.int128, "feeGrowthOutside0X128": p.uint256, "feeGrowthOutside1X128": p.uint256, "tickCumulativeOutside": p.int56, "secondsPerLiquidityOutsideX128": p.uint160, "secondsOutside": p.uint32, "initialized": p.bool}), - token0: viewFun("0x0dfe1681", "token0()", {}, p.address), - token1: viewFun("0xd21220a7", "token1()", {}, p.address), -} - -export class Contract extends ContractBase { - - factory() { - return this.eth_call(functions.factory, {}) - } - - fee() { - return this.eth_call(functions.fee, {}) - } - - feeGrowthGlobal0X128() { - return this.eth_call(functions.feeGrowthGlobal0X128, {}) - } - - feeGrowthGlobal1X128() { - return this.eth_call(functions.feeGrowthGlobal1X128, {}) - } - - liquidity() { - return this.eth_call(functions.liquidity, {}) - } - - maxLiquidityPerTick() { - return this.eth_call(functions.maxLiquidityPerTick, {}) - } - - observations(_0: ObservationsParams["_0"]) { - return this.eth_call(functions.observations, {_0}) - } - - observe(secondsAgos: ObserveParams["secondsAgos"]) { - return this.eth_call(functions.observe, {secondsAgos}) - } - - positions(_0: PositionsParams["_0"]) { - return this.eth_call(functions.positions, {_0}) - } - - protocolFees() { - return this.eth_call(functions.protocolFees, {}) - } - - slot0() { - return this.eth_call(functions.slot0, {}) - } - - snapshotCumulativesInside(tickLower: SnapshotCumulativesInsideParams["tickLower"], tickUpper: SnapshotCumulativesInsideParams["tickUpper"]) { - return this.eth_call(functions.snapshotCumulativesInside, {tickLower, tickUpper}) - } - - tickBitmap(_0: TickBitmapParams["_0"]) { - return this.eth_call(functions.tickBitmap, {_0}) - } - - tickSpacing() { - return this.eth_call(functions.tickSpacing, {}) - } - - ticks(_0: TicksParams["_0"]) { - return this.eth_call(functions.ticks, {_0}) - } - - token0() { - return this.eth_call(functions.token0, {}) - } - - token1() { - return this.eth_call(functions.token1, {}) - } -} - -/// Event types -export type BurnEventArgs = EParams -export type CollectEventArgs = EParams -export type CollectProtocolEventArgs = EParams -export type FlashEventArgs = EParams -export type IncreaseObservationCardinalityNextEventArgs = EParams -export type InitializeEventArgs = EParams -export type MintEventArgs = EParams -export type SetFeeProtocolEventArgs = EParams -export type SwapEventArgs = EParams - -/// Function types -export type BurnParams = FunctionArguments -export type BurnReturn = FunctionReturn - -export type CollectParams = FunctionArguments -export type CollectReturn = FunctionReturn - -export type CollectProtocolParams = FunctionArguments -export type CollectProtocolReturn = FunctionReturn - -export type FactoryParams = FunctionArguments -export type FactoryReturn = FunctionReturn - -export type FeeParams = FunctionArguments -export type FeeReturn = FunctionReturn - -export type FeeGrowthGlobal0X128Params = FunctionArguments -export type FeeGrowthGlobal0X128Return = FunctionReturn - -export type FeeGrowthGlobal1X128Params = FunctionArguments -export type FeeGrowthGlobal1X128Return = FunctionReturn - -export type FlashParams = FunctionArguments -export type FlashReturn = FunctionReturn - -export type IncreaseObservationCardinalityNextParams = FunctionArguments -export type IncreaseObservationCardinalityNextReturn = FunctionReturn - -export type InitializeParams = FunctionArguments -export type InitializeReturn = FunctionReturn - -export type LiquidityParams = FunctionArguments -export type LiquidityReturn = FunctionReturn - -export type MaxLiquidityPerTickParams = FunctionArguments -export type MaxLiquidityPerTickReturn = FunctionReturn - -export type MintParams = FunctionArguments -export type MintReturn = FunctionReturn - -export type ObservationsParams = FunctionArguments -export type ObservationsReturn = FunctionReturn - -export type ObserveParams = FunctionArguments -export type ObserveReturn = FunctionReturn - -export type PositionsParams = FunctionArguments -export type PositionsReturn = FunctionReturn - -export type ProtocolFeesParams = FunctionArguments -export type ProtocolFeesReturn = FunctionReturn - -export type SetFeeProtocolParams = FunctionArguments -export type SetFeeProtocolReturn = FunctionReturn - -export type Slot0Params = FunctionArguments -export type Slot0Return = FunctionReturn - -export type SnapshotCumulativesInsideParams = FunctionArguments -export type SnapshotCumulativesInsideReturn = FunctionReturn - -export type SwapParams = FunctionArguments -export type SwapReturn = FunctionReturn - -export type TickBitmapParams = FunctionArguments -export type TickBitmapReturn = FunctionReturn - -export type TickSpacingParams = FunctionArguments -export type TickSpacingReturn = FunctionReturn - -export type TicksParams = FunctionArguments -export type TicksReturn = FunctionReturn - -export type Token0Params = FunctionArguments -export type Token0Return = FunctionReturn - -export type Token1Params = FunctionArguments -export type Token1Return = FunctionReturn - diff --git a/src/abi/uniswap-v3/contract.ts b/src/abi/uniswap-v3/contract.ts new file mode 100644 index 00000000..dc313226 --- /dev/null +++ b/src/abi/uniswap-v3/contract.ts @@ -0,0 +1,93 @@ +import { ContractBase } from '../abi.support.js' +import { burn, collect, collectProtocol, factory, fee, feeGrowthGlobal0X128, feeGrowthGlobal1X128, liquidity, maxLiquidityPerTick, mint, observations, observe, positions, protocolFees, slot0, snapshotCumulativesInside, swap, tickBitmap, tickSpacing, ticks, token0, token1 } from './functions.js' +import type { BurnParams, CollectParams, CollectProtocolParams, MintParams, ObservationsParams, ObserveParams, PositionsParams, SnapshotCumulativesInsideParams, SwapParams, TickBitmapParams, TicksParams } from './functions.js' + +export class Contract extends ContractBase { + burn(tickLower: BurnParams["tickLower"], tickUpper: BurnParams["tickUpper"], amount: BurnParams["amount"]) { + return this.eth_call(burn, {tickLower, tickUpper, amount}) + } + + collect(recipient: CollectParams["recipient"], tickLower: CollectParams["tickLower"], tickUpper: CollectParams["tickUpper"], amount0Requested: CollectParams["amount0Requested"], amount1Requested: CollectParams["amount1Requested"]) { + return this.eth_call(collect, {recipient, tickLower, tickUpper, amount0Requested, amount1Requested}) + } + + collectProtocol(recipient: CollectProtocolParams["recipient"], amount0Requested: CollectProtocolParams["amount0Requested"], amount1Requested: CollectProtocolParams["amount1Requested"]) { + return this.eth_call(collectProtocol, {recipient, amount0Requested, amount1Requested}) + } + + factory() { + return this.eth_call(factory, {}) + } + + fee() { + return this.eth_call(fee, {}) + } + + feeGrowthGlobal0X128() { + return this.eth_call(feeGrowthGlobal0X128, {}) + } + + feeGrowthGlobal1X128() { + return this.eth_call(feeGrowthGlobal1X128, {}) + } + + liquidity() { + return this.eth_call(liquidity, {}) + } + + maxLiquidityPerTick() { + return this.eth_call(maxLiquidityPerTick, {}) + } + + mint(recipient: MintParams["recipient"], tickLower: MintParams["tickLower"], tickUpper: MintParams["tickUpper"], amount: MintParams["amount"], data: MintParams["data"]) { + return this.eth_call(mint, {recipient, tickLower, tickUpper, amount, data}) + } + + observations(_0: ObservationsParams["_0"]) { + return this.eth_call(observations, {_0}) + } + + observe(secondsAgos: ObserveParams["secondsAgos"]) { + return this.eth_call(observe, {secondsAgos}) + } + + positions(_0: PositionsParams["_0"]) { + return this.eth_call(positions, {_0}) + } + + protocolFees() { + return this.eth_call(protocolFees, {}) + } + + slot0() { + return this.eth_call(slot0, {}) + } + + snapshotCumulativesInside(tickLower: SnapshotCumulativesInsideParams["tickLower"], tickUpper: SnapshotCumulativesInsideParams["tickUpper"]) { + return this.eth_call(snapshotCumulativesInside, {tickLower, tickUpper}) + } + + swap(recipient: SwapParams["recipient"], zeroForOne: SwapParams["zeroForOne"], amountSpecified: SwapParams["amountSpecified"], sqrtPriceLimitX96: SwapParams["sqrtPriceLimitX96"], data: SwapParams["data"]) { + return this.eth_call(swap, {recipient, zeroForOne, amountSpecified, sqrtPriceLimitX96, data}) + } + + tickBitmap(_0: TickBitmapParams["_0"]) { + return this.eth_call(tickBitmap, {_0}) + } + + tickSpacing() { + return this.eth_call(tickSpacing, {}) + } + + ticks(_0: TicksParams["_0"]) { + return this.eth_call(ticks, {_0}) + } + + token0() { + return this.eth_call(token0, {}) + } + + token1() { + return this.eth_call(token1, {}) + } +} diff --git a/src/abi/uniswap-v3/events.ts b/src/abi/uniswap-v3/events.ts new file mode 100644 index 00000000..83838f72 --- /dev/null +++ b/src/abi/uniswap-v3/events.ts @@ -0,0 +1,92 @@ +import { address, int24, int256, uint128, uint16, uint160, uint256, uint8 } from '@subsquid/evm-codec' +import { event, indexed } from '../abi.support.js' +import type { EventParams as EParams } from '../abi.support.js' + +/** Burn(address,int24,int24,uint128,uint256,uint256) */ +export const Burn = event('0x0c396cd989a39f4459b5fa1aed6a9a8dcdbc45908acfd67e028cd568da98982c', { + owner: indexed(address), + tickLower: indexed(int24), + tickUpper: indexed(int24), + amount: uint128, + amount0: uint256, + amount1: uint256, +}) +export type BurnEventArgs = EParams + +/** Collect(address,address,int24,int24,uint128,uint128) */ +export const Collect = event('0x70935338e69775456a85ddef226c395fb668b63fa0115f5f20610b388e6ca9c0', { + owner: indexed(address), + recipient: address, + tickLower: indexed(int24), + tickUpper: indexed(int24), + amount0: uint128, + amount1: uint128, +}) +export type CollectEventArgs = EParams + +/** CollectProtocol(address,address,uint128,uint128) */ +export const CollectProtocol = event('0x596b573906218d3411850b26a6b437d6c4522fdb43d2d2386263f86d50b8b151', { + sender: indexed(address), + recipient: indexed(address), + amount0: uint128, + amount1: uint128, +}) +export type CollectProtocolEventArgs = EParams + +/** Flash(address,address,uint256,uint256,uint256,uint256) */ +export const Flash = event('0xbdbdb71d7860376ba52b25a5028beea23581364a40522f6bcfb86bb1f2dca633', { + sender: indexed(address), + recipient: indexed(address), + amount0: uint256, + amount1: uint256, + paid0: uint256, + paid1: uint256, +}) +export type FlashEventArgs = EParams + +/** IncreaseObservationCardinalityNext(uint16,uint16) */ +export const IncreaseObservationCardinalityNext = event('0xac49e518f90a358f652e4400164f05a5d8f7e35e7747279bc3a93dbf584e125a', { + observationCardinalityNextOld: uint16, + observationCardinalityNextNew: uint16, +}) +export type IncreaseObservationCardinalityNextEventArgs = EParams + +/** Initialize(uint160,int24) */ +export const Initialize = event('0x98636036cb66a9c19a37435efc1e90142190214e8abeb821bdba3f2990dd4c95', { + sqrtPriceX96: uint160, + tick: int24, +}) +export type InitializeEventArgs = EParams + +/** Mint(address,address,int24,int24,uint128,uint256,uint256) */ +export const Mint = event('0x7a53080ba414158be7ec69b987b5fb7d07dee101fe85488f0853ae16239d0bde', { + sender: address, + owner: indexed(address), + tickLower: indexed(int24), + tickUpper: indexed(int24), + amount: uint128, + amount0: uint256, + amount1: uint256, +}) +export type MintEventArgs = EParams + +/** SetFeeProtocol(uint8,uint8,uint8,uint8) */ +export const SetFeeProtocol = event('0x973d8d92bb299f4af6ce49b52a8adb85ae46b9f214c4c4fc06ac77401237b133', { + feeProtocol0Old: uint8, + feeProtocol1Old: uint8, + feeProtocol0New: uint8, + feeProtocol1New: uint8, +}) +export type SetFeeProtocolEventArgs = EParams + +/** Swap(address,address,int256,int256,uint160,uint128,int24) */ +export const Swap = event('0xc42079f94a6350d7e6235f29174924f928cc2ac818eb64fed8004e115fbcca67', { + sender: indexed(address), + recipient: indexed(address), + amount0: int256, + amount1: int256, + sqrtPriceX96: uint160, + liquidity: uint128, + tick: int24, +}) +export type SwapEventArgs = EParams diff --git a/src/abi/uniswap-v3/functions.ts b/src/abi/uniswap-v3/functions.ts new file mode 100644 index 00000000..1cdb4cbe --- /dev/null +++ b/src/abi/uniswap-v3/functions.ts @@ -0,0 +1,237 @@ +import { address, array, bool, bytes, bytes32, int128, int16, int24, int256, int56, struct, uint128, uint16, uint160, uint24, uint256, uint32, uint8 } from '@subsquid/evm-codec' +import { func } from '../abi.support.js' +import type { FunctionArguments, FunctionReturn } from '../abi.support.js' + +/** burn(int24,int24,uint128) */ +export const burn = func('0xa34123a7', { + tickLower: int24, + tickUpper: int24, + amount: uint128, +}, struct({ + amount0: uint256, + amount1: uint256, +})) +export type BurnParams = FunctionArguments +export type BurnReturn = FunctionReturn + +/** collect(address,int24,int24,uint128,uint128) */ +export const collect = func('0x4f1eb3d8', { + recipient: address, + tickLower: int24, + tickUpper: int24, + amount0Requested: uint128, + amount1Requested: uint128, +}, struct({ + amount0: uint128, + amount1: uint128, +})) +export type CollectParams = FunctionArguments +export type CollectReturn = FunctionReturn + +/** collectProtocol(address,uint128,uint128) */ +export const collectProtocol = func('0x85b66729', { + recipient: address, + amount0Requested: uint128, + amount1Requested: uint128, +}, struct({ + amount0: uint128, + amount1: uint128, +})) +export type CollectProtocolParams = FunctionArguments +export type CollectProtocolReturn = FunctionReturn + +/** factory() */ +export const factory = func('0xc45a0155', {}, address) +export type FactoryParams = FunctionArguments +export type FactoryReturn = FunctionReturn + +/** fee() */ +export const fee = func('0xddca3f43', {}, uint24) +export type FeeParams = FunctionArguments +export type FeeReturn = FunctionReturn + +/** feeGrowthGlobal0X128() */ +export const feeGrowthGlobal0X128 = func('0xf3058399', {}, uint256) +export type FeeGrowthGlobal0X128Params = FunctionArguments +export type FeeGrowthGlobal0X128Return = FunctionReturn + +/** feeGrowthGlobal1X128() */ +export const feeGrowthGlobal1X128 = func('0x46141319', {}, uint256) +export type FeeGrowthGlobal1X128Params = FunctionArguments +export type FeeGrowthGlobal1X128Return = FunctionReturn + +/** flash(address,uint256,uint256,bytes) */ +export const flash = func('0x490e6cbc', { + recipient: address, + amount0: uint256, + amount1: uint256, + data: bytes, +}) +export type FlashParams = FunctionArguments +export type FlashReturn = FunctionReturn + +/** increaseObservationCardinalityNext(uint16) */ +export const increaseObservationCardinalityNext = func('0x32148f67', { + observationCardinalityNext: uint16, +}) +export type IncreaseObservationCardinalityNextParams = FunctionArguments +export type IncreaseObservationCardinalityNextReturn = FunctionReturn + +/** initialize(uint160) */ +export const initialize = func('0xf637731d', { + sqrtPriceX96: uint160, +}) +export type InitializeParams = FunctionArguments +export type InitializeReturn = FunctionReturn + +/** liquidity() */ +export const liquidity = func('0x1a686502', {}, uint128) +export type LiquidityParams = FunctionArguments +export type LiquidityReturn = FunctionReturn + +/** maxLiquidityPerTick() */ +export const maxLiquidityPerTick = func('0x70cf754a', {}, uint128) +export type MaxLiquidityPerTickParams = FunctionArguments +export type MaxLiquidityPerTickReturn = FunctionReturn + +/** mint(address,int24,int24,uint128,bytes) */ +export const mint = func('0x3c8a7d8d', { + recipient: address, + tickLower: int24, + tickUpper: int24, + amount: uint128, + data: bytes, +}, struct({ + amount0: uint256, + amount1: uint256, +})) +export type MintParams = FunctionArguments +export type MintReturn = FunctionReturn + +/** observations(uint256) */ +export const observations = func('0x252c09d7', { + _0: uint256, +}, struct({ + blockTimestamp: uint32, + tickCumulative: int56, + secondsPerLiquidityCumulativeX128: uint160, + initialized: bool, +})) +export type ObservationsParams = FunctionArguments +export type ObservationsReturn = FunctionReturn + +/** observe(uint32[]) */ +export const observe = func('0x883bdbfd', { + secondsAgos: array(uint32), +}, struct({ + tickCumulatives: array(int56), + secondsPerLiquidityCumulativeX128s: array(uint160), +})) +export type ObserveParams = FunctionArguments +export type ObserveReturn = FunctionReturn + +/** positions(bytes32) */ +export const positions = func('0x514ea4bf', { + _0: bytes32, +}, struct({ + liquidity: uint128, + feeGrowthInside0LastX128: uint256, + feeGrowthInside1LastX128: uint256, + tokensOwed0: uint128, + tokensOwed1: uint128, +})) +export type PositionsParams = FunctionArguments +export type PositionsReturn = FunctionReturn + +/** protocolFees() */ +export const protocolFees = func('0x1ad8b03b', {}, struct({ + token0: uint128, + token1: uint128, +})) +export type ProtocolFeesParams = FunctionArguments +export type ProtocolFeesReturn = FunctionReturn + +/** setFeeProtocol(uint8,uint8) */ +export const setFeeProtocol = func('0x8206a4d1', { + feeProtocol0: uint8, + feeProtocol1: uint8, +}) +export type SetFeeProtocolParams = FunctionArguments +export type SetFeeProtocolReturn = FunctionReturn + +/** slot0() */ +export const slot0 = func('0x3850c7bd', {}, struct({ + sqrtPriceX96: uint160, + tick: int24, + observationIndex: uint16, + observationCardinality: uint16, + observationCardinalityNext: uint16, + feeProtocol: uint8, + unlocked: bool, +})) +export type Slot0Params = FunctionArguments +export type Slot0Return = FunctionReturn + +/** snapshotCumulativesInside(int24,int24) */ +export const snapshotCumulativesInside = func('0xa38807f2', { + tickLower: int24, + tickUpper: int24, +}, struct({ + tickCumulativeInside: int56, + secondsPerLiquidityInsideX128: uint160, + secondsInside: uint32, +})) +export type SnapshotCumulativesInsideParams = FunctionArguments +export type SnapshotCumulativesInsideReturn = FunctionReturn + +/** swap(address,bool,int256,uint160,bytes) */ +export const swap = func('0x128acb08', { + recipient: address, + zeroForOne: bool, + amountSpecified: int256, + sqrtPriceLimitX96: uint160, + data: bytes, +}, struct({ + amount0: int256, + amount1: int256, +})) +export type SwapParams = FunctionArguments +export type SwapReturn = FunctionReturn + +/** tickBitmap(int16) */ +export const tickBitmap = func('0x5339c296', { + _0: int16, +}, uint256) +export type TickBitmapParams = FunctionArguments +export type TickBitmapReturn = FunctionReturn + +/** tickSpacing() */ +export const tickSpacing = func('0xd0c93a7c', {}, int24) +export type TickSpacingParams = FunctionArguments +export type TickSpacingReturn = FunctionReturn + +/** ticks(int24) */ +export const ticks = func('0xf30dba93', { + _0: int24, +}, struct({ + liquidityGross: uint128, + liquidityNet: int128, + feeGrowthOutside0X128: uint256, + feeGrowthOutside1X128: uint256, + tickCumulativeOutside: int56, + secondsPerLiquidityOutsideX128: uint160, + secondsOutside: uint32, + initialized: bool, +})) +export type TicksParams = FunctionArguments +export type TicksReturn = FunctionReturn + +/** token0() */ +export const token0 = func('0x0dfe1681', {}, address) +export type Token0Params = FunctionArguments +export type Token0Return = FunctionReturn + +/** token1() */ +export const token1 = func('0xd21220a7', {}, address) +export type Token1Params = FunctionArguments +export type Token1Return = FunctionReturn diff --git a/src/abi/uniswap-v3/index.ts b/src/abi/uniswap-v3/index.ts new file mode 100644 index 00000000..11829d6e --- /dev/null +++ b/src/abi/uniswap-v3/index.ts @@ -0,0 +1,4 @@ +export * as events from './events.js' +export * as functions from './functions.js' + +export { Contract } from './contract.js' diff --git a/src/abi/veogv.ts b/src/abi/veogv.ts deleted file mode 100644 index a293de16..00000000 --- a/src/abi/veogv.ts +++ /dev/null @@ -1,266 +0,0 @@ -import * as p from '@subsquid/evm-codec' -import { event, fun, viewFun, indexed, ContractBase } from '@subsquid/evm-abi' -import type { EventParams as EParams, FunctionArguments, FunctionReturn } from '@subsquid/evm-abi' - -export const events = { - Approval: event("0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925", "Approval(address,address,uint256)", {"owner": indexed(p.address), "spender": indexed(p.address), "value": p.uint256}), - DelegateChanged: event("0x3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f", "DelegateChanged(address,address,address)", {"delegator": indexed(p.address), "fromDelegate": indexed(p.address), "toDelegate": indexed(p.address)}), - DelegateVotesChanged: event("0xdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a724", "DelegateVotesChanged(address,uint256,uint256)", {"delegate": indexed(p.address), "previousBalance": p.uint256, "newBalance": p.uint256}), - Reward: event("0x619caafabdd75649b302ba8419e48cccf64f37f1983ac4727cfb38b57703ffc9", "Reward(address,uint256)", {"user": indexed(p.address), "amount": p.uint256}), - Stake: event("0x2720efa4b2dd4f3f8a347da3cbd290a522e9432da9072c5b8e6300496fdde282", "Stake(address,uint256,uint256,uint256,uint256)", {"user": indexed(p.address), "lockupId": p.uint256, "amount": p.uint256, "end": p.uint256, "points": p.uint256}), - Transfer: event("0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", "Transfer(address,address,uint256)", {"from": indexed(p.address), "to": indexed(p.address), "value": p.uint256}), - Unstake: event("0x05b744e3e9358bc00ba3cc0c6606a4d6536134dba00b2d2ee4b5de169acd6427", "Unstake(address,uint256,uint256,uint256,uint256)", {"user": indexed(p.address), "lockupId": p.uint256, "amount": p.uint256, "end": p.uint256, "points": p.uint256}), -} - -export const functions = { - DOMAIN_SEPARATOR: viewFun("0x3644e515", "DOMAIN_SEPARATOR()", {}, p.bytes32), - accRewardPerShare: viewFun("0x939d6237", "accRewardPerShare()", {}, p.uint256), - allowance: viewFun("0xdd62ed3e", "allowance(address,address)", {"owner": p.address, "spender": p.address}, p.uint256), - approve: fun("0x095ea7b3", "approve(address,uint256)", {"spender": p.address, "amount": p.uint256}, p.bool), - balanceOf: viewFun("0x70a08231", "balanceOf(address)", {"account": p.address}, p.uint256), - checkpoints: viewFun("0xf1127ed8", "checkpoints(address,uint32)", {"account": p.address, "pos": p.uint32}, p.struct({"fromBlock": p.uint32, "votes": p.uint224})), - collectRewards: fun("0x70bb45b3", "collectRewards()", {}, ), - decimals: viewFun("0x313ce567", "decimals()", {}, p.uint8), - decreaseAllowance: fun("0xa457c2d7", "decreaseAllowance(address,uint256)", {"spender": p.address, "subtractedValue": p.uint256}, p.bool), - delegate: fun("0x5c19a95c", "delegate(address)", {"delegatee": p.address}, ), - delegateBySig: fun("0xc3cda520", "delegateBySig(address,uint256,uint256,uint8,bytes32,bytes32)", {"delegatee": p.address, "nonce": p.uint256, "expiry": p.uint256, "v": p.uint8, "r": p.bytes32, "s": p.bytes32}, ), - delegates: viewFun("0x587cde1e", "delegates(address)", {"account": p.address}, p.address), - epoch: viewFun("0x900cf0cf", "epoch()", {}, p.uint256), - extend: fun("0xc89258db", "extend(uint256,uint256)", {"lockupId": p.uint256, "duration": p.uint256}, ), - getPastTotalSupply: viewFun("0x8e539e8c", "getPastTotalSupply(uint256)", {"blockNumber": p.uint256}, p.uint256), - getPastVotes: viewFun("0x3a46b1a8", "getPastVotes(address,uint256)", {"account": p.address, "blockNumber": p.uint256}, p.uint256), - getVotes: viewFun("0x9ab24eb0", "getVotes(address)", {"account": p.address}, p.uint256), - increaseAllowance: fun("0x39509351", "increaseAllowance(address,uint256)", {"spender": p.address, "addedValue": p.uint256}, p.bool), - lockups: viewFun("0xc93d0b1e", "lockups(address,uint256)", {"_0": p.address, "_1": p.uint256}, {"amount": p.uint128, "end": p.uint128, "points": p.uint256}), - minStakeDuration: viewFun("0x5fec5c64", "minStakeDuration()", {}, p.uint256), - name: viewFun("0x06fdde03", "name()", {}, p.string), - nonces: viewFun("0x7ecebe00", "nonces(address)", {"owner": p.address}, p.uint256), - numCheckpoints: viewFun("0x6fcfff45", "numCheckpoints(address)", {"account": p.address}, p.uint32), - ogv: viewFun("0x142561cf", "ogv()", {}, p.address), - permit: fun("0xd505accf", "permit(address,address,uint256,uint256,uint8,bytes32,bytes32)", {"owner": p.address, "spender": p.address, "value": p.uint256, "deadline": p.uint256, "v": p.uint8, "r": p.bytes32, "s": p.bytes32}, ), - previewPoints: viewFun("0x4fd0e648", "previewPoints(uint256,uint256)", {"amount": p.uint256, "duration": p.uint256}, {"_0": p.uint256, "_1": p.uint256}), - previewRewards: viewFun("0xf166e920", "previewRewards(address)", {"user": p.address}, p.uint256), - rewardDebtPerShare: viewFun("0x4423bf57", "rewardDebtPerShare(address)", {"_0": p.address}, p.uint256), - rewardsSource: viewFun("0xf7240d2f", "rewardsSource()", {}, p.address), - 'stake(uint256,uint256,address)': fun("0x7628a37d", "stake(uint256,uint256,address)", {"amount": p.uint256, "duration": p.uint256, "to": p.address}, ), - 'stake(uint256,uint256)': fun("0x7b0472f0", "stake(uint256,uint256)", {"amount": p.uint256, "duration": p.uint256}, ), - symbol: viewFun("0x95d89b41", "symbol()", {}, p.string), - totalSupply: viewFun("0x18160ddd", "totalSupply()", {}, p.uint256), - transfer: fun("0xa9059cbb", "transfer(address,uint256)", {"_0": p.address, "_1": p.uint256}, p.bool), - transferFrom: fun("0x23b872dd", "transferFrom(address,address,uint256)", {"_0": p.address, "_1": p.address, "_2": p.uint256}, p.bool), - unstake: fun("0x2e17de78", "unstake(uint256)", {"lockupId": p.uint256}, ), -} - -export class Contract extends ContractBase { - - DOMAIN_SEPARATOR() { - return this.eth_call(functions.DOMAIN_SEPARATOR, {}) - } - - accRewardPerShare() { - return this.eth_call(functions.accRewardPerShare, {}) - } - - allowance(owner: AllowanceParams["owner"], spender: AllowanceParams["spender"]) { - return this.eth_call(functions.allowance, {owner, spender}) - } - - balanceOf(account: BalanceOfParams["account"]) { - return this.eth_call(functions.balanceOf, {account}) - } - - checkpoints(account: CheckpointsParams["account"], pos: CheckpointsParams["pos"]) { - return this.eth_call(functions.checkpoints, {account, pos}) - } - - decimals() { - return this.eth_call(functions.decimals, {}) - } - - delegates(account: DelegatesParams["account"]) { - return this.eth_call(functions.delegates, {account}) - } - - epoch() { - return this.eth_call(functions.epoch, {}) - } - - getPastTotalSupply(blockNumber: GetPastTotalSupplyParams["blockNumber"]) { - return this.eth_call(functions.getPastTotalSupply, {blockNumber}) - } - - getPastVotes(account: GetPastVotesParams["account"], blockNumber: GetPastVotesParams["blockNumber"]) { - return this.eth_call(functions.getPastVotes, {account, blockNumber}) - } - - getVotes(account: GetVotesParams["account"]) { - return this.eth_call(functions.getVotes, {account}) - } - - lockups(_0: LockupsParams["_0"], _1: LockupsParams["_1"]) { - return this.eth_call(functions.lockups, {_0, _1}) - } - - minStakeDuration() { - return this.eth_call(functions.minStakeDuration, {}) - } - - name() { - return this.eth_call(functions.name, {}) - } - - nonces(owner: NoncesParams["owner"]) { - return this.eth_call(functions.nonces, {owner}) - } - - numCheckpoints(account: NumCheckpointsParams["account"]) { - return this.eth_call(functions.numCheckpoints, {account}) - } - - ogv() { - return this.eth_call(functions.ogv, {}) - } - - previewPoints(amount: PreviewPointsParams["amount"], duration: PreviewPointsParams["duration"]) { - return this.eth_call(functions.previewPoints, {amount, duration}) - } - - previewRewards(user: PreviewRewardsParams["user"]) { - return this.eth_call(functions.previewRewards, {user}) - } - - rewardDebtPerShare(_0: RewardDebtPerShareParams["_0"]) { - return this.eth_call(functions.rewardDebtPerShare, {_0}) - } - - rewardsSource() { - return this.eth_call(functions.rewardsSource, {}) - } - - symbol() { - return this.eth_call(functions.symbol, {}) - } - - totalSupply() { - return this.eth_call(functions.totalSupply, {}) - } -} - -/// Event types -export type ApprovalEventArgs = EParams -export type DelegateChangedEventArgs = EParams -export type DelegateVotesChangedEventArgs = EParams -export type RewardEventArgs = EParams -export type StakeEventArgs = EParams -export type TransferEventArgs = EParams -export type UnstakeEventArgs = EParams - -/// Function types -export type DOMAIN_SEPARATORParams = FunctionArguments -export type DOMAIN_SEPARATORReturn = FunctionReturn - -export type AccRewardPerShareParams = FunctionArguments -export type AccRewardPerShareReturn = FunctionReturn - -export type AllowanceParams = FunctionArguments -export type AllowanceReturn = FunctionReturn - -export type ApproveParams = FunctionArguments -export type ApproveReturn = FunctionReturn - -export type BalanceOfParams = FunctionArguments -export type BalanceOfReturn = FunctionReturn - -export type CheckpointsParams = FunctionArguments -export type CheckpointsReturn = FunctionReturn - -export type CollectRewardsParams = FunctionArguments -export type CollectRewardsReturn = FunctionReturn - -export type DecimalsParams = FunctionArguments -export type DecimalsReturn = FunctionReturn - -export type DecreaseAllowanceParams = FunctionArguments -export type DecreaseAllowanceReturn = FunctionReturn - -export type DelegateParams = FunctionArguments -export type DelegateReturn = FunctionReturn - -export type DelegateBySigParams = FunctionArguments -export type DelegateBySigReturn = FunctionReturn - -export type DelegatesParams = FunctionArguments -export type DelegatesReturn = FunctionReturn - -export type EpochParams = FunctionArguments -export type EpochReturn = FunctionReturn - -export type ExtendParams = FunctionArguments -export type ExtendReturn = FunctionReturn - -export type GetPastTotalSupplyParams = FunctionArguments -export type GetPastTotalSupplyReturn = FunctionReturn - -export type GetPastVotesParams = FunctionArguments -export type GetPastVotesReturn = FunctionReturn - -export type GetVotesParams = FunctionArguments -export type GetVotesReturn = FunctionReturn - -export type IncreaseAllowanceParams = FunctionArguments -export type IncreaseAllowanceReturn = FunctionReturn - -export type LockupsParams = FunctionArguments -export type LockupsReturn = FunctionReturn - -export type MinStakeDurationParams = FunctionArguments -export type MinStakeDurationReturn = FunctionReturn - -export type NameParams = FunctionArguments -export type NameReturn = FunctionReturn - -export type NoncesParams = FunctionArguments -export type NoncesReturn = FunctionReturn - -export type NumCheckpointsParams = FunctionArguments -export type NumCheckpointsReturn = FunctionReturn - -export type OgvParams = FunctionArguments -export type OgvReturn = FunctionReturn - -export type PermitParams = FunctionArguments -export type PermitReturn = FunctionReturn - -export type PreviewPointsParams = FunctionArguments -export type PreviewPointsReturn = FunctionReturn - -export type PreviewRewardsParams = FunctionArguments -export type PreviewRewardsReturn = FunctionReturn - -export type RewardDebtPerShareParams = FunctionArguments -export type RewardDebtPerShareReturn = FunctionReturn - -export type RewardsSourceParams = FunctionArguments -export type RewardsSourceReturn = FunctionReturn - -export type StakeParams_0 = FunctionArguments -export type StakeReturn_0 = FunctionReturn - -export type StakeParams_1 = FunctionArguments -export type StakeReturn_1 = FunctionReturn - -export type SymbolParams = FunctionArguments -export type SymbolReturn = FunctionReturn - -export type TotalSupplyParams = FunctionArguments -export type TotalSupplyReturn = FunctionReturn - -export type TransferParams = FunctionArguments -export type TransferReturn = FunctionReturn - -export type TransferFromParams = FunctionArguments -export type TransferFromReturn = FunctionReturn - -export type UnstakeParams = FunctionArguments -export type UnstakeReturn = FunctionReturn - diff --git a/src/abi/veogv/contract.ts b/src/abi/veogv/contract.ts new file mode 100644 index 00000000..813ae247 --- /dev/null +++ b/src/abi/veogv/contract.ts @@ -0,0 +1,117 @@ +import { ContractBase } from '../abi.support.js' +import { DOMAIN_SEPARATOR, accRewardPerShare, allowance, approve, balanceOf, checkpoints, decimals, decreaseAllowance, delegates, epoch, getPastTotalSupply, getPastVotes, getVotes, increaseAllowance, lockups, minStakeDuration, name, nonces, numCheckpoints, ogv, previewPoints, previewRewards, rewardDebtPerShare, rewardsSource, symbol, totalSupply, transfer, transferFrom } from './functions.js' +import type { AllowanceParams, ApproveParams, BalanceOfParams, CheckpointsParams, DecreaseAllowanceParams, DelegatesParams, GetPastTotalSupplyParams, GetPastVotesParams, GetVotesParams, IncreaseAllowanceParams, LockupsParams, NoncesParams, NumCheckpointsParams, PreviewPointsParams, PreviewRewardsParams, RewardDebtPerShareParams, TransferFromParams, TransferParams } from './functions.js' + +export class Contract extends ContractBase { + DOMAIN_SEPARATOR() { + return this.eth_call(DOMAIN_SEPARATOR, {}) + } + + accRewardPerShare() { + return this.eth_call(accRewardPerShare, {}) + } + + allowance(owner: AllowanceParams["owner"], spender: AllowanceParams["spender"]) { + return this.eth_call(allowance, {owner, spender}) + } + + approve(spender: ApproveParams["spender"], amount: ApproveParams["amount"]) { + return this.eth_call(approve, {spender, amount}) + } + + balanceOf(account: BalanceOfParams["account"]) { + return this.eth_call(balanceOf, {account}) + } + + checkpoints(account: CheckpointsParams["account"], pos: CheckpointsParams["pos"]) { + return this.eth_call(checkpoints, {account, pos}) + } + + decimals() { + return this.eth_call(decimals, {}) + } + + decreaseAllowance(spender: DecreaseAllowanceParams["spender"], subtractedValue: DecreaseAllowanceParams["subtractedValue"]) { + return this.eth_call(decreaseAllowance, {spender, subtractedValue}) + } + + delegates(account: DelegatesParams["account"]) { + return this.eth_call(delegates, {account}) + } + + epoch() { + return this.eth_call(epoch, {}) + } + + getPastTotalSupply(blockNumber: GetPastTotalSupplyParams["blockNumber"]) { + return this.eth_call(getPastTotalSupply, {blockNumber}) + } + + getPastVotes(account: GetPastVotesParams["account"], blockNumber: GetPastVotesParams["blockNumber"]) { + return this.eth_call(getPastVotes, {account, blockNumber}) + } + + getVotes(account: GetVotesParams["account"]) { + return this.eth_call(getVotes, {account}) + } + + increaseAllowance(spender: IncreaseAllowanceParams["spender"], addedValue: IncreaseAllowanceParams["addedValue"]) { + return this.eth_call(increaseAllowance, {spender, addedValue}) + } + + lockups(_0: LockupsParams["_0"], _1: LockupsParams["_1"]) { + return this.eth_call(lockups, {_0, _1}) + } + + minStakeDuration() { + return this.eth_call(minStakeDuration, {}) + } + + name() { + return this.eth_call(name, {}) + } + + nonces(owner: NoncesParams["owner"]) { + return this.eth_call(nonces, {owner}) + } + + numCheckpoints(account: NumCheckpointsParams["account"]) { + return this.eth_call(numCheckpoints, {account}) + } + + ogv() { + return this.eth_call(ogv, {}) + } + + previewPoints(amount: PreviewPointsParams["amount"], duration: PreviewPointsParams["duration"]) { + return this.eth_call(previewPoints, {amount, duration}) + } + + previewRewards(user: PreviewRewardsParams["user"]) { + return this.eth_call(previewRewards, {user}) + } + + rewardDebtPerShare(_0: RewardDebtPerShareParams["_0"]) { + return this.eth_call(rewardDebtPerShare, {_0}) + } + + rewardsSource() { + return this.eth_call(rewardsSource, {}) + } + + symbol() { + return this.eth_call(symbol, {}) + } + + totalSupply() { + return this.eth_call(totalSupply, {}) + } + + transfer(_0: TransferParams["_0"], _1: TransferParams["_1"]) { + return this.eth_call(transfer, {_0, _1}) + } + + transferFrom(_0: TransferFromParams["_0"], _1: TransferFromParams["_1"], _2: TransferFromParams["_2"]) { + return this.eth_call(transferFrom, {_0, _1, _2}) + } +} diff --git a/src/abi/veogv/events.ts b/src/abi/veogv/events.ts new file mode 100644 index 00000000..f000b7e0 --- /dev/null +++ b/src/abi/veogv/events.ts @@ -0,0 +1,62 @@ +import { address, uint256 } from '@subsquid/evm-codec' +import { event, indexed } from '../abi.support.js' +import type { EventParams as EParams } from '../abi.support.js' + +/** Approval(address,address,uint256) */ +export const Approval = event('0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925', { + owner: indexed(address), + spender: indexed(address), + value: uint256, +}) +export type ApprovalEventArgs = EParams + +/** DelegateChanged(address,address,address) */ +export const DelegateChanged = event('0x3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f', { + delegator: indexed(address), + fromDelegate: indexed(address), + toDelegate: indexed(address), +}) +export type DelegateChangedEventArgs = EParams + +/** DelegateVotesChanged(address,uint256,uint256) */ +export const DelegateVotesChanged = event('0xdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a724', { + delegate: indexed(address), + previousBalance: uint256, + newBalance: uint256, +}) +export type DelegateVotesChangedEventArgs = EParams + +/** Reward(address,uint256) */ +export const Reward = event('0x619caafabdd75649b302ba8419e48cccf64f37f1983ac4727cfb38b57703ffc9', { + user: indexed(address), + amount: uint256, +}) +export type RewardEventArgs = EParams + +/** Stake(address,uint256,uint256,uint256,uint256) */ +export const Stake = event('0x2720efa4b2dd4f3f8a347da3cbd290a522e9432da9072c5b8e6300496fdde282', { + user: indexed(address), + lockupId: uint256, + amount: uint256, + end: uint256, + points: uint256, +}) +export type StakeEventArgs = EParams + +/** Transfer(address,address,uint256) */ +export const Transfer = event('0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', { + from: indexed(address), + to: indexed(address), + value: uint256, +}) +export type TransferEventArgs = EParams + +/** Unstake(address,uint256,uint256,uint256,uint256) */ +export const Unstake = event('0x05b744e3e9358bc00ba3cc0c6606a4d6536134dba00b2d2ee4b5de169acd6427', { + user: indexed(address), + lockupId: uint256, + amount: uint256, + end: uint256, + points: uint256, +}) +export type UnstakeEventArgs = EParams diff --git a/src/abi/veogv/functions.ts b/src/abi/veogv/functions.ts new file mode 100644 index 00000000..3ce65173 --- /dev/null +++ b/src/abi/veogv/functions.ts @@ -0,0 +1,269 @@ +import { address, bool, bytes32, string, struct, uint128, uint224, uint256, uint32, uint8 } from '@subsquid/evm-codec' +import { func } from '../abi.support.js' +import type { FunctionArguments, FunctionReturn } from '../abi.support.js' + +/** DOMAIN_SEPARATOR() */ +export const DOMAIN_SEPARATOR = func('0x3644e515', {}, bytes32) +export type DOMAIN_SEPARATORParams = FunctionArguments +export type DOMAIN_SEPARATORReturn = FunctionReturn + +/** accRewardPerShare() */ +export const accRewardPerShare = func('0x939d6237', {}, uint256) +export type AccRewardPerShareParams = FunctionArguments +export type AccRewardPerShareReturn = FunctionReturn + +/** allowance(address,address) */ +export const allowance = func('0xdd62ed3e', { + owner: address, + spender: address, +}, uint256) +export type AllowanceParams = FunctionArguments +export type AllowanceReturn = FunctionReturn + +/** approve(address,uint256) */ +export const approve = func('0x095ea7b3', { + spender: address, + amount: uint256, +}, bool) +export type ApproveParams = FunctionArguments +export type ApproveReturn = FunctionReturn + +/** balanceOf(address) */ +export const balanceOf = func('0x70a08231', { + account: address, +}, uint256) +export type BalanceOfParams = FunctionArguments +export type BalanceOfReturn = FunctionReturn + +/** checkpoints(address,uint32) */ +export const checkpoints = func('0xf1127ed8', { + account: address, + pos: uint32, +}, struct({ + fromBlock: uint32, + votes: uint224, +})) +export type CheckpointsParams = FunctionArguments +export type CheckpointsReturn = FunctionReturn + +/** collectRewards() */ +export const collectRewards = func('0x70bb45b3', {}) +export type CollectRewardsParams = FunctionArguments +export type CollectRewardsReturn = FunctionReturn + +/** decimals() */ +export const decimals = func('0x313ce567', {}, uint8) +export type DecimalsParams = FunctionArguments +export type DecimalsReturn = FunctionReturn + +/** decreaseAllowance(address,uint256) */ +export const decreaseAllowance = func('0xa457c2d7', { + spender: address, + subtractedValue: uint256, +}, bool) +export type DecreaseAllowanceParams = FunctionArguments +export type DecreaseAllowanceReturn = FunctionReturn + +/** delegate(address) */ +export const delegate = func('0x5c19a95c', { + delegatee: address, +}) +export type DelegateParams = FunctionArguments +export type DelegateReturn = FunctionReturn + +/** delegateBySig(address,uint256,uint256,uint8,bytes32,bytes32) */ +export const delegateBySig = func('0xc3cda520', { + delegatee: address, + nonce: uint256, + expiry: uint256, + v: uint8, + r: bytes32, + s: bytes32, +}) +export type DelegateBySigParams = FunctionArguments +export type DelegateBySigReturn = FunctionReturn + +/** delegates(address) */ +export const delegates = func('0x587cde1e', { + account: address, +}, address) +export type DelegatesParams = FunctionArguments +export type DelegatesReturn = FunctionReturn + +/** epoch() */ +export const epoch = func('0x900cf0cf', {}, uint256) +export type EpochParams = FunctionArguments +export type EpochReturn = FunctionReturn + +/** extend(uint256,uint256) */ +export const extend = func('0xc89258db', { + lockupId: uint256, + duration: uint256, +}) +export type ExtendParams = FunctionArguments +export type ExtendReturn = FunctionReturn + +/** getPastTotalSupply(uint256) */ +export const getPastTotalSupply = func('0x8e539e8c', { + blockNumber: uint256, +}, uint256) +export type GetPastTotalSupplyParams = FunctionArguments +export type GetPastTotalSupplyReturn = FunctionReturn + +/** getPastVotes(address,uint256) */ +export const getPastVotes = func('0x3a46b1a8', { + account: address, + blockNumber: uint256, +}, uint256) +export type GetPastVotesParams = FunctionArguments +export type GetPastVotesReturn = FunctionReturn + +/** getVotes(address) */ +export const getVotes = func('0x9ab24eb0', { + account: address, +}, uint256) +export type GetVotesParams = FunctionArguments +export type GetVotesReturn = FunctionReturn + +/** increaseAllowance(address,uint256) */ +export const increaseAllowance = func('0x39509351', { + spender: address, + addedValue: uint256, +}, bool) +export type IncreaseAllowanceParams = FunctionArguments +export type IncreaseAllowanceReturn = FunctionReturn + +/** lockups(address,uint256) */ +export const lockups = func('0xc93d0b1e', { + _0: address, + _1: uint256, +}, struct({ + amount: uint128, + end: uint128, + points: uint256, +})) +export type LockupsParams = FunctionArguments +export type LockupsReturn = FunctionReturn + +/** minStakeDuration() */ +export const minStakeDuration = func('0x5fec5c64', {}, uint256) +export type MinStakeDurationParams = FunctionArguments +export type MinStakeDurationReturn = FunctionReturn + +/** name() */ +export const name = func('0x06fdde03', {}, string) +export type NameParams = FunctionArguments +export type NameReturn = FunctionReturn + +/** nonces(address) */ +export const nonces = func('0x7ecebe00', { + owner: address, +}, uint256) +export type NoncesParams = FunctionArguments +export type NoncesReturn = FunctionReturn + +/** numCheckpoints(address) */ +export const numCheckpoints = func('0x6fcfff45', { + account: address, +}, uint32) +export type NumCheckpointsParams = FunctionArguments +export type NumCheckpointsReturn = FunctionReturn + +/** ogv() */ +export const ogv = func('0x142561cf', {}, address) +export type OgvParams = FunctionArguments +export type OgvReturn = FunctionReturn + +/** permit(address,address,uint256,uint256,uint8,bytes32,bytes32) */ +export const permit = func('0xd505accf', { + owner: address, + spender: address, + value: uint256, + deadline: uint256, + v: uint8, + r: bytes32, + s: bytes32, +}) +export type PermitParams = FunctionArguments +export type PermitReturn = FunctionReturn + +/** previewPoints(uint256,uint256) */ +export const previewPoints = func('0x4fd0e648', { + amount: uint256, + duration: uint256, +}, struct({ + _0: uint256, + _1: uint256, +})) +export type PreviewPointsParams = FunctionArguments +export type PreviewPointsReturn = FunctionReturn + +/** previewRewards(address) */ +export const previewRewards = func('0xf166e920', { + user: address, +}, uint256) +export type PreviewRewardsParams = FunctionArguments +export type PreviewRewardsReturn = FunctionReturn + +/** rewardDebtPerShare(address) */ +export const rewardDebtPerShare = func('0x4423bf57', { + _0: address, +}, uint256) +export type RewardDebtPerShareParams = FunctionArguments +export type RewardDebtPerShareReturn = FunctionReturn + +/** rewardsSource() */ +export const rewardsSource = func('0xf7240d2f', {}, address) +export type RewardsSourceParams = FunctionArguments +export type RewardsSourceReturn = FunctionReturn + +/** stake(uint256,uint256,address) */ +export const stake = func('0x7628a37d', { + amount: uint256, + duration: uint256, + to: address, +}) +export type StakeParams = FunctionArguments +export type StakeReturn = FunctionReturn + +/** stake(uint256,uint256) */ +export const stake_1 = func('0x7b0472f0', { + amount: uint256, + duration: uint256, +}) +export type StakeParams_1 = FunctionArguments +export type StakeReturn_1 = FunctionReturn + +/** symbol() */ +export const symbol = func('0x95d89b41', {}, string) +export type SymbolParams = FunctionArguments +export type SymbolReturn = FunctionReturn + +/** totalSupply() */ +export const totalSupply = func('0x18160ddd', {}, uint256) +export type TotalSupplyParams = FunctionArguments +export type TotalSupplyReturn = FunctionReturn + +/** transfer(address,uint256) */ +export const transfer = func('0xa9059cbb', { + _0: address, + _1: uint256, +}, bool) +export type TransferParams = FunctionArguments +export type TransferReturn = FunctionReturn + +/** transferFrom(address,address,uint256) */ +export const transferFrom = func('0x23b872dd', { + _0: address, + _1: address, + _2: uint256, +}, bool) +export type TransferFromParams = FunctionArguments +export type TransferFromReturn = FunctionReturn + +/** unstake(uint256) */ +export const unstake = func('0x2e17de78', { + lockupId: uint256, +}) +export type UnstakeParams = FunctionArguments +export type UnstakeReturn = FunctionReturn diff --git a/src/abi/veogv/index.ts b/src/abi/veogv/index.ts new file mode 100644 index 00000000..11829d6e --- /dev/null +++ b/src/abi/veogv/index.ts @@ -0,0 +1,4 @@ +export * as events from './events.js' +export * as functions from './functions.js' + +export { Contract } from './contract.js' diff --git a/src/abi/woeth.ts b/src/abi/woeth.ts deleted file mode 100644 index a79b51fa..00000000 --- a/src/abi/woeth.ts +++ /dev/null @@ -1,240 +0,0 @@ -import * as p from '@subsquid/evm-codec' -import { event, fun, viewFun, indexed, ContractBase } from '@subsquid/evm-abi' -import type { EventParams as EParams, FunctionArguments, FunctionReturn } from '@subsquid/evm-abi' - -export const events = { - Approval: event("0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925", "Approval(address,address,uint256)", {"owner": indexed(p.address), "spender": indexed(p.address), "value": p.uint256}), - Deposit: event("0xdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d7", "Deposit(address,address,uint256,uint256)", {"caller": indexed(p.address), "owner": indexed(p.address), "assets": p.uint256, "shares": p.uint256}), - GovernorshipTransferred: event("0xc7c0c772add429241571afb3805861fb3cfa2af374534088b76cdb4325a87e9a", "GovernorshipTransferred(address,address)", {"previousGovernor": indexed(p.address), "newGovernor": indexed(p.address)}), - PendingGovernorshipTransfer: event("0xa39cc5eb22d0f34d8beaefee8a3f17cc229c1a1d1ef87a5ad47313487b1c4f0d", "PendingGovernorshipTransfer(address,address)", {"previousGovernor": indexed(p.address), "newGovernor": indexed(p.address)}), - Transfer: event("0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", "Transfer(address,address,uint256)", {"from": indexed(p.address), "to": indexed(p.address), "value": p.uint256}), - Withdraw: event("0xfbde797d201c681b91056529119e0b02407c7bb96a4a2c75c01fc9667232c8db", "Withdraw(address,address,address,uint256,uint256)", {"caller": indexed(p.address), "receiver": indexed(p.address), "owner": indexed(p.address), "assets": p.uint256, "shares": p.uint256}), -} - -export const functions = { - allowance: viewFun("0xdd62ed3e", "allowance(address,address)", {"owner": p.address, "spender": p.address}, p.uint256), - approve: fun("0x095ea7b3", "approve(address,uint256)", {"spender": p.address, "amount": p.uint256}, p.bool), - asset: viewFun("0x38d52e0f", "asset()", {}, p.address), - balanceOf: viewFun("0x70a08231", "balanceOf(address)", {"account": p.address}, p.uint256), - claimGovernance: fun("0x5d36b190", "claimGovernance()", {}, ), - convertToAssets: viewFun("0x07a2d13a", "convertToAssets(uint256)", {"shares": p.uint256}, p.uint256), - convertToShares: viewFun("0xc6e6f592", "convertToShares(uint256)", {"assets": p.uint256}, p.uint256), - decimals: viewFun("0x313ce567", "decimals()", {}, p.uint8), - decreaseAllowance: fun("0xa457c2d7", "decreaseAllowance(address,uint256)", {"spender": p.address, "subtractedValue": p.uint256}, p.bool), - deposit: fun("0x6e553f65", "deposit(uint256,address)", {"assets": p.uint256, "receiver": p.address}, p.uint256), - governor: viewFun("0x0c340a24", "governor()", {}, p.address), - increaseAllowance: fun("0x39509351", "increaseAllowance(address,uint256)", {"spender": p.address, "addedValue": p.uint256}, p.bool), - initialize: fun("0x8129fc1c", "initialize()", {}, ), - isGovernor: viewFun("0xc7af3352", "isGovernor()", {}, p.bool), - maxDeposit: viewFun("0x402d267d", "maxDeposit(address)", {"_0": p.address}, p.uint256), - maxMint: viewFun("0xc63d75b6", "maxMint(address)", {"_0": p.address}, p.uint256), - maxRedeem: viewFun("0xd905777e", "maxRedeem(address)", {"owner": p.address}, p.uint256), - maxWithdraw: viewFun("0xce96cb77", "maxWithdraw(address)", {"owner": p.address}, p.uint256), - mint: fun("0x94bf804d", "mint(uint256,address)", {"shares": p.uint256, "receiver": p.address}, p.uint256), - name: viewFun("0x06fdde03", "name()", {}, p.string), - previewDeposit: viewFun("0xef8b30f7", "previewDeposit(uint256)", {"assets": p.uint256}, p.uint256), - previewMint: viewFun("0xb3d7f6b9", "previewMint(uint256)", {"shares": p.uint256}, p.uint256), - previewRedeem: viewFun("0x4cdad506", "previewRedeem(uint256)", {"shares": p.uint256}, p.uint256), - previewWithdraw: viewFun("0x0a28a477", "previewWithdraw(uint256)", {"assets": p.uint256}, p.uint256), - redeem: fun("0xba087652", "redeem(uint256,address,address)", {"shares": p.uint256, "receiver": p.address, "owner": p.address}, p.uint256), - symbol: viewFun("0x95d89b41", "symbol()", {}, p.string), - totalAssets: viewFun("0x01e1d114", "totalAssets()", {}, p.uint256), - totalSupply: viewFun("0x18160ddd", "totalSupply()", {}, p.uint256), - transfer: fun("0xa9059cbb", "transfer(address,uint256)", {"recipient": p.address, "amount": p.uint256}, p.bool), - transferFrom: fun("0x23b872dd", "transferFrom(address,address,uint256)", {"sender": p.address, "recipient": p.address, "amount": p.uint256}, p.bool), - transferGovernance: fun("0xd38bfff4", "transferGovernance(address)", {"_newGovernor": p.address}, ), - transferToken: fun("0x1072cbea", "transferToken(address,uint256)", {"asset_": p.address, "amount_": p.uint256}, ), - withdraw: fun("0xb460af94", "withdraw(uint256,address,address)", {"assets": p.uint256, "receiver": p.address, "owner": p.address}, p.uint256), -} - -export class Contract extends ContractBase { - - allowance(owner: AllowanceParams["owner"], spender: AllowanceParams["spender"]) { - return this.eth_call(functions.allowance, {owner, spender}) - } - - asset() { - return this.eth_call(functions.asset, {}) - } - - balanceOf(account: BalanceOfParams["account"]) { - return this.eth_call(functions.balanceOf, {account}) - } - - convertToAssets(shares: ConvertToAssetsParams["shares"]) { - return this.eth_call(functions.convertToAssets, {shares}) - } - - convertToShares(assets: ConvertToSharesParams["assets"]) { - return this.eth_call(functions.convertToShares, {assets}) - } - - decimals() { - return this.eth_call(functions.decimals, {}) - } - - governor() { - return this.eth_call(functions.governor, {}) - } - - isGovernor() { - return this.eth_call(functions.isGovernor, {}) - } - - maxDeposit(_0: MaxDepositParams["_0"]) { - return this.eth_call(functions.maxDeposit, {_0}) - } - - maxMint(_0: MaxMintParams["_0"]) { - return this.eth_call(functions.maxMint, {_0}) - } - - maxRedeem(owner: MaxRedeemParams["owner"]) { - return this.eth_call(functions.maxRedeem, {owner}) - } - - maxWithdraw(owner: MaxWithdrawParams["owner"]) { - return this.eth_call(functions.maxWithdraw, {owner}) - } - - name() { - return this.eth_call(functions.name, {}) - } - - previewDeposit(assets: PreviewDepositParams["assets"]) { - return this.eth_call(functions.previewDeposit, {assets}) - } - - previewMint(shares: PreviewMintParams["shares"]) { - return this.eth_call(functions.previewMint, {shares}) - } - - previewRedeem(shares: PreviewRedeemParams["shares"]) { - return this.eth_call(functions.previewRedeem, {shares}) - } - - previewWithdraw(assets: PreviewWithdrawParams["assets"]) { - return this.eth_call(functions.previewWithdraw, {assets}) - } - - symbol() { - return this.eth_call(functions.symbol, {}) - } - - totalAssets() { - return this.eth_call(functions.totalAssets, {}) - } - - totalSupply() { - return this.eth_call(functions.totalSupply, {}) - } -} - -/// Event types -export type ApprovalEventArgs = EParams -export type DepositEventArgs = EParams -export type GovernorshipTransferredEventArgs = EParams -export type PendingGovernorshipTransferEventArgs = EParams -export type TransferEventArgs = EParams -export type WithdrawEventArgs = EParams - -/// Function types -export type AllowanceParams = FunctionArguments -export type AllowanceReturn = FunctionReturn - -export type ApproveParams = FunctionArguments -export type ApproveReturn = FunctionReturn - -export type AssetParams = FunctionArguments -export type AssetReturn = FunctionReturn - -export type BalanceOfParams = FunctionArguments -export type BalanceOfReturn = FunctionReturn - -export type ClaimGovernanceParams = FunctionArguments -export type ClaimGovernanceReturn = FunctionReturn - -export type ConvertToAssetsParams = FunctionArguments -export type ConvertToAssetsReturn = FunctionReturn - -export type ConvertToSharesParams = FunctionArguments -export type ConvertToSharesReturn = FunctionReturn - -export type DecimalsParams = FunctionArguments -export type DecimalsReturn = FunctionReturn - -export type DecreaseAllowanceParams = FunctionArguments -export type DecreaseAllowanceReturn = FunctionReturn - -export type DepositParams = FunctionArguments -export type DepositReturn = FunctionReturn - -export type GovernorParams = FunctionArguments -export type GovernorReturn = FunctionReturn - -export type IncreaseAllowanceParams = FunctionArguments -export type IncreaseAllowanceReturn = FunctionReturn - -export type InitializeParams = FunctionArguments -export type InitializeReturn = FunctionReturn - -export type IsGovernorParams = FunctionArguments -export type IsGovernorReturn = FunctionReturn - -export type MaxDepositParams = FunctionArguments -export type MaxDepositReturn = FunctionReturn - -export type MaxMintParams = FunctionArguments -export type MaxMintReturn = FunctionReturn - -export type MaxRedeemParams = FunctionArguments -export type MaxRedeemReturn = FunctionReturn - -export type MaxWithdrawParams = FunctionArguments -export type MaxWithdrawReturn = FunctionReturn - -export type MintParams = FunctionArguments -export type MintReturn = FunctionReturn - -export type NameParams = FunctionArguments -export type NameReturn = FunctionReturn - -export type PreviewDepositParams = FunctionArguments -export type PreviewDepositReturn = FunctionReturn - -export type PreviewMintParams = FunctionArguments -export type PreviewMintReturn = FunctionReturn - -export type PreviewRedeemParams = FunctionArguments -export type PreviewRedeemReturn = FunctionReturn - -export type PreviewWithdrawParams = FunctionArguments -export type PreviewWithdrawReturn = FunctionReturn - -export type RedeemParams = FunctionArguments -export type RedeemReturn = FunctionReturn - -export type SymbolParams = FunctionArguments -export type SymbolReturn = FunctionReturn - -export type TotalAssetsParams = FunctionArguments -export type TotalAssetsReturn = FunctionReturn - -export type TotalSupplyParams = FunctionArguments -export type TotalSupplyReturn = FunctionReturn - -export type TransferParams = FunctionArguments -export type TransferReturn = FunctionReturn - -export type TransferFromParams = FunctionArguments -export type TransferFromReturn = FunctionReturn - -export type TransferGovernanceParams = FunctionArguments -export type TransferGovernanceReturn = FunctionReturn - -export type TransferTokenParams = FunctionArguments -export type TransferTokenReturn = FunctionReturn - -export type WithdrawParams = FunctionArguments -export type WithdrawReturn = FunctionReturn - diff --git a/src/abi/woeth/contract.ts b/src/abi/woeth/contract.ts new file mode 100644 index 00000000..7f8d4519 --- /dev/null +++ b/src/abi/woeth/contract.ts @@ -0,0 +1,121 @@ +import { ContractBase } from '../abi.support.js' +import { allowance, approve, asset, balanceOf, convertToAssets, convertToShares, decimals, decreaseAllowance, deposit, governor, increaseAllowance, isGovernor, maxDeposit, maxMint, maxRedeem, maxWithdraw, mint, name, previewDeposit, previewMint, previewRedeem, previewWithdraw, redeem, symbol, totalAssets, totalSupply, transfer, transferFrom, withdraw } from './functions.js' +import type { AllowanceParams, ApproveParams, BalanceOfParams, ConvertToAssetsParams, ConvertToSharesParams, DecreaseAllowanceParams, DepositParams, IncreaseAllowanceParams, MaxDepositParams, MaxMintParams, MaxRedeemParams, MaxWithdrawParams, MintParams, PreviewDepositParams, PreviewMintParams, PreviewRedeemParams, PreviewWithdrawParams, RedeemParams, TransferFromParams, TransferParams, WithdrawParams } from './functions.js' + +export class Contract extends ContractBase { + allowance(owner: AllowanceParams["owner"], spender: AllowanceParams["spender"]) { + return this.eth_call(allowance, {owner, spender}) + } + + approve(spender: ApproveParams["spender"], amount: ApproveParams["amount"]) { + return this.eth_call(approve, {spender, amount}) + } + + asset() { + return this.eth_call(asset, {}) + } + + balanceOf(account: BalanceOfParams["account"]) { + return this.eth_call(balanceOf, {account}) + } + + convertToAssets(shares: ConvertToAssetsParams["shares"]) { + return this.eth_call(convertToAssets, {shares}) + } + + convertToShares(assets: ConvertToSharesParams["assets"]) { + return this.eth_call(convertToShares, {assets}) + } + + decimals() { + return this.eth_call(decimals, {}) + } + + decreaseAllowance(spender: DecreaseAllowanceParams["spender"], subtractedValue: DecreaseAllowanceParams["subtractedValue"]) { + return this.eth_call(decreaseAllowance, {spender, subtractedValue}) + } + + deposit(assets: DepositParams["assets"], receiver: DepositParams["receiver"]) { + return this.eth_call(deposit, {assets, receiver}) + } + + governor() { + return this.eth_call(governor, {}) + } + + increaseAllowance(spender: IncreaseAllowanceParams["spender"], addedValue: IncreaseAllowanceParams["addedValue"]) { + return this.eth_call(increaseAllowance, {spender, addedValue}) + } + + isGovernor() { + return this.eth_call(isGovernor, {}) + } + + maxDeposit(_0: MaxDepositParams["_0"]) { + return this.eth_call(maxDeposit, {_0}) + } + + maxMint(_0: MaxMintParams["_0"]) { + return this.eth_call(maxMint, {_0}) + } + + maxRedeem(owner: MaxRedeemParams["owner"]) { + return this.eth_call(maxRedeem, {owner}) + } + + maxWithdraw(owner: MaxWithdrawParams["owner"]) { + return this.eth_call(maxWithdraw, {owner}) + } + + mint(shares: MintParams["shares"], receiver: MintParams["receiver"]) { + return this.eth_call(mint, {shares, receiver}) + } + + name() { + return this.eth_call(name, {}) + } + + previewDeposit(assets: PreviewDepositParams["assets"]) { + return this.eth_call(previewDeposit, {assets}) + } + + previewMint(shares: PreviewMintParams["shares"]) { + return this.eth_call(previewMint, {shares}) + } + + previewRedeem(shares: PreviewRedeemParams["shares"]) { + return this.eth_call(previewRedeem, {shares}) + } + + previewWithdraw(assets: PreviewWithdrawParams["assets"]) { + return this.eth_call(previewWithdraw, {assets}) + } + + redeem(shares: RedeemParams["shares"], receiver: RedeemParams["receiver"], owner: RedeemParams["owner"]) { + return this.eth_call(redeem, {shares, receiver, owner}) + } + + symbol() { + return this.eth_call(symbol, {}) + } + + totalAssets() { + return this.eth_call(totalAssets, {}) + } + + totalSupply() { + return this.eth_call(totalSupply, {}) + } + + transfer(recipient: TransferParams["recipient"], amount: TransferParams["amount"]) { + return this.eth_call(transfer, {recipient, amount}) + } + + transferFrom(sender: TransferFromParams["sender"], recipient: TransferFromParams["recipient"], amount: TransferFromParams["amount"]) { + return this.eth_call(transferFrom, {sender, recipient, amount}) + } + + withdraw(assets: WithdrawParams["assets"], receiver: WithdrawParams["receiver"], owner: WithdrawParams["owner"]) { + return this.eth_call(withdraw, {assets, receiver, owner}) + } +} diff --git a/src/abi/woeth/events.ts b/src/abi/woeth/events.ts new file mode 100644 index 00000000..2f0f71c9 --- /dev/null +++ b/src/abi/woeth/events.ts @@ -0,0 +1,52 @@ +import { address, uint256 } from '@subsquid/evm-codec' +import { event, indexed } from '../abi.support.js' +import type { EventParams as EParams } from '../abi.support.js' + +/** Approval(address,address,uint256) */ +export const Approval = event('0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925', { + owner: indexed(address), + spender: indexed(address), + value: uint256, +}) +export type ApprovalEventArgs = EParams + +/** Deposit(address,address,uint256,uint256) */ +export const Deposit = event('0xdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d7', { + caller: indexed(address), + owner: indexed(address), + assets: uint256, + shares: uint256, +}) +export type DepositEventArgs = EParams + +/** GovernorshipTransferred(address,address) */ +export const GovernorshipTransferred = event('0xc7c0c772add429241571afb3805861fb3cfa2af374534088b76cdb4325a87e9a', { + previousGovernor: indexed(address), + newGovernor: indexed(address), +}) +export type GovernorshipTransferredEventArgs = EParams + +/** PendingGovernorshipTransfer(address,address) */ +export const PendingGovernorshipTransfer = event('0xa39cc5eb22d0f34d8beaefee8a3f17cc229c1a1d1ef87a5ad47313487b1c4f0d', { + previousGovernor: indexed(address), + newGovernor: indexed(address), +}) +export type PendingGovernorshipTransferEventArgs = EParams + +/** Transfer(address,address,uint256) */ +export const Transfer = event('0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', { + from: indexed(address), + to: indexed(address), + value: uint256, +}) +export type TransferEventArgs = EParams + +/** Withdraw(address,address,address,uint256,uint256) */ +export const Withdraw = event('0xfbde797d201c681b91056529119e0b02407c7bb96a4a2c75c01fc9667232c8db', { + caller: indexed(address), + receiver: indexed(address), + owner: indexed(address), + assets: uint256, + shares: uint256, +}) +export type WithdrawEventArgs = EParams diff --git a/src/abi/woeth/functions.ts b/src/abi/woeth/functions.ts new file mode 100644 index 00000000..b5eaed74 --- /dev/null +++ b/src/abi/woeth/functions.ts @@ -0,0 +1,228 @@ +import { address, bool, string, uint256, uint8 } from '@subsquid/evm-codec' +import { func } from '../abi.support.js' +import type { FunctionArguments, FunctionReturn } from '../abi.support.js' + +/** allowance(address,address) */ +export const allowance = func('0xdd62ed3e', { + owner: address, + spender: address, +}, uint256) +export type AllowanceParams = FunctionArguments +export type AllowanceReturn = FunctionReturn + +/** approve(address,uint256) */ +export const approve = func('0x095ea7b3', { + spender: address, + amount: uint256, +}, bool) +export type ApproveParams = FunctionArguments +export type ApproveReturn = FunctionReturn + +/** asset() */ +export const asset = func('0x38d52e0f', {}, address) +export type AssetParams = FunctionArguments +export type AssetReturn = FunctionReturn + +/** balanceOf(address) */ +export const balanceOf = func('0x70a08231', { + account: address, +}, uint256) +export type BalanceOfParams = FunctionArguments +export type BalanceOfReturn = FunctionReturn + +/** claimGovernance() */ +export const claimGovernance = func('0x5d36b190', {}) +export type ClaimGovernanceParams = FunctionArguments +export type ClaimGovernanceReturn = FunctionReturn + +/** convertToAssets(uint256) */ +export const convertToAssets = func('0x07a2d13a', { + shares: uint256, +}, uint256) +export type ConvertToAssetsParams = FunctionArguments +export type ConvertToAssetsReturn = FunctionReturn + +/** convertToShares(uint256) */ +export const convertToShares = func('0xc6e6f592', { + assets: uint256, +}, uint256) +export type ConvertToSharesParams = FunctionArguments +export type ConvertToSharesReturn = FunctionReturn + +/** decimals() */ +export const decimals = func('0x313ce567', {}, uint8) +export type DecimalsParams = FunctionArguments +export type DecimalsReturn = FunctionReturn + +/** decreaseAllowance(address,uint256) */ +export const decreaseAllowance = func('0xa457c2d7', { + spender: address, + subtractedValue: uint256, +}, bool) +export type DecreaseAllowanceParams = FunctionArguments +export type DecreaseAllowanceReturn = FunctionReturn + +/** deposit(uint256,address) */ +export const deposit = func('0x6e553f65', { + assets: uint256, + receiver: address, +}, uint256) +export type DepositParams = FunctionArguments +export type DepositReturn = FunctionReturn + +/** governor() */ +export const governor = func('0x0c340a24', {}, address) +export type GovernorParams = FunctionArguments +export type GovernorReturn = FunctionReturn + +/** increaseAllowance(address,uint256) */ +export const increaseAllowance = func('0x39509351', { + spender: address, + addedValue: uint256, +}, bool) +export type IncreaseAllowanceParams = FunctionArguments +export type IncreaseAllowanceReturn = FunctionReturn + +/** initialize() */ +export const initialize = func('0x8129fc1c', {}) +export type InitializeParams = FunctionArguments +export type InitializeReturn = FunctionReturn + +/** isGovernor() */ +export const isGovernor = func('0xc7af3352', {}, bool) +export type IsGovernorParams = FunctionArguments +export type IsGovernorReturn = FunctionReturn + +/** maxDeposit(address) */ +export const maxDeposit = func('0x402d267d', { + _0: address, +}, uint256) +export type MaxDepositParams = FunctionArguments +export type MaxDepositReturn = FunctionReturn + +/** maxMint(address) */ +export const maxMint = func('0xc63d75b6', { + _0: address, +}, uint256) +export type MaxMintParams = FunctionArguments +export type MaxMintReturn = FunctionReturn + +/** maxRedeem(address) */ +export const maxRedeem = func('0xd905777e', { + owner: address, +}, uint256) +export type MaxRedeemParams = FunctionArguments +export type MaxRedeemReturn = FunctionReturn + +/** maxWithdraw(address) */ +export const maxWithdraw = func('0xce96cb77', { + owner: address, +}, uint256) +export type MaxWithdrawParams = FunctionArguments +export type MaxWithdrawReturn = FunctionReturn + +/** mint(uint256,address) */ +export const mint = func('0x94bf804d', { + shares: uint256, + receiver: address, +}, uint256) +export type MintParams = FunctionArguments +export type MintReturn = FunctionReturn + +/** name() */ +export const name = func('0x06fdde03', {}, string) +export type NameParams = FunctionArguments +export type NameReturn = FunctionReturn + +/** previewDeposit(uint256) */ +export const previewDeposit = func('0xef8b30f7', { + assets: uint256, +}, uint256) +export type PreviewDepositParams = FunctionArguments +export type PreviewDepositReturn = FunctionReturn + +/** previewMint(uint256) */ +export const previewMint = func('0xb3d7f6b9', { + shares: uint256, +}, uint256) +export type PreviewMintParams = FunctionArguments +export type PreviewMintReturn = FunctionReturn + +/** previewRedeem(uint256) */ +export const previewRedeem = func('0x4cdad506', { + shares: uint256, +}, uint256) +export type PreviewRedeemParams = FunctionArguments +export type PreviewRedeemReturn = FunctionReturn + +/** previewWithdraw(uint256) */ +export const previewWithdraw = func('0x0a28a477', { + assets: uint256, +}, uint256) +export type PreviewWithdrawParams = FunctionArguments +export type PreviewWithdrawReturn = FunctionReturn + +/** redeem(uint256,address,address) */ +export const redeem = func('0xba087652', { + shares: uint256, + receiver: address, + owner: address, +}, uint256) +export type RedeemParams = FunctionArguments +export type RedeemReturn = FunctionReturn + +/** symbol() */ +export const symbol = func('0x95d89b41', {}, string) +export type SymbolParams = FunctionArguments +export type SymbolReturn = FunctionReturn + +/** totalAssets() */ +export const totalAssets = func('0x01e1d114', {}, uint256) +export type TotalAssetsParams = FunctionArguments +export type TotalAssetsReturn = FunctionReturn + +/** totalSupply() */ +export const totalSupply = func('0x18160ddd', {}, uint256) +export type TotalSupplyParams = FunctionArguments +export type TotalSupplyReturn = FunctionReturn + +/** transfer(address,uint256) */ +export const transfer = func('0xa9059cbb', { + recipient: address, + amount: uint256, +}, bool) +export type TransferParams = FunctionArguments +export type TransferReturn = FunctionReturn + +/** transferFrom(address,address,uint256) */ +export const transferFrom = func('0x23b872dd', { + sender: address, + recipient: address, + amount: uint256, +}, bool) +export type TransferFromParams = FunctionArguments +export type TransferFromReturn = FunctionReturn + +/** transferGovernance(address) */ +export const transferGovernance = func('0xd38bfff4', { + _newGovernor: address, +}) +export type TransferGovernanceParams = FunctionArguments +export type TransferGovernanceReturn = FunctionReturn + +/** transferToken(address,uint256) */ +export const transferToken = func('0x1072cbea', { + asset_: address, + amount_: uint256, +}) +export type TransferTokenParams = FunctionArguments +export type TransferTokenReturn = FunctionReturn + +/** withdraw(uint256,address,address) */ +export const withdraw = func('0xb460af94', { + assets: uint256, + receiver: address, + owner: address, +}, uint256) +export type WithdrawParams = FunctionArguments +export type WithdrawReturn = FunctionReturn diff --git a/src/abi/woeth/index.ts b/src/abi/woeth/index.ts new file mode 100644 index 00000000..11829d6e --- /dev/null +++ b/src/abi/woeth/index.ts @@ -0,0 +1,4 @@ +export * as events from './events.js' +export * as functions from './functions.js' + +export { Contract } from './contract.js' diff --git a/src/abi/zero-x-exchange.abi.ts b/src/abi/zero-x-exchange.abi.ts deleted file mode 100644 index 31f599b4..00000000 --- a/src/abi/zero-x-exchange.abi.ts +++ /dev/null @@ -1,234 +0,0 @@ -export const ABI_JSON = [ - { - "type": "constructor", - "stateMutability": "undefined", - "payable": false, - "inputs": [ - { - "type": "address", - "name": "weth" - }, - { - "type": "address", - "name": "uniFactory" - }, - { - "type": "bytes32", - "name": "poolInitCodeHash" - } - ] - }, - { - "type": "function", - "name": "FEATURE_NAME", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [ - { - "type": "string", - "name": "" - } - ] - }, - { - "type": "function", - "name": "FEATURE_VERSION", - "constant": true, - "stateMutability": "view", - "payable": false, - "inputs": [], - "outputs": [ - { - "type": "uint256", - "name": "" - } - ] - }, - { - "type": "function", - "name": "_sellHeldTokenForTokenToUniswapV3", - "constant": false, - "payable": false, - "inputs": [ - { - "type": "bytes", - "name": "encodedPath" - }, - { - "type": "uint256", - "name": "sellAmount" - }, - { - "type": "uint256", - "name": "minBuyAmount" - }, - { - "type": "address", - "name": "recipient" - } - ], - "outputs": [ - { - "type": "uint256", - "name": "buyAmount" - } - ] - }, - { - "type": "function", - "name": "_sellTokenForTokenToUniswapV3", - "constant": false, - "payable": false, - "inputs": [ - { - "type": "bytes", - "name": "encodedPath" - }, - { - "type": "uint256", - "name": "sellAmount" - }, - { - "type": "uint256", - "name": "minBuyAmount" - }, - { - "type": "address", - "name": "recipient" - }, - { - "type": "address", - "name": "payer" - } - ], - "outputs": [ - { - "type": "uint256", - "name": "buyAmount" - } - ] - }, - { - "type": "function", - "name": "migrate", - "constant": false, - "payable": false, - "inputs": [], - "outputs": [ - { - "type": "bytes4", - "name": "success" - } - ] - }, - { - "type": "function", - "name": "sellEthForTokenToUniswapV3", - "constant": false, - "stateMutability": "payable", - "payable": true, - "inputs": [ - { - "type": "bytes", - "name": "encodedPath" - }, - { - "type": "uint256", - "name": "minBuyAmount" - }, - { - "type": "address", - "name": "recipient" - } - ], - "outputs": [ - { - "type": "uint256", - "name": "buyAmount" - } - ] - }, - { - "type": "function", - "name": "sellTokenForEthToUniswapV3", - "constant": false, - "payable": false, - "inputs": [ - { - "type": "bytes", - "name": "encodedPath" - }, - { - "type": "uint256", - "name": "sellAmount" - }, - { - "type": "uint256", - "name": "minBuyAmount" - }, - { - "type": "address", - "name": "recipient" - } - ], - "outputs": [ - { - "type": "uint256", - "name": "buyAmount" - } - ] - }, - { - "type": "function", - "name": "sellTokenForTokenToUniswapV3", - "constant": false, - "payable": false, - "inputs": [ - { - "type": "bytes", - "name": "encodedPath" - }, - { - "type": "uint256", - "name": "sellAmount" - }, - { - "type": "uint256", - "name": "minBuyAmount" - }, - { - "type": "address", - "name": "recipient" - } - ], - "outputs": [ - { - "type": "uint256", - "name": "buyAmount" - } - ] - }, - { - "type": "function", - "name": "uniswapV3SwapCallback", - "constant": false, - "payable": false, - "inputs": [ - { - "type": "int256", - "name": "amount0Delta" - }, - { - "type": "int256", - "name": "amount1Delta" - }, - { - "type": "bytes", - "name": "data" - } - ], - "outputs": [] - } -] as const diff --git a/src/main-test.ts b/src/main-test.ts index b7d61259..f38135fd 100644 --- a/src/main-test.ts +++ b/src/main-test.ts @@ -5,7 +5,7 @@ import { formatUnits } from 'viem' import { base } from 'viem/chains' import * as aerodromeLPSugarAbi from '@abi/aerodrome-lp-sugar-v3' -import * as mixedQuoterAbi from '@abi/aerodrome-mixed-quoter.extended' +import * as mixedQuoterAbi from '@abi/aerodrome-mixed-quoter' import * as erc20Abi from '@abi/erc20' import * as otokenAbi from '@abi/otoken' import { Context, EvmBatchProcessor, defineProcessor, logFilter, multicall, run } from '@originprotocol/squid-utils' diff --git a/src/mainnet/processors/legacy-staking.ts b/src/mainnet/processors/legacy-staking.ts index 934741a8..205c6d8b 100644 --- a/src/mainnet/processors/legacy-staking.ts +++ b/src/mainnet/processors/legacy-staking.ts @@ -13,10 +13,10 @@ export const setup = (processor: EvmBatchProcessor) => { processor.addLog({ address: [LEGACY_OGN_STAKING], topic0: [ - legacyStakingAbi.events['Staked(address indexed,uint256)'], - legacyStakingAbi.events['Staked(address indexed,uint256,uint256,uint256)'], - legacyStakingAbi.events['Withdrawn(address indexed,uint256)'], - legacyStakingAbi.events['Withdrawn(address indexed,uint256,uint256)'], + legacyStakingAbi.events.Staked_1, + legacyStakingAbi.events.Staked, + legacyStakingAbi.events.Withdrawn_1, + legacyStakingAbi.events.Withdrawn, legacyStakingAbi.events.StakesTransfered, ].map((ev) => ev.topic), range: { from }, @@ -36,24 +36,23 @@ export const process = async (ctx: Context) => { continue } - if (firstTopic === legacyStakingAbi.events['Staked(address indexed,uint256)'].topic) { - let { user, amount } = legacyStakingAbi.events['Staked(address indexed,uint256)'].decode(log) + if (firstTopic === legacyStakingAbi.events.Staked_1.topic) { + let { user, amount } = legacyStakingAbi.events.Staked_1.decode(log) const staker = await _getStaker(ctx, user, result) staker.inputAmount += amount staker.balance += amount - } else if (firstTopic === legacyStakingAbi.events['Staked(address indexed,uint256,uint256,uint256)'].topic) { - let { user, amount } = legacyStakingAbi.events['Staked(address indexed,uint256,uint256,uint256)'].decode(log) + } else if (firstTopic === legacyStakingAbi.events.Staked.topic) { + let { user, amount } = legacyStakingAbi.events.Staked.decode(log) const staker = await _getStaker(ctx, user, result) staker.inputAmount += amount staker.balance += amount - } else if (firstTopic === legacyStakingAbi.events['Withdrawn(address indexed,uint256)'].topic) { - let { user, amount } = legacyStakingAbi.events['Withdrawn(address indexed,uint256)'].decode(log) + } else if (firstTopic === legacyStakingAbi.events.Withdrawn_1.topic) { + let { user, amount } = legacyStakingAbi.events.Withdrawn_1.decode(log) const staker = await _getStaker(ctx, user, result) staker.outputAmount += amount staker.balance -= amount - } else if (firstTopic === legacyStakingAbi.events['Withdrawn(address indexed,uint256,uint256)'].topic) { - let { user, amount, stakedAmount } = - legacyStakingAbi.events['Withdrawn(address indexed,uint256,uint256)'].decode(log) + } else if (firstTopic === legacyStakingAbi.events.Withdrawn.topic) { + let { user, amount, stakedAmount } = legacyStakingAbi.events.Withdrawn.decode(log) const staker = await _getStaker(ctx, user, result) staker.outputAmount += stakedAmount staker.rewardAmount += amount - stakedAmount diff --git a/src/mainnet/processors/origin-arms.ts b/src/mainnet/processors/origin-arms.ts index 3a54faaa..7ef17b35 100644 --- a/src/mainnet/processors/origin-arms.ts +++ b/src/mainnet/processors/origin-arms.ts @@ -5,6 +5,7 @@ import { addresses } from '@utils/addresses' export const originArmProcessors = [ // Lido ARM ...createOriginARMProcessors({ + chainId: 1, name: 'ARM-WETH-stETH', from: 20987226, armAddress: addresses.arms['ARM-WETH-stETH'].address, @@ -17,6 +18,7 @@ export const originArmProcessors = [ // Ether.fi ARM ...createOriginARMProcessors({ + chainId: 1, name: 'ARM-WETH-eETH', from: 23689028, armAddress: addresses.arms['ARM-WETH-eETH'].address, @@ -29,6 +31,7 @@ export const originArmProcessors = [ // Ethena ARM ...createOriginARMProcessors({ + chainId: 1, name: 'ARM-USDe-sUSDe', from: 23924654, armAddress: addresses.arms['ARM-USDe-sUSDe'].address, diff --git a/src/model/generated/armState.model.ts b/src/model/generated/armState.model.ts index 57a9eb4b..fa7139f0 100644 --- a/src/model/generated/armState.model.ts +++ b/src/model/generated/armState.model.ts @@ -66,4 +66,7 @@ export class ArmState { @BigIntColumn_({nullable: false}) totalFees!: bigint + + @BigIntColumn_({nullable: false}) + claimable!: bigint } diff --git a/src/model/generated/armWithdrawalRequest.model.ts b/src/model/generated/armWithdrawalRequest.model.ts index f9eff587..9e5e929d 100644 --- a/src/model/generated/armWithdrawalRequest.model.ts +++ b/src/model/generated/armWithdrawalRequest.model.ts @@ -47,4 +47,7 @@ export class ArmWithdrawalRequest { @DateTimeColumn_({nullable: true}) claimedAt!: Date | undefined | null + + @DateTimeColumn_({nullable: true}) + claimableAt!: Date | undefined | null } diff --git a/src/model/generated/index.ts b/src/model/generated/index.ts index 1fc4c337..d3496cbb 100644 --- a/src/model/generated/index.ts +++ b/src/model/generated/index.ts @@ -38,6 +38,7 @@ export * from "./woToken.model" export * from "./oTokenAsset.model" export * from "./oTokenAddress.model" export * from "./_rebasingOption" +export * from "./oTokenAddressYield.model" export * from "./oTokenHistory.model" export * from "./_historyType" export * from "./oTokenRebase.model" diff --git a/src/model/generated/oTokenAddressYield.model.ts b/src/model/generated/oTokenAddressYield.model.ts new file mode 100644 index 00000000..a1c647e6 --- /dev/null +++ b/src/model/generated/oTokenAddressYield.model.ts @@ -0,0 +1,49 @@ +import {Entity as Entity_, Column as Column_, PrimaryColumn as PrimaryColumn_, IntColumn as IntColumn_, Index as Index_, StringColumn as StringColumn_, DateTimeColumn as DateTimeColumn_, BigIntColumn as BigIntColumn_, FloatColumn as FloatColumn_} from "@subsquid/typeorm-store" + +@Entity_() +export class OTokenAddressYield { + constructor(props?: Partial) { + Object.assign(this, props) + } + + @PrimaryColumn_() + id!: string + + @Index_() + @IntColumn_({nullable: false}) + chainId!: number + + @Index_() + @StringColumn_({nullable: false}) + otoken!: string + + @Index_() + @StringColumn_({nullable: false}) + address!: string + + @Index_() + @StringColumn_({nullable: false}) + date!: string + + @DateTimeColumn_({nullable: false}) + timestamp!: Date + + @Index_() + @IntColumn_({nullable: false}) + blockNumber!: number + + @BigIntColumn_({nullable: false}) + balance!: bigint + + @BigIntColumn_({nullable: false}) + costBasis!: bigint + + @BigIntColumn_({nullable: false}) + yield!: bigint + + @BigIntColumn_({nullable: false}) + cumulativeYield!: bigint + + @FloatColumn_({nullable: false}) + roi!: number +} diff --git a/src/model/generated/oTokenVault.model.ts b/src/model/generated/oTokenVault.model.ts index fefe936d..5e5db508 100644 --- a/src/model/generated/oTokenVault.model.ts +++ b/src/model/generated/oTokenVault.model.ts @@ -34,4 +34,7 @@ export class OTokenVault { @BigIntColumn_({nullable: false}) totalValue!: bigint + + @BigIntColumn_({nullable: false}) + claimable!: bigint } diff --git a/src/model/generated/oTokenWithdrawalRequest.model.ts b/src/model/generated/oTokenWithdrawalRequest.model.ts index 2a68de6e..93bdf616 100644 --- a/src/model/generated/oTokenWithdrawalRequest.model.ts +++ b/src/model/generated/oTokenWithdrawalRequest.model.ts @@ -43,6 +43,9 @@ export class OTokenWithdrawalRequest { @DateTimeColumn_({nullable: true}) claimedAt!: Date | undefined | null + @DateTimeColumn_({nullable: true}) + claimableAt!: Date | undefined | null + @BigIntColumn_({nullable: true}) queueWait!: bigint | undefined | null diff --git a/src/sonic/origin-sonic-arm.ts b/src/sonic/origin-sonic-arm.ts index 3d56e9ab..a422ce3c 100644 --- a/src/sonic/origin-sonic-arm.ts +++ b/src/sonic/origin-sonic-arm.ts @@ -2,6 +2,7 @@ import { createOriginARMProcessors } from '@templates/origin-arm' import { sonicAddresses } from '@utils/addresses-sonic' export const sonicArmProcessors = createOriginARMProcessors({ + chainId: 146, name: 'origin-os-arm', from: 28716127, armAddress: sonicAddresses.armOS.address, diff --git a/src/templates/morpho/fetch.ts b/src/templates/morpho/fetch.ts index f378bbf0..a8c1cd97 100644 --- a/src/templates/morpho/fetch.ts +++ b/src/templates/morpho/fetch.ts @@ -10,20 +10,25 @@ * - `fetchVaultApyViem` — viem version, returns { apy, markets } or null */ import { compact } from 'lodash' -import type { PublicClient } from 'viem' +import type { Abi, PublicClient } from 'viem' import { getAddress } from 'viem' import * as erc20 from '@abi/erc20' -import { ABI_JSON as ERC20_ABI_JSON } from '@abi/erc20.abi' import * as irmAbi from '@abi/irm-adaptive-curve' -import { ABI_JSON as IRM_ABI_JSON } from '@abi/irm-adaptive-curve.abi' import * as metaMorphoAbi from '@abi/meta-morpho' -import { ABI_JSON as META_MORPHO_ABI_JSON } from '@abi/meta-morpho.abi' import * as morphoAbi from '@abi/morpho' -import { ABI_JSON as MORPHO_ABI_JSON } from '@abi/morpho.abi' import { Block, Context, multicall, range } from '@originprotocol/squid-utils' import { ADDRESS_ZERO } from '@utils/addresses' +import IRM_ABI_JSON_RAW from '../../abi-json/aave-lending-pool.json' +import ERC20_ABI_JSON_RAW from '../../abi-json/erc20.json' +import META_MORPHO_ABI_JSON_RAW from '../../abi-json/meta-morpho.json' +import MORPHO_ABI_JSON_RAW from '../../abi-json/morpho.json' + +const IRM_ABI_JSON = IRM_ABI_JSON_RAW as Abi +const ERC20_ABI_JSON = ERC20_ABI_JSON_RAW as Abi +const META_MORPHO_ABI_JSON = META_MORPHO_ABI_JSON_RAW as Abi +const MORPHO_ABI_JSON = MORPHO_ABI_JSON_RAW as Abi import type { MarketForApy } from './math' import { weightedVaultApy } from './math' @@ -218,24 +223,49 @@ export async function fetchVaultMarketsViem( if (allIds.length === 0) return [] // 4. Fetch market state, position, params, config (parallel multicalls) - const [marketStates, positions, marketParams, configs] = await Promise.all([ + const [marketStates, positions, marketParams, configs] = (await Promise.all([ client.multicall({ - contracts: allIds.map((id) => ({ address: morpho, abi: MORPHO_ABI_JSON, functionName: 'market' as const, args: [id] })), + contracts: allIds.map((id) => ({ + address: morpho, + abi: MORPHO_ABI_JSON, + functionName: 'market' as const, + args: [id], + })), allowFailure: false, }), client.multicall({ - contracts: allIds.map((id) => ({ address: morpho, abi: MORPHO_ABI_JSON, functionName: 'position' as const, args: [id, vault] })), + contracts: allIds.map((id) => ({ + address: morpho, + abi: MORPHO_ABI_JSON, + functionName: 'position' as const, + args: [id, vault], + })), allowFailure: false, }), client.multicall({ - contracts: allIds.map((id) => ({ address: morpho, abi: MORPHO_ABI_JSON, functionName: 'idToMarketParams' as const, args: [id] })), + contracts: allIds.map((id) => ({ + address: morpho, + abi: MORPHO_ABI_JSON, + functionName: 'idToMarketParams' as const, + args: [id], + })), allowFailure: false, }), client.multicall({ - contracts: allIds.map((id) => ({ address: vault, abi: META_MORPHO_ABI_JSON, functionName: 'config' as const, args: [id] })), + contracts: allIds.map((id) => ({ + address: vault, + abi: META_MORPHO_ABI_JSON, + functionName: 'config' as const, + args: [id], + })), allowFailure: false, }), - ]) + ])) as unknown as [ + [bigint, bigint, bigint, bigint, bigint, bigint][], + [bigint, bigint, bigint][], + [`0x${string}`, `0x${string}`, `0x${string}`, `0x${string}`, bigint][], + [bigint, boolean, bigint][], + ] // 5. Per-market IRM + decimals (single multicall batch) const irmAndDecimalCalls = marketParams.flatMap(([loanToken, , , irm], i) => { @@ -248,7 +278,7 @@ export async function fetchVaultMarketsViem( ] }) const irmAndDecimalResults = await client.multicall({ - contracts: compact(irmAndDecimalCalls), + contracts: compact(irmAndDecimalCalls) as { address: `0x${string}`; abi: Abi; functionName: string; args?: readonly unknown[] }[], allowFailure: true, }) @@ -328,4 +358,4 @@ export async function fetchVaultApyViem( const markets = await fetchVaultMarketsViem(client, vaultAddress, morphoAddress) if (markets.length === 0) return null return { apy: weightedVaultApy(markets), markets } -} \ No newline at end of file +} diff --git a/src/templates/origin-arm/arm-apy.ts b/src/templates/origin-arm/arm-apy.ts index 86477e9f..5b735bc2 100644 --- a/src/templates/origin-arm/arm-apy.ts +++ b/src/templates/origin-arm/arm-apy.ts @@ -16,5 +16,14 @@ export const calculateArmDailyApy = ({ const startOfDay = dayjs(date).startOf('day').toDate() const endOfDay = dayjs(date).endOf('day').toDate() - return calculateAPY(startOfDay, endOfDay, previousDailyStat?.assetsPerShare ?? 10n ** 18n, state.assetsPerShare) + const result = calculateAPY( + startOfDay, + endOfDay, + previousDailyStat?.assetsPerShare ?? 10n ** 18n, + state.assetsPerShare, + ) + // Guard against bad on-chain data producing absurd APYs. Anything above + // 1000% is treated as noise and zeroed out. + if (result.apy > 10) return { apr: 0, apy: 0 } + return result } diff --git a/src/templates/origin-arm/origin-arm.graphql b/src/templates/origin-arm/origin-arm.graphql index fe45e3b0..40c5185e 100644 --- a/src/templates/origin-arm/origin-arm.graphql +++ b/src/templates/origin-arm/origin-arm.graphql @@ -43,6 +43,7 @@ type ArmState @entity { totalWithdrawalsClaimed: BigInt! totalYield: BigInt! totalFees: BigInt! + claimable: BigInt! } type ArmDailyStat @entity { @@ -106,6 +107,7 @@ type ArmWithdrawalRequest @entity { queued: BigInt! claimed: Boolean! claimedAt: DateTime + claimableAt: DateTime } type ArmSwap @entity { diff --git a/src/templates/origin-arm/origin-arm.ts b/src/templates/origin-arm/origin-arm.ts index 654dd168..306fcbf5 100644 --- a/src/templates/origin-arm/origin-arm.ts +++ b/src/templates/origin-arm/origin-arm.ts @@ -1,6 +1,7 @@ import dayjs from 'dayjs' +import utc from 'dayjs/plugin/utc' import { findLast } from 'lodash' -import { LessThan } from 'typeorm' +import { IsNull, LessThan, LessThanOrEqual } from 'typeorm' import { formatEther, formatUnits } from 'viem' import * as erc20Abi from '@abi/erc20' @@ -9,15 +10,7 @@ import * as originEthenaArmAbi from '@abi/origin-ethena-arm' import * as originEtherfiArmAbi from '@abi/origin-etherfi-arm' import * as originLidoArmAbi from '@abi/origin-lido-arm' import * as originLidoArmCapManagerAbi from '@abi/origin-lido-arm-cap-manager' -import { - Arm, - ArmAddressYield, - ArmDailyStat, - ArmState, - ArmSwap, - ArmWithdrawalRequest, - TraderateChanged, -} from '@model' +import { Arm, ArmAddressYield, ArmDailyStat, ArmState, ArmSwap, ArmWithdrawalRequest, TraderateChanged } from '@model' import { Block, Context, @@ -27,7 +20,7 @@ import { logFilter, } from '@originprotocol/squid-utils' import { ensureExchangeRate } from '@shared/post-processors/exchange-rates' -import { Currency } from '@shared/post-processors/exchange-rates/mainnetCurrencies' +import { Currency, currencyToAddress } from '@shared/post-processors/exchange-rates/mainnetCurrencies' import { createERC20Entry } from '@templates/erc20/erc20-entry' import { createERC20EventTracker } from '@templates/erc20/erc20-event' import { createEventProcessor } from '@templates/events/createEventProcessor' @@ -36,7 +29,10 @@ import { traceFilter } from '@utils/traceFilter' import { calculateArmDailyApy } from './arm-apy' +dayjs.extend(utc) + export const createOriginARMProcessors = ({ + chainId = 1, name, from, armAddress, @@ -47,6 +43,7 @@ export const createOriginARMProcessors = ({ marketFrom, armType, }: { + chainId?: number name: string from: number armAddress: string @@ -87,14 +84,23 @@ export const createOriginARMProcessors = ({ topic0: [originLidoArmAbi.events.Transfer.topic], range: { from }, }) + // Inbound transfers of the base asset (token0) advance the ARM's claimable + // pointer. Mainnet-only template, so resolve the symbol against chainId 1. + const token0Address = currencyToAddress(chainId, token0) + const baseAssetInboundFilter = logFilter({ + address: [token0Address], + topic0: [erc20Abi.events.Transfer.topic], + topic2: [armAddress], + range: { from }, + }) const swapFilter = traceFilter({ type: ['call'], callTo: [armAddress], callSighash: [ - originLidoArmAbi.functions['swapExactTokensForTokens(uint256,uint256,address[],address,uint256)'].sighash, - originLidoArmAbi.functions['swapExactTokensForTokens(address,address,uint256,uint256,address)'].sighash, - originLidoArmAbi.functions['swapTokensForExactTokens(uint256,uint256,address[],address,uint256)'].sighash, - originLidoArmAbi.functions['swapTokensForExactTokens(address,address,uint256,uint256,address)'].sighash, + originLidoArmAbi.functions.swapExactTokensForTokens.sighash, + originLidoArmAbi.functions.swapExactTokensForTokens_1.sighash, + originLidoArmAbi.functions.swapTokensForExactTokens.sighash, + originLidoArmAbi.functions.swapTokensForExactTokens_1.sighash, ], range: { from }, transaction: true, @@ -170,6 +176,7 @@ export const createOriginARMProcessors = ({ p.addLog(withdrawalFilter.value) p.addLog(feeCollectedFilter.value) p.addLog(transferFilter.value) + p.addLog(baseAssetInboundFilter.value) p.addTrace(swapFilter.value) tradeRateProcessor.setup(p) }, @@ -213,7 +220,7 @@ export const createOriginARMProcessors = ({ ) } const getYesterdayState = async (block: Block) => { - const startOfToday = dayjs(block.header.timestamp).startOf('day').toDate() + const startOfToday = dayjs.utc(block.header.timestamp).startOf('day').toDate() return ( findLast(states, (state) => state.timestamp < startOfToday) ?? (await ctx.store.findOne(ArmState, { @@ -245,6 +252,7 @@ export const createOriginARMProcessors = ({ totalSupply, assetsPerShare, activeMarket, + claimable, ] = await Promise.all([ new erc20Abi.Contract(ctx, block.header, armEntity.token0).balanceOf(armAddress), new erc20Abi.Contract(ctx, block.header, armEntity.token1).balanceOf(armAddress), @@ -263,6 +271,7 @@ export const createOriginARMProcessors = ({ armContract.totalSupply(), armContract.previewRedeem(10n ** 18n), marketFrom && block.header.height >= marketFrom ? armContract.activeMarket() : Promise.resolve(undefined), + armContract.claimable(), ]) // Guard against the zero address: an ARM may expose activeMarket() // from its deploy block but not have a market wired up until later. @@ -299,12 +308,41 @@ export const createOriginARMProcessors = ({ totalWithdrawalsClaimed: previousState?.totalWithdrawalsClaimed ?? 0n, totalFees: previousState?.totalFees ?? 0n, totalYield: 0n, + claimable, }) armStateEntity.totalYield = calculateTotalYield(armStateEntity) states.push(armStateEntity) states.sort((a, b) => a.blockNumber - b.blockNumber) // sort ascending + await resolveClaimableRequests(block, claimable) return armStateEntity } + const computeClaimableAt = (requestTimestampMs: number, blockTimestampMs: number): Date => { + // 10-minute floor: even when the vault already has enough liquidity, + // a request can never have been claimable sooner than 10 minutes + // after it was made (per product spec). + const floor = requestTimestampMs + 10 * 60 * 1000 + return new Date(blockTimestampMs > floor ? blockTimestampMs : floor) + } + const resolveClaimableRequests = async (block: Block, claimable: bigint) => { + for (const req of redemptionMap.values()) { + if (req.claimableAt == null && req.queued <= claimable) { + req.claimableAt = computeClaimableAt(req.timestamp.getTime(), block.header.timestamp) + } + } + const rows = await ctx.store.find(ArmWithdrawalRequest, { + where: { + chainId: ctx.chain.id, + address: armAddress, + claimableAt: IsNull(), + queued: LessThanOrEqual(claimable), + }, + }) + for (const row of rows) { + if (redemptionMap.has(row.id)) continue + row.claimableAt = computeClaimableAt(row.timestamp.getTime(), block.header.timestamp) + redemptionMap.set(row.id, row) + } + } const calculateTotalYield = (state: ArmState) => state.totalAssets - state.totalDeposits + state.totalWithdrawals const checkpoint = ( @@ -446,6 +484,11 @@ export const createOriginARMProcessors = ({ checkpoint(event.to, block, R, event.value, costBasisDelta) } } + if (baseAssetInboundFilter.matches(log)) { + // Inbound base-asset transfer changes the ARM's liquidity, which can + // advance claimable. Snapshot ArmState so the new value is captured. + await getCurrentState(block) + } } const swapHandledTransactions = new Set() @@ -548,7 +591,7 @@ export const createOriginARMProcessors = ({ // ArmDailyStat const date = new Date(block.header.timestamp) const dateStr = date.toISOString().slice(0, 10) - const previousDateStr = dayjs(date).subtract(1, 'day').toISOString().slice(0, 10) + const previousDateStr = dayjs.utc(date).subtract(1, 'day').format('YYYY-MM-DD') const currentDayId = `${ctx.chain.id}:${dateStr}:${armAddress}` const previousDayId = `${ctx.chain.id}:${previousDateStr}:${armAddress}` const previousDailyStat = diff --git a/src/templates/otoken/otoken-2.ts b/src/templates/otoken/otoken-2.ts index 220c1247..ae5cf6f0 100644 --- a/src/templates/otoken/otoken-2.ts +++ b/src/templates/otoken/otoken-2.ts @@ -1,7 +1,7 @@ import crypto from 'crypto' import { existsSync, readFileSync, writeFileSync } from 'fs' import { pick, uniq } from 'lodash' -import { getAddress } from 'viem' +import { type AbiFunction, getAddress, toFunctionSelector } from 'viem' import * as proxyAbi from '@abi/governed-upgradeability-proxy' import * as otokenAbi from '@abi/otoken' @@ -9,6 +9,7 @@ import * as otokenAbi20241221 from '@abi/otoken-2024-12-21' import * as otokenHarvester from '@abi/otoken-base-harvester' import * as otokenUpgradeAccountsAbi from '@abi/otoken-upgradeAccounts' import * as otokenVaultAbi from '@abi/otoken-vault' +import OTOKEN_2024_12_21_ABI_JSON from '../../abi-json/otoken-2024-12-21.json' import { OTokenAsset, OTokenRawData } from '@model' import { Block, @@ -36,12 +37,18 @@ import { OToken_2023_12_21 } from './otoken-2023-12-21' import { OToken_2025_03_04 } from './otoken-2025-03-04' import { OToken_2025_07_01 } from './otoken-2025-07-01' import { OTokenEntityProducer } from './otoken-entity-producer' -import { otokenFrequencyProcessor } from './otoken-frequency' +import { otokenStateProcessor } from './otoken-state' import { OTokenClass } from './types' import { isYieldDelegationContract } from './utils' const DEBUG_PERF = process.env.DEBUG_PERF === 'true' +const otokenViewSelectors = new Set( + (OTOKEN_2024_12_21_ABI_JSON as AbiFunction[]) + .filter((f) => f.type === 'function' && (f.stateMutability === 'view' || f.stateMutability === 'pure')) + .map((f) => toFunctionSelector(f)), +) + export type OTokenContractAddress = | typeof OUSD_ADDRESS | typeof OETH_ADDRESS @@ -132,7 +139,7 @@ export const createOTokenProcessor2 = (params: { }) => { const { otokenAddress, from, otokenVaultAddress } = params - const frequencyUpdater = otokenFrequencyProcessor(params) + const stateUpdater = otokenStateProcessor(params) // Create trace filter for rebase opt events const generalTraceParams = { @@ -340,6 +347,7 @@ export const createOTokenProcessor2 = (params: { processor.includeAllBlocks({ from }) }, initialize: async (ctx: Context) => { + await stateUpdater.initialize(ctx) const assetsCount = await ctx.store.count(OTokenAsset, { where: { chainId: ctx.chain.id, otoken: params.otokenAddress }, }) @@ -365,7 +373,7 @@ export const createOTokenProcessor2 = (params: { */ async process(ctx: Context): Promise { await loadIsContractCache(ctx) - const frequencyUpdatePromise = frequencyUpdater(ctx) + const stateUpdaterPromise = stateUpdater.process(ctx) if (!otoken) { if (process.env.BLOCK_FROM) { @@ -732,19 +740,13 @@ export const createOTokenProcessor2 = (params: { trace.action.input.startsWith(value.selector), ) if (fun) { - if (!fun.isView) { - ctx.log.info({ data: trace.action.input, hash: trace.transaction?.hash }, fun.signature) + if (!otokenViewSelectors.has(fun.selector)) { + ctx.log.info({ data: trace.action.input, hash: trace.transaction?.hash }, fun.sighash) } } else { ctx.log.info({ data: trace.action.input, hash: trace.transaction?.hash }, 'unknown') } - if (!fun?.isView) { - ctx.log.error( - { data: trace.action.input, hash: trace.transaction?.hash }, - 'write function not being processed', - ) - } endSection('trace_unknown') } } @@ -780,15 +782,15 @@ export const createOTokenProcessor2 = (params: { // ) } - const frequencyUpdateResults = await frequencyUpdatePromise + const stateUpdaterResults = await stateUpdaterPromise startSection('finalSave') await Promise.all([ saveIsContractCache(ctx), producer.save(), - ctx.store.insert(frequencyUpdateResults.vaults), - ctx.store.insert(frequencyUpdateResults.wotokens), - ctx.store.insert(frequencyUpdateResults.dripperStates), + ctx.store.insert(stateUpdaterResults.vaults), + ctx.store.insert(stateUpdaterResults.wotokens), + ctx.store.insert(stateUpdaterResults.dripperStates), ]) endSection('finalSave') @@ -821,18 +823,18 @@ const loadOTokenRawData = (ctx: Context, block: Block, entity: OTokenRawData) => entity.type === 'OToken_2021_01_02' ? new OToken_2021_01_02(ctx, block, entity.otoken) : entity.type === 'OToken_2021_01_08' - ? new OToken_2021_01_08(ctx, block, entity.otoken) - : entity.type === 'OToken_2021_01_25' - ? new OToken_2021_01_25(ctx, block, entity.otoken) - : entity.type === 'OToken_2021_06_06' - ? new OToken_2021_06_06(ctx, block, entity.otoken) - : entity.type === 'OToken_2023_12_21' - ? new OToken_2023_12_21(ctx, block, entity.otoken) - : entity.type === 'OToken_2025_03_04' - ? new OToken_2025_03_04(ctx, block, entity.otoken) - : entity.type === 'OToken_2025_07_01' - ? new OToken_2025_07_01(ctx, block, entity.otoken) - : undefined + ? new OToken_2021_01_08(ctx, block, entity.otoken) + : entity.type === 'OToken_2021_01_25' + ? new OToken_2021_01_25(ctx, block, entity.otoken) + : entity.type === 'OToken_2021_06_06' + ? new OToken_2021_06_06(ctx, block, entity.otoken) + : entity.type === 'OToken_2023_12_21' + ? new OToken_2023_12_21(ctx, block, entity.otoken) + : entity.type === 'OToken_2025_03_04' + ? new OToken_2025_03_04(ctx, block, entity.otoken) + : entity.type === 'OToken_2025_07_01' + ? new OToken_2025_07_01(ctx, block, entity.otoken) + : undefined if (!otoken) throw new Error('Class type not set up for loadOTokenRawData') Object.assign(otoken, entity.data) @@ -857,50 +859,50 @@ const saveOTokenRawData = async (ctx: Context, block: Block, otoken: OTokenClass 'rebaseState', ] : otoken instanceof OToken_2023_12_21 - ? [ - 'totalSupply', - 'allowances', - 'vaultAddress', - 'creditBalances', - '_rebasingCredits', - '_rebasingCreditsPerToken', - 'nonRebasingSupply', - 'nonRebasingCreditsPerToken', - 'rebaseState', - 'isUpgraded', - 'governor', - ] - : otoken instanceof OToken_2025_03_04 - ? [ - 'totalSupply', - 'allowances', - 'vaultAddress', - 'creditBalances', - 'rebasingCredits', - 'rebasingCreditsPerToken', - 'nonRebasingSupply', - 'alternativeCreditsPerToken', - 'rebaseState', - 'yieldTo', - 'yieldFrom', - 'governor', - ] - : otoken instanceof OToken_2025_07_01 - ? [ - 'totalSupply', - 'allowances', - 'vaultAddress', - 'creditBalances', - 'rebasingCredits', - 'rebasingCreditsPerToken', - 'nonRebasingSupply', - 'alternativeCreditsPerToken', - 'rebaseState', - 'yieldTo', - 'yieldFrom', - 'governor', - ] - : undefined + ? [ + 'totalSupply', + 'allowances', + 'vaultAddress', + 'creditBalances', + '_rebasingCredits', + '_rebasingCreditsPerToken', + 'nonRebasingSupply', + 'nonRebasingCreditsPerToken', + 'rebaseState', + 'isUpgraded', + 'governor', + ] + : otoken instanceof OToken_2025_03_04 + ? [ + 'totalSupply', + 'allowances', + 'vaultAddress', + 'creditBalances', + 'rebasingCredits', + 'rebasingCreditsPerToken', + 'nonRebasingSupply', + 'alternativeCreditsPerToken', + 'rebaseState', + 'yieldTo', + 'yieldFrom', + 'governor', + ] + : otoken instanceof OToken_2025_07_01 + ? [ + 'totalSupply', + 'allowances', + 'vaultAddress', + 'creditBalances', + 'rebasingCredits', + 'rebasingCreditsPerToken', + 'nonRebasingSupply', + 'alternativeCreditsPerToken', + 'rebaseState', + 'yieldTo', + 'yieldFrom', + 'governor', + ] + : undefined if (!keys) throw new Error('Keys not set up for saveOTokenRawData') diff --git a/src/templates/otoken/otoken-daily-stats.ts b/src/templates/otoken/otoken-daily-stats.ts index 8bfd77da..db81790a 100644 --- a/src/templates/otoken/otoken-daily-stats.ts +++ b/src/templates/otoken/otoken-daily-stats.ts @@ -48,6 +48,10 @@ export const processOTokenDailyStats = async ( ) => { // Daily Stats // Whatever days we've just crossed over, let's update their respective daily stat entry using the last block seen at that time. + // params.balances reflects addressMap state at end-of-batch — only meaningful for the day matching the batch's last block. + // For older days in this batch (batch spanning a UTC boundary), skip accountsOverThreshold so the prior batch's + // near-EOD value isn't overwritten with a snapshot from the next day. + const lastBatchDate = new Date(ctx.blocks[ctx.blocks.length - 1].header.timestamp).toISOString().substring(0, 10) for (const { block, entity } of params.dailyStats.values()) { if (block.header.height < params.from) continue const blockDate = new Date(block.header.timestamp) @@ -221,7 +225,7 @@ export const processOTokenDailyStats = async ( // } entity.fees = rebases.reduce((sum, current) => sum + current.fee, 0n) - const lastDayString = dayjs(block.header.timestamp).subtract(1, 'day').toISOString().substring(0, 10) + const lastDayString = dayjs.utc(block.header.timestamp).subtract(1, 'day').format('YYYY-MM-DD') const lastId = `${ctx.chain.id}-${params.otokenAddress}-${lastDayString}` const last = params.dailyStats.get(lastId)?.entity ?? (await ctx.store.get(OTokenDailyStat, lastId)) entity.cumulativeYield = (last?.cumulativeYield ?? 0n) + entity.yield @@ -237,9 +241,15 @@ export const processOTokenDailyStats = async ( entity.marketCapUSD = +formatUnits(entity.totalSupply * entity.rateUSD, 18) entity.wrappedSupply = wrappedSupply entity.rateWrapped = wrappedRate - entity.accountsOverThreshold = Array.from(params.balances.values()).filter( - (balance) => balance >= params.accountsOverThresholdMinimum, - ).length + // Only refresh accountsOverThreshold when the entity's day matches the batch's + // last block — otherwise params.balances reflects a snapshot from a later day. + // Exception: if the entity is uninitialized (e.g., created earlier in this same + // multi-day batch), set an initial value rather than leaving it at 0. + if (entity.date === lastBatchDate || needsInit) { + entity.accountsOverThreshold = Array.from(params.balances.values()).filter( + (balance) => balance >= params.accountsOverThresholdMinimum, + ).length + } ctx.log.info(`Updated OTokenDailyStat: ${entity.id}`) } } diff --git a/src/templates/otoken/otoken-entity-producer.ts b/src/templates/otoken/otoken-entity-producer.ts index ba5b020c..ea48ea6d 100644 --- a/src/templates/otoken/otoken-entity-producer.ts +++ b/src/templates/otoken/otoken-entity-producer.ts @@ -1,6 +1,6 @@ import dayjs from 'dayjs' import utc from 'dayjs/plugin/utc' -import { LessThan } from 'typeorm' +import { In, LessThan } from 'typeorm' import { parseUnits } from 'viem' import * as otokenHarvester from '@abi/otoken-base-harvester' @@ -11,6 +11,7 @@ import { OToken, OTokenAPY, OTokenAddress, + OTokenAddressYield, OTokenDailyStat, OTokenHarvesterYieldSent, OTokenHistory, @@ -54,6 +55,10 @@ export class OTokenEntityProducer { private otokenMap: Map = new Map() private addressMap: Map = new Map() private changedAddressMap: Map = new Map() // Only to contain addresses whose content has changed during the context. + private currentDayAddressYieldRows: Map = new Map() + private previousDayAddressYieldRows: Map = new Map() + private changedAddressYieldRows: Map = new Map() + private addressYieldRowsInitialized = false private histories: Map = new Map() private apyMap: Map = new Map() private rebaseMap: Map = new Map() @@ -109,6 +114,46 @@ export class OTokenEntityProducer { this.addressMap.set(address.address, address) } + if (!this.addressYieldRowsInitialized) { + // Only preload yield rows for addresses currently above the dust threshold. + // Dust accounts get skipped during rebase processing anyway and would just + // bloat memory. Re-encounters (a dust account receiving more tokens) are + // handled by `ensureYieldSeed` on demand. + const activeAddresses = [...this.addressMap.values()] + .filter((a) => a.balance > this.rebaseBalanceUpdateThreshold) + .map((a) => a.address) + + if (activeAddresses.length > 0) { + const today = dayjs.utc(this.block.header.timestamp).format('YYYY-MM-DD') + const yesterday = dayjs.utc(this.block.header.timestamp).subtract(1, 'day').format('YYYY-MM-DD') + const [todayRows, yesterdayRows] = await Promise.all([ + this.ctx.store.find(OTokenAddressYield, { + where: { + chainId: this.ctx.chain.id, + otoken: this.otoken.address, + address: In(activeAddresses), + date: today, + }, + }), + this.ctx.store.find(OTokenAddressYield, { + where: { + chainId: this.ctx.chain.id, + otoken: this.otoken.address, + address: In(activeAddresses), + date: yesterday, + }, + }), + ]) + for (const row of todayRows) { + this.currentDayAddressYieldRows.set(row.address, row) + } + for (const row of yesterdayRows) { + this.previousDayAddressYieldRows.set(row.address, row) + } + } + this.addressYieldRowsInitialized = true + } + this.initialized = true } @@ -245,6 +290,94 @@ export class OTokenEntityProducer { return address } + // Lazy-load the most recent prior yield row for an address into the current/ + // previous-day cache when not already present. This lets us evict dust holders + // from memory and still preserve `cumulativeYield` history if they come back. + private async ensureYieldSeed(account: string): Promise { + const address = account.toLowerCase() + if (this.currentDayAddressYieldRows.has(address) || this.previousDayAddressYieldRows.has(address)) { + return + } + const row = await this.ctx.store.findOne(OTokenAddressYield, { + where: { + chainId: this.ctx.chain.id, + otoken: this.otoken.address, + address, + }, + order: { date: 'DESC' }, + }) + if (!row) return + const today = new Date(this.block.header.timestamp).toISOString().slice(0, 10) + if (row.date === today) { + this.currentDayAddressYieldRows.set(address, row) + } else { + this.previousDayAddressYieldRows.set(address, row) + } + } + + // Snapshot the current OTokenAddress state into today's yield row. Derives + // costBasis from the implied capital flow: balance moves that aren't + // attributable to yield (address.earned growth) are inflows/outflows. + // Caller must have ensured the address's seed row is in memory (via + // ensureYieldSeed or the bulk pre-fetch in afterChangeSupply). + private snapshotAddressYield(account: string): void { + const address = this.addressMap.get(account) + if (!address) throw new Error('Address must exist before snapshot: ' + account) + + const lower = account.toLowerCase() + const date = new Date(this.block.header.timestamp).toISOString().slice(0, 10) + const id = `${this.ctx.chain.id}:${this.otoken.address}:${lower}:${date}` + + let row = this.currentDayAddressYieldRows.get(lower) + if (!row || row.date !== date) { + if (row) this.previousDayAddressYieldRows.set(lower, row) + const seed = row ?? this.previousDayAddressYieldRows.get(lower) + row = new OTokenAddressYield({ + id, + chainId: this.ctx.chain.id, + otoken: this.otoken.address, + address: lower, + date, + timestamp: new Date(this.block.header.timestamp), + blockNumber: this.block.header.height, + balance: seed?.balance ?? 0n, + costBasis: seed?.costBasis ?? 0n, + yield: 0n, + cumulativeYield: seed?.cumulativeYield ?? 0n, + roi: 0, + }) + this.currentDayAddressYieldRows.set(lower, row) + } + + // address.earned is cumulative yield since inception, so the diff vs the + // row's prior cumulativeYield is yield accrued since the last snapshot. + // Whatever balance moved beyond that is capital flow. + const balanceDelta = address.balance - row.balance + const yieldDelta = address.earned - row.cumulativeYield + const capitalFlow = balanceDelta - yieldDelta + + if (capitalFlow < 0n && row.balance > 0n) { + const outflow = -capitalFlow + const removeBasis = (row.costBasis * (outflow > row.balance ? row.balance : outflow)) / row.balance + row.costBasis -= removeBasis + } else if (capitalFlow > 0n) { + row.costBasis += capitalFlow + } + + row.balance = address.balance + row.cumulativeYield = address.earned + row.yield = row.cumulativeYield - (this.previousDayAddressYieldRows.get(lower)?.cumulativeYield ?? 0n) + row.roi = row.costBasis > 0n ? Number(row.balance) / Number(row.costBasis) - 1 : 0 + row.timestamp = new Date(this.block.header.timestamp) + row.blockNumber = this.block.header.height + + if (row.balance > 0n || row.costBasis > 0n || row.cumulativeYield > 0n) { + this.changedAddressYieldRows.set(row.id, row) + } else { + this.changedAddressYieldRows.delete(row.id) + } + } + private async createHistory( trace: Trace, from: string | null, @@ -487,7 +620,9 @@ export class OTokenEntityProducer { async afterMint(trace: Trace, to: string, value: bigint): Promise { await this.getOrCreateOTokenEntity() + await this.ensureYieldSeed(to) await this.createHistory(trace, null, to, value) + this.snapshotAddressYield(to) this.transfers.push({ block: this.block, transactionHash: trace.transaction!.hash, @@ -501,7 +636,9 @@ export class OTokenEntityProducer { async afterBurn(trace: Trace, from: string, value: bigint): Promise { await this.getOrCreateOTokenEntity() + await this.ensureYieldSeed(from) await this.createHistory(trace, from, null, value) + this.snapshotAddressYield(from) this.transfers.push({ block: this.block, transactionHash: trace.transaction!.hash, @@ -515,7 +652,11 @@ export class OTokenEntityProducer { async afterTransfer(trace: Trace, from: string, to: string, value: bigint): Promise { await this.getOrCreateOTokenEntity() + await this.ensureYieldSeed(from) + await this.ensureYieldSeed(to) await this.createHistory(trace, from, to, value) + this.snapshotAddressYield(from) + this.snapshotAddressYield(to) this.transfers.push({ block: this.block, transactionHash: trace.transaction!.hash, @@ -529,7 +670,11 @@ export class OTokenEntityProducer { async afterTransferFrom(trace: Trace, from: string, to: string, value: bigint): Promise { await this.getOrCreateOTokenEntity() + await this.ensureYieldSeed(from) + await this.ensureYieldSeed(to) await this.createHistory(trace, from, to, value) + this.snapshotAddressYield(from) + this.snapshotAddressYield(to) this.transfers.push({ block: this.block, transactionHash: trace.transaction!.hash, @@ -602,10 +747,45 @@ export class OTokenEntityProducer { // Create Rebase Entity await this.getOrCreateRebaseEntity(trace, _yield, _fee) + // Pre-fetch yield seeds for above-threshold accounts that aren't cached + // (typically because they were evicted as dust and crossed back over the + // threshold). The rebase loop below is sync; without this, those accounts + // would create a new row with seed=undefined and lose their prior balance + // and cumulativeYield history. + const accountsNeedingSeed: string[] = [] + for (const account of Object.keys(this.otoken.creditBalances)) { + if (this.otoken.balanceOf(account) > this.rebaseBalanceUpdateThreshold) { + const lower = account.toLowerCase() + if (!this.currentDayAddressYieldRows.has(lower) && !this.previousDayAddressYieldRows.has(lower)) { + accountsNeedingSeed.push(lower) + } + } + } + if (accountsNeedingSeed.length > 0) { + const rows = await this.ctx.store.find(OTokenAddressYield, { + where: { + chainId: this.ctx.chain.id, + otoken: this.otoken.address, + address: In(accountsNeedingSeed), + }, + order: { date: 'DESC' }, + }) + const today = new Date(this.otoken.block.header.timestamp).toISOString().slice(0, 10) + for (const row of rows) { + if (row.date === today) { + if (!this.currentDayAddressYieldRows.has(row.address)) { + this.currentDayAddressYieldRows.set(row.address, row) + } + } else if (!this.previousDayAddressYieldRows.has(row.address)) { + this.previousDayAddressYieldRows.set(row.address, row) + } + } + } + // Trying not to have any async calls within this loop. for (const account of Object.keys(this.otoken.creditBalances)) { //Delete previous hour accrual - const previousDateHour = dayjs(this.otoken.block.header.timestamp).subtract(1, 'hour').toISOString().slice(0, 13) + const previousDateHour = dayjs.utc(this.otoken.block.header.timestamp).subtract(1, 'hour').format('YYYY-MM-DDTHH') this.accountEarningsByHour.delete(previousDateHour) if (this.otoken.balanceOf(account) > this.rebaseBalanceUpdateThreshold) { const dateHour = dayjs(this.otoken.block.header.timestamp).toISOString().slice(0, 13) // Date including hour @@ -619,6 +799,11 @@ export class OTokenEntityProducer { // Update the address state and check new earnings. address = this.updateAddress(account, true) const earnedDiff = address.earned - earned + if (earnedDiff > 0n) { + // address.earned and address.balance both grew by the rebase yield; + // snapshot picks that up as pure yield (capitalFlow=0). + this.snapshotAddressYield(account) + } if (earnedDiff > 0n) { const hourlyEarnings = (this.accountEarningsByHour.get(id) ?? 0n) + earnedDiff @@ -788,6 +973,7 @@ export class OTokenEntityProducer { this.ctx.store.insert([...this.otokenMap.values()]), this.ctx.store.upsert([...this.rebaseMap.values()]), this.ctx.store.upsert([...this.histories.values()]), + this.ctx.store.upsert([...this.changedAddressYieldRows.values()]), this.ctx.store.insert(this.rebaseOptions), this.ctx.store.insert(this.harvesterYieldSent), this.ctx.store.upsert([...this.dailyStats.values()].map((ds) => ds.entity)), @@ -804,6 +990,7 @@ export class OTokenEntityProducer { this.apyMap.size + this.rebaseMap.size + this.histories.size + + this.changedAddressYieldRows.size + this.rebaseOptions.length + this.harvesterYieldSent.length + [...this.dailyStats.values()].length + @@ -822,6 +1009,7 @@ export class OTokenEntityProducer { apy: this.apyMap.size, rebases: this.rebaseMap.size, histories: this.histories.size, + addressYieldRows: this.changedAddressYieldRows.size, rebaseOptions: this.rebaseOptions.length, harvesterYieldSent: this.harvesterYieldSent.length, dailyStats: [...this.dailyStats.values()].length, @@ -842,6 +1030,7 @@ export class OTokenEntityProducer { this.otokenMap = new Map() // We don't reset `this.addressMap` - keep it in memory for performance. this.changedAddressMap = new Map() + this.changedAddressYieldRows = new Map() this.histories = new Map() this.apyMap = new Map() this.rebaseMap = new Map() @@ -857,6 +1046,7 @@ export class OTokenEntityProducer { return ( this.otokenMap.size > 0 || this.changedAddressMap.size > 0 || + this.changedAddressYieldRows.size > 0 || this.histories.size > 0 || this.apyMap.size > 0 || this.rebaseMap.size > 0 || diff --git a/src/templates/otoken/otoken-frequency.ts b/src/templates/otoken/otoken-state.ts similarity index 66% rename from src/templates/otoken/otoken-frequency.ts rename to src/templates/otoken/otoken-state.ts index 8150d2c0..a1878ed6 100644 --- a/src/templates/otoken/otoken-frequency.ts +++ b/src/templates/otoken/otoken-state.ts @@ -4,9 +4,9 @@ import * as dripperAbi from '@abi/otoken-dripper' import * as otokenVault from '@abi/otoken-vault' import * as wotokenAbi from '@abi/woeth' import { OTokenDripperState, OTokenVault, WOToken } from '@model' -import { Context, blockFrequencyUpdater } from '@originprotocol/squid-utils' +import { Block, Context, blockFrequencyUpdater } from '@originprotocol/squid-utils' -export const otokenFrequencyProcessor = (params: { +export const otokenStateProcessor = (params: { otokenAddress: string otokenVaultAddress: string vaultFrom: number @@ -30,27 +30,65 @@ export const otokenFrequencyProcessor = (params: { Number.MAX_SAFE_INTEGER, ), }) - return async (ctx: Context) => { - const vaults: OTokenVault[] = [] + // Running claimable pointer; advanced whenever WithdrawalClaimable fires. + // Monotonic per the contract, so the latest event value is always current. + let currentClaimable = 0n + const vaultAddrLc = params.otokenVaultAddress.toLowerCase() + + const initialize = async (ctx: Context) => { + // Seed claimable from the most recent persisted snapshot so a restart + // mid-history doesn't write claimable=0 until the next event fires. + const last = await ctx.store.findOne(OTokenVault, { + where: { + chainId: ctx.chain.id, + otoken: params.otokenAddress, + address: params.otokenVaultAddress, + }, + order: { blockNumber: 'desc' }, + }) + if (last) currentClaimable = last.claimable + } + + const process = async (ctx: Context) => { + // Keyed by id so an event-driven + frequency snapshot on the same block dedupe. + const vaults = new Map() const wotokens: WOToken[] = [] const dripperStates: OTokenDripperState[] = [] - await frequencyUpdate(ctx, async (ctx, block) => { - if (block.header.height >= params.vaultFrom) { - const vaultContract = new otokenVault.Contract(ctx, block.header, params.otokenVaultAddress) - const [vaultBuffer, totalValue] = await Promise.all([vaultContract.vaultBuffer(), vaultContract.totalValue()]) - vaults.push( - new OTokenVault({ - id: `${ctx.chain.id}-${params.otokenAddress}-${block.header.height}-${params.otokenVaultAddress}`, - chainId: ctx.chain.id, - otoken: params.otokenAddress, - blockNumber: block.header.height, - timestamp: new Date(block.header.timestamp), - address: params.otokenVaultAddress, - vaultBuffer, - totalValue, - }), - ) + + const upsertVaultState = async (block: Block, newClaimable?: bigint) => { + if (newClaimable !== undefined) currentClaimable = newClaimable + if (block.header.height < params.vaultFrom) return + const vaultContract = new otokenVault.Contract(ctx, block.header, params.otokenVaultAddress) + const [vaultBuffer, totalValue] = await Promise.all([vaultContract.vaultBuffer(), vaultContract.totalValue()]) + const id = `${ctx.chain.id}-${params.otokenAddress}-${block.header.height}-${params.otokenVaultAddress}` + vaults.set( + id, + new OTokenVault({ + id, + chainId: ctx.chain.id, + otoken: params.otokenAddress, + blockNumber: block.header.height, + timestamp: new Date(block.header.timestamp), + address: params.otokenVaultAddress, + vaultBuffer, + totalValue, + claimable: currentClaimable, + }), + ) + } + + // Event-driven: snapshot at each WithdrawalClaimable block, capturing the new pointer. + for (const block of ctx.blocksWithContent) { + for (const log of block.logs) { + if (log.address === vaultAddrLc && log.topics[0] === otokenVault.events.WithdrawalClaimable.topic) { + const data = otokenVault.events.WithdrawalClaimable.decode(log) + await upsertVaultState(block, data._newClaimable) + } } + } + + await frequencyUpdate(ctx, async (ctx, block) => { + await upsertVaultState(block) if (params.wotoken && block.header.height >= params.wotoken.from) { const wrappedContract = new wotokenAbi.Contract(ctx, block.header, params.wotoken.address) @@ -146,9 +184,11 @@ export const otokenFrequencyProcessor = (params: { }) return { - vaults, + vaults: [...vaults.values()], wotokens, dripperStates, } } + + return { initialize, process } } diff --git a/src/templates/otoken/otoken.graphql b/src/templates/otoken/otoken.graphql index bb0114fe..b3919869 100644 --- a/src/templates/otoken/otoken.graphql +++ b/src/templates/otoken/otoken.graphql @@ -60,6 +60,21 @@ type OTokenAddress @entity { history: [OTokenHistory!]! @derivedFrom(field: "address") } +type OTokenAddressYield @entity { + id: ID! + chainId: Int! @index + otoken: String! @index + address: String! @index + date: String! @index + timestamp: DateTime! + blockNumber: Int! @index + balance: BigInt! + costBasis: BigInt! + yield: BigInt! + cumulativeYield: BigInt! + roi: Float! +} + type OTokenHistory @entity { id: ID! chainId: Int! @index @@ -129,6 +144,7 @@ type OTokenVault @entity { address: String! @index vaultBuffer: BigInt! totalValue: BigInt! + claimable: BigInt! } type OTokenActivity @entity { @@ -250,6 +266,7 @@ type OTokenWithdrawalRequest @entity { queued: BigInt! claimed: Boolean! claimedAt: DateTime + claimableAt: DateTime queueWait: BigInt txHash: String! @index } diff --git a/src/templates/strategy/strategy-balancer.ts b/src/templates/strategy/strategy-balancer.ts index e9906563..b7766628 100644 --- a/src/templates/strategy/strategy-balancer.ts +++ b/src/templates/strategy/strategy-balancer.ts @@ -54,7 +54,7 @@ export const getStrategyETHBalance = async (ctx: Context, block: { height: numbe { address, asset: WETH_ADDRESS, - balance: await strategy['checkBalance()'](), + balance: await strategy.checkBalance_1(), }, ] } @@ -73,7 +73,7 @@ export const getBalancerStrategyHoldings = async ( const balancerVault = new balancerVaultAbi.Contract(ctx, block, BALANCER_VAULT) const { tokens: poolAssets, balances } = await balancerVault.getPoolTokens(poolId) - const totalStrategyBalance = await strategy['checkBalance()']() // in WETH + const totalStrategyBalance = await strategy.checkBalance_1() // in WETH const eth1 = BigInt('1000000000000000000') let totalPoolValue = BigInt(0) diff --git a/src/templates/strategy/strategy-earnings.ts b/src/templates/strategy/strategy-earnings.ts index 88b5d39c..f77307a4 100644 --- a/src/templates/strategy/strategy-earnings.ts +++ b/src/templates/strategy/strategy-earnings.ts @@ -214,7 +214,12 @@ export const processStrategyEarnings = async ( }) } const balanceTrackingUpdate = async () => { - // ctx.log.info(`balanceTrackingUpdate`) + // Skip if we've already updated balances for this block. Multiple matching + // logs/traces in the same block would otherwise call processDepositWithdrawal + // multiple times, and the `current.earningsChange += earningsChange` accumulator + // in that function would double-count. The eth_call at this block returns the + // same value regardless of how many events fired, so one pass per block is correct. + if (didUpdate) return didUpdate = true const balances = await getBalances() await processDepositWithdrawal(ctx, strategyData, block, strategyYields, balances) diff --git a/src/templates/withdrawals.ts b/src/templates/withdrawals.ts index 1316666a..33ae589f 100644 --- a/src/templates/withdrawals.ts +++ b/src/templates/withdrawals.ts @@ -1,8 +1,13 @@ +import { In, IsNull, LessThanOrEqual, Not } from 'typeorm' + import * as oethVault from '@abi/otoken-vault' import { OTokenWithdrawalRequest } from '@model' -import { Context, EvmBatchProcessor, logFilter } from '@originprotocol/squid-utils' +import { Block, Context, EvmBatchProcessor, logFilter } from '@originprotocol/squid-utils' -// export const from = 20428558 +// Minimum time-to-claimable per spec. Even if the vault's claimable pointer +// already covers a request, the request cannot have been claimed sooner than +// this floor relative to the request's own block timestamp. +const CLAIMABLE_FLOOR_MS = 10 * 60 * 1000 interface ProcessResult { withdrawalRequests: Map @@ -29,10 +34,50 @@ export const createOTokenWithdrawalsProcessor = ({ topic0: [oethVault.events.WithdrawalClaimed.topic], range: { from }, }) + const withdrawalClaimableFilter = logFilter({ + address: [oTokenVaultAddress], + topic0: [oethVault.events.WithdrawalClaimable.topic], + range: { from }, + }) const setup = (processor: EvmBatchProcessor) => { processor.addLog(withdrawalRequestedFilter.value) processor.addLog(withdrawalClaimedFilter.value) + processor.addLog(withdrawalClaimableFilter.value) + } + + // Running claimable pointer for this vault. Lazy-loaded from chain on the + // first WithdrawalRequested encountered with unknown state, then advanced by + // every WithdrawalClaimable event we observe. Persisted across batches. + let currentClaimable: bigint | undefined + + const computeClaimableAt = (requestTimestampMs: number, blockTimestampMs: number): Date => { + const floor = requestTimestampMs + CLAIMABLE_FLOOR_MS + return new Date(blockTimestampMs > floor ? blockTimestampMs : floor) + } + + const resolvePending = async (ctx: Context, result: ProcessResult, block: Block, claimable: bigint) => { + // In-batch entries first; they take precedence over any DB row with the same id. + for (const req of result.withdrawalRequests.values()) { + if (req.claimableAt == null && req.queued <= claimable) { + req.claimableAt = computeClaimableAt(req.timestamp.getTime(), block.header.timestamp) + } + } + // Update any records we don't have in memory. + const inBatchIds = [...result.withdrawalRequests.keys()] + const rows = await ctx.store.find(OTokenWithdrawalRequest, { + where: { + chainId: ctx.chain.id, + otoken: oTokenAddress, + claimableAt: IsNull(), + queued: LessThanOrEqual(claimable), + ...(inBatchIds.length > 0 ? { id: Not(In(inBatchIds)) } : {}), + }, + }) + for (const row of rows) { + row.claimableAt = computeClaimableAt(row.timestamp.getTime(), block.header.timestamp) + result.withdrawalRequests.set(row.id, row) + } } const process = async (ctx: Context) => { @@ -46,6 +91,10 @@ export const createOTokenWithdrawalsProcessor = ({ await processWithdrawalRequested(ctx, result, block, log) } else if (withdrawalClaimedFilter.matches(log)) { await processWithdrawalClaimed(ctx, result, block, log) + } else if (withdrawalClaimableFilter.matches(log)) { + const data = oethVault.events.WithdrawalClaimable.decode(log) + currentClaimable = data._newClaimable + await resolvePending(ctx, result, block, data._newClaimable) } } } @@ -56,7 +105,7 @@ export const createOTokenWithdrawalsProcessor = ({ const processWithdrawalRequested = async ( ctx: Context, result: ProcessResult, - block: Context['blocks'][number], + block: Block, log: Context['blocks'][number]['logs'][number], ) => { const data = oethVault.events.WithdrawalRequested.decode(log) @@ -69,6 +118,14 @@ export const createOTokenWithdrawalsProcessor = ({ queueWait = BigInt('0x' + extraBytes) } } + if (currentClaimable === undefined) { + // First request we've seen; sync the running pointer from chain so we + // can decide whether this request is born claimable. + const meta = await new oethVault.Contract(ctx, block.header, oTokenVaultAddress).withdrawalQueueMetadata() + currentClaimable = meta.claimable + } + const claimableAt = + data._queued <= currentClaimable ? computeClaimableAt(block.header.timestamp, block.header.timestamp) : null const withdrawalRequest = new OTokenWithdrawalRequest({ id, chainId: ctx.chain.id, @@ -82,6 +139,7 @@ export const createOTokenWithdrawalsProcessor = ({ withdrawer: data._withdrawer.toLowerCase(), txHash: log.transactionHash, queueWait, + claimableAt, }) result.withdrawalRequests.set(withdrawalRequest.id, withdrawalRequest) } @@ -89,7 +147,7 @@ export const createOTokenWithdrawalsProcessor = ({ const processWithdrawalClaimed = async ( ctx: Context, result: ProcessResult, - block: Context['blocks'][number], + block: Block, log: Context['blocks'][number]['logs'][number], ) => { const data = oethVault.events.WithdrawalClaimed.decode(log) diff --git a/src/utils/db-dump-manager.ts b/src/utils/db-dump-manager.ts index 5c0ccdef..73661fea 100644 --- a/src/utils/db-dump-manager.ts +++ b/src/utils/db-dump-manager.ts @@ -158,7 +158,10 @@ export class DBDumpManager { const now = new Date() // Check if the lock has expired - if (now.getTime() - lockTimestamp.getTime() > this.LOCK_TIMEOUT_MS) { + if ( + now.getTime() - lockTimestamp.getTime() > this.LOCK_TIMEOUT_MS || + lockData.processorName === processorName // A past runtime opened this lock. + ) { console.log(`Removing expired restore lock for processor: ${lockData.processorName}`) await client.query('DELETE FROM "util_cache" WHERE id = $1', [this.LOCK_KEY]) } else { @@ -306,7 +309,7 @@ export class DBDumpManager { // Keep the last line as partial if it doesn't end with a newline partial = chunkStr.endsWith('\n') ? null : lines.pop() || null - const tablesWithConflicts = ['exchange_rate'] + const tablesWithConflicts = ['erc20', 'exchange_rate', 'exchange_rate_daily'] let action = async () => { for (const line of lines) { diff --git a/tsconfig.json b/tsconfig.json index c78e79b8..881ed18b 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -20,16 +20,16 @@ "@templates/*": ["templates/*"], "@utils/*": ["utils/*"], "@test-utils/*": ["test-utils/*"], - "@validation/*": ["validation/*"] - } + "@validation/*": ["validation/*"], + }, }, "ts-node": { "transpileOnly": true, "files": true, "compilerOptions": { - "module": "commonjs" - } + "module": "commonjs", + }, }, "include": ["src"], - "exclude": ["node_modules"] + "exclude": ["node_modules"], }